1 // Copyright (c) 2021 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=1a256c04042ebd4867f39e1c31def558871b2bab$ 37 // 38 39 #ifndef CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_ 40 #define CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_ 41 #pragma once 42 43 #include "include/capi/cef_base_capi.h" 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 struct _cef_browser_t; 50 51 /// 52 // Callback structure for cef_browser_host_t::AddDevToolsMessageObserver. The 53 // functions of this structure will be called on the browser process UI thread. 54 /// 55 typedef struct _cef_dev_tools_message_observer_t { 56 /// 57 // Base structure. 58 /// 59 cef_base_ref_counted_t base; 60 61 /// 62 // Method that will be called on receipt of a DevTools protocol message. 63 // |browser| is the originating browser instance. |message| is a UTF8-encoded 64 // JSON dictionary representing either a function result or an event. 65 // |message| is only valid for the scope of this callback and should be copied 66 // if necessary. Return true (1) if the message was handled or false (0) if 67 // the message should be further processed and passed to the 68 // OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate. 69 // 70 // Method result dictionaries include an "id" (int) value that identifies the 71 // orginating function call sent from cef_browser_host_t::SendDevToolsMessage, 72 // and optionally either a "result" (dictionary) or "error" (dictionary) 73 // value. The "error" dictionary will contain "code" (int) and "message" 74 // (string) values. Event dictionaries include a "function" (string) value and 75 // optionally a "params" (dictionary) value. See the DevTools protocol 76 // documentation at https://chromedevtools.github.io/devtools-protocol/ for 77 // details of supported function calls and the expected "result" or "params" 78 // dictionary contents. JSON dictionaries can be parsed using the CefParseJSON 79 // function if desired, however be aware of performance considerations when 80 // parsing large messages (some of which may exceed 1MB in size). 81 /// 82 int(CEF_CALLBACK* on_dev_tools_message)( 83 struct _cef_dev_tools_message_observer_t* self, 84 struct _cef_browser_t* browser, 85 const void* message, 86 size_t message_size); 87 88 /// 89 // Method that will be called after attempted execution of a DevTools protocol 90 // function. |browser| is the originating browser instance. |message_id| is 91 // the "id" value that identifies the originating function call message. If 92 // the function succeeded |success| will be true (1) and |result| will be the 93 // UTF8-encoded JSON "result" dictionary value (which may be NULL). If the 94 // function failed |success| will be false (0) and |result| will be the 95 // UTF8-encoded JSON "error" dictionary value. |result| is only valid for the 96 // scope of this callback and should be copied if necessary. See the 97 // OnDevToolsMessage documentation for additional details on |result| 98 // contents. 99 /// 100 void(CEF_CALLBACK* on_dev_tools_method_result)( 101 struct _cef_dev_tools_message_observer_t* self, 102 struct _cef_browser_t* browser, 103 int message_id, 104 int success, 105 const void* result, 106 size_t result_size); 107 108 /// 109 // Method that will be called on receipt of a DevTools protocol event. 110 // |browser| is the originating browser instance. |function| is the "function" 111 // value. |params| is the UTF8-encoded JSON "params" dictionary value (which 112 // may be NULL). |params| is only valid for the scope of this callback and 113 // should be copied if necessary. See the OnDevToolsMessage documentation for 114 // additional details on |params| contents. 115 /// 116 void(CEF_CALLBACK* on_dev_tools_event)( 117 struct _cef_dev_tools_message_observer_t* self, 118 struct _cef_browser_t* browser, 119 const cef_string_t* method, 120 const void* params, 121 size_t params_size); 122 123 /// 124 // Method that will be called when the DevTools agent has attached. |browser| 125 // is the originating browser instance. This will generally occur in response 126 // to the first message sent while the agent is detached. 127 /// 128 void(CEF_CALLBACK* on_dev_tools_agent_attached)( 129 struct _cef_dev_tools_message_observer_t* self, 130 struct _cef_browser_t* browser); 131 132 /// 133 // Method that will be called when the DevTools agent has detached. |browser| 134 // is the originating browser instance. Any function results that were pending 135 // before the agent became detached will not be delivered, and any active 136 // event subscriptions will be canceled. 137 /// 138 void(CEF_CALLBACK* on_dev_tools_agent_detached)( 139 struct _cef_dev_tools_message_observer_t* self, 140 struct _cef_browser_t* browser); 141 } cef_dev_tools_message_observer_t; 142 143 #ifdef __cplusplus 144 } 145 #endif 146 147 #endif // CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_ 148