• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 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 // 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
34 // more information.
35 //
36 // $hash=adfba3dd6479b96a95639c13ee1e07bed7b335d0$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_base_capi.h"
44 #include "include/capi/cef_browser_process_handler_capi.h"
45 #include "include/capi/cef_command_line_capi.h"
46 #include "include/capi/cef_render_process_handler_capi.h"
47 #include "include/capi/cef_resource_bundle_handler_capi.h"
48 #include "include/capi/cef_scheme_capi.h"
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 struct _cef_app_t;
55 
56 ///
57 // Implement this structure to provide handler implementations. Methods will be
58 // called by the process and/or thread indicated.
59 ///
60 typedef struct _cef_app_t {
61   ///
62   // Base structure.
63   ///
64   cef_base_ref_counted_t base;
65 
66   ///
67   // Provides an opportunity to view and/or modify command-line arguments before
68   // processing by CEF and Chromium. The |process_type| value will be NULL for
69   // the browser process. Do not keep a reference to the cef_command_line_t
70   // object passed to this function. The CefSettings.command_line_args_disabled
71   // value can be used to start with an NULL command-line object. Any values
72   // specified in CefSettings that equate to command-line arguments will be set
73   // before this function is called. Be cautious when using this function to
74   // modify command-line arguments for non-browser processes as this may result
75   // in undefined behavior including crashes.
76   ///
77   void(CEF_CALLBACK* on_before_command_line_processing)(
78       struct _cef_app_t* self,
79       const cef_string_t* process_type,
80       struct _cef_command_line_t* command_line);
81 
82   ///
83   // Provides an opportunity to register custom schemes. Do not keep a reference
84   // to the |registrar| object. This function is called on the main thread for
85   // each process and the registered schemes should be the same across all
86   // processes.
87   ///
88   void(CEF_CALLBACK* on_register_custom_schemes)(
89       struct _cef_app_t* self,
90       struct _cef_scheme_registrar_t* registrar);
91 
92   ///
93   // Return the handler for resource bundle events. If
94   // CefSettings.pack_loading_disabled is true (1) a handler must be returned.
95   // If no handler is returned resources will be loaded from pack files. This
96   // function is called by the browser and render processes on multiple threads.
97   ///
98   struct _cef_resource_bundle_handler_t*(
99       CEF_CALLBACK* get_resource_bundle_handler)(struct _cef_app_t* self);
100 
101   ///
102   // Return the handler for functionality specific to the browser process. This
103   // function is called on multiple threads in the browser process.
104   ///
105   struct _cef_browser_process_handler_t*(
106       CEF_CALLBACK* get_browser_process_handler)(struct _cef_app_t* self);
107 
108   ///
109   // Return the handler for functionality specific to the render process. This
110   // function is called on the render process main thread.
111   ///
112   struct _cef_render_process_handler_t*(
113       CEF_CALLBACK* get_render_process_handler)(struct _cef_app_t* self);
114 } cef_app_t;
115 
116 ///
117 // This function should be called from the application entry point function to
118 // execute a secondary process. It can be used to run secondary processes from
119 // the browser client executable (default behavior) or from a separate
120 // executable specified by the CefSettings.browser_subprocess_path value. If
121 // called for the browser process (identified by no "type" command-line value)
122 // it will return immediately with a value of -1. If called for a recognized
123 // secondary process it will block until the process should exit and then return
124 // the process exit code. The |application| parameter may be NULL. The
125 // |windows_sandbox_info| parameter is only used on Windows and may be NULL (see
126 // cef_sandbox_win.h for details).
127 ///
128 CEF_EXPORT int cef_execute_process(const struct _cef_main_args_t* args,
129                                    cef_app_t* application,
130                                    void* windows_sandbox_info);
131 
132 ///
133 // This function should be called on the main application thread to initialize
134 // the CEF browser process. The |application| parameter may be NULL. A return
135 // value of true (1) indicates that it succeeded and false (0) indicates that it
136 // failed. The |windows_sandbox_info| parameter is only used on Windows and may
137 // be NULL (see cef_sandbox_win.h for details).
138 ///
139 CEF_EXPORT int cef_initialize(const struct _cef_main_args_t* args,
140                               const struct _cef_settings_t* settings,
141                               cef_app_t* application,
142                               void* windows_sandbox_info);
143 
144 ///
145 // This function should be called on the main application thread to shut down
146 // the CEF browser process before the application exits.
147 ///
148 CEF_EXPORT void cef_shutdown();
149 
150 ///
151 // Perform a single iteration of CEF message loop processing. This function is
152 // provided for cases where the CEF message loop must be integrated into an
153 // existing application message loop. Use of this function is not recommended
154 // for most users; use either the cef_run_message_loop() function or
155 // CefSettings.multi_threaded_message_loop if possible. When using this function
156 // care must be taken to balance performance against excessive CPU usage. It is
157 // recommended to enable the CefSettings.external_message_pump option when using
158 // this function so that
159 // cef_browser_process_handler_t::on_schedule_message_pump_work() callbacks can
160 // facilitate the scheduling process. This function should only be called on the
161 // main application thread and only if cef_initialize() is called with a
162 // CefSettings.multi_threaded_message_loop value of false (0). This function
163 // will not block.
164 ///
165 CEF_EXPORT void cef_do_message_loop_work();
166 
167 ///
168 // Run the CEF message loop. Use this function instead of an application-
169 // provided message loop to get the best balance between performance and CPU
170 // usage. This function should only be called on the main application thread and
171 // only if cef_initialize() is called with a
172 // CefSettings.multi_threaded_message_loop value of false (0). This function
173 // will block until a quit message is received by the system.
174 ///
175 CEF_EXPORT void cef_run_message_loop();
176 
177 ///
178 // Quit the CEF message loop that was started by calling cef_run_message_loop().
179 // This function should only be called on the main application thread and only
180 // if cef_run_message_loop() was used.
181 ///
182 CEF_EXPORT void cef_quit_message_loop();
183 
184 ///
185 // Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a
186 // modal message loop. Set to false (0) after exiting the modal message loop.
187 ///
188 CEF_EXPORT void cef_set_osmodal_loop(int osModalLoop);
189 
190 ///
191 // Call during process startup to enable High-DPI support on Windows 7 or newer.
192 // Older versions of Windows should be left DPI-unaware because they do not
193 // support DirectWrite and GDI fonts are kerned very badly.
194 ///
195 CEF_EXPORT void cef_enable_highdpi_support();
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 
201 #endif  // CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
202