blob: 64020a66b6e8bbf1a1fad3fd6a81a5444acbc809 [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2021 The Chromium Authors
Jeremy Roman2d8dfe132021-07-06 20:51:262// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_RENDERER_HOST_PAGE_DELEGATE_H_
6#define CONTENT_BROWSER_RENDERER_HOST_PAGE_DELEGATE_H_
7
Jeremy Roman2d8dfe132021-07-06 20:51:268namespace content {
9
10class PageImpl;
11
12// Interface implemented by an object (in practice, WebContentsImpl) which
13// owns (possibly indirectly) and is interested in knowing about the state of
14// one or more Pages. It must outlive the Page.
Lei Zhanged9be3a2021-11-17 22:01:1815class PageDelegate {
Jeremy Roman2d8dfe132021-07-06 20:51:2616 public:
17 // Called when a paint happens after the first non empty layout. In other
18 // words, after the page has painted something.
19 virtual void OnFirstVisuallyNonEmptyPaint(PageImpl& page) {}
20
21 // Called when the theme color (from the theme-color meta tag) has changed.
22 virtual void OnThemeColorChanged(PageImpl& page) {}
23
24 // Called when the main document background color has changed.
25 virtual void OnBackgroundColorChanged(PageImpl& page) {}
Michael Bai19f17a302021-12-08 04:08:3326
27 // Called when the main document color scheme was inferred.
28 virtual void DidInferColorScheme(PageImpl& page) {}
David Bokand6e44055b2022-09-21 03:58:0829
30 // Called when the main document's virtual keyboard mode changes.
31 virtual void OnVirtualKeyboardModeChanged(PageImpl& page) {}
Julie Jeongeun Kimd4597df12022-11-11 02:44:5132
33 // Called when `page` becomes primary in its FrameTree.
34 virtual void NotifyPageBecamePrimary(PageImpl& page) = 0;
Takashi Toyoshima1b73e312023-10-17 04:53:3535
Takashi Toyoshimaa35e5fc2023-10-20 04:00:3436 // Tells if `page` should be handled as in preview mode.
Takashi Toyoshima8dfc05c2024-01-29 21:03:5137 virtual bool IsPageInPreviewMode() const = 0;
Takashi Toyoshimaa35e5fc2023-10-20 04:00:3438
Sonja5f1ab742023-11-09 14:48:3639 // Notifies `BrowserView` about the resizable boolean having been set vith
40 // `window.setResizable(bool)` API.
Robert Ferens9610d7282025-02-17 09:52:3241 virtual void OnWebApiWindowResizableChanged() = 0;
Sonja5f1ab742023-11-09 14:48:3642
Takashi Toyoshimaa35e5fc2023-10-20 04:00:3443 // Notify the page uses a forbidden powerful API and cannot be shown in
44 // preview mode.
45 virtual void CancelPreviewByMojoBinderPolicy(
46 const std::string& interface_name) = 0;
Jeremy Roman2d8dfe132021-07-06 20:51:2647};
48
49} // namespace content
50
51#endif // CONTENT_BROWSER_RENDERER_HOST_PAGE_DELEGATE_H_