]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/capi/cef_life_span_handler_capi.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / capi / cef_life_span_handler_capi.h
1 // Copyright (c) 2015 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
37 #ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
39 #pragma once
40
41 #include "include/capi/cef_base_capi.h"
42 #include "include/capi/cef_browser_capi.h"
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 struct _cef_client_t;
49
50 ///
51 // Implement this structure to handle events related to browser life span. The
52 // functions of this structure will be called on the UI thread unless otherwise
53 // indicated.
54 ///
55 typedef struct _cef_life_span_handler_t {
56   ///
57   // Base structure.
58   ///
59   cef_base_t base;
60
61   ///
62   // Called on the IO thread before a new popup browser is created. The
63   // |browser| and |frame| values represent the source of the popup request. The
64   // |target_url| and |target_frame_name| values indicate where the popup
65   // browser should navigate and may be NULL if not specified with the request.
66   // The |target_disposition| value indicates where the user intended to open
67   // the popup (e.g. current tab, new tab, etc). The |user_gesture| value will
68   // be true (1) if the popup was opened via explicit user gesture (e.g.
69   // clicking a link) or false (0) if the popup opened automatically (e.g. via
70   // the DomContentLoaded event). The |popupFeatures| structure contains
71   // additional information about the requested popup window. To allow creation
72   // of the popup browser optionally modify |windowInfo|, |client|, |settings|
73   // and |no_javascript_access| and return false (0). To cancel creation of the
74   // popup browser return true (1). The |client| and |settings| values will
75   // default to the source browser's values. If the |no_javascript_access| value
76   // is set to false (0) the new browser will not be scriptable and may not be
77   // hosted in the same renderer process as the source browser.
78   int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self,
79       struct _cef_browser_t* browser, struct _cef_frame_t* frame,
80       const cef_string_t* target_url, const cef_string_t* target_frame_name,
81       cef_window_open_disposition_t target_disposition, int user_gesture,
82       const struct _cef_popup_features_t* popupFeatures,
83       struct _cef_window_info_t* windowInfo, struct _cef_client_t** client,
84       struct _cef_browser_settings_t* settings, int* no_javascript_access);
85
86   ///
87   // Called after a new browser is created.
88   ///
89   void (CEF_CALLBACK *on_after_created)(struct _cef_life_span_handler_t* self,
90       struct _cef_browser_t* browser);
91
92   ///
93   // Called when a modal window is about to display and the modal loop should
94   // begin running. Return false (0) to use the default modal loop
95   // implementation or true (1) to use a custom implementation.
96   ///
97   int (CEF_CALLBACK *run_modal)(struct _cef_life_span_handler_t* self,
98       struct _cef_browser_t* browser);
99
100   ///
101   // Called when a browser has recieved a request to close. This may result
102   // directly from a call to cef_browser_host_t::close_browser() or indirectly
103   // if the browser is a top-level OS window created by CEF and the user
104   // attempts to close the window. This function will be called after the
105   // JavaScript 'onunload' event has been fired. It will not be called for
106   // browsers after the associated OS window has been destroyed (for those
107   // browsers it is no longer possible to cancel the close).
108   //
109   // If CEF created an OS window for the browser returning false (0) will send
110   // an OS close notification to the browser window's top-level owner (e.g.
111   // WM_CLOSE on Windows, performClose: on OS-X and "delete_event" on Linux). If
112   // no OS window exists (window rendering disabled) returning false (0) will
113   // cause the browser object to be destroyed immediately. Return true (1) if
114   // the browser is parented to another window and that other window needs to
115   // receive close notification via some non-standard technique.
116   //
117   // If an application provides its own top-level window it should handle OS
118   // close notifications by calling cef_browser_host_t::CloseBrowser(false (0))
119   // instead of immediately closing (see the example below). This gives CEF an
120   // opportunity to process the 'onbeforeunload' event and optionally cancel the
121   // close before do_close() is called.
122   //
123   // The cef_life_span_handler_t::on_before_close() function will be called
124   // immediately before the browser object is destroyed. The application should
125   // only exit after on_before_close() has been called for all existing
126   // browsers.
127   //
128   // If the browser represents a modal window and a custom modal loop
129   // implementation was provided in cef_life_span_handler_t::run_modal() this
130   // callback should be used to restore the opener window to a usable state.
131   //
132   // By way of example consider what should happen during window close when the
133   // browser is parented to an application-provided top-level OS window. 1.
134   // User clicks the window close button which sends an OS close
135   //     notification (e.g. WM_CLOSE on Windows, performClose: on OS-X and
136   //     "delete_event" on Linux).
137   // 2.  Application's top-level window receives the close notification and:
138   //     A. Calls CefBrowserHost::CloseBrowser(false).
139   //     B. Cancels the window close.
140   // 3.  JavaScript 'onbeforeunload' handler executes and shows the close
141   //     confirmation dialog (which can be overridden via
142   //     CefJSDialogHandler::OnBeforeUnloadDialog()).
143   // 4.  User approves the close. 5.  JavaScript 'onunload' handler executes. 6.
144   // Application's do_close() handler is called. Application will:
145   //     A. Set a flag to indicate that the next close attempt will be allowed.
146   //     B. Return false.
147   // 7.  CEF sends an OS close notification. 8.  Application's top-level window
148   // receives the OS close notification and
149   //     allows the window to close based on the flag from #6B.
150   // 9.  Browser OS window is destroyed. 10. Application's
151   // cef_life_span_handler_t::on_before_close() handler is called and
152   //     the browser object is destroyed.
153   // 11. Application exits by calling cef_quit_message_loop() if no other
154   // browsers
155   //     exist.
156   ///
157   int (CEF_CALLBACK *do_close)(struct _cef_life_span_handler_t* self,
158       struct _cef_browser_t* browser);
159
160   ///
161   // Called just before a browser is destroyed. Release all references to the
162   // browser object and do not attempt to execute any functions on the browser
163   // object after this callback returns. If this is a modal window and a custom
164   // modal loop implementation was provided in run_modal() this callback should
165   // be used to exit the custom modal loop. See do_close() documentation for
166   // additional usage information.
167   ///
168   void (CEF_CALLBACK *on_before_close)(struct _cef_life_span_handler_t* self,
169       struct _cef_browser_t* browser);
170 } cef_life_span_handler_t;
171
172
173 #ifdef __cplusplus
174 }
175 #endif
176
177 #endif  // CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_