1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
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
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.
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.
30 // ---------------------------------------------------------------------------
32 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
37 #ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
41 #include "include/capi/cef_base_capi.h"
42 #include "include/capi/cef_browser_process_handler_capi.h"
43 #include "include/capi/cef_command_line_capi.h"
44 #include "include/capi/cef_render_process_handler_capi.h"
45 #include "include/capi/cef_resource_bundle_handler_capi.h"
46 #include "include/capi/cef_scheme_capi.h"
55 // Implement this structure to provide handler implementations. Methods will be
56 // called by the process and/or thread indicated.
58 typedef struct _cef_app_t {
65 // Provides an opportunity to view and/or modify command-line arguments before
66 // processing by CEF and Chromium. The |process_type| value will be NULL for
67 // the browser process. Do not keep a reference to the cef_command_line_t
68 // object passed to this function. The CefSettings.command_line_args_disabled
69 // value can be used to start with an NULL command-line object. Any values
70 // specified in CefSettings that equate to command-line arguments will be set
71 // before this function is called. Be cautious when using this function to
72 // modify command-line arguments for non-browser processes as this may result
73 // in undefined behavior including crashes.
75 void (CEF_CALLBACK *on_before_command_line_processing)(
76 struct _cef_app_t* self, const cef_string_t* process_type,
77 struct _cef_command_line_t* command_line);
80 // Provides an opportunity to register custom schemes. Do not keep a reference
81 // to the |registrar| object. This function is called on the main thread for
82 // each process and the registered schemes should be the same across all
85 void (CEF_CALLBACK *on_register_custom_schemes)(struct _cef_app_t* self,
86 struct _cef_scheme_registrar_t* registrar);
89 // Return the handler for resource bundle events. If
90 // CefSettings.pack_loading_disabled is true (1) a handler must be returned.
91 // If no handler is returned resources will be loaded from pack files. This
92 // function is called by the browser and render processes on multiple threads.
94 struct _cef_resource_bundle_handler_t* (
95 CEF_CALLBACK *get_resource_bundle_handler)(struct _cef_app_t* self);
98 // Return the handler for functionality specific to the browser process. This
99 // function is called on multiple threads in the browser process.
101 struct _cef_browser_process_handler_t* (
102 CEF_CALLBACK *get_browser_process_handler)(struct _cef_app_t* self);
105 // Return the handler for functionality specific to the render process. This
106 // function is called on the render process main thread.
108 struct _cef_render_process_handler_t* (
109 CEF_CALLBACK *get_render_process_handler)(struct _cef_app_t* self);
114 // This function should be called from the application entry point function to
115 // execute a secondary process. It can be used to run secondary processes from
116 // the browser client executable (default behavior) or from a separate
117 // executable specified by the CefSettings.browser_subprocess_path value. If
118 // called for the browser process (identified by no "type" command-line value)
119 // it will return immediately with a value of -1. If called for a recognized
120 // secondary process it will block until the process should exit and then return
121 // the process exit code. The |application| parameter may be NULL. The
122 // |windows_sandbox_info| parameter is only used on Windows and may be NULL (see
123 // cef_sandbox_win.h for details).
125 CEF_EXPORT int cef_execute_process(const struct _cef_main_args_t* args,
126 cef_app_t* application, void* windows_sandbox_info);
129 // This function should be called on the main application thread to initialize
130 // the CEF browser process. The |application| parameter may be NULL. A return
131 // value of true (1) indicates that it succeeded and false (0) indicates that it
132 // failed. The |windows_sandbox_info| parameter is only used on Windows and may
133 // be NULL (see cef_sandbox_win.h for details).
135 CEF_EXPORT int cef_initialize(const struct _cef_main_args_t* args,
136 const struct _cef_settings_t* settings, cef_app_t* application,
137 void* windows_sandbox_info);
140 // This function should be called on the main application thread to shut down
141 // the CEF browser process before the application exits.
143 CEF_EXPORT void cef_shutdown();
146 // Perform a single iteration of CEF message loop processing. This function is
147 // used to integrate the CEF message loop into an existing application message
148 // loop. Care must be taken to balance performance against excessive CPU usage.
149 // This function should only be called on the main application thread and only
150 // if cef_initialize() is called with a CefSettings.multi_threaded_message_loop
151 // value of false (0). This function will not block.
153 CEF_EXPORT void cef_do_message_loop_work();
156 // Run the CEF message loop. Use this function instead of an application-
157 // provided message loop to get the best balance between performance and CPU
158 // usage. This function should only be called on the main application thread and
159 // only if cef_initialize() is called with a
160 // CefSettings.multi_threaded_message_loop value of false (0). This function
161 // will block until a quit message is received by the system.
163 CEF_EXPORT void cef_run_message_loop();
166 // Quit the CEF message loop that was started by calling cef_run_message_loop().
167 // This function should only be called on the main application thread and only
168 // if cef_run_message_loop() was used.
170 CEF_EXPORT void cef_quit_message_loop();
173 // Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a
174 // modal message loop. Set to false (0) after exiting the modal message loop.
176 CEF_EXPORT void cef_set_osmodal_loop(int osModalLoop);
182 #endif // CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_