// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Sync protocol datatype extension for desks on Chrome OS. // If you change or add any fields in this file, update proto_visitors.h and // potentially proto_enum_conversions.{h, cc}. syntax = "proto2"; option go_package = "./sync_pb"; option java_multiple_files = true; option java_package = "org.chromium.components.sync.protocol"; option optimize_for = LITE_RUNTIME; package sync_pb; import "sync_enums.proto"; // A workspace desk entry. This proto contains the fields synced to represent // a saved desk in user's workspace. message WorkspaceDeskSpecifics { reserved "created_time_usec"; // A random unique identifier for each desk. // Required. optional string uuid = 1; // The name of the desk being saved. optional string name = 2; // The time this snapshot of desk was created. optional int64 created_time_windows_epoch_micros = 3; // The time this snapshot of desk was updated. optional int64 updated_time_windows_epoch_micros = 5; optional Desk desk = 4; // The type of a desk. optional DeskType desk_type = 6; // The cache guid of the syncing client. Used to identify a unique device // that's syncing data. optional string client_cache_guid = 7; // The form factor of the device. optional SyncEnums.DeviceFormFactor device_form_factor = 8; // Represent a snapshot of the information on a desk. message Desk { // The apps in this template. repeated App apps = 1; } // A Launchable app in template. message App { // The on-display location of this window. optional WindowBound window_bound = 1; optional WindowState window_state = 2; // The z-index of this app relative to other apps in this template. // App with larger z-index appears in front of app with smaller z-index. optional int32 z_index = 3; optional AppOneOf app = 4; // window_id used to instantiate proto as a restore_data object. The // restore_data object in question can be found at: // //components/app_restore/restore_data.h optional int32 window_id = 5; // Display ID this app is on. optional int64 display_id = 6; // State of a window before it was minimized. Empty/unset for non-minimized // windows. optional WindowState pre_minimized_window_state = 7; // Container this app was launched from. Empty/unset for Arc apps. optional LaunchContainer container = 8; // Window open disposition, defines how a window opens. Empty/unset for Arc // apps. optional WindowOpenDisposition disposition = 9; // Name of the app which is used by the browser to determine whether to // launch an app as an app or a tab. Does not contain a human readable name // but contains the app ID and a prefix. optional string app_name = 10; // Human readable title of the app. optional string title = 11; // This is used to determine the size of a snapped window is in clamshell // mode. Empty/unset for non-snapped windows. This should be a value between // 0 and 100. optional int32 snap_percentage = 12; // The override URL can be specified by apps to override the default URL at // launch. optional string override_url = 13; } message AppOneOf { oneof app { BrowserAppWindow browser_app_window = 1; ChromeApp chrome_app = 2; ProgressiveWebApp progress_web_app = 3; ArcApp arc_app = 4; } } // A Chrome or Lacros Browser app window. message BrowserAppWindow { message BrowserAppTab { // The last committed URL of the main frame of the tab. optional string url = 1; // The title of the tab. optional string title = 2; } // Structure representing a tab group associated with this window. message TabGroup { // Zero-based index within the browser app tabs of the first tab in the // group. optional int32 first_index = 1; // Zero-based Index wotjom the browser app tabs of the last tab in the // group. optional int32 last_index = 2; // User readable title of the tab group. optional string title = 3; // Color associated with this tab group. optional TabGroupColor color = 4; // Indicates whether the tab group is collapsed. optional bool is_collapsed = 5; } // The tabs in this browser window. repeated BrowserAppTab tabs = 1; // The index of the currently active tab. optional int32 active_tab_index = 2; // Indicates whether to show as a dedicated app window. optional bool show_as_app = 3; // Tab groups associated with this window. repeated TabGroup tab_groups = 4; // The index of the first non-pinned tab. optional int32 first_non_pinned_tab_index = 5; } // A Chrome App window. message ChromeApp { // The Chrome App's App ID. optional string app_id = 1; reserved 2; } // A PWA window. message ProgressiveWebApp { // The PWA's App ID. optional string app_id = 1; reserved 2; } // An Arc App window. message ArcApp { // The Arc App's ID. optional string app_id = 1; // Arc window information. This maps // to ArcExtraInfo in a WindowInfo struct. optional WindowSize minimum_size = 2; optional WindowSize maximum_size = 3; reserved 4; optional WindowBound bounds_in_root = 5; // maps to gfx::Size. Width of the window, including the frame, // in pixels. message WindowSize { optional int32 width = 1; optional int32 height = 2; } } message WindowBound { // The offset of the window from the top edge of the screen in pixels. optional int32 top = 1; // The offset of the window from the left edge of the screen in pixels. optional int32 left = 2; // The width of the window, including the frame, in pixels. optional int32 width = 3; // The height of the window, including the frame, in pixels. optional int32 height = 4; } // Enumeration for the container an app was launched from as used by // (components/services/app_services/public/mojom/types.mojom:490). enum LaunchContainer { LAUNCH_CONTAINER_UNSPECIFIED = 0; LAUNCH_CONTAINER_WINDOW = 1; LAUNCH_CONTAINER_PANEL_DEPRECATED = 2; LAUNCH_CONTAINER_TAB = 3; LAUNCH_CONTAINER_NONE = 4; } // The state of a generic window. enum WindowState { UNKNOWN_WINDOW_STATE = 0; // Normal window state (not minimized, maximized, or fullscreen). NORMAL = 1; // Minimized window state. MINIMIZED = 2; // Maximized window state. MAXIMIZED = 3; // Fullscreen window state. FULLSCREEN = 4; // Snapped to primary half of the screen. Primary half is on the left in // landscape screen orientation and top in portrait screen orientation. PRIMARY_SNAPPED = 5; // Snapped to secondary half of the screen. Secondary half is on the right // in landscape screen orientation and bottom in portrait screen // orientation. SECONDARY_SNAPPED = 6; // Floated window state. FLOATED = 7; } // Enumeration for how a window opens. Maps to base::WindowOpenDisposition. // (found in ui/base/window_open_disposition.h:10). Does not include // MAX_VALUE as MAX_VALUE is equivalent to NEW_PICTURE_IN_PICTURE. All // comments are copied verbatim from aforementioned header. enum WindowOpenDisposition { UNKNOWN = 0; CURRENT_TAB = 1; // Indicates that only one tab with the URL shoul exist in the same window. SINGLETON_TAB = 2; NEW_FOREGROUND_TAB = 3; NEW_BACKGROUND_TAB = 4; NEW_POPUP = 5; NEW_WINDOW = 6; SAVE_TO_DISK = 7; OFF_THE_RECORD = 8; IGNORE_ACTION = 9; // Activates an existing tab containing the URL, rather than navigating. // This is similar to SINGLETON_TAB, but searches across all windows // from the current profile and anymity (instead of tjust the current one); // closes the current tab on switching if the current ta was the NTP with // no session history; and behaves like CURRENT_TAB instead of // NEW_FOREGROUND_TAB when no existing tab is found. SWITCH_TO_TAB = 10; // creates a new document picture-in-picture window showing a child WebView. NEW_PICTURE_IN_PICTURE = 11; } // Enumerates the type of desk, namely to differentiate desks between desks // saved for desk templates and desks saved for save and recall. enum DeskType { UNKNOWN_TYPE = 0; TEMPLATE = 1; SAVE_AND_RECALL = 2; FLOATING_WORKSPACE = 3; } // Enumerates the possible colors that a tab group can have. This mirrors // the enumeration that can be found in // components/tab_groups/tab_group_color.h enum TabGroupColor { UNKNOWN_COLOR = 0; GREY = 1; BLUE = 2; RED = 3; YELLOW = 4; GREEN = 5; PINK = 6; PURPLE = 7; CYAN = 8; ORANGE = 9; } }