chromium/chrome/browser/apps/app_preload_service/proto/app_preload.proto

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package apps.proto;

import "chrome/browser/apps/almanac_api_client/proto/client_context.proto";

// This file is a mirror of the proto file maintained in the server code base at
// go/app-preload-service-proto. Changes should be made by updating the
// server code base and then copying the result to Chromium.

message AppPreloadListRequest {
  // Context information about the device making this request.
  optional ClientDeviceContext device_context = 1;

  // Context information about the user making this request.
  optional ClientUserContext user_context = 2;
}

message AppPreloadListResponse {
  // A list of zero or more apps for APS to install.
  repeated App apps_to_install = 1;

  // The Launcher Configuration.
  repeated LauncherConfig launcher_config = 2;

  // The Shelf Configuration.
  repeated ShelfConfig shelf_config = 3;

  enum InstallReason {
    // Default for deserialization when an unexpected value is encountered.
    // Usually indicates to the client that the server has a new reason and
    // needs the proto file updated.
    INSTALL_REASON_UNKNOWN = 0;

    // An app other than an OEM app. This should be pinned in the Launcher at
    // the position that matches the PackageId or, if not specified, into the
    // end of the "OTHER" position, as defined in the launcher config.
    INSTALL_REASON_DEFAULT = 1;

    // An app installed for an OEM. This should be placed into the "OEM" folder
    // defined in the launcher config.
    // (note: position in the OEM folder itself does not matter).
    INSTALL_REASON_OEM = 2;

    // An app which is being returned by the server for testing purposes.
    // This generally will be ignored by the client unless it is configured
    // in some sort of test mode.
    INSTALL_REASON_TEST = 3;
  }

  // For Android-only metadata.
  // Note: Once Unified App Install has been hooked up, this will be deprecated.
  message AndroidExtras {}

  // For Web-only metadata.
  // Note: Once Unified App Install has been hooked up, this will be deprecated.
  message WebExtras {
    // A URL to the web app's manifest in json format. This will always be from
    // the host meltingpot.googleusercontent.com.
    optional string manifest_url = 1;

    // The URL for the original source used to retrieve the contents of the
    // manifest above. This is needed to resolve the file on the client-side.
    optional string original_manifest_url = 2;
  }

  message App {
    // The primary key for the installer. This will always be of the format
    // "platform:primary_key". For now we support "android:package_name" and
    // "web:http://manifest/id".
    optional string package_id = 1;

    // The identifier for the App Group that Fondue used to derive this app
    // instance in the response.
    // Note: this may not be unique in the apps_to_install collection.
    optional string app_group_uuid = 2;

    // The App's UTF-8 encoded name in the requested language (or next best).
    optional string name = 3;

    // Icons (which are not currently used).
    reserved 4;

    // The reason why this app is in the list.
    optional InstallReason install_reason = 5;

    // An optional campaign code for this preload.
    optional string campaign_code = 8;

    // The localised folder name that this preload should be placed in.
    // Note: this is not populated and should be ignored for OEM preloads.
    optional string folder_name = 9;

    // Every platform has its own [Platform]Extras message to store platform
    // specific metadata.
    // Note: Once Unified App Install has been hooked up, this will be
    // deprecated.
    oneof extras {
      AndroidExtras android_extras = 6;
      WebExtras web_extras = 7;
    }
  }

  // Configuration defining the order of apps pinned in the Shelf.
  message ShelfConfig {
    // The order of the entries in this config. Sort by this value and then
    // process in ascending order.
    optional uint32 order = 1;

    // An optional feature flag. If specified, evaluate the flag and ignore this
    // entry if the feature is not enabled.
    optional string feature_flag = 2;

    // The identifier for the app for this slot (usually one). If more than one
    // is specified, evaluate the entries in order and place the first app
    // detected on the device in this slot. Ignore the remaining entries.
    repeated string package_id = 3;
  }

  // Indicates the type of Launcher entry.
  enum LauncherType {
    // Default for deserialization when an unexpected value is encountered.
    // Usually Indicates to the client that the server has a new reason and
    // needs the proto file updated.
    LAUNCHER_TYPE_UNKNOWN = 0;

    // Indicates where the Chrome Browser (Ash or Lacross) should be placed.
    // Note: this may be in a folder (see below).
    LAUNCHER_TYPE_CHROME = 1;

    // An App with the `package_id` should be placed in this position.
    // Note: this may be in a folder (see below).
    LAUNCHER_TYPE_APP = 2;

    // All other apps not explicitly listed should be installed in this
    // position in the order they are installed (ie. doesn't matter).
    // Note: this may be in a folder (see below).
    LAUNCHER_TYPE_OTHER = 3;

    // Indicates the position of the OEM folder which should be named with the
    // localised string in `folder_name`. Preloads marked "INSTALL_REASON_OEM"
    // should be placed in this folder in the order they install (ie. doesn't
    // matter).
    LAUNCHER_TYPE_FOLDER_OEM = 4;

    // Indicates an arbitrary folder should be created in this position named
    // with the string in `folder_name`. This will have a child configuration
    // which can only contain Apps (ie. no nested folders).
    LAUNCHER_TYPE_FOLDER = 5;
  }

  // Configuration defining the order of items pinned in the Launcher.
  message LauncherConfig {
    // Indicates what type of entry this is in the config (see above).
    optional LauncherType type = 1;

    // The order of the entries in this config. Sort by this value and then
    // process in ascending order.
    optional uint32 order = 2;

    // An optional feature flag. If specified, evaluate the flag and ignore
    // this entry if the feature is not enabled.
    optional string feature_flag = 3;

    // The identifier for the app for this slot (usually one). If more than one
    // is specified, evaluate the entries in order and place the first app
    // detected on the device in this slot. Ignore the remaining entries.
    repeated string package_id = 4;

    // For LAUNCHER_TYPE_FOLDER_OEM and LAUNCHER_TYPE_FOLDER, the localised name
    // to use for the folder.
    optional string folder_name = 5;

    // For LAUNCHER_TYPE_FOLDER the nested configuration controlling the
    // placement of apps within the folder.
    // Note: this is not recursive (ie. only valid for 1 level down).
    // Install the child apps in this configuration in the order specified.
    repeated LauncherConfig child_config = 6;
  }
}