github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/include/capi/cef_jsdialog_handler_capi.h (about) 1 // Copyright (c) 2014 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_JSDIALOG_HANDLER_CAPI_H_ 38 #define CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_ 39 #pragma once 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 #include "include/capi/cef_base_capi.h" 46 #include "include/capi/cef_browser_capi.h" 47 48 49 /// 50 // Callback structure used for asynchronous continuation of JavaScript dialog 51 // requests. 52 /// 53 typedef struct _cef_jsdialog_callback_t { 54 /// 55 // Base structure. 56 /// 57 cef_base_t base; 58 59 /// 60 // Continue the JS dialog request. Set |success| to true (1) if the OK button 61 // was pressed. The |user_input| value should be specified for prompt dialogs. 62 /// 63 void (CEF_CALLBACK *cont)(struct _cef_jsdialog_callback_t* self, int success, 64 const cef_string_t* user_input); 65 } cef_jsdialog_callback_t; 66 67 68 /// 69 // Implement this structure to handle events related to JavaScript dialogs. The 70 // functions of this structure will be called on the UI thread. 71 /// 72 typedef struct _cef_jsdialog_handler_t { 73 /// 74 // Base structure. 75 /// 76 cef_base_t base; 77 78 /// 79 // Called to run a JavaScript dialog. The |default_prompt_text| value will be 80 // specified for prompt dialogs only. Set |suppress_message| to true (1) and 81 // return false (0) to suppress the message (suppressing messages is 82 // preferable to immediately executing the callback as this is used to detect 83 // presumably malicious behavior like spamming alert messages in 84 // onbeforeunload). Set |suppress_message| to false (0) and return false (0) 85 // to use the default implementation (the default implementation will show one 86 // modal dialog at a time and suppress any additional dialog requests until 87 // the displayed dialog is dismissed). Return true (1) if the application will 88 // use a custom dialog or if the callback has been executed immediately. 89 // Custom dialogs may be either modal or modeless. If a custom dialog is used 90 // the application must execute |callback| once the custom dialog is 91 // dismissed. 92 /// 93 int (CEF_CALLBACK *on_jsdialog)(struct _cef_jsdialog_handler_t* self, 94 struct _cef_browser_t* browser, const cef_string_t* origin_url, 95 const cef_string_t* accept_lang, cef_jsdialog_type_t dialog_type, 96 const cef_string_t* message_text, 97 const cef_string_t* default_prompt_text, 98 struct _cef_jsdialog_callback_t* callback, int* suppress_message); 99 100 /// 101 // Called to run a dialog asking the user if they want to leave a page. Return 102 // false (0) to use the default dialog implementation. Return true (1) if the 103 // application will use a custom dialog or if the callback has been executed 104 // immediately. Custom dialogs may be either modal or modeless. If a custom 105 // dialog is used the application must execute |callback| once the custom 106 // dialog is dismissed. 107 /// 108 int (CEF_CALLBACK *on_before_unload_dialog)( 109 struct _cef_jsdialog_handler_t* self, struct _cef_browser_t* browser, 110 const cef_string_t* message_text, int is_reload, 111 struct _cef_jsdialog_callback_t* callback); 112 113 /// 114 // Called to cancel any pending dialogs and reset any saved dialog state. Will 115 // be called due to events like page navigation irregardless of whether any 116 // dialogs are currently pending. 117 /// 118 void (CEF_CALLBACK *on_reset_dialog_state)( 119 struct _cef_jsdialog_handler_t* self, struct _cef_browser_t* browser); 120 121 /// 122 // Called when the default implementation dialog is closed. 123 /// 124 void (CEF_CALLBACK *on_dialog_closed)(struct _cef_jsdialog_handler_t* self, 125 struct _cef_browser_t* browser); 126 } cef_jsdialog_handler_t; 127 128 129 #ifdef __cplusplus 130 } 131 #endif 132 133 #endif // CEF_INCLUDE_CAPI_CEF_JSDIALOG_HANDLER_CAPI_H_