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