// Copyright 2018 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";
import "components/sync/protocol/web_app_specifics.proto";
import "chrome/browser/ash/system_web_apps/types/proto/system_web_app_data.proto";
import "chrome/browser/web_applications/proto/web_app_launch_handler.proto";
import "chrome/browser/web_applications/proto/web_app_os_integration_state.proto";
import "chrome/browser/web_applications/proto/web_app_install_state.proto";
import "chrome/browser/web_applications/proto/web_app_isolation_data.proto";
import "chrome/browser/web_applications/proto/web_app_proto_package.proto";
import "chrome/browser/web_applications/proto/web_app_share_target.proto";
import "chrome/browser/web_applications/proto/web_app_tab_strip.proto";
option optimize_for = LITE_RUNTIME;
// TODO(http://b/307989065) Make this web_app.proto and remove "Proto" from type
// names.
package web_app;
// A mapping between a MIME type and a set of file extensions for a file handler
// "accept" entry. See chrome/browser/web_applications/web_app.h for details.
message WebAppFileHandlerAcceptProto {
optional string mimetype = 1; // Required.
repeated string file_extensions = 2;
}
// A file handler "action" associated with a set of "accept" entries, each of
// which specifies a MIME type and corresponding set of file extensions that the
// handler can handle. See chrome/browser/web_applications/web_app.h for
// details.
message WebAppFileHandlerProto {
optional string action = 1; // Required.
repeated WebAppFileHandlerAcceptProto accept = 2;
repeated sync_pb.WebAppIconInfo downloaded_icons = 3;
optional string display_name = 4;
// This enum should be synced with `LaunchType` in `apps::FileHandler`.
enum LaunchType {
UNDEFINED = 0;
SINGLE_CLIENT = 1;
MULTIPLE_CLIENTS = 2;
}
optional LaunchType launch_type = 5; // Required.
}
message WebAppProtocolHandler {
optional string protocol = 1; // Required.
optional string url = 2; // Required.
}
message WebAppUrlHandlerProto {
optional string origin = 1; // Required.
optional bool has_origin_wildcard = 2; // Required.
}
message WebAppScopeExtensionProto {
optional string origin = 1; // Required.
optional bool has_origin_wildcard = 2; // Required.
}
// A set to track simultaneous installs and uninstalls from multiple install
// sources. This should stay in sync with |WebAppManagement| in
// chrome/browser/web_applications/web_app_constants.h
// and the WebAppManagementProto enum below.
message SourcesProto {
optional bool system = 1;
optional bool policy = 2;
optional bool web_app_store = 3;
optional bool sync = 4;
optional bool default = 5;
optional bool sub_app = 6;
optional bool kiosk = 7;
reserved 8;
optional bool oem = 9;
optional bool one_drive_integration = 10;
optional bool aps_default = 11;
optional bool iwa_shimless_rma = 12;
optional bool iwa_policy = 13;
optional bool iwa_user_installed = 14;
}
// Properties for integrating with Chrome OS.
message ChromeOSDataProto {
optional bool show_in_launcher = 1;
optional bool show_in_search_and_shelf = 2;
optional bool show_in_management = 3;
optional bool is_disabled = 4;
optional bool oem_installed = 5;
optional bool handles_file_open_intents = 6;
reserved 7;
}
message ClientDataProto {
optional ash.SystemWebAppDataProto system_web_app_data = 1;
}
// Properties for a WebApp's shortcuts menu item.
message WebAppShortcutsMenuItemInfoProto {
optional string name = 1; // Required.
optional string url = 2; // Required.
repeated sync_pb.WebAppIconInfo shortcut_manifest_icons = 3;
repeated sync_pb.WebAppIconInfo shortcut_manifest_icons_maskable = 4;
repeated sync_pb.WebAppIconInfo shortcut_manifest_icons_monochrome = 5;
}
// List of icon sizes downloaded to disk for a shortcuts menu item.
message DownloadedShortcutsMenuIconSizesProto {
repeated int32 icon_sizes = 1;
repeated int32 icon_sizes_maskable = 2;
repeated int32 icon_sizes_monochrome = 3;
}
message WebAppPermissionsPolicy {
optional string feature = 1;
repeated string allowed_origins = 2;
optional bool matches_all_origins = 3;
optional bool matches_opaque_src = 4;
}
// This enum should be synced with |WebAppManagement| in
// chrome/browser/web_applications/web_app_constants.h as well as
// with the SourcesProto message defined above.
enum WebAppManagementProto {
WEBAPPMANAGEMENT_UNSPECIFIED = 0;
SYSTEM = 1;
POLICY = 2;
SUBAPP = 3;
WEBAPPSTORE = 4;
SYNC = 5;
DEFAULT = 6;
KIOSK = 7;
reserved 8;
OEM = 9;
ONEDRIVEINTEGRATION = 10;
APS_DEFAULT = 11;
IWA_SHIMLESS_RMA = 12;
IWA_POLICY = 13;
IWA_USER_INSTALLED = 14;
}
// This stores data per-external-WebAppManagement::Type, as each installation
// manager can have different installation configurations for the same web app.
message ManagementToExternalConfigInfo {
optional WebAppManagementProto management = 1;
// The collection of install_urls per web_app per WebAppManagement::Type.
repeated string install_urls = 2;
// Stores whether the app is a placeholder app or not.
optional bool is_placeholder = 3;
// A list of additional terms to use when matching this app against
// identifiers in admin policies (for shelf pinning, default file handlers,
// etc) per web_app per WebAppManagement::Type.
// Note that list is not meant to be an exhaustive enumeration of all possible
// policy_ids but rather just a supplement for tricky cases.
repeated string additional_policy_ids = 4;
}
// The initiator of a sync generated icon fix time window.
enum GeneratedIconFixSource {
GeneratedIconFixSource_UNKNOWN = 0;
GeneratedIconFixSource_SYNC_INSTALL = 1;
GeneratedIconFixSource_RETROACTIVE = 2;
GeneratedIconFixSource_MANIFEST_UPDATE = 3;
};
// Represents the current state of attempts to fix broken icons from sync
// installed web apps.
message GeneratedIconFix {
optional GeneratedIconFixSource source = 1; // Required.
optional int64 window_start_time = 2; // Required.
optional int64 last_attempt_time = 3;
optional uint32 attempt_count = 4; // Required.
}
// Full WebApp object data. See detailed comments in
// chrome/browser/web_applications/web_app.h. Note on database identities:
// app_id is a hash of launch_url. app_id is the client tag for sync system.
// app_id is the storage key in DataTypeStore.
message WebAppProto {
reserved "handle_links", "is_in_sync_install", "is_placeholder",
"file_handler_os_integration_state",
"run_on_os_login_os_integration_state";
// Synced data. It is replicated across , all devices with WEB_APPS.
//
// |sync_data.name| and |sync_data.theme_color| are read by a device to
// generate a placeholder icon. Any device may write new values to synced
// |name| and |theme_color|. A random last update wins.
optional sync_pb.WebAppSpecifics sync_data = 1; // Required.
// This enum should be synced with
// third_party/blink/public/mojom/manifest/display_mode.mojom
enum DisplayMode {
// UNDEFINED if optional |display_mode| is absent.
BROWSER = 1;
MINIMAL_UI = 2;
STANDALONE = 3;
FULLSCREEN = 4;
WINDOW_CONTROLS_OVERLAY = 5;
TABBED = 6;
BORDERLESS = 7;
PICTURE_IN_PICTURE = 8;
}
// Local data. May vary across devices. Not to be synced.
//
optional string name = 2; // Required.
optional uint32 theme_color = 3;
optional string description = 4;
optional DisplayMode display_mode = 5;
optional string scope = 6;
optional SourcesProto sources = 7; // Required.
// This used to be `bool is_locally_installed`.
required proto.InstallState install_state = 8; // Required.
// Installation state:
// Specifies if this web app is from sync and has not completed installation.
// If true, this entity will be re-installed on startup.
optional bool is_from_sync_and_pending_installation = 9;
repeated sync_pb.WebAppIconInfo manifest_icons = 10;
// A list of icon sizes we successfully downloaded to store on disk, for icons
// that are suitable for any purpose (ie. IconPurpose::ANY). See also:
// |downloaded_icon_sizes_purpose_monochrome|.
repeated int32 downloaded_icon_sizes_purpose_any = 11;
// A list of file handlers.
repeated WebAppFileHandlerProto file_handlers = 12;
// A list of additional search terms to use when searching for the app.
repeated string additional_search_terms = 13;
// Even though |chromeos_data| is optional, it should always exist on
// ChromeOS.
optional ChromeOSDataProto chromeos_data = 14;
// Last time the app is launched.
// ms since the Unix epoch. See sync/base/time.h.
optional int64 last_launch_time = 15;
// Time the app is installed.
// ms since the Unix epoch. See sync/base/time.h.
optional int64 first_install_time = 16;
// A list of protocol handlers.
repeated WebAppProtocolHandler protocol_handlers = 17;
// Represents whether the icons for the web app are generated by Chrome due to
// no suitable icons being available.
optional bool is_generated_icon = 18;
// A list of Shortcuts Menu items specified in the Web App Manifest.
repeated WebAppShortcutsMenuItemInfoProto shortcuts_menu_item_infos = 19;
// A list of icon sizes we successfully downloaded to store on disk.
repeated DownloadedShortcutsMenuIconSizesProto
downloaded_shortcuts_menu_icons_sizes = 20;
optional uint32 background_color = 21;
// A list of display modes specified in app manifest.
repeated DisplayMode display_mode_override = 22;
// A list of icon sizes we successfully downloaded to store on disk, for icons
// that are designed for masking (ie. IconPurpose::MASKABLE). See also:
// |downloaded_icon_sizes_purpose_any|.
repeated int32 downloaded_icon_sizes_purpose_maskable = 23;
// Run on OS Login modes for web app.
// See chrome/browser/web_applications/web_app_constants.h
// for web_app::RunOnOsLoginMode definition, which this enum should be in sync
// with.
enum RunOnOsLoginMode {
// NOT_RUN if optional |user_run_on_os_login_mode| is absent.
NOT_RUN = 0;
WINDOWED = 1;
MINIMIZED = 2;
}
// User preference: Run on OS Login mode for web app.
// If present, the web app is configured to run on OS login.
optional RunOnOsLoginMode user_run_on_os_login_mode = 24;
optional ShareTarget share_target = 25;
optional string launch_query_params = 26;
repeated WebAppUrlHandlerProto url_handlers = 27;
optional ClientDataProto client_data = 28;
// This enum should be synced with |CaptureLinks| in
// third_party/blink/public/mojom/manifest/capture_links.mojom
enum CaptureLinks {
// UNDEFINED if optional |capture_links| is absent.
NONE = 1;
NEW_CLIENT = 2;
EXISTING_CLIENT_NAVIGATE = 3;
}
optional CaptureLinks capture_links = 29;
optional string manifest_url = 30;
// Last time the Badging API was used.
// ms since the Unix epoch. See sync/base/time.h.
optional int64 last_badging_time = 31;
optional bool file_handler_permission_blocked = 32;
// A list of icon sizes we successfully downloaded to store on disk for
// monochrome icons. (IconPurpose::MONOCHROME). See also:
// |downloaded_icon_sizes_purpose_any|,
// |downloaded_icon_sizes_purpose_maskable|.
repeated int32 downloaded_icon_sizes_purpose_monochrome = 33;
optional bool window_controls_overlay_enabled = 34;
// If present, the URL to use to create a new note in the app.
optional string note_taking_new_note_url = 35;
// A list of allowed launch protocols when launching the app with a protocol
// url. This list is checked to see if we can bypass the permission dialog
// when launching the web app.
repeated string allowed_launch_protocols = 37;
optional LaunchHandlerProto launch_handler = 38;
// Time the app is updated.
// ms since the Unix epoch. See sync/base/time.h.
optional int64 manifest_update_time = 39;
// A list of disallowed launch protocols. The user has elected to never
// allow these protocols be launched in the web app.
repeated string disallowed_launch_protocols = 40;
// A theme color to be used when the app is opened in dark mode.
optional uint32 dark_mode_theme_color = 41;
// Should be kept in sync with `ApiApprovalState` in web_app_constants.h.
enum ApiApprovalState {
REQUIRES_PROMPT = 0;
ALLOWED = 1;
DISALLOWED = 2;
}
optional ApiApprovalState file_handler_approval_state = 42;
// For apps installed via the SubApp API, ID of the parent app that installed
// the Sub-app.
optional string parent_app_id = 43;
// A background color to be used when the app is opened in dark mode.
optional uint32 dark_mode_background_color = 44;
// Specifies if this web app is currently being uninstalled. If true on
// startup, it's assumed there was a crash or other error during
// uninstallation, and the uninstallation will be tried again.
optional bool is_uninstalling = 45;
reserved 46;
// Whether the app should show up in file-open intent and picking surfaces.
optional bool handles_file_open_intents = 47;
reserved 48;
// Contains the permissions policy that should be applied to the web app.
repeated WebAppPermissionsPolicy permissions_policy = 49;
// The source that triggered the latest install. This is a
// `webapps::WebappInstallSource` encoded as an integer.
optional uint32 latest_install_source = 50;
reserved 51;
// Map of WebAppManagement enum to placeholder info and install_urls.
// There should be only one entry per WebAppManagement source.
repeated ManagementToExternalConfigInfo management_to_external_config_info =
52;
reserved 53;
// The amount of storage (in bytes) used by the app and its related data.
optional uint64 app_size_in_bytes = 54;
optional uint64 data_size_in_bytes = 55;
// If present, the URL to use to launch the app on the lock screen.
optional string lock_screen_start_url = 56;
// Contains customisations to the web app tab strip. Only present when the
// display_mode is tabbed.
optional proto.TabStrip tab_strip = 57;
// Only used on Mac OS, stores whether the app should always show the
// toolbar when in fullscreen mode.
optional bool always_show_toolbar_in_fullscreen = 58;
// Contains the os_integration_state currently deployed for a web_app.
// This will be populated from the fields in this proto when ran for the first
// time after OS hooks have been registered.
optional proto.WebAppOsIntegrationState current_os_integration_states = 59;
// If present, signals that this app is an Isolated Web App, and contains
// IWA-specific information like bundle location.
optional proto.IsolationData isolation_data = 60;
// Contains web origins that are part of the app's extended scope.
repeated WebAppScopeExtensionProto scope_extensions = 61;
// The same as scope_extensions but filtered to origins that have validated
// associations with this web app. See
// https://github.com/WICG/manifest-incubations/blob/gh-pages/scope_extensions-explainer.md
// for association requirements.
repeated WebAppScopeExtensionProto scope_extensions_validated = 62;
// Stores whether the current web app is set as the default app to capture
// links.
optional proto.LinkCapturingUserPreference user_link_capturing_preference =
63;
// Time the app was updated as part of a full install. For example when a
// policy installs an app that is already in the DB installed as a
// default/sync installed app and the DB data is overwritten. ms since the
// Unix epoch. See sync/base/time.h.
optional int64 latest_install_time = 64;
// Contains bookkeeping details about attempts to fix broken icons from sync
// installed web apps.
optional GeneratedIconFix generated_icon_fix = 65;
// Records the number of times the user has ignored/dismissed the offer to
// turn on user link capturing after launching the app via the intent picker,
// specifically from the `EnableLinkCapturingInfoBarDelegate`.
optional int32 supported_links_offer_ignore_count = 66;
optional int32 supported_links_offer_dismiss_count = 67;
// Set to true if the app was installed via the DIY app install path by the
// user (3-dot menu, Install page as App...). DIY apps aren't promotable or
// installable, and the user can customize its name.
optional bool is_diy_app = 68;
}