mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for direct DevTools protocol messaging (fixes issue #2961).
This change allows the client to directly send and receive DevTools protocol messages (send method calls, and receive method results and events) without requiring a DevTools front-end or remote-debugging session. This change includes additional supporting changes: - Add a new CefRequestHandler::OnDocumentAvailableInMainFrame callback (see issue #1454). - Add a CefParseJSON variant that accepts a UTF8-encoded buffer. - Add a `--devtools-protocol-log-file=<path>` command-line flag for logging protocol messages sent to/from the DevTools front-end while it is displayed. This is useful for understanding existing DevTools protocol usage. - Add a new "libcef_static_unittests" executable target to support light-weight unit tests of libcef_static internals (e.g. without requiring exposure via the CEF API). Files to be unittested are placed in the new "libcef_static_unittested" source_set which is then included by both the existing libcef_static library and the new unittests executable target. - Linux: Remove use_bundled_fontconfig=false, which is no longer required and causes unittest build errors (see issue #2424). This change also adds a cefclient demo for configuring offline mode using the DevTools protocol (fixes issue #245). This is controlled by the "Offline mode" context menu option and the `--offline` command-line switch which will launch cefclient in offline mode. When cefclient is offline all network requests will fail with ERR_INTERNET_DISCONNECTED and navigator.onLine will return false when called from JavaScript in any frame. This mode is per-browser so newly created browser windows will have the default mode. Note that configuring offline mode in this way will not update the Network tab UI ("Throtting" option) in a displayed DevTools front-end instance.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a84451b4f759f2a4a0fe673d90be1fb5053bfd1a$
|
||||
// $hash=516b55b7ea53e2de2b096e85ba0eb83f2a2693f3$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
|
||||
@@ -18,8 +18,10 @@
|
||||
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/extension_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/navigation_entry_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/registration_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/client_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/download_image_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/pdf_print_callback_ctocpp.h"
|
||||
@@ -522,6 +524,81 @@ int CEF_CALLBACK browser_host_has_dev_tools(struct _cef_browser_host_t* self) {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK
|
||||
browser_host_send_dev_tools_message(struct _cef_browser_host_t* self,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefBrowserHostCppToC::Get(self)->SendDevToolsMessage(
|
||||
message, message_size);
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK
|
||||
browser_host_execute_dev_tools_method(struct _cef_browser_host_t* self,
|
||||
int message_id,
|
||||
const cef_string_t* method,
|
||||
struct _cef_dictionary_value_t* params) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: method; type: string_byref_const
|
||||
DCHECK(method);
|
||||
if (!method)
|
||||
return 0;
|
||||
// Unverified params: params
|
||||
|
||||
// Execute
|
||||
int _retval = CefBrowserHostCppToC::Get(self)->ExecuteDevToolsMethod(
|
||||
message_id, CefString(method), CefDictionaryValueCppToC::Unwrap(params));
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
struct _cef_registration_t* CEF_CALLBACK
|
||||
browser_host_add_dev_tools_message_observer(
|
||||
struct _cef_browser_host_t* self,
|
||||
struct _cef_dev_tools_message_observer_t* observer) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
// Verify param: observer; type: refptr_diff
|
||||
DCHECK(observer);
|
||||
if (!observer)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefRegistration> _retval =
|
||||
CefBrowserHostCppToC::Get(self)->AddDevToolsMessageObserver(
|
||||
CefDevToolsMessageObserverCToCpp::Wrap(observer));
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefRegistrationCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
browser_host_get_navigation_entries(struct _cef_browser_host_t* self,
|
||||
cef_navigation_entry_visitor_t* visitor,
|
||||
@@ -1285,6 +1362,10 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
|
||||
GetStruct()->show_dev_tools = browser_host_show_dev_tools;
|
||||
GetStruct()->close_dev_tools = browser_host_close_dev_tools;
|
||||
GetStruct()->has_dev_tools = browser_host_has_dev_tools;
|
||||
GetStruct()->send_dev_tools_message = browser_host_send_dev_tools_message;
|
||||
GetStruct()->execute_dev_tools_method = browser_host_execute_dev_tools_method;
|
||||
GetStruct()->add_dev_tools_message_observer =
|
||||
browser_host_add_dev_tools_message_observer;
|
||||
GetStruct()->get_navigation_entries = browser_host_get_navigation_entries;
|
||||
GetStruct()->set_mouse_cursor_change_disabled =
|
||||
browser_host_set_mouse_cursor_change_disabled;
|
||||
|
184
libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.cc
Normal file
184
libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.cc
Normal file
@@ -0,0 +1,184 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c4a7b4d679f1f2ed47fc31df3e2099962d5cb9d6$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
int CEF_CALLBACK dev_tools_message_observer_on_dev_tools_message(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return 0;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsMessage(
|
||||
CefBrowserCToCpp::Wrap(browser), message, message_size);
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK dev_tools_message_observer_on_dev_tools_method_result(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser,
|
||||
int message_id,
|
||||
int success,
|
||||
const void* result,
|
||||
size_t result_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Unverified params: result
|
||||
|
||||
// Execute
|
||||
CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsMethodResult(
|
||||
CefBrowserCToCpp::Wrap(browser), message_id, success ? true : false,
|
||||
result, result_size);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK dev_tools_message_observer_on_dev_tools_event(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser,
|
||||
const cef_string_t* method,
|
||||
const void* params,
|
||||
size_t params_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Verify param: method; type: string_byref_const
|
||||
DCHECK(method);
|
||||
if (!method)
|
||||
return;
|
||||
// Unverified params: params
|
||||
|
||||
// Execute
|
||||
CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsEvent(
|
||||
CefBrowserCToCpp::Wrap(browser), CefString(method), params, params_size);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK dev_tools_message_observer_on_dev_tools_agent_attached(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsAgentAttached(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK dev_tools_message_observer_on_dev_tools_agent_detached(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsAgentDetached(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDevToolsMessageObserverCppToC::CefDevToolsMessageObserverCppToC() {
|
||||
GetStruct()->on_dev_tools_message =
|
||||
dev_tools_message_observer_on_dev_tools_message;
|
||||
GetStruct()->on_dev_tools_method_result =
|
||||
dev_tools_message_observer_on_dev_tools_method_result;
|
||||
GetStruct()->on_dev_tools_event =
|
||||
dev_tools_message_observer_on_dev_tools_event;
|
||||
GetStruct()->on_dev_tools_agent_attached =
|
||||
dev_tools_message_observer_on_dev_tools_agent_attached;
|
||||
GetStruct()->on_dev_tools_agent_detached =
|
||||
dev_tools_message_observer_on_dev_tools_agent_detached;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDevToolsMessageObserverCppToC::~CefDevToolsMessageObserverCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefDevToolsMessageObserver>
|
||||
CefCppToCRefCounted<CefDevToolsMessageObserverCppToC,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t>::
|
||||
UnwrapDerived(CefWrapperType type, cef_dev_tools_message_observer_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCppToCRefCounted<CefDevToolsMessageObserverCppToC,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t>::kWrapperType =
|
||||
WT_DEV_TOOLS_MESSAGE_OBSERVER;
|
40
libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h
Normal file
40
libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=d48f93f3817dab7daf0e30a6fa94b1a173356383$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_DEV_TOOLS_MESSAGE_OBSERVER_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_DEV_TOOLS_MESSAGE_OBSERVER_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_devtools_message_observer_capi.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_devtools_message_observer.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefDevToolsMessageObserverCppToC
|
||||
: public CefCppToCRefCounted<CefDevToolsMessageObserverCppToC,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t> {
|
||||
public:
|
||||
CefDevToolsMessageObserverCppToC();
|
||||
virtual ~CefDevToolsMessageObserverCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_DEV_TOOLS_MESSAGE_OBSERVER_CPPTOC_H_
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=68840d18a25efe4d749e480225d7ac3caacd4723$
|
||||
// $hash=716501855da0203723eb18bfb9e518c7b155f110$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
|
||||
@@ -396,6 +396,26 @@ void CEF_CALLBACK request_handler_on_render_process_terminated(
|
||||
CefBrowserCToCpp::Wrap(browser), status);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_handler_on_document_available_in_main_frame(
|
||||
struct _cef_request_handler_t* self,
|
||||
cef_browser_t* browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefRequestHandlerCppToC::Get(self)->OnDocumentAvailableInMainFrame(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
@@ -414,6 +434,8 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC() {
|
||||
GetStruct()->on_render_view_ready = request_handler_on_render_view_ready;
|
||||
GetStruct()->on_render_process_terminated =
|
||||
request_handler_on_render_process_terminated;
|
||||
GetStruct()->on_document_available_in_main_frame =
|
||||
request_handler_on_document_available_in_main_frame;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
@@ -9,11 +9,12 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=9073823898d373a435ccdc56f2914aad91cbba1e$
|
||||
// $hash=a362e11e85ce68488bbb0f5232b01f53cffeec1d$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/client_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/download_image_callback_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/pdf_print_callback_cpptoc.h"
|
||||
@@ -23,6 +24,7 @@
|
||||
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/extension_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/navigation_entry_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/registration_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
@@ -468,6 +470,81 @@ NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::HasDevTools() {
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefBrowserHostCToCpp::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_browser_host_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, send_dev_tools_message))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->send_dev_tools_message(_struct, message, message_size);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
int CefBrowserHostCToCpp::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_browser_host_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, execute_dev_tools_method))
|
||||
return 0;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: method; type: string_byref_const
|
||||
DCHECK(!method.empty());
|
||||
if (method.empty())
|
||||
return 0;
|
||||
// Unverified params: params
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->execute_dev_tools_method(
|
||||
_struct, message_id, method.GetStruct(),
|
||||
CefDictionaryValueCToCpp::Unwrap(params));
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefRegistration> CefBrowserHostCToCpp::AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_browser_host_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, add_dev_tools_message_observer))
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: observer; type: refptr_diff
|
||||
DCHECK(observer.get());
|
||||
if (!observer.get())
|
||||
return nullptr;
|
||||
|
||||
// Execute
|
||||
cef_registration_t* _retval = _struct->add_dev_tools_message_observer(
|
||||
_struct, CefDevToolsMessageObserverCppToC::Wrap(observer));
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefRegistrationCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefBrowserHostCToCpp::GetNavigationEntries(
|
||||
CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a9c5f9224663a0c2f2a29c35c2dea3f47973b82f$
|
||||
// $hash=c9abd1293472afbac964aac4cd7dd4cac9dd8e58$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_
|
||||
@@ -76,6 +76,12 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
|
||||
const CefPoint& inspect_element_at) OVERRIDE;
|
||||
void CloseDevTools() OVERRIDE;
|
||||
bool HasDevTools() OVERRIDE;
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size) OVERRIDE;
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) OVERRIDE;
|
||||
CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) OVERRIDE;
|
||||
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) OVERRIDE;
|
||||
void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;
|
||||
|
174
libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.cc
Normal file
174
libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.cc
Normal file
@@ -0,0 +1,174 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e8d1eaf4b8cdfd79a260de33fb3be05a2948c81e$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefDevToolsMessageObserverCToCpp::OnDevToolsMessage(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_message))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->on_dev_tools_message(
|
||||
_struct, CefBrowserCppToC::Wrap(browser), message, message_size);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefDevToolsMessageObserverCToCpp::OnDevToolsMethodResult(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
int message_id,
|
||||
bool success,
|
||||
const void* result,
|
||||
size_t result_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_method_result))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Unverified params: result
|
||||
|
||||
// Execute
|
||||
_struct->on_dev_tools_method_result(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
message_id, success, result, result_size);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefDevToolsMessageObserverCToCpp::OnDevToolsEvent(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& method,
|
||||
const void* params,
|
||||
size_t params_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_event))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: method; type: string_byref_const
|
||||
DCHECK(!method.empty());
|
||||
if (method.empty())
|
||||
return;
|
||||
// Unverified params: params
|
||||
|
||||
// Execute
|
||||
_struct->on_dev_tools_event(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
method.GetStruct(), params, params_size);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefDevToolsMessageObserverCToCpp::OnDevToolsAgentAttached(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_agent_attached))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_dev_tools_agent_attached(_struct,
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefDevToolsMessageObserverCToCpp::OnDevToolsAgentDetached(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_agent_detached))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_dev_tools_agent_detached(_struct,
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDevToolsMessageObserverCToCpp::CefDevToolsMessageObserverCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDevToolsMessageObserverCToCpp::~CefDevToolsMessageObserverCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_dev_tools_message_observer_t* CefCToCppRefCounted<
|
||||
CefDevToolsMessageObserverCToCpp,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t>::UnwrapDerived(CefWrapperType type,
|
||||
CefDevToolsMessageObserver*
|
||||
c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCToCppRefCounted<CefDevToolsMessageObserverCToCpp,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t>::kWrapperType =
|
||||
WT_DEV_TOOLS_MESSAGE_OBSERVER;
|
56
libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h
Normal file
56
libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) 2020 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=26b1ef9d351b0ce4a7ca0d61c53a8374ba21168b$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_DEV_TOOLS_MESSAGE_OBSERVER_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_DEV_TOOLS_MESSAGE_OBSERVER_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_devtools_message_observer_capi.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_devtools_message_observer.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefDevToolsMessageObserverCToCpp
|
||||
: public CefCToCppRefCounted<CefDevToolsMessageObserverCToCpp,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t> {
|
||||
public:
|
||||
CefDevToolsMessageObserverCToCpp();
|
||||
virtual ~CefDevToolsMessageObserverCToCpp();
|
||||
|
||||
// CefDevToolsMessageObserver methods.
|
||||
bool OnDevToolsMessage(CefRefPtr<CefBrowser> browser,
|
||||
const void* message,
|
||||
size_t message_size) override;
|
||||
void OnDevToolsMethodResult(CefRefPtr<CefBrowser> browser,
|
||||
int message_id,
|
||||
bool success,
|
||||
const void* result,
|
||||
size_t result_size) override;
|
||||
void OnDevToolsEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& method,
|
||||
const void* params,
|
||||
size_t params_size) override;
|
||||
void OnDevToolsAgentAttached(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnDevToolsAgentDetached(CefRefPtr<CefBrowser> browser) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_DEV_TOOLS_MESSAGE_OBSERVER_CTOCPP_H_
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=72e6ec9a5095a99eaa78ff867ca429f8cd28b101$
|
||||
// $hash=fdcb73f79369fe74f65f75d54f08aaec0f0e4dbf$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
||||
@@ -394,6 +394,27 @@ void CefRequestHandlerCToCpp::OnRenderProcessTerminated(
|
||||
_struct, CefBrowserCppToC::Wrap(browser), status);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefRequestHandlerCToCpp::OnDocumentAvailableInMainFrame(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_request_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_document_available_in_main_frame))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_document_available_in_main_frame(_struct,
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRequestHandlerCToCpp::CefRequestHandlerCToCpp() {}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=0d67e24bf6d8079bcdfd8b36ba48543a05a9d2fd$
|
||||
// $hash=be2bb80e8816f0eaad34382f05e2bec59dfe7fa7$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_HANDLER_CTOCPP_H_
|
||||
@@ -82,6 +82,7 @@ class CefRequestHandlerCToCpp
|
||||
void OnRenderViewReady(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) override;
|
||||
void OnDocumentAvailableInMainFrame(CefRefPtr<CefBrowser> browser) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_REQUEST_HANDLER_CTOCPP_H_
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=fbf992432bd4ff88bed34f803047f70b5b3400f7$
|
||||
// $hash=c42cd0225d8e4286df471fcc622f9bbf9ed977d3$
|
||||
//
|
||||
|
||||
#include "include/capi/cef_app_capi.h"
|
||||
@@ -589,6 +589,24 @@ CEF_EXPORT struct _cef_value_t* cef_parse_json(
|
||||
return CefValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_json_buffer(
|
||||
const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: json; type: simple_byaddr
|
||||
DCHECK(json);
|
||||
if (!json)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefValue> _retval = CefParseJSON(json, json_size, options);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_jsonand_return_error(
|
||||
const cef_string_t* json_string,
|
||||
cef_json_parser_options_t options,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=bf82965f02cafae5a1afc80ab0c976436be9712e$
|
||||
// $hash=66b734973339eb27399083e978844f7d5a6a6c44$
|
||||
//
|
||||
|
||||
#include <dlfcn.h>
|
||||
@@ -139,6 +139,8 @@ typedef cef_string_userfree_t (*cef_uridecode_ptr)(const cef_string_t*,
|
||||
cef_uri_unescape_rule_t);
|
||||
typedef struct _cef_value_t* (*cef_parse_json_ptr)(const cef_string_t*,
|
||||
cef_json_parser_options_t);
|
||||
typedef struct _cef_value_t* (
|
||||
*cef_parse_json_buffer_ptr)(const void*, size_t, cef_json_parser_options_t);
|
||||
typedef struct _cef_value_t* (*cef_parse_jsonand_return_error_ptr)(
|
||||
const cef_string_t*,
|
||||
cef_json_parser_options_t,
|
||||
@@ -547,6 +549,7 @@ struct libcef_pointers {
|
||||
cef_uriencode_ptr cef_uriencode;
|
||||
cef_uridecode_ptr cef_uridecode;
|
||||
cef_parse_json_ptr cef_parse_json;
|
||||
cef_parse_json_buffer_ptr cef_parse_json_buffer;
|
||||
cef_parse_jsonand_return_error_ptr cef_parse_jsonand_return_error;
|
||||
cef_write_json_ptr cef_write_json;
|
||||
cef_get_path_ptr cef_get_path;
|
||||
@@ -763,6 +766,7 @@ int libcef_init_pointers(const char* path) {
|
||||
INIT_ENTRY(cef_uriencode);
|
||||
INIT_ENTRY(cef_uridecode);
|
||||
INIT_ENTRY(cef_parse_json);
|
||||
INIT_ENTRY(cef_parse_json_buffer);
|
||||
INIT_ENTRY(cef_parse_jsonand_return_error);
|
||||
INIT_ENTRY(cef_write_json);
|
||||
INIT_ENTRY(cef_get_path);
|
||||
@@ -1134,6 +1138,13 @@ struct _cef_value_t* cef_parse_json(const cef_string_t* json_string,
|
||||
return g_libcef_pointers.cef_parse_json(json_string, options);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
struct _cef_value_t* cef_parse_json_buffer(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options) {
|
||||
return g_libcef_pointers.cef_parse_json_buffer(json, json_size, options);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
struct _cef_value_t* cef_parse_jsonand_return_error(
|
||||
const cef_string_t* json_string,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c565ea9030eeed15f24fe420b828453a23dbc6ba$
|
||||
// $hash=7db8dbe24a2510d9ae0649f1569909711017c064$
|
||||
//
|
||||
|
||||
#include "include/capi/cef_app_capi.h"
|
||||
@@ -557,6 +557,24 @@ CEF_GLOBAL CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||
return CefValueCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL CefRefPtr<CefValue> CefParseJSON(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: json; type: simple_byaddr
|
||||
DCHECK(json);
|
||||
if (!json)
|
||||
return nullptr;
|
||||
|
||||
// Execute
|
||||
cef_value_t* _retval = cef_parse_json_buffer(json, json_size, options);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefValueCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL CefRefPtr<CefValue> CefParseJSONAndReturnError(
|
||||
const CefString& json_string,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=9bfe176dfac4770800e95e2bbc0fafffbf0aeeaf$
|
||||
// $hash=20268db646dcf8aa6d54b2342dbc70a6e624e202$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_
|
||||
@@ -46,6 +46,7 @@ enum CefWrapperType {
|
||||
WT_DOMNODE,
|
||||
WT_DOMVISITOR,
|
||||
WT_DELETE_COOKIES_CALLBACK,
|
||||
WT_DEV_TOOLS_MESSAGE_OBSERVER,
|
||||
WT_DIALOG_HANDLER,
|
||||
WT_DICTIONARY_VALUE,
|
||||
WT_DISPLAY,
|
||||
|
Reference in New Issue
Block a user