| // Copyright 2025 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module extensions_bar.mojom; |
| |
| import "url/mojom/url.mojom"; |
| import "ui/base/mojom/menu_source_type.mojom"; |
| |
| // Data of a toolbar button for dealing with extensions. |
| struct ExtensionActionInfo { |
| // This is the action id used to identify the action in the |
| // ExtensionsContainer and related APIs --- and is the extenion's identifier |
| // string. |
| string id; |
| string accessible_name; |
| string tooltip; |
| |
| // True if button is visible for any reason; e.g. pinned, or popped out |
| // because the user is interacting with this extension. |
| bool is_visible; |
| url.mojom.Url data_url_for_icon; |
| }; |
| |
| // Used by the WebUI page to bootstrap bidirectional communication. |
| // At most a single connection is expected to exist at a time, but it |
| // may be broken and re-established (e.g. if the UI is reloaded via |
| // devtools). |
| interface PageHandlerFactory { |
| // The WebUI calls this method when the page is first initialized. |
| CreatePageHandler(pending_remote<Page> page, |
| pending_receiver<PageHandler> handler); |
| }; |
| |
| // Browser-side handler for requests from WebUI page. |
| interface PageHandler { |
| // Runs the action with given ID. |
| ExecuteUserAction(string id); |
| |
| // Show the context menu for the toolbar button corresponding to the |
| // given action ID. `source` denotes the type of input that produced the |
| // request. |
| ShowContextMenu(ui.mojom.MenuSourceType source, string id); |
| |
| // Asks the browser to flip show/hide status of extensions menu. |
| ToggleExtensionsMenuFromWebUI(); |
| }; |
| |
| // WebUI-side handler for requests from the browser. |
| interface Page { |
| // Called when new actions are added or existing actions changed. |
| ActionsAddedOrUpdated(array<ExtensionActionInfo> actions); |
| |
| // Called when an action is removed. |
| ActionRemoved(string id); |
| |
| // Called when an action has been popped out. The callback is expected to |
| // be called when it's safe to anchor things to newly-visible button. |
| // |
| // There will also be an ActionsAddedOrUpdated before this message. |
| ActionPoppedOut() => (); |
| }; |