blob: 3b776b41634fadac6663a0c6a4b50c15a45931dc [file] [log] [blame]
Googler11871152020-10-01 14:59:09 -04001// 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///
Googler39a97572023-12-13 22:53:26 +000046/// Implement this interface to handle events related to browser display state.
47/// The methods of this class will be called on the UI thread.
Googler11871152020-10-01 14:59:09 -040048///
49/*--cef(source=client)--*/
50class CefDisplayHandler : public virtual CefBaseRefCounted {
51 public:
52 ///
Googler39a97572023-12-13 22:53:26 +000053 /// Called when a frame's address has changed.
Googler11871152020-10-01 14:59:09 -040054 ///
55 /*--cef()--*/
56 virtual void OnAddressChange(CefRefPtr<CefBrowser> browser,
57 CefRefPtr<CefFrame> frame,
58 const CefString& url) {}
59
60 ///
Googler39a97572023-12-13 22:53:26 +000061 /// Called when the page title changes.
Googler11871152020-10-01 14:59:09 -040062 ///
63 /*--cef(optional_param=title)--*/
64 virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
65 const CefString& title) {}
66
67 ///
Googler39a97572023-12-13 22:53:26 +000068 /// Called when the page icon changes.
Googler11871152020-10-01 14:59:09 -040069 ///
70 /*--cef(optional_param=icon_urls)--*/
71 virtual void OnFaviconURLChange(CefRefPtr<CefBrowser> browser,
72 const std::vector<CefString>& icon_urls) {}
73
74 ///
Googler39a97572023-12-13 22:53:26 +000075 /// 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.
Googler11871152020-10-01 14:59:09 -040084 ///
85 /*--cef()--*/
86 virtual void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,
87 bool fullscreen) {}
88
89 ///
Googler39a97572023-12-13 22:53:26 +000090 /// 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.
Googler11871152020-10-01 14:59:09 -040096 ///
97 /*--cef(optional_param=text)--*/
98 virtual bool OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text) {
99 return false;
100 }
101
102 ///
Googler39a97572023-12-13 22:53:26 +0000103 /// Called when the browser receives a status message. |value| contains the
104 /// text that will be displayed in the status message.
Googler11871152020-10-01 14:59:09 -0400105 ///
106 /*--cef(optional_param=value)--*/
107 virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser,
108 const CefString& value) {}
109
110 ///
Googler39a97572023-12-13 22:53:26 +0000111 /// Called to display a console message. Return true to stop the message from
112 /// being output to the console.
Googler11871152020-10-01 14:59:09 -0400113 ///
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 ///
Googler39a97572023-12-13 22:53:26 +0000124 /// 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.
Googler11871152020-10-01 14:59:09 -0400128 ///
129 /*--cef()--*/
130 virtual bool OnAutoResize(CefRefPtr<CefBrowser> browser,
131 const CefSize& new_size) {
132 return false;
133 }
134
135 ///
Googler39a97572023-12-13 22:53:26 +0000136 /// Called when the overall page loading progress has changed. |progress|
137 /// ranges from 0.0 to 1.0.
Googler11871152020-10-01 14:59:09 -0400138 ///
139 /*--cef()--*/
140 virtual void OnLoadingProgressChange(CefRefPtr<CefBrowser> browser,
141 double progress) {}
Googler39a97572023-12-13 22:53:26 +0000142
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) {}
Googler11871152020-10-01 14:59:09 -0400165};
166
167#endif // CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_