]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/cef_app.h
bac62281253aa1687b9cfad3e4209e72f5289e21
[casparcg] / dependencies64 / cef / include / cef_app.h
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
38 #ifndef CEF_INCLUDE_CEF_APP_H_
39 #define CEF_INCLUDE_CEF_APP_H_
40 #pragma once
41
42 #include "include/cef_base.h"
43 #include "include/cef_browser_process_handler.h"
44 #include "include/cef_command_line.h"
45 #include "include/cef_render_process_handler.h"
46 #include "include/cef_resource_bundle_handler.h"
47 #include "include/cef_scheme.h"
48
49 class CefApp;
50
51 ///
52 // This function should be called from the application entry point function to
53 // execute a secondary process. It can be used to run secondary processes from
54 // the browser client executable (default behavior) or from a separate
55 // executable specified by the CefSettings.browser_subprocess_path value. If
56 // called for the browser process (identified by no "type" command-line value)
57 // it will return immediately with a value of -1. If called for a recognized
58 // secondary process it will block until the process should exit and then return
59 // the process exit code. The |application| parameter may be empty. The
60 // |windows_sandbox_info| parameter is only used on Windows and may be NULL (see
61 // cef_sandbox_win.h for details).
62 ///
63 /*--cef(api_hash_check,optional_param=application,
64         optional_param=windows_sandbox_info)--*/
65 int CefExecuteProcess(const CefMainArgs& args,
66                       CefRefPtr<CefApp> application,
67                       void* windows_sandbox_info);
68
69 ///
70 // This function should be called on the main application thread to initialize
71 // the CEF browser process. The |application| parameter may be empty. A return
72 // value of true indicates that it succeeded and false indicates that it failed.
73 // The |windows_sandbox_info| parameter is only used on Windows and may be NULL
74 // (see cef_sandbox_win.h for details).
75 ///
76 /*--cef(api_hash_check,optional_param=application,
77         optional_param=windows_sandbox_info)--*/
78 bool CefInitialize(const CefMainArgs& args,
79                    const CefSettings& settings,
80                    CefRefPtr<CefApp> application,
81                    void* windows_sandbox_info);
82
83 ///
84 // This function should be called on the main application thread to shut down
85 // the CEF browser process before the application exits.
86 ///
87 /*--cef()--*/
88 void CefShutdown();
89
90 ///
91 // Perform a single iteration of CEF message loop processing. This function is
92 // used to integrate the CEF message loop into an existing application message
93 // loop. Care must be taken to balance performance against excessive CPU usage.
94 // This function should only be called on the main application thread and only
95 // if CefInitialize() is called with a CefSettings.multi_threaded_message_loop
96 // value of false. This function will not block.
97 ///
98 /*--cef()--*/
99 void CefDoMessageLoopWork();
100
101 ///
102 // Run the CEF message loop. Use this function instead of an application-
103 // provided message loop to get the best balance between performance and CPU
104 // usage. This function should only be called on the main application thread and
105 // only if CefInitialize() is called with a
106 // CefSettings.multi_threaded_message_loop value of false. This function will
107 // block until a quit message is received by the system.
108 ///
109 /*--cef()--*/
110 void CefRunMessageLoop();
111
112 ///
113 // Quit the CEF message loop that was started by calling CefRunMessageLoop().
114 // This function should only be called on the main application thread and only
115 // if CefRunMessageLoop() was used.
116 ///
117 /*--cef()--*/
118 void CefQuitMessageLoop();
119
120 ///
121 // Set to true before calling Windows APIs like TrackPopupMenu that enter a
122 // modal message loop. Set to false after exiting the modal message loop.
123 ///
124 /*--cef()--*/
125 void CefSetOSModalLoop(bool osModalLoop);
126
127 ///
128 // Implement this interface to provide handler implementations. Methods will be
129 // called by the process and/or thread indicated.
130 ///
131 /*--cef(source=client,no_debugct_check)--*/
132 class CefApp : public virtual CefBase {
133  public:
134   ///
135   // Provides an opportunity to view and/or modify command-line arguments before
136   // processing by CEF and Chromium. The |process_type| value will be empty for
137   // the browser process. Do not keep a reference to the CefCommandLine object
138   // passed to this method. The CefSettings.command_line_args_disabled value
139   // can be used to start with an empty command-line object. Any values
140   // specified in CefSettings that equate to command-line arguments will be set
141   // before this method is called. Be cautious when using this method to modify
142   // command-line arguments for non-browser processes as this may result in
143   // undefined behavior including crashes.
144   ///
145   /*--cef(optional_param=process_type)--*/
146   virtual void OnBeforeCommandLineProcessing(
147       const CefString& process_type,
148       CefRefPtr<CefCommandLine> command_line) {
149   }
150
151   ///
152   // Provides an opportunity to register custom schemes. Do not keep a reference
153   // to the |registrar| object. This method is called on the main thread for
154   // each process and the registered schemes should be the same across all
155   // processes.
156   ///
157   /*--cef()--*/
158   virtual void OnRegisterCustomSchemes(
159       CefRefPtr<CefSchemeRegistrar> registrar) {
160   }
161
162   ///
163   // Return the handler for resource bundle events. If
164   // CefSettings.pack_loading_disabled is true a handler must be returned. If no
165   // handler is returned resources will be loaded from pack files. This method
166   // is called by the browser and render processes on multiple threads.
167   ///
168   /*--cef()--*/
169   virtual CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler() {
170     return NULL;
171   }
172
173   ///
174   // Return the handler for functionality specific to the browser process. This
175   // method is called on multiple threads in the browser process.
176   ///
177   /*--cef()--*/
178   virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
179     return NULL;
180   }
181
182   ///
183   // Return the handler for functionality specific to the render process. This
184   // method is called on the render process main thread.
185   ///
186   /*--cef()--*/
187   virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() {
188     return NULL;
189   }
190 };
191
192 #endif  // CEF_INCLUDE_CEF_APP_H_