app_service.mojom 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. // Next MinVersion: 19
  6. module crosapi.mojom;
  7. import "chromeos/crosapi/mojom/app_service_types.mojom";
  8. // Interacts with the app service. Implemented in ash-chrome.
  9. // This is a generic app-publisher interface that is used by the implementation
  10. // for both Web Apps and Chrome Apps in Lacros.
  11. [Stable, Uuid="238dd8e0-480e-49f4-a3a0-28e610ef7119"]
  12. interface AppPublisher {
  13. // Publish a stream of apps from lacros-chrome.
  14. // |deltas| holds a sparse data structure that includes the update App data
  15. // from the existing app state in app service.
  16. OnApps@0(array<App> deltas);
  17. // Lacros exposes an AppController interface to Ash. This allows Ash to
  18. // launch, or otherwise interact with Apps that run in Lacros.
  19. [MinVersion=1]
  20. RegisterAppController@1(pending_remote<AppController> controller);
  21. // Receives a stream of accesses from lacros-chrome, and saves to
  22. // AppCapabilityAccess.
  23. [MinVersion=2]
  24. OnCapabilityAccesses@2(array<CapabilityAccess> deltas);
  25. };
  26. // Interacts with the app service. Implemented in lacros-chrome and called in
  27. // ash-chrome.
  28. [Stable, Uuid="2031a614-3f0b-4111-8977-fd96fd780cb7"]
  29. interface AppController {
  30. // Directly uninstalls |app_id| without prompting the user.
  31. // If |clear_site_data| is true, any site data associated with the app will
  32. // be removed.
  33. // If |report_abuse| is true, the app will be reported for abuse to the Web
  34. // Store.
  35. [MinVersion=1]
  36. Uninstall@1(
  37. string app_id,
  38. UninstallSource uninstall_source,
  39. bool clear_site_data,
  40. bool report_abuse);
  41. // Pauses an app to stop the current running app, and apply the icon effect
  42. // to indicate the app is paused.
  43. // Pause a paused app will make the app stay paused, and pause an app
  44. // that is not currently running will only change the icon to paused
  45. // indication and make the app in pause state when the app is launched the
  46. // next time.
  47. [MinVersion=3]
  48. PauseApp@2(string app_id);
  49. // Unpauses an app, and recover the icon effect for the app to indicate
  50. // the app is no longer paused.
  51. // Unpause an unpaused app will make the app stay unpaused, and unpause
  52. // an app that is not currently running will only change the icon back to
  53. // normal state and make the app in normal state when the app is launched
  54. // the next time.
  55. [MinVersion=3]
  56. UnpauseApp@3(string app_id);
  57. // Returns the context menu items for an app with |app_id| to show in app
  58. // list and shelf. This interface only returns menu items that needs to be
  59. // populated in lacros-chrome (e.g. app-specific shortcuts).
  60. [MinVersion=4]
  61. GetMenuModel@4(string app_id) => (MenuItems menu_items);
  62. // Load icon for an app with |app_id| from lacros-chrome.
  63. // |icon_key| contains the arguments for an app icon, see
  64. // apps::mojom::IconKey for more details. |icon_type| represent the icon
  65. // format requested (e.g. compressed, uncompressed. etc). |size_hint_in_dip|
  66. // is a hint of how big the icon should be. All these fields are necessary
  67. // to fill to get the required icon.
  68. // There should always be a return value for this method. If there is an
  69. // error during the loading, the return value should be a default IconValue
  70. // struct, with IconType = kUnknown to indicate it's an error case. If loading
  71. // succeeded, the size of the returning icon is expected to be as close as
  72. // possible with the |size_hint_in_dip| set in the interface, but may not be
  73. // exactly the same.
  74. [MinVersion=5]
  75. LoadIcon@5(
  76. string app_id,
  77. IconKey icon_key,
  78. IconType icon_type,
  79. int32 size_hint_in_dip) => (IconValue icon_value);
  80. // Opens the app platform settings page for the app with |app_id|.
  81. // e.g. for web app, it opens the Chrome site settings page for the app.
  82. [MinVersion=6]
  83. OpenNativeSettings@6(string app_id);
  84. // Set the window display mode for the app identified by |app_id|.
  85. // |window_mode| represents how the app will be open in (e.g. in a
  86. // standalone window or in a browser tab).
  87. [MinVersion=7]
  88. SetWindowMode@7(
  89. string app_id,
  90. WindowMode window_mode);
  91. // Launch the app with |params|. The params include |app_id|,
  92. // |launch_source|, and optional |intent| at the moment. This method will
  93. // return |launch_result| to allow us find out which instance the app is
  94. // running in.
  95. [MinVersion=10]
  96. Launch@8(LaunchParams params) => (LaunchResult launch_result);
  97. // Sends the execution command to Lacros when user selects an item in the
  98. // context menu to execute for an app with |app_id|. Current only the
  99. // shortcut items in context menu need to be executed in lacros-chrome.
  100. // The |id| represent which item user selected.
  101. // This method will launch the app with selected shortcut and return
  102. // |launch_result| to allow us find out which instance the app is running in.
  103. [MinVersion=12]
  104. ExecuteContextMenuCommand@9(
  105. string app_id,
  106. string id) => (LaunchResult launch_result);
  107. // Close all instances of the given |app_id|.
  108. [MinVersion=13]
  109. StopApp@10(string app_id);
  110. // Change permission setting for the app with |app_id|.
  111. [MinVersion=14]
  112. SetPermission@11(
  113. string app_id,
  114. Permission permission);
  115. };
  116. // Interacts with the app service. Implemented in ash-chrome and called in
  117. // lacros-chrome. This interface will allow the browser to interact with
  118. // all types of apps installed in Chrome OS.
  119. [Stable, Uuid="a8979226-04ab-4c29-bca6-1b487ca769f7"]
  120. interface AppServiceProxy {
  121. // Lacros exposes an AppServiceSubscriber interface to Ash. This allows Ash
  122. // to update the info for apps that registered in app service.
  123. [MinVersion=8]
  124. RegisterAppServiceSubscriber@0(
  125. pending_remote<AppServiceSubscriber> subscriber);
  126. // Launch the app with |params|. The params include |app_id|,
  127. // |launch_source|, and optional |intent| at the moment.
  128. [MinVersion=11]
  129. Launch@1(LaunchParams params);
  130. // Load icon for an app with |app_id| from ash-chrome.
  131. // |icon_key| contains the arguments for an app icon, see
  132. // apps::mojom::IconKey for more details. |icon_type| represent the icon
  133. // format requested (e.g. compressed, uncompressed. etc). |size_hint_in_dip|
  134. // is a hint of how big the icon should be. All these fields are necessary
  135. // to fill to get the required icon.
  136. // There should always be a return value for this method. If there is an
  137. // error during the loading, the return value should be a default IconValue
  138. // struct, with IconType = kUnknown to indicate it's an error case. If loading
  139. // succeeded, the size of the returning icon is expected to be as close as
  140. // possible with the |size_hint_in_dip| set in the interface, but may not be
  141. // exactly the same.
  142. [MinVersion=12]
  143. LoadIcon@2(
  144. string app_id,
  145. IconKey icon_key,
  146. IconType icon_type,
  147. int32 size_hint_in_dip) => (IconValue icon_value);
  148. // Lacros informs Ash of the preferred app that should be used to handle a
  149. // given |intent|. This allows Ash to build an in-memory representation of
  150. // the user's preferred apps for a given intent.
  151. [MinVersion=15]
  152. AddPreferredApp@3(
  153. string app_id,
  154. Intent intent);
  155. // In the Settings SWA, show the app management page for |app_id|.
  156. [MinVersion=16]
  157. ShowAppManagementPage@4(string app_id);
  158. // Sets |app_id| as the preferred app for all of its supported links ('view'
  159. // intent filters with a scheme, host, and port) in ash-chrome. All changes to
  160. // the user's preferences as a result of this call will be synchronized back
  161. // to lacros-chrome through AppServiceSubscriber::OnPreferredAppsChanged.
  162. [MinVersion=17]
  163. SetSupportedLinksPreference@5(string app_id);
  164. // Uninstalls |app_id| without prompting the user to confirm.
  165. [MinVersion=18]
  166. UninstallSilently@6(string app_id, UninstallSource uninstall_source);
  167. };
  168. // Interacts with the app service. Implemented in lacros-chrome and called in
  169. // ash-chrome. This interface will allow the app service to push updates to
  170. // the lacros-chrome so that the browser can access the app service info
  171. // in the same process.
  172. [Stable, Uuid="d77d3b7e-ef90-4615-b81b-7e43482a4d5e"]
  173. interface AppServiceSubscriber {
  174. // Receives a stream of apps from ash-chrome from a publisher, and save to
  175. // AppRegistryCache.
  176. // If |should_notify_initialized| is true, notifies observers that |app_type|
  177. // has finished initiating apps.
  178. [MinVersion=9]
  179. OnApps@0(array<App> deltas, AppType app_type, bool should_notify_initialized);
  180. // Indicates that a changes have been made by App Service to the preferred
  181. // apps list. All of the changes should be applied to the subscriber's copy of
  182. // the list using PreferredAppsList::ApplyBulkUpdate.
  183. [MinVersion=15]
  184. OnPreferredAppsChanged@1(PreferredAppChanges changes);
  185. // On startup, Ash informs Lacros of the user's historically preferred apps
  186. // for given intents. This allows Lacros to initialize its in-memory
  187. // representation of the user's preferred apps.
  188. [MinVersion=15]
  189. InitializePreferredApps@2(array<PreferredApp> preferred_apps);
  190. };