Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 1 | // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved. |
| 2 | // |
| 3 | // Redistribution and use in source and binary forms, with or without |
| 4 | // modification, are permitted provided that the following conditions are |
| 5 | // met: |
| 6 | // |
| 7 | // * Redistributions of source code must retain the above copyright |
| 8 | // notice, this list of conditions and the following disclaimer. |
| 9 | // * Redistributions in binary form must reproduce the above |
| 10 | // copyright notice, this list of conditions and the following disclaimer |
| 11 | // in the documentation and/or other materials provided with the |
| 12 | // distribution. |
| 13 | // * Neither the name of Google Inc. nor the name Chromium Embedded |
| 14 | // Framework nor the names of its contributors may be used to endorse |
| 15 | // or promote products derived from this software without specific prior |
| 16 | // written permission. |
| 17 | // |
| 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | // |
| 30 | // --------------------------------------------------------------------------- |
| 31 | // |
| 32 | // The contents of this file must follow a specific format in order to |
| 33 | // support the CEF translator tool. See the translator.README.txt file in the |
| 34 | // tools directory for more information. |
| 35 | // |
| 36 | |
| 37 | #ifndef CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_ |
| 38 | #define CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_ |
| 39 | #pragma once |
| 40 | |
| 41 | #include "include/cef_base.h" |
| 42 | #include "include/cef_browser.h" |
| 43 | #include "include/cef_frame.h" |
| 44 | |
| 45 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 46 | /// Implement this interface to handle events related to browser display state. |
| 47 | /// The methods of this class will be called on the UI thread. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 48 | /// |
| 49 | /*--cef(source=client)--*/ |
| 50 | class CefDisplayHandler : public virtual CefBaseRefCounted { |
| 51 | public: |
| 52 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 53 | /// Called when a frame's address has changed. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 54 | /// |
| 55 | /*--cef()--*/ |
| 56 | virtual void OnAddressChange(CefRefPtr<CefBrowser> browser, |
| 57 | CefRefPtr<CefFrame> frame, |
| 58 | const CefString& url) {} |
| 59 | |
| 60 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 61 | /// Called when the page title changes. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 62 | /// |
| 63 | /*--cef(optional_param=title)--*/ |
| 64 | virtual void OnTitleChange(CefRefPtr<CefBrowser> browser, |
| 65 | const CefString& title) {} |
| 66 | |
| 67 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 68 | /// Called when the page icon changes. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 69 | /// |
| 70 | /*--cef(optional_param=icon_urls)--*/ |
| 71 | virtual void OnFaviconURLChange(CefRefPtr<CefBrowser> browser, |
| 72 | const std::vector<CefString>& icon_urls) {} |
| 73 | |
| 74 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 75 | /// Called when web content in the page has toggled fullscreen mode. If |
| 76 | /// |fullscreen| is true the content will automatically be sized to fill the |
| 77 | /// browser content area. If |fullscreen| is false the content will |
| 78 | /// automatically return to its original size and position. With the Alloy |
| 79 | /// runtime the client is responsible for triggering the fullscreen transition |
| 80 | /// (for example, by calling CefWindow::SetFullscreen when using Views). With |
| 81 | /// the Chrome runtime the fullscreen transition will be triggered |
| 82 | /// automatically. The CefWindowDelegate::OnWindowFullscreenTransition method |
| 83 | /// will be called during the fullscreen transition for notification purposes. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 84 | /// |
| 85 | /*--cef()--*/ |
| 86 | virtual void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser, |
| 87 | bool fullscreen) {} |
| 88 | |
| 89 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 90 | /// Called when the browser is about to display a tooltip. |text| contains the |
| 91 | /// text that will be displayed in the tooltip. To handle the display of the |
| 92 | /// tooltip yourself return true. Otherwise, you can optionally modify |text| |
| 93 | /// and then return false to allow the browser to display the tooltip. |
| 94 | /// When window rendering is disabled the application is responsible for |
| 95 | /// drawing tooltips and the return value is ignored. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 96 | /// |
| 97 | /*--cef(optional_param=text)--*/ |
| 98 | virtual bool OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text) { |
| 99 | return false; |
| 100 | } |
| 101 | |
| 102 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 103 | /// Called when the browser receives a status message. |value| contains the |
| 104 | /// text that will be displayed in the status message. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 105 | /// |
| 106 | /*--cef(optional_param=value)--*/ |
| 107 | virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser, |
| 108 | const CefString& value) {} |
| 109 | |
| 110 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 111 | /// Called to display a console message. Return true to stop the message from |
| 112 | /// being output to the console. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 113 | /// |
| 114 | /*--cef(optional_param=message,optional_param=source)--*/ |
| 115 | virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser, |
| 116 | cef_log_severity_t level, |
| 117 | const CefString& message, |
| 118 | const CefString& source, |
| 119 | int line) { |
| 120 | return false; |
| 121 | } |
| 122 | |
| 123 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 124 | /// Called when auto-resize is enabled via |
| 125 | /// CefBrowserHost::SetAutoResizeEnabled and the contents have auto-resized. |
| 126 | /// |new_size| will be the desired size in view coordinates. Return true if |
| 127 | /// the resize was handled or false for default handling. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 128 | /// |
| 129 | /*--cef()--*/ |
| 130 | virtual bool OnAutoResize(CefRefPtr<CefBrowser> browser, |
| 131 | const CefSize& new_size) { |
| 132 | return false; |
| 133 | } |
| 134 | |
| 135 | /// |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 136 | /// Called when the overall page loading progress has changed. |progress| |
| 137 | /// ranges from 0.0 to 1.0. |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 138 | /// |
| 139 | /*--cef()--*/ |
| 140 | virtual void OnLoadingProgressChange(CefRefPtr<CefBrowser> browser, |
| 141 | double progress) {} |
Googler | 39a9757 | 2023-12-13 22:53:26 +0000 | [diff] [blame^] | 142 | |
| 143 | /// |
| 144 | /// Called when the browser's cursor has changed. If |type| is CT_CUSTOM then |
| 145 | /// |custom_cursor_info| will be populated with the custom cursor information. |
| 146 | /// Return true if the cursor change was handled or false for default |
| 147 | /// handling. |
| 148 | /// |
| 149 | /*--cef()--*/ |
| 150 | virtual bool OnCursorChange(CefRefPtr<CefBrowser> browser, |
| 151 | CefCursorHandle cursor, |
| 152 | cef_cursor_type_t type, |
| 153 | const CefCursorInfo& custom_cursor_info) { |
| 154 | return false; |
| 155 | } |
| 156 | |
| 157 | /// |
| 158 | /// Called when the browser's access to an audio and/or video source has |
| 159 | /// changed. |
| 160 | /// |
| 161 | /*--cef()--*/ |
| 162 | virtual void OnMediaAccessChange(CefRefPtr<CefBrowser> browser, |
| 163 | bool has_video_access, |
| 164 | bool has_audio_access) {} |
Googler | 1187115 | 2020-10-01 14:59:09 -0400 | [diff] [blame] | 165 | }; |
| 166 | |
| 167 | #endif // CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_ |