• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CLIENT_H_
38 #define CEF_INCLUDE_CEF_CLIENT_H_
39 #pragma once
40 
41 #include "include/cef_audio_handler.h"
42 #include "include/cef_base.h"
43 #include "include/cef_context_menu_handler.h"
44 #include "include/cef_dialog_handler.h"
45 #include "include/cef_display_handler.h"
46 #include "include/cef_download_handler.h"
47 #include "include/cef_drag_handler.h"
48 #include "include/cef_find_handler.h"
49 #include "include/cef_focus_handler.h"
50 #include "include/cef_jsdialog_handler.h"
51 #include "include/cef_keyboard_handler.h"
52 #include "include/cef_life_span_handler.h"
53 #include "include/cef_load_handler.h"
54 #include "include/cef_print_handler.h"
55 #include "include/cef_process_message.h"
56 #include "include/cef_render_handler.h"
57 #include "include/cef_request_handler.h"
58 
59 ///
60 // Implement this interface to provide handler implementations.
61 ///
62 /*--cef(source=client,no_debugct_check)--*/
63 class CefClient : public virtual CefBaseRefCounted {
64  public:
65   ///
66   // Return the handler for audio rendering events.
67   ///
68   /*--cef()--*/
GetAudioHandler()69   virtual CefRefPtr<CefAudioHandler> GetAudioHandler() { return nullptr; }
70 
71   ///
72   // Return the handler for context menus. If no handler is provided the default
73   // implementation will be used.
74   ///
75   /*--cef()--*/
GetContextMenuHandler()76   virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() {
77     return nullptr;
78   }
79 
80   ///
81   // Return the handler for dialogs. If no handler is provided the default
82   // implementation will be used.
83   ///
84   /*--cef()--*/
GetDialogHandler()85   virtual CefRefPtr<CefDialogHandler> GetDialogHandler() { return nullptr; }
86 
87   ///
88   // Return the handler for browser display state events.
89   ///
90   /*--cef()--*/
GetDisplayHandler()91   virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() { return nullptr; }
92 
93   ///
94   // Return the handler for download events. If no handler is returned downloads
95   // will not be allowed.
96   ///
97   /*--cef()--*/
GetDownloadHandler()98   virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() { return nullptr; }
99 
100   ///
101   // Return the handler for drag events.
102   ///
103   /*--cef()--*/
GetDragHandler()104   virtual CefRefPtr<CefDragHandler> GetDragHandler() { return nullptr; }
105 
106   ///
107   // Return the handler for find result events.
108   ///
109   /*--cef()--*/
GetFindHandler()110   virtual CefRefPtr<CefFindHandler> GetFindHandler() { return nullptr; }
111 
112   ///
113   // Return the handler for focus events.
114   ///
115   /*--cef()--*/
GetFocusHandler()116   virtual CefRefPtr<CefFocusHandler> GetFocusHandler() { return nullptr; }
117 
118   ///
119   // Return the handler for JavaScript dialogs. If no handler is provided the
120   // default implementation will be used.
121   ///
122   /*--cef()--*/
GetJSDialogHandler()123   virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() { return nullptr; }
124 
125   ///
126   // Return the handler for keyboard events.
127   ///
128   /*--cef()--*/
GetKeyboardHandler()129   virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() { return nullptr; }
130 
131   ///
132   // Return the handler for browser life span events.
133   ///
134   /*--cef()--*/
GetLifeSpanHandler()135   virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() { return nullptr; }
136 
137   ///
138   // Return the handler for browser load status events.
139   ///
140   /*--cef()--*/
GetLoadHandler()141   virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return nullptr; }
142 
143   ///
144   // Return the handler for printing on Linux. If a print handler is not
145   // provided then printing will not be supported on the Linux platform.
146   ///
147   /*--cef()--*/
GetPrintHandler()148   virtual CefRefPtr<CefPrintHandler> GetPrintHandler() { return nullptr; }
149 
150   ///
151   // Return the handler for off-screen rendering events.
152   ///
153   /*--cef()--*/
GetRenderHandler()154   virtual CefRefPtr<CefRenderHandler> GetRenderHandler() { return nullptr; }
155 
156   ///
157   // Return the handler for browser request events.
158   ///
159   /*--cef()--*/
GetRequestHandler()160   virtual CefRefPtr<CefRequestHandler> GetRequestHandler() { return nullptr; }
161 
162   ///
163   // Called when a new message is received from a different process. Return true
164   // if the message was handled or false otherwise. Do not keep a reference to
165   // or attempt to access the message outside of this callback.
166   ///
167   /*--cef()--*/
OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,CefProcessId source_process,CefRefPtr<CefProcessMessage> message)168   virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
169                                         CefRefPtr<CefFrame> frame,
170                                         CefProcessId source_process,
171                                         CefRefPtr<CefProcessMessage> message) {
172     return false;
173   }
174 };
175 
176 #endif  // CEF_INCLUDE_CEF_CLIENT_H_
177