Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors |
Jeremy Roman | 2d8dfe13 | 2021-07-06 20:51:26 | [diff] [blame] | 2 | // 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 Roman | 2d8dfe13 | 2021-07-06 20:51:26 | [diff] [blame] | 8 | namespace content { |
| 9 | |
| 10 | class 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 Zhang | ed9be3a | 2021-11-17 22:01:18 | [diff] [blame] | 15 | class PageDelegate { |
Jeremy Roman | 2d8dfe13 | 2021-07-06 20:51:26 | [diff] [blame] | 16 | 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 Bai | 19f17a30 | 2021-12-08 04:08:33 | [diff] [blame] | 26 | |
| 27 | // Called when the main document color scheme was inferred. |
| 28 | virtual void DidInferColorScheme(PageImpl& page) {} |
David Bokan | d6e44055b | 2022-09-21 03:58:08 | [diff] [blame] | 29 | |
| 30 | // Called when the main document's virtual keyboard mode changes. |
| 31 | virtual void OnVirtualKeyboardModeChanged(PageImpl& page) {} |
Julie Jeongeun Kim | d4597df1 | 2022-11-11 02:44:51 | [diff] [blame] | 32 | |
| 33 | // Called when `page` becomes primary in its FrameTree. |
| 34 | virtual void NotifyPageBecamePrimary(PageImpl& page) = 0; |
Takashi Toyoshima | 1b73e31 | 2023-10-17 04:53:35 | [diff] [blame] | 35 | |
Takashi Toyoshima | a35e5fc | 2023-10-20 04:00:34 | [diff] [blame] | 36 | // Tells if `page` should be handled as in preview mode. |
Takashi Toyoshima | 8dfc05c | 2024-01-29 21:03:51 | [diff] [blame] | 37 | virtual bool IsPageInPreviewMode() const = 0; |
Takashi Toyoshima | a35e5fc | 2023-10-20 04:00:34 | [diff] [blame] | 38 | |
Sonja | 5f1ab74 | 2023-11-09 14:48:36 | [diff] [blame] | 39 | // Notifies `BrowserView` about the resizable boolean having been set vith |
| 40 | // `window.setResizable(bool)` API. |
Robert Ferens | 9610d728 | 2025-02-17 09:52:32 | [diff] [blame] | 41 | virtual void OnWebApiWindowResizableChanged() = 0; |
Sonja | 5f1ab74 | 2023-11-09 14:48:36 | [diff] [blame] | 42 | |
Takashi Toyoshima | a35e5fc | 2023-10-20 04:00:34 | [diff] [blame] | 43 | // 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 Roman | 2d8dfe13 | 2021-07-06 20:51:26 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | } // namespace content |
| 50 | |
| 51 | #endif // CONTENT_BROWSER_RENDERER_HOST_PAGE_DELEGATE_H_ |