browser_app_instance_registry.mojom 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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: 3
  6. module crosapi.mojom;
  7. import "mojo/public/mojom/base/unguessable_token.mojom";
  8. // Represents an update to an instance of a tabbed Chrome browser window.
  9. [Stable]
  10. struct BrowserWindowInstanceUpdate {
  11. // Instance ID generated in lacros-chrome.
  12. mojo_base.mojom.UnguessableToken id@0;
  13. // Wayland ID of the browser's Aura window.
  14. string window_id@1;
  15. // Browser window is currently activated.
  16. bool is_active@2;
  17. // Unique session id for the browser's window from the current browser
  18. // session.
  19. [MinVersion=2]
  20. uint32 browser_session_id@3;
  21. // Unique restored session id for the browser's window from the restored
  22. // browser session.
  23. [MinVersion=2]
  24. uint32 restored_browser_session_id@4;
  25. };
  26. [Stable, Extensible]
  27. enum BrowserAppInstanceType {
  28. kAppTab,
  29. kAppWindow,
  30. };
  31. // Represents an update to an instance of an app running in WebContents (either
  32. // an app window or a tab).
  33. [Stable]
  34. struct BrowserAppInstanceUpdate {
  35. // Instance ID generated in lacros-chrome.
  36. mojo_base.mojom.UnguessableToken id@0;
  37. // Indicates if it's a tab in a browser or a standalone window.
  38. BrowserAppInstanceType type@1;
  39. // App ID.
  40. string app_id@2;
  41. // Wayland ID of the browser's Aura window. It may change for apps of type
  42. // kAppTab, and stays the same for instances of type kAppWindow.
  43. string window_id@3;
  44. // Current title of this instance's WebContents.
  45. string title@4;
  46. // The browser hosting this instance's WebContents is currently activated.
  47. bool is_browser_active@5;
  48. // The instance's WebContents is the active tab in the browser's tab strip.
  49. // May change for apps of type kAppTab, stays the same (true) for instances
  50. // of type kAppWindow.
  51. bool is_web_contents_active@6;
  52. // Unique session id for the browser's window from the current browser
  53. // session.
  54. [MinVersion=2]
  55. uint32 browser_session_id@7;
  56. // Unique restored session id for the browser's window from the restored
  57. // browser session.
  58. [MinVersion=2]
  59. uint32 restored_browser_session_id@8;
  60. };
  61. // Implemented in ash-chrome, and is used to receive browser app instance
  62. // events from lacros-chrome.
  63. [Stable, Uuid="c29f078d-8d82-4f65-bce0-18f047b1ea31"]
  64. interface BrowserAppInstanceRegistry {
  65. // Called by lacros-chrome when when a new browser window is created.
  66. OnBrowserWindowAdded@0(BrowserWindowInstanceUpdate update);
  67. // Called when a browser window is updated.
  68. OnBrowserWindowUpdated@1(BrowserWindowInstanceUpdate update);
  69. // Called when a browser window is closed.
  70. OnBrowserWindowRemoved@2(BrowserWindowInstanceUpdate update);
  71. // Called by lacros-chrome when a new browser-based app instance is created
  72. // in Lacros.
  73. OnBrowserAppAdded@3(BrowserAppInstanceUpdate update);
  74. // Called by lacros-chrome when any attributes in a Lacros browser-based app
  75. // instance are updated.
  76. OnBrowserAppUpdated@4(BrowserAppInstanceUpdate update);
  77. // Called by lacros-chrome browser-based app instance is terminated.
  78. OnBrowserAppRemoved@5(BrowserAppInstanceUpdate update);
  79. // Binds the BrowserAppInstanceController interface, which allows the
  80. // BrowserAppInstanceRegistry implemented in ash-chrome to communicate with
  81. // its controller which is implemented in lacros-chrome.
  82. [MinVersion=1]
  83. RegisterController@6(
  84. pending_remote<BrowserAppInstanceController> controller);
  85. };
  86. // Implemented in lacros-chrome, and is used to perform actions on instances
  87. // that live in lacros-chrome from ash-chrome.
  88. [Stable, Uuid="5058756a-9826-4276-abff-f2a84b9386b9"]
  89. interface BrowserAppInstanceController {
  90. // Activate the tab for the given instance ID in lacros-chrome. If the
  91. // instance being referenced is not a tab instance, does nothing.
  92. [MinVersion=1]
  93. ActivateTabInstance@0(mojo_base.mojom.UnguessableToken id);
  94. };