workspace_desk_specifics.proto 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. //
  5. // Sync protocol datatype extension for desks on Chrome OS.
  6. // If you change or add any fields in this file, update proto_visitors.h and
  7. // potentially proto_enum_conversions.{h, cc}.
  8. syntax = "proto2";
  9. option java_multiple_files = true;
  10. option java_package = "org.chromium.components.sync.protocol";
  11. option optimize_for = LITE_RUNTIME;
  12. package sync_pb;
  13. // A workspace desk entry. This proto contains the fields synced to represent
  14. // a saved desk in user's workspace.
  15. message WorkspaceDeskSpecifics {
  16. reserved "created_time_usec";
  17. // A random unique identifier for each desk.
  18. // Required.
  19. optional string uuid = 1;
  20. // The name of the desk being saved.
  21. optional string name = 2;
  22. // The time this snapshot of desk was created.
  23. optional int64 created_time_windows_epoch_micros = 3;
  24. // The time this snapshot of desk was updated.
  25. optional int64 updated_time_windows_epoch_micros = 5;
  26. optional Desk desk = 4;
  27. // The type of a desk.
  28. optional DeskType desk_type = 6;
  29. // Represent a snapshot of the information on a desk.
  30. message Desk {
  31. // The apps in this template.
  32. repeated App apps = 1;
  33. }
  34. // A Launchable app in template.
  35. message App {
  36. // The on-display location of this window.
  37. optional WindowBound window_bound = 1;
  38. optional WindowState window_state = 2;
  39. // The z-index of this app relative to other apps in this template.
  40. // App with larger z-index appears in front of app with smaller z-index.
  41. optional int32 z_index = 3;
  42. optional AppOneOf app = 4;
  43. // window_id used to instantiate proto as a restore_data object. The
  44. // restore_data object in question can be found at:
  45. // //components/app_restore/restore_data.h
  46. optional int32 window_id = 5;
  47. // Display ID this app is on.
  48. optional int64 display_id = 6;
  49. // State of a window before it was minimized. Empty/unset for non-minimized
  50. // windows.
  51. optional WindowState pre_minimized_window_state = 7;
  52. // Container this app was launched from. Empty/unset for Arc apps.
  53. optional LaunchContainer container = 8;
  54. // Window open disposition, defines how a window opens. Empty/unset for Arc
  55. // apps.
  56. optional WindowOpenDisposition disposition = 9;
  57. // Name of the app which is used by the browser to determine whether to
  58. // launch an app as an app or a tab. Does not contain a human readable name
  59. // but contains the app ID and a prefix.
  60. optional string app_name = 10;
  61. // Human readable title of the app.
  62. optional string title = 11;
  63. // This is used to determine the size of a snapped window is in clamshell
  64. // mode. Empty/unset for non-snapped windows. This should be a value between
  65. // 0 and 100.
  66. optional int32 snap_percentage = 12;
  67. }
  68. message AppOneOf {
  69. oneof app {
  70. BrowserAppWindow browser_app_window = 1;
  71. ChromeApp chrome_app = 2;
  72. ProgressiveWebApp progress_web_app = 3;
  73. ArcApp arc_app = 4;
  74. }
  75. }
  76. // A Chrome or Lacros Browser app window.
  77. message BrowserAppWindow {
  78. message BrowserAppTab {
  79. // The last committed URL of the main frame of the tab.
  80. optional string url = 1;
  81. // The title of the tab.
  82. optional string title = 2;
  83. }
  84. // Structure representing a tab group associated with this window.
  85. message TabGroup {
  86. // Zero-based index within the browser app tabs of the first tab in the
  87. // group.
  88. optional int32 first_index = 1;
  89. // Zero-based Index wotjom the browser app tabs of the last tab in the
  90. // group.
  91. optional int32 last_index = 2;
  92. // User readable title of the tab group.
  93. optional string title = 3;
  94. // Color associated with this tab group.
  95. optional TabGroupColor color = 4;
  96. // Indicates whether the tab group is collapsed.
  97. optional bool is_collapsed = 5;
  98. }
  99. // The tabs in this browser window.
  100. repeated BrowserAppTab tabs = 1;
  101. // The index of the currently active tab.
  102. optional int32 active_tab_index = 2;
  103. // Indicates whether to show as a dedicated app window.
  104. optional bool show_as_app = 3;
  105. // Tab groups associated with this window.
  106. repeated TabGroup tab_groups = 4;
  107. // The index of the first non-pinned tab.
  108. optional int32 first_non_pinned_tab_index = 5;
  109. }
  110. // A Chrome App window.
  111. message ChromeApp {
  112. // The Chrome App's App ID.
  113. optional string app_id = 1;
  114. reserved 2;
  115. }
  116. // A PWA window.
  117. message ProgressiveWebApp {
  118. // The PWA's App ID.
  119. optional string app_id = 1;
  120. reserved 2;
  121. }
  122. // An Arc App window.
  123. message ArcApp {
  124. // The Arc App's ID.
  125. optional string app_id = 1;
  126. // Arc window information. This maps
  127. // to ArcExtraInfo in a WindowInfo struct.
  128. optional WindowSize minimum_size = 2;
  129. optional WindowSize maximum_size = 3;
  130. reserved 4;
  131. optional WindowBound bounds_in_root = 5;
  132. // maps to gfx::Size. Width of the window, including the frame,
  133. // in pixels.
  134. message WindowSize {
  135. optional int32 width = 1;
  136. optional int32 height = 2;
  137. }
  138. }
  139. message WindowBound {
  140. // The offset of the window from the top edge of the screen in pixels.
  141. optional int32 top = 1;
  142. // The offset of the window from the left edge of the screen in pixels.
  143. optional int32 left = 2;
  144. // The width of the window, including the frame, in pixels.
  145. optional int32 width = 3;
  146. // The height of the window, including the frame, in pixels.
  147. optional int32 height = 4;
  148. }
  149. // Enumeration for the container an app was launched from as used by
  150. // (components/services/app_services/public/mojom/types.mojom:490).
  151. enum LaunchContainer {
  152. LAUNCH_CONTAINER_UNSPECIFIED = 0;
  153. LAUNCH_CONTAINER_WINDOW = 1;
  154. LAUNCH_CONTAINER_PANEL_DEPRECATED = 2;
  155. LAUNCH_CONTAINER_TAB = 3;
  156. LAUNCH_CONTAINER_NONE = 4;
  157. }
  158. // The state of a generic window.
  159. enum WindowState {
  160. UNKNOWN_WINDOW_STATE = 0;
  161. // Normal window state (not minimized, maximized, or fullscreen).
  162. NORMAL = 1;
  163. // Minimized window state.
  164. MINIMIZED = 2;
  165. // Maximized window state.
  166. MAXIMIZED = 3;
  167. // Fullscreen window state.
  168. FULLSCREEN = 4;
  169. // Snapped to primary half of the screen. Primary half is on the left in
  170. // landscape screen orientation and top in portrait screen orientation.
  171. PRIMARY_SNAPPED = 5;
  172. // Snapped to secondary half of the screen. Secondary half is on the right
  173. // in landscape screen orientation and bottom in portrait screen
  174. // orientation.
  175. SECONDARY_SNAPPED = 6;
  176. }
  177. // Enumeration for how a window opens. Maps to base::WindowOpenDisposition.
  178. // (found in ui/base/window_open_disposition.h:10). Does not include
  179. // MAX_VALUE as MAX_VALUE is equivalent to NEW_PICTURE_IN_PICTURE. All
  180. // comments are copied verbatim from aforementioned header.
  181. enum WindowOpenDisposition {
  182. UNKNOWN = 0;
  183. CURRENT_TAB = 1;
  184. // Indicates that only one tab with the URL shoul exist in the same window.
  185. SINGLETON_TAB = 2;
  186. NEW_FOREGROUND_TAB = 3;
  187. NEW_BACKGROUND_TAB = 4;
  188. NEW_POPUP = 5;
  189. NEW_WINDOW = 6;
  190. SAVE_TO_DISK = 7;
  191. OFF_THE_RECORD = 8;
  192. IGNORE_ACTION = 9;
  193. // Activates an existing tab containing the URL, rather than navigating.
  194. // This is similar to SINGLETON_TAB, but searches across all windows
  195. // from the current profile and anymity (instead of tjust the current one);
  196. // closes the current tab on switching if the current ta was the NTP with
  197. // no session history; and behaves like CURRENT_TAB instead of
  198. // NEW_FOREGROUND_TAB when no existing tab is found.
  199. SWITCH_TO_TAB = 10;
  200. // creates a new document picture-in-picture window showing a child WebView.
  201. NEW_PICTURE_IN_PICTURE = 11;
  202. }
  203. // Enumerates the type of desk, namely to differentiate desks between desks
  204. // saved for desk templates and desks saved for save and recall.
  205. enum DeskType {
  206. UNKNOWN_TYPE = 0;
  207. TEMPLATE = 1;
  208. SAVE_AND_RECALL = 2;
  209. }
  210. // Enumerates the possible colors that a tab group can have. This mirrors
  211. // the enumeration that can be found in
  212. // components/tab_groups/tab_group_color.h
  213. enum TabGroupColor {
  214. UNKNOWN_COLOR = 0;
  215. GREY = 1;
  216. BLUE = 2;
  217. RED = 3;
  218. YELLOW = 4;
  219. GREEN = 5;
  220. PINK = 6;
  221. PURPLE = 7;
  222. CYAN = 8;
  223. ORANGE = 9;
  224. }
  225. }