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 /// 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. 48 /// 49 /*--cef(source=client)--*/ 50 class CefDisplayHandler : public virtual CefBaseRefCounted { 51 public: 52 /// 53 // Called when a frame's address has changed. 54 /// 55 /*--cef()--*/ OnAddressChange(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,const CefString & url)56 virtual void OnAddressChange(CefRefPtr<CefBrowser> browser, 57 CefRefPtr<CefFrame> frame, 58 const CefString& url) {} 59 60 /// 61 // Called when the page title changes. 62 /// 63 /*--cef(optional_param=title)--*/ OnTitleChange(CefRefPtr<CefBrowser> browser,const CefString & title)64 virtual void OnTitleChange(CefRefPtr<CefBrowser> browser, 65 const CefString& title) {} 66 67 /// 68 // Called when the page icon changes. 69 /// 70 /*--cef(optional_param=icon_urls)--*/ OnFaviconURLChange(CefRefPtr<CefBrowser> browser,const std::vector<CefString> & icon_urls)71 virtual void OnFaviconURLChange(CefRefPtr<CefBrowser> browser, 72 const std::vector<CefString>& icon_urls) {} 73 74 /// 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. The client is 79 // responsible for resizing the browser if desired. 80 /// 81 /*--cef()--*/ OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,bool fullscreen)82 virtual void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser, 83 bool fullscreen) {} 84 85 /// 86 // Called when the browser is about to display a tooltip. |text| contains the 87 // text that will be displayed in the tooltip. To handle the display of the 88 // tooltip yourself return true. Otherwise, you can optionally modify |text| 89 // and then return false to allow the browser to display the tooltip. 90 // When window rendering is disabled the application is responsible for 91 // drawing tooltips and the return value is ignored. 92 /// 93 /*--cef(optional_param=text)--*/ OnTooltip(CefRefPtr<CefBrowser> browser,CefString & text)94 virtual bool OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text) { 95 return false; 96 } 97 98 /// 99 // Called when the browser receives a status message. |value| contains the 100 // text that will be displayed in the status message. 101 /// 102 /*--cef(optional_param=value)--*/ OnStatusMessage(CefRefPtr<CefBrowser> browser,const CefString & value)103 virtual void OnStatusMessage(CefRefPtr<CefBrowser> browser, 104 const CefString& value) {} 105 106 /// 107 // Called to display a console message. Return true to stop the message from 108 // being output to the console. 109 /// 110 /*--cef(optional_param=message,optional_param=source)--*/ OnConsoleMessage(CefRefPtr<CefBrowser> browser,cef_log_severity_t level,const CefString & message,const CefString & source,int line)111 virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser, 112 cef_log_severity_t level, 113 const CefString& message, 114 const CefString& source, 115 int line) { 116 return false; 117 } 118 119 /// 120 // Called when auto-resize is enabled via CefBrowserHost::SetAutoResizeEnabled 121 // and the contents have auto-resized. |new_size| will be the desired size in 122 // view coordinates. Return true if the resize was handled or false for 123 // default handling. 124 /// 125 /*--cef()--*/ OnAutoResize(CefRefPtr<CefBrowser> browser,const CefSize & new_size)126 virtual bool OnAutoResize(CefRefPtr<CefBrowser> browser, 127 const CefSize& new_size) { 128 return false; 129 } 130 131 /// 132 // Called when the overall page loading progress has changed. |progress| 133 // ranges from 0.0 to 1.0. 134 /// 135 /*--cef()--*/ OnLoadingProgressChange(CefRefPtr<CefBrowser> browser,double progress)136 virtual void OnLoadingProgressChange(CefRefPtr<CefBrowser> browser, 137 double progress) {} 138 139 /// 140 // Called when the browser's cursor has changed. If |type| is CT_CUSTOM then 141 // |custom_cursor_info| will be populated with the custom cursor information. 142 // Return true if the cursor change was handled or false for default handling. 143 /// 144 /*--cef()--*/ OnCursorChange(CefRefPtr<CefBrowser> browser,CefCursorHandle cursor,cef_cursor_type_t type,const CefCursorInfo & custom_cursor_info)145 virtual bool OnCursorChange(CefRefPtr<CefBrowser> browser, 146 CefCursorHandle cursor, 147 cef_cursor_type_t type, 148 const CefCursorInfo& custom_cursor_info) { 149 return false; 150 } 151 }; 152 153 #endif // CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_ 154