1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
// 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 webui_browser.mojom;
import "chrome/browser/ui/tabs/tab_strip_api/tab_strip_api_types.mojom";
import "mojo/public/mojom/base/values.mojom";
import "url/mojom/url.mojom";
// Used by the WebUI page to bootstrap communication to/from the browser
// process.
interface PageHandlerFactory {
// The WebUI calls this method when the page is first initialized.
CreatePageHandler(
pending_remote<Page> page,
pending_receiver<PageHandler> handler);
};
// Requests from the browser to WebUI ui for it.
interface Page {
// Requests the location box be focused. `is_user_initiated` is true if the
// user has asked for it explicitly (e.g. by pressing Ctrl-L) rather than this
// being done automatically.
SetFocusToLocationBar(bool is_user_initiated);
// Update the Reload/Stop button's state based on `is_loading`.
SetReloadStopState(bool is_loading);
// Shows the side panel UI. The side panel contents is hosted by a guest
// contents.
ShowSidePanel(int32 guest_contents_id);
};
// Browser-side handler for requests from WebUI page.
interface PageHandler {
// Get the guest id for a tab id.
GetGuestIdForTabId(tabs_api.mojom.NodeId tab_id) => (int32 guest_id);
// Load TabSearch in a guest contents and returns the guest id.
LoadTabSearch() => (int32 guest_id);
// Shows the Tab Search bubble.
ShowTabSearchBubble(string anchor_name);
// Navigates the GuestContents with `guest_id` to `src`.
Navigate(int32 guest_id, url.mojom.Url src);
// Checks if GuestContents with `guest_id` can go back in the nav stack.
CanGoBack(int32 guest_id) => (bool can_go_back);
// Navigates the GuestContents with `guest_id` to back in the nav stack.
GoBack(int32 guest_id);
// Checks if GuestContents with `guest_id` can go forward in the nav stack.
CanGoForward(int32 guest_id) => (bool can_go_forward);
// Navigates the GuestContents with `guest_id` to forward in the nav stack.
GoForward(int32 guest_id);
// Reload the GuestContents with `guest_id`.
Reload(int32 guest_id);
// Stop loading the GuestContents with `guest_id`.
StopLoading(int32 guest_id);
// Opens the app menu.
OpenAppMenu();
// Opens the profile menu.
OpenProfileMenu();
// Launch Chrome DevTools inspecting the browser UI itself.
LaunchDevToolsForBrowser();
// Called when the side panel is closed.
OnSidePanelClosed();
// Minimizes the browser window.
Minimize();
// Maximizes the browser window.
Maximize();
// Restores the browser window to its not-minimized not-maximized size.
Restore();
// Closes the browser window.
Close();
};
|