mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fdc7504631 | ||
|
304e015509 | ||
|
6c81b2125f | ||
|
a46056b1eb | ||
|
7efb1099d9 | ||
|
c8a556f173 | ||
|
97011bca14 | ||
|
83f4983b73 | ||
|
d246bb6967 | ||
|
1058991018 | ||
|
ffc2f0ea62 | ||
|
1a795a1b4b | ||
|
7448470392 | ||
|
a8731e7501 | ||
|
eeda28cdc8 | ||
|
3dd2e2902a | ||
|
d9aa1a58ec | ||
|
7c5e746ea4 | ||
|
149ccf946f | ||
|
3f2c37255f | ||
|
7077b0efe1 | ||
|
1812f94ebd | ||
|
c551bc2695 | ||
|
f7c90a6bb2 | ||
|
08c49aa624 | ||
|
2fef70b664 | ||
|
48637c687c | ||
|
d808850d4e | ||
|
0fb8a5f1ea | ||
|
98e6450272 |
49
BUILD.gn
49
BUILD.gn
@@ -106,6 +106,7 @@ import("//media/media_options.gni")
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
import("//ppapi/buildflags/buildflags.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//third_party/icu/config.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
@@ -262,12 +263,6 @@ if (is_clang) {
|
||||
assert(!clang_use_chrome_plugins)
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
|
||||
# issue #2424).
|
||||
assert(!use_bundled_fontconfig)
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
# Always generate dSYM files. The make_distrib script will fail if
|
||||
# enable_dsyms=true is not explicitly set when is_official_build=false.
|
||||
@@ -316,6 +311,7 @@ group("cef") {
|
||||
deps = [
|
||||
":cefsimple",
|
||||
":ceftests",
|
||||
":libcef_static_unittests",
|
||||
]
|
||||
|
||||
if (!is_linux || use_x11) {
|
||||
@@ -373,6 +369,41 @@ if (is_win) {
|
||||
}
|
||||
}
|
||||
|
||||
# libcef_static source files that have unit tests.
|
||||
source_set("libcef_static_unittested") {
|
||||
sources = [
|
||||
"libcef/browser/devtools/devtools_util.cc",
|
||||
"libcef/browser/devtools/devtools_util.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"libcef/features:config",
|
||||
"//build/config:precompiled_headers",
|
||||
]
|
||||
}
|
||||
|
||||
# Executable target for libcef_static unit tests.
|
||||
test("libcef_static_unittests") {
|
||||
sources = [
|
||||
"libcef/browser/devtools/devtools_util_unittest.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":libcef_static_unittested",
|
||||
"//base/test:run_all_unittests",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"libcef/features:config",
|
||||
"//build/config:precompiled_headers",
|
||||
]
|
||||
}
|
||||
|
||||
static_library("libcef_static") {
|
||||
sources = includes_common +
|
||||
gypi_paths.autogen_cpp_includes + [
|
||||
@@ -412,10 +443,14 @@ static_library("libcef_static") {
|
||||
"libcef/browser/context.h",
|
||||
"libcef/browser/context_menu_params_impl.cc",
|
||||
"libcef/browser/context_menu_params_impl.h",
|
||||
"libcef/browser/devtools/devtools_controller.cc",
|
||||
"libcef/browser/devtools/devtools_controller.h",
|
||||
"libcef/browser/devtools/devtools_file_manager.cc",
|
||||
"libcef/browser/devtools/devtools_file_manager.h",
|
||||
"libcef/browser/devtools/devtools_frontend.cc",
|
||||
"libcef/browser/devtools/devtools_frontend.h",
|
||||
"libcef/browser/devtools/devtools_manager.cc",
|
||||
"libcef/browser/devtools/devtools_manager.h",
|
||||
"libcef/browser/devtools/devtools_manager_delegate.cc",
|
||||
"libcef/browser/devtools/devtools_manager_delegate.h",
|
||||
"libcef/browser/download_item_impl.cc",
|
||||
@@ -739,6 +774,8 @@ static_library("libcef_static") {
|
||||
":cef_make_headers",
|
||||
":cef_service_manifests",
|
||||
|
||||
":libcef_static_unittested",
|
||||
|
||||
# Generate API bindings for extensions.
|
||||
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
# libcef/common/extensions/api/README.txt for details.
|
||||
|
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/84.0.4147.0'
|
||||
'chromium_checkout': 'refs/tags/84.0.4147.105',
|
||||
'depot_tools_checkout': '233589f2e7'
|
||||
}
|
||||
|
@@ -12,8 +12,8 @@
|
||||
# distribution include:
|
||||
#
|
||||
# Linux: Ninja, Unix Makefiles
|
||||
# Mac OS X: Ninja, Xcode 5+
|
||||
# Windows: Ninja, Visual Studio 2010+
|
||||
# MacOS: Ninja, Xcode 8+
|
||||
# Windows: Ninja, Visual Studio 2015+
|
||||
#
|
||||
# Ninja is a cross-platform open-source tool for running fast builds using
|
||||
# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
|
||||
@@ -40,21 +40,21 @@
|
||||
#
|
||||
# - Linux requirements:
|
||||
# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
|
||||
# related. Ubuntu 14.04 64-bit is recommended. Newer versions will likely also
|
||||
# related. Ubuntu 18.04 64-bit is recommended. Newer versions will likely also
|
||||
# work but may not have been tested.
|
||||
# Required packages include:
|
||||
# build-essential
|
||||
# libgtk2.0-dev (required by the cefclient target only)
|
||||
# libgtkglext1-dev (required by the cefclient target only)
|
||||
#
|
||||
# - Mac OS X requirements:
|
||||
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 8.3
|
||||
# and OS X 10.12 are recommended. The Xcode command-line tools must also be
|
||||
# installed. Only 64-bit builds are supported on OS X.
|
||||
# - MacOS requirements:
|
||||
# Xcode 8 or newer building on MacOS 10.10 (Yosemite) or newer. Xcode 11.2
|
||||
# and MacOS 10.14 are recommended. The Xcode command-line tools must also be
|
||||
# installed. Only 64-bit builds are supported.
|
||||
#
|
||||
# - Windows requirements:
|
||||
# Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio
|
||||
# 2015 Update 3 and Windows 10 64-bit are recommended.
|
||||
# Visual Studio 2015 or newer building on Windows 7 or newer. Visual Studio
|
||||
# 2019 and Windows 10 64-bit are recommended.
|
||||
#
|
||||
# BUILD EXAMPLES
|
||||
#
|
||||
@@ -75,7 +75,7 @@
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Mac OS X build using a 64-bit CEF binary distribution:
|
||||
# To perform a MacOS build using a 64-bit CEF binary distribution:
|
||||
# Using the Xcode IDE:
|
||||
# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
|
||||
# Open build\cef.xcodeproj in Xcode and select Product > Build.
|
||||
@@ -85,24 +85,24 @@
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using a 32-bit CEF binary distribution:
|
||||
# Using the Visual Studio 2015 IDE:
|
||||
# > cmake -G "Visual Studio 14" ..
|
||||
# Using the Visual Studio 2019 IDE:
|
||||
# > cmake -G "Visual Studio 16" -A Win32 ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2015 command-line tools:
|
||||
# Using Ninja with Visual Studio 2019 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
#
|
||||
# To perform a Windows build using a 64-bit CEF binary distribution:
|
||||
# Using the Visual Studio 2015 IDE:
|
||||
# > cmake -G "Visual Studio 14 Win64" ..
|
||||
# Using the Visual Studio 2019 IDE:
|
||||
# > cmake -G "Visual Studio 16" -A x64 ..
|
||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||
#
|
||||
# Using Ninja with Visual Studio 2015 command-line tools:
|
||||
# Using Ninja with Visual Studio 2019 command-line tools:
|
||||
# (this path may be different depending on your Visual Studio installation)
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
|
||||
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
|
||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||
# > ninja cefclient cefsimple
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=21f0ab1e9902e4a47bf2893a4a383d33bd8161e2$
|
||||
# $hash=72268a78a76d7d91b8ad47f6b6e9f6d9cb04d9cf$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -26,6 +26,7 @@
|
||||
'include/cef_context_menu_handler.h',
|
||||
'include/cef_cookie.h',
|
||||
'include/cef_crash_util.h',
|
||||
'include/cef_devtools_message_observer.h',
|
||||
'include/cef_dialog_handler.h',
|
||||
'include/cef_display_handler.h',
|
||||
'include/cef_dom.h',
|
||||
@@ -122,6 +123,7 @@
|
||||
'include/capi/cef_context_menu_handler_capi.h',
|
||||
'include/capi/cef_cookie_capi.h',
|
||||
'include/capi/cef_crash_util_capi.h',
|
||||
'include/capi/cef_devtools_message_observer_capi.h',
|
||||
'include/capi/cef_dialog_handler_capi.h',
|
||||
'include/capi/cef_display_handler_capi.h',
|
||||
'include/capi/cef_dom_capi.h',
|
||||
@@ -260,6 +262,8 @@
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h',
|
||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
|
||||
@@ -326,6 +330,8 @@
|
||||
'libcef_dll/cpptoc/media_router_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
|
||||
@@ -566,6 +572,8 @@
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h',
|
||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
|
||||
@@ -632,6 +640,8 @@
|
||||
'libcef_dll/ctocpp/media_router_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
|
||||
|
@@ -470,6 +470,7 @@
|
||||
'tests/ceftests/browser_info_map_unittest.cc',
|
||||
'tests/ceftests/command_line_unittest.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/devtools_message_unittest.cc',
|
||||
'tests/ceftests/dialog_unittest.cc',
|
||||
'tests/ceftests/display_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
|
@@ -310,7 +310,7 @@ if(OS_MACOSX)
|
||||
|
||||
# Find the newest available base SDK.
|
||||
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
foreach(OS_VERSION 10.11 10.10 10.9)
|
||||
foreach(OS_VERSION 10.15 10.14 10.13 10.12 10.11 10.10)
|
||||
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
|
||||
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
|
||||
set(CMAKE_OSX_SYSROOT ${SDK})
|
||||
@@ -318,7 +318,7 @@ if(OS_MACOSX)
|
||||
endforeach()
|
||||
|
||||
# Target SDK.
|
||||
set(CEF_TARGET_SDK "10.9")
|
||||
set(CEF_TARGET_SDK "10.10")
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
-mmacosx-version-min=${CEF_TARGET_SDK}
|
||||
)
|
||||
@@ -375,25 +375,8 @@ if(OS_WINDOWS)
|
||||
|
||||
if(USE_SANDBOX)
|
||||
# Check if the current MSVC version is compatible with the cef_sandbox.lib
|
||||
# static library. For a list of all version numbers see
|
||||
# https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
|
||||
list(APPEND supported_msvc_versions
|
||||
1900 # VS2015 and updates 1, 2, & 3
|
||||
1910 # VS2017 version 15.1 & 15.2
|
||||
1911 # VS2017 version 15.3 & 15.4
|
||||
1912 # VS2017 version 15.5
|
||||
1913 # VS2017 version 15.6
|
||||
1914 # VS2017 version 15.7
|
||||
1915 # VS2017 version 15.8
|
||||
1916 # VS2017 version 15.9
|
||||
1920 # VS2019 version 16.0
|
||||
1921 # VS2019 version 16.1
|
||||
1922 # VS2019 version 16.2
|
||||
1923 # VS2019 version 16.3
|
||||
1924 # VS2019 version 16.4
|
||||
)
|
||||
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
|
||||
if (${_index} EQUAL -1)
|
||||
# static library. We require VS2015 or newer.
|
||||
if(MSVC_VERSION LESS 1900)
|
||||
message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
|
||||
set(USE_SANDBOX OFF)
|
||||
endif()
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=ba4033eaf40a8ee24408b89b78496bf1381e7e6b$
|
||||
// $hash=6cb00a0fa3631a46903abb3a783f315895511db2$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -41,10 +41,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_devtools_message_observer_capi.h"
|
||||
#include "include/capi/cef_drag_data_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_image_capi.h"
|
||||
#include "include/capi/cef_navigation_entry_capi.h"
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
#include "include/capi/cef_request_context_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -484,6 +486,71 @@ typedef struct _cef_browser_host_t {
|
||||
///
|
||||
int(CEF_CALLBACK* has_dev_tools)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Send a function call message over the DevTools protocol. |message| must be
|
||||
// a UTF8-encoded JSON dictionary that contains "id" (int), "function"
|
||||
// (string) and "params" (dictionary, optional) values. See the DevTools
|
||||
// protocol documentation at https://chromedevtools.github.io/devtools-
|
||||
// protocol/ for details of supported functions and the expected "params"
|
||||
// dictionary contents. |message| will be copied if necessary. This function
|
||||
// will return true (1) if called on the UI thread and the message was
|
||||
// successfully submitted for validation, otherwise false (0). Validation will
|
||||
// be applied asynchronously and any messages that fail due to formatting
|
||||
// errors or missing parameters may be discarded without notification. Prefer
|
||||
// ExecuteDevToolsMethod if a more structured approach to message formatting
|
||||
// is desired.
|
||||
//
|
||||
// Every valid function call will result in an asynchronous function result or
|
||||
// error message that references the sent message "id". Event messages are
|
||||
// received while notifications are enabled (for example, between function
|
||||
// calls for "Page.enable" and "Page.disable"). All received messages will be
|
||||
// delivered to the observer(s) registered with AddDevToolsMessageObserver.
|
||||
// See cef_dev_tools_message_observer_t::OnDevToolsMessage documentation for
|
||||
// details of received message contents.
|
||||
//
|
||||
// Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
|
||||
// AddDevToolsMessageObserver functions does not require an active DevTools
|
||||
// front-end or remote-debugging session. Other active DevTools sessions will
|
||||
// continue to function independently. However, any modification of global
|
||||
// browser state by one session may not be reflected in the UI of other
|
||||
// sessions.
|
||||
//
|
||||
// Communication with the DevTools front-end (when displayed) can be logged
|
||||
// for development purposes by passing the `--devtools-protocol-log-
|
||||
// file=<path>` command-line flag.
|
||||
///
|
||||
int(CEF_CALLBACK* send_dev_tools_message)(struct _cef_browser_host_t* self,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
// Execute a function call over the DevTools protocol. This is a more
|
||||
// structured version of SendDevToolsMessage. |message_id| is an incremental
|
||||
// number that uniquely identifies the message (pass 0 to have the next number
|
||||
// assigned automatically based on previous values). |function| is the
|
||||
// function name. |params| are the function parameters, which may be NULL. See
|
||||
// the DevTools protocol documentation (linked above) for details of supported
|
||||
// functions and the expected |params| dictionary contents. This function will
|
||||
// return the assigned message ID if called on the UI thread and the message
|
||||
// was successfully submitted for validation, otherwise 0. See the
|
||||
// SendDevToolsMessage documentation for additional usage information.
|
||||
///
|
||||
int(CEF_CALLBACK* execute_dev_tools_method)(
|
||||
struct _cef_browser_host_t* self,
|
||||
int message_id,
|
||||
const cef_string_t* method,
|
||||
struct _cef_dictionary_value_t* params);
|
||||
|
||||
///
|
||||
// Add an observer for DevTools protocol messages (function results and
|
||||
// events). The observer will remain registered until the returned
|
||||
// Registration object is destroyed. See the SendDevToolsMessage documentation
|
||||
// for additional usage information.
|
||||
///
|
||||
struct _cef_registration_t*(CEF_CALLBACK* add_dev_tools_message_observer)(
|
||||
struct _cef_browser_host_t* self,
|
||||
struct _cef_dev_tools_message_observer_t* observer);
|
||||
|
||||
///
|
||||
// Retrieve a snapshot of current navigation entries as values sent to the
|
||||
// specified visitor. If |current_only| is true (1) only the current
|
||||
|
147
include/capi/cef_devtools_message_observer_capi.h
Normal file
147
include/capi/cef_devtools_message_observer_capi.h
Normal file
@@ -0,0 +1,147 @@
|
||||
// Copyright (c) 2020 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=86906c2e971fea7e479738f59bbf85d71ce31953$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_browser_t;
|
||||
|
||||
///
|
||||
// Callback structure for cef_browser_host_t::AddDevToolsMessageObserver. The
|
||||
// functions of this structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_dev_tools_message_observer_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Method that will be called on receipt of a DevTools protocol message.
|
||||
// |browser| is the originating browser instance. |message| is a UTF8-encoded
|
||||
// JSON dictionary representing either a function result or an event.
|
||||
// |message| is only valid for the scope of this callback and should be copied
|
||||
// if necessary. Return true (1) if the message was handled or false (0) if
|
||||
// the message should be further processed and passed to the
|
||||
// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.
|
||||
//
|
||||
// Method result dictionaries include an "id" (int) value that identifies the
|
||||
// orginating function call sent from cef_browser_host_t::SendDevToolsMessage,
|
||||
// and optionally either a "result" (dictionary) or "error" (dictionary)
|
||||
// value. The "error" dictionary will contain "code" (int) and "message"
|
||||
// (string) values. Event dictionaries include a "function" (string) value and
|
||||
// optionally a "params" (dictionary) value. See the DevTools protocol
|
||||
// documentation at https://chromedevtools.github.io/devtools-protocol/ for
|
||||
// details of supported function calls and the expected "result" or "params"
|
||||
// dictionary contents. JSON dictionaries can be parsed using the CefParseJSON
|
||||
// function if desired, however be aware of performance considerations when
|
||||
// parsing large messages (some of which may exceed 1MB in size).
|
||||
///
|
||||
int(CEF_CALLBACK* on_dev_tools_message)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
// Method that will be called after attempted execution of a DevTools protocol
|
||||
// function. |browser| is the originating browser instance. |message_id| is
|
||||
// the "id" value that identifies the originating function call message. If
|
||||
// the function succeeded |success| will be true (1) and |result| will be the
|
||||
// UTF8-encoded JSON "result" dictionary value (which may be NULL). If the
|
||||
// function failed |success| will be false (0) and |result| will be the
|
||||
// UTF8-encoded JSON "error" dictionary value. |result| is only valid for the
|
||||
// scope of this callback and should be copied if necessary. See the
|
||||
// OnDevToolsMessage documentation for additional details on |result|
|
||||
// contents.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_method_result)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int message_id,
|
||||
int success,
|
||||
const void* result,
|
||||
size_t result_size);
|
||||
|
||||
///
|
||||
// Method that will be called on receipt of a DevTools protocol event.
|
||||
// |browser| is the originating browser instance. |function| is the "function"
|
||||
// value. |params| is the UTF8-encoded JSON "params" dictionary value (which
|
||||
// may be NULL). |params| is only valid for the scope of this callback and
|
||||
// should be copied if necessary. See the OnDevToolsMessage documentation for
|
||||
// additional details on |params| contents.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_event)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* method,
|
||||
const void* params,
|
||||
size_t params_size);
|
||||
|
||||
///
|
||||
// Method that will be called when the DevTools agent has attached. |browser|
|
||||
// is the originating browser instance. This will generally occur in response
|
||||
// to the first message sent while the agent is detached.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_agent_attached)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
// Method that will be called when the DevTools agent has detached. |browser|
|
||||
// is the originating browser instance. Any function results that were pending
|
||||
// before the agent became detached will not be delivered, and any active
|
||||
// event subscriptions will be canceled.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_agent_detached)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_dev_tools_message_observer_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=aa1310919932145744d5347d449d6ee10a3a0813$
|
||||
// $hash=9d5077fdb3fe7fa0ff1141f839988ac821eba4bf$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
@@ -50,6 +50,7 @@ extern "C" {
|
||||
struct _cef_media_observer_t;
|
||||
struct _cef_media_route_create_callback_t;
|
||||
struct _cef_media_route_t;
|
||||
struct _cef_media_sink_device_info_callback_t;
|
||||
struct _cef_media_sink_t;
|
||||
struct _cef_media_source_t;
|
||||
|
||||
@@ -270,6 +271,13 @@ typedef struct _cef_media_sink_t {
|
||||
cef_media_sink_icon_type_t(CEF_CALLBACK* get_icon_type)(
|
||||
struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Asynchronously retrieves device info.
|
||||
///
|
||||
void(CEF_CALLBACK* get_device_info)(
|
||||
struct _cef_media_sink_t* self,
|
||||
struct _cef_media_sink_device_info_callback_t* callback);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink accepts content via Cast.
|
||||
///
|
||||
@@ -287,6 +295,25 @@ typedef struct _cef_media_sink_t {
|
||||
struct _cef_media_source_t* source);
|
||||
} cef_media_sink_t;
|
||||
|
||||
///
|
||||
// Callback structure for cef_media_sink_t::GetDeviceInfo. The functions of this
|
||||
// structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_sink_device_info_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Method that will be executed asyncronously once device information has been
|
||||
// retrieved.
|
||||
///
|
||||
void(CEF_CALLBACK* on_media_sink_device_info)(
|
||||
struct _cef_media_sink_device_info_callback_t* self,
|
||||
const struct _cef_media_sink_device_info_t* device_info);
|
||||
} cef_media_sink_device_info_callback_t;
|
||||
|
||||
///
|
||||
// Represents a source from which media can be routed. Instances of this object
|
||||
// are retrieved via cef_media_router_t::GetSource. The functions of this
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=3bc4225f43428d8a3a24dcac1830dafac18b0caf$
|
||||
// $hash=14cf03e02d8ca3416e65f756470afd8185c7bc78$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
||||
@@ -140,6 +140,16 @@ CEF_EXPORT struct _cef_value_t* cef_parse_json(
|
||||
const cef_string_t* json_string,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified UTF8-encoded |json| buffer of size |json_size| and
|
||||
// returns a dictionary or list representation. If JSON parsing fails this
|
||||
// function returns NULL.
|
||||
///
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_json_buffer(
|
||||
const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified |json_string| and returns a dictionary or list
|
||||
// representation. If JSON parsing fails this function returns NULL and
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=a28219cc8c1cb53faacaf236374c3cf2c0c45bef$
|
||||
// $hash=0167eb1abe614bd6391d273a8085fa3e53e7c217$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -253,6 +253,14 @@ typedef struct _cef_request_handler_t {
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_termination_status_t status);
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the window.document object of
|
||||
// the main frame has been created.
|
||||
///
|
||||
void(CEF_CALLBACK* on_document_available_in_main_frame)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_request_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=b9577b495df3990284d4e4a3db2824196175dc91$
|
||||
// $hash=b0e2b63b467c6d4e990405d948908da3546ea1c7$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
|
||||
@@ -41,6 +41,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -70,34 +71,25 @@ typedef struct _cef_resource_bundle_t {
|
||||
int string_id);
|
||||
|
||||
///
|
||||
// Retrieves the contents of the specified scale independent |resource_id|. If
|
||||
// the value is found then |data| and |data_size| will be populated and this
|
||||
// function will return true (1). If the value is not found then this function
|
||||
// will return false (0). The returned |data| pointer will remain resident in
|
||||
// memory and should not be freed. Include cef_pack_resources.h for a listing
|
||||
// of valid resource ID values.
|
||||
// Returns a cef_binary_value_t containing the decompressed contents of the
|
||||
// specified scale independent |resource_id| or NULL if not found. Include
|
||||
// cef_pack_resources.h for a listing of valid resource ID values.
|
||||
///
|
||||
int(CEF_CALLBACK* get_data_resource)(struct _cef_resource_bundle_t* self,
|
||||
int resource_id,
|
||||
void** data,
|
||||
size_t* data_size);
|
||||
struct _cef_binary_value_t*(CEF_CALLBACK* get_data_resource)(
|
||||
struct _cef_resource_bundle_t* self,
|
||||
int resource_id);
|
||||
|
||||
///
|
||||
// Retrieves the contents of the specified |resource_id| nearest the scale
|
||||
// factor |scale_factor|. Use a |scale_factor| value of SCALE_FACTOR_NONE for
|
||||
// scale independent resources or call GetDataResource instead. If the value
|
||||
// is found then |data| and |data_size| will be populated and this function
|
||||
// will return true (1). If the value is not found then this function will
|
||||
// return false (0). The returned |data| pointer will remain resident in
|
||||
// memory and should not be freed. Include cef_pack_resources.h for a listing
|
||||
// of valid resource ID values.
|
||||
// Returns a cef_binary_value_t containing the decompressed contents of the
|
||||
// specified |resource_id| nearest the scale factor |scale_factor| or NULL if
|
||||
// not found. Use a |scale_factor| value of SCALE_FACTOR_NONE for scale
|
||||
// independent resources or call GetDataResource instead.Include
|
||||
// cef_pack_resources.h for a listing of valid resource ID values.
|
||||
///
|
||||
int(CEF_CALLBACK* get_data_resource_for_scale)(
|
||||
struct _cef_binary_value_t*(CEF_CALLBACK* get_data_resource_for_scale)(
|
||||
struct _cef_resource_bundle_t* self,
|
||||
int resource_id,
|
||||
cef_scale_factor_t scale_factor,
|
||||
void** data,
|
||||
size_t* data_size);
|
||||
cef_scale_factor_t scale_factor);
|
||||
} cef_resource_bundle_t;
|
||||
|
||||
///
|
||||
|
@@ -42,13 +42,13 @@
|
||||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "a48c939496261acf27f45293484f2c9e4065ca6f"
|
||||
#define CEF_API_HASH_UNIVERSAL "63365efe2e93a4e7cc789cbb8f618d61c92c1b6d"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "7ab8365e6f76e376342247954be2f90f69014776"
|
||||
#define CEF_API_HASH_PLATFORM "726d42ca7d92188542b433d88d17a87af5b53c05"
|
||||
#elif defined(OS_MACOSX)
|
||||
#define CEF_API_HASH_PLATFORM "01cc20ae8dbd5ce63ff50cac215855c4c58059f4"
|
||||
#define CEF_API_HASH_PLATFORM "1c8a413434b592d388446e66b54a3f0bfc0d6fff"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "112ef821732253dfda925d4a1a6d490396bac6d2"
|
||||
#define CEF_API_HASH_PLATFORM "13f7e0e86daab3b1a08d8a31103fc93e45cc508f"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -40,10 +40,12 @@
|
||||
|
||||
#include <vector>
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_devtools_message_observer.h"
|
||||
#include "include/cef_drag_data.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_image.h"
|
||||
#include "include/cef_navigation_entry.h"
|
||||
#include "include/cef_registration.h"
|
||||
#include "include/cef_request_context.h"
|
||||
|
||||
class CefBrowserHost;
|
||||
@@ -517,6 +519,69 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual bool HasDevTools() = 0;
|
||||
|
||||
///
|
||||
// Send a method call message over the DevTools protocol. |message| must be a
|
||||
// UTF8-encoded JSON dictionary that contains "id" (int), "method" (string)
|
||||
// and "params" (dictionary, optional) values. See the DevTools protocol
|
||||
// documentation at https://chromedevtools.github.io/devtools-protocol/ for
|
||||
// details of supported methods and the expected "params" dictionary contents.
|
||||
// |message| will be copied if necessary. This method will return true if
|
||||
// called on the UI thread and the message was successfully submitted for
|
||||
// validation, otherwise false. Validation will be applied asynchronously and
|
||||
// any messages that fail due to formatting errors or missing parameters may
|
||||
// be discarded without notification. Prefer ExecuteDevToolsMethod if a more
|
||||
// structured approach to message formatting is desired.
|
||||
//
|
||||
// Every valid method call will result in an asynchronous method result or
|
||||
// error message that references the sent message "id". Event messages are
|
||||
// received while notifications are enabled (for example, between method calls
|
||||
// for "Page.enable" and "Page.disable"). All received messages will be
|
||||
// delivered to the observer(s) registered with AddDevToolsMessageObserver.
|
||||
// See CefDevToolsMessageObserver::OnDevToolsMessage documentation for details
|
||||
// of received message contents.
|
||||
//
|
||||
// Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
|
||||
// AddDevToolsMessageObserver methods does not require an active DevTools
|
||||
// front-end or remote-debugging session. Other active DevTools sessions will
|
||||
// continue to function independently. However, any modification of global
|
||||
// browser state by one session may not be reflected in the UI of other
|
||||
// sessions.
|
||||
//
|
||||
// Communication with the DevTools front-end (when displayed) can be logged
|
||||
// for development purposes by passing the
|
||||
// `--devtools-protocol-log-file=<path>` command-line flag.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool SendDevToolsMessage(const void* message,
|
||||
size_t message_size) = 0;
|
||||
|
||||
///
|
||||
// Execute a method call over the DevTools protocol. This is a more structured
|
||||
// version of SendDevToolsMessage. |message_id| is an incremental number that
|
||||
// uniquely identifies the message (pass 0 to have the next number assigned
|
||||
// automatically based on previous values). |method| is the method name.
|
||||
// |params| are the method parameters, which may be empty. See the DevTools
|
||||
// protocol documentation (linked above) for details of supported methods and
|
||||
// the expected |params| dictionary contents. This method will return the
|
||||
// assigned message ID if called on the UI thread and the message was
|
||||
// successfully submitted for validation, otherwise 0. See the
|
||||
// SendDevToolsMessage documentation for additional usage information.
|
||||
///
|
||||
/*--cef(optional_param=params)--*/
|
||||
virtual int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) = 0;
|
||||
|
||||
///
|
||||
// Add an observer for DevTools protocol messages (method results and events).
|
||||
// The observer will remain registered until the returned Registration object
|
||||
// is destroyed. See the SendDevToolsMessage documentation for additional
|
||||
// usage information.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) = 0;
|
||||
|
||||
///
|
||||
// Retrieve a snapshot of current navigation entries as values sent to the
|
||||
// specified visitor. If |current_only| is true only the current navigation
|
||||
|
130
include/cef_devtools_message_observer.h
Normal file
130
include/cef_devtools_message_observer.h
Normal file
@@ -0,0 +1,130 @@
|
||||
// Copyright (c) 2020 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_DEVTOOLS_MESSAGE_OBSERVER_H_
|
||||
#define CEF_INCLUDE_CEF_DEVTOOLS_MESSAGE_OBSERVER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
class CefBrowser;
|
||||
|
||||
///
|
||||
// Callback interface for CefBrowserHost::AddDevToolsMessageObserver. The
|
||||
// methods of this class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefDevToolsMessageObserver : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Method that will be called on receipt of a DevTools protocol message.
|
||||
// |browser| is the originating browser instance. |message| is a UTF8-encoded
|
||||
// JSON dictionary representing either a method result or an event. |message|
|
||||
// is only valid for the scope of this callback and should be copied if
|
||||
// necessary. Return true if the message was handled or false if the message
|
||||
// should be further processed and passed to the OnDevToolsMethodResult or
|
||||
// OnDevToolsEvent methods as appropriate.
|
||||
//
|
||||
// Method result dictionaries include an "id" (int) value that identifies the
|
||||
// orginating method call sent from CefBrowserHost::SendDevToolsMessage, and
|
||||
// optionally either a "result" (dictionary) or "error" (dictionary) value.
|
||||
// The "error" dictionary will contain "code" (int) and "message" (string)
|
||||
// values. Event dictionaries include a "method" (string) value and optionally
|
||||
// a "params" (dictionary) value. See the DevTools protocol documentation at
|
||||
// https://chromedevtools.github.io/devtools-protocol/ for details of
|
||||
// supported method calls and the expected "result" or "params" dictionary
|
||||
// contents. JSON dictionaries can be parsed using the CefParseJSON function
|
||||
// if desired, however be aware of performance considerations when parsing
|
||||
// large messages (some of which may exceed 1MB in size).
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnDevToolsMessage(CefRefPtr<CefBrowser> browser,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Method that will be called after attempted execution of a DevTools protocol
|
||||
// method. |browser| is the originating browser instance. |message_id| is the
|
||||
// "id" value that identifies the originating method call message. If the
|
||||
// method succeeded |success| will be true and |result| will be the
|
||||
// UTF8-encoded JSON "result" dictionary value (which may be empty). If the
|
||||
// method failed |success| will be false and |result| will be the UTF8-encoded
|
||||
// JSON "error" dictionary value. |result| is only valid for the scope of this
|
||||
// callback and should be copied if necessary. See the OnDevToolsMessage
|
||||
// documentation for additional details on |result| contents.
|
||||
///
|
||||
/*--cef(optional_param=result)--*/
|
||||
virtual void OnDevToolsMethodResult(CefRefPtr<CefBrowser> browser,
|
||||
int message_id,
|
||||
bool success,
|
||||
const void* result,
|
||||
size_t result_size) {}
|
||||
|
||||
///
|
||||
// Method that will be called on receipt of a DevTools protocol event.
|
||||
// |browser| is the originating browser instance. |method| is the "method"
|
||||
// value. |params| is the UTF8-encoded JSON "params" dictionary value (which
|
||||
// may be empty). |params| is only valid for the scope of this callback and
|
||||
// should be copied if necessary. See the OnDevToolsMessage documentation for
|
||||
// additional details on |params| contents.
|
||||
///
|
||||
/*--cef(optional_param=params)--*/
|
||||
virtual void OnDevToolsEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& method,
|
||||
const void* params,
|
||||
size_t params_size) {}
|
||||
|
||||
///
|
||||
// Method that will be called when the DevTools agent has attached. |browser|
|
||||
// is the originating browser instance. This will generally occur in response
|
||||
// to the first message sent while the agent is detached.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnDevToolsAgentAttached(CefRefPtr<CefBrowser> browser) {}
|
||||
|
||||
///
|
||||
// Method that will be called when the DevTools agent has detached. |browser|
|
||||
// is the originating browser instance. Any method results that were pending
|
||||
// before the agent became detached will not be delivered, and any active
|
||||
// event subscriptions will be canceled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnDevToolsAgentDetached(CefRefPtr<CefBrowser> browser) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_DEVTOOLS_MESSAGE_OBSERVER_H_
|
@@ -46,6 +46,7 @@ class CefMediaObserver;
|
||||
class CefMediaRoute;
|
||||
class CefMediaRouteCreateCallback;
|
||||
class CefMediaSink;
|
||||
class CefMediaSinkDeviceInfoCallback;
|
||||
class CefMediaSource;
|
||||
|
||||
///
|
||||
@@ -253,6 +254,13 @@ class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
/*--cef(default_retval=CEF_MSIT_GENERIC)--*/
|
||||
virtual IconType GetIconType() = 0;
|
||||
|
||||
///
|
||||
// Asynchronously retrieves device info.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink accepts content via Cast.
|
||||
///
|
||||
@@ -272,6 +280,22 @@ class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
virtual bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Callback interface for CefMediaSink::GetDeviceInfo. The methods of this
|
||||
// class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefMediaSinkDeviceInfoCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Method that will be executed asyncronously once device information has been
|
||||
// retrieved.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnMediaSinkDeviceInfo(
|
||||
const CefMediaSinkDeviceInfo& device_info) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Represents a source from which media can be routed. Instances of this object
|
||||
// are retrieved via CefMediaRouter::GetSource. The methods of this class may be
|
||||
|
@@ -133,6 +133,16 @@ CefString CefURIDecode(const CefString& text,
|
||||
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified UTF8-encoded |json| buffer of size |json_size| and
|
||||
// returns a dictionary or list representation. If JSON parsing fails this
|
||||
// method returns NULL.
|
||||
///
|
||||
/*--cef(capi_name=cef_parse_json_buffer)--*/
|
||||
CefRefPtr<CefValue> CefParseJSON(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified |json_string| and returns a dictionary or list
|
||||
// representation. If JSON parsing fails this method returns NULL and populates
|
||||
|
@@ -252,6 +252,13 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the window.document object of
|
||||
// the main frame has been created.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnDocumentAvailableInMainFrame(CefRefPtr<CefBrowser> browser) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_values.h"
|
||||
|
||||
///
|
||||
// Class used for retrieving resources from the resource bundle (*.pak) files
|
||||
@@ -67,33 +68,24 @@ class CefResourceBundle : public virtual CefBaseRefCounted {
|
||||
virtual CefString GetLocalizedString(int string_id) = 0;
|
||||
|
||||
///
|
||||
// Retrieves the contents of the specified scale independent |resource_id|.
|
||||
// If the value is found then |data| and |data_size| will be populated and
|
||||
// this method will return true. If the value is not found then this method
|
||||
// will return false. The returned |data| pointer will remain resident in
|
||||
// memory and should not be freed. Include cef_pack_resources.h for a listing
|
||||
// of valid resource ID values.
|
||||
// Returns a CefBinaryValue containing the decompressed contents of the
|
||||
// specified scale independent |resource_id| or NULL if not found. Include
|
||||
// cef_pack_resources.h for a listing of valid resource ID values.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetDataResource(int resource_id,
|
||||
void*& data,
|
||||
size_t& data_size) = 0;
|
||||
virtual CefRefPtr<CefBinaryValue> GetDataResource(int resource_id) = 0;
|
||||
|
||||
///
|
||||
// Retrieves the contents of the specified |resource_id| nearest the scale
|
||||
// factor |scale_factor|. Use a |scale_factor| value of SCALE_FACTOR_NONE for
|
||||
// scale independent resources or call GetDataResource instead. If the value
|
||||
// is found then |data| and |data_size| will be populated and this method will
|
||||
// return true. If the value is not found then this method will return false.
|
||||
// The returned |data| pointer will remain resident in memory and should not
|
||||
// be freed. Include cef_pack_resources.h for a listing of valid resource ID
|
||||
// values.
|
||||
// Returns a CefBinaryValue containing the decompressed contents of the
|
||||
// specified |resource_id| nearest the scale factor |scale_factor| or NULL if
|
||||
// not found. Use a |scale_factor| value of SCALE_FACTOR_NONE for scale
|
||||
// independent resources or call GetDataResource instead.Include
|
||||
// cef_pack_resources.h for a listing of valid resource ID values.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetDataResourceForScale(int resource_id,
|
||||
ScaleFactor scale_factor,
|
||||
void*& data,
|
||||
size_t& data_size) = 0;
|
||||
virtual CefRefPtr<CefBinaryValue> GetDataResourceForScale(
|
||||
int resource_id,
|
||||
ScaleFactor scale_factor) = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_RESOURCE_BUNDLE_H_
|
||||
|
@@ -3180,6 +3180,15 @@ typedef enum {
|
||||
CEF_MSIT_TOTAL_COUNT, // The total number of values.
|
||||
} cef_media_sink_icon_type_t;
|
||||
|
||||
///
|
||||
// Device information for a MediaSink object.
|
||||
///
|
||||
typedef struct _cef_media_sink_device_info_t {
|
||||
cef_string_t ip_address;
|
||||
int port;
|
||||
cef_string_t model_name;
|
||||
} cef_media_sink_device_info_t;
|
||||
|
||||
///
|
||||
// Represents commands available to TextField.
|
||||
///
|
||||
|
@@ -979,4 +979,30 @@ struct CefAudioParametersTraits {
|
||||
///
|
||||
typedef CefStructBase<CefAudioParametersTraits> CefAudioParameters;
|
||||
|
||||
struct CefMediaSinkDeviceInfoTraits {
|
||||
typedef cef_media_sink_device_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s) {
|
||||
cef_string_clear(&s->ip_address);
|
||||
cef_string_clear(&s->model_name);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
cef_string_set(src->ip_address.str, src->ip_address.length,
|
||||
&target->ip_address, copy);
|
||||
target->port = src->port;
|
||||
cef_string_set(src->model_name.str, src->model_name.length,
|
||||
&target->model_name, copy);
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
// Class representing MediaSink device info.
|
||||
///
|
||||
typedef CefStructBase<CefMediaSinkDeviceInfoTraits> CefMediaSinkDeviceInfo;
|
||||
|
||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_
|
||||
|
@@ -16,8 +16,7 @@
|
||||
#include "libcef/browser/browser_util.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools/devtools_frontend.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/devtools/devtools_manager.h"
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "libcef/browser/extensions/extension_background_host.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
@@ -594,26 +593,6 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForFrameRoute(
|
||||
// CefBrowserHostImpl methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// WebContentsObserver that will be notified when the frontend WebContents is
|
||||
// destroyed so that the inspected browser can clear its DevTools references.
|
||||
class CefBrowserHostImpl::DevToolsWebContentsObserver
|
||||
: public content::WebContentsObserver {
|
||||
public:
|
||||
DevToolsWebContentsObserver(CefBrowserHostImpl* browser,
|
||||
content::WebContents* frontend_web_contents)
|
||||
: WebContentsObserver(frontend_web_contents), browser_(browser) {}
|
||||
|
||||
// WebContentsObserver methods:
|
||||
void WebContentsDestroyed() override {
|
||||
browser_->OnDevToolsWebContentsDestroyed();
|
||||
}
|
||||
|
||||
private:
|
||||
CefBrowserHostImpl* browser_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DevToolsWebContentsObserver);
|
||||
};
|
||||
|
||||
CefBrowserHostImpl::~CefBrowserHostImpl() {}
|
||||
|
||||
CefRefPtr<CefBrowser> CefBrowserHostImpl::GetBrowser() {
|
||||
@@ -906,39 +885,29 @@ void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
if (devtools_frontend_) {
|
||||
if (!inspect_element_at.IsEmpty()) {
|
||||
devtools_frontend_->InspectElementAt(inspect_element_at.x,
|
||||
inspect_element_at.y);
|
||||
}
|
||||
devtools_frontend_->Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
devtools_frontend_ = CefDevToolsFrontend::Show(
|
||||
this, windowInfo, client, settings, inspect_element_at);
|
||||
devtools_observer_.reset(new DevToolsWebContentsObserver(
|
||||
this, devtools_frontend_->frontend_browser()->web_contents()));
|
||||
} else {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
ShowDevToolsHelper* helper = new ShowDevToolsHelper(
|
||||
this, windowInfo, client, settings, inspect_element_at);
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(ShowDevToolsWithHelper, helper));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return;
|
||||
devtools_manager_->ShowDevTools(windowInfo, client, settings,
|
||||
inspect_element_at);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::CloseDevTools() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!devtools_frontend_)
|
||||
return;
|
||||
devtools_frontend_->Close();
|
||||
} else {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::CloseDevTools, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!devtools_manager_)
|
||||
return;
|
||||
devtools_manager_->CloseDevTools();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::HasDevTools() {
|
||||
@@ -947,7 +916,84 @@ bool CefBrowserHostImpl::HasDevTools() {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (devtools_frontend_ != nullptr);
|
||||
if (!devtools_manager_)
|
||||
return false;
|
||||
return devtools_manager_->HasDevTools();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
if (!message || message_size == 0)
|
||||
return false;
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
std::string message_str(static_cast<const char*>(message), message_size);
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
[](CefRefPtr<CefBrowserHostImpl> self, std::string message_str) {
|
||||
self->SendDevToolsMessage(message_str.data(), message_str.size());
|
||||
},
|
||||
CefRefPtr<CefBrowserHostImpl>(this), std::move(message_str)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return false;
|
||||
return devtools_manager_->SendDevToolsMessage(message, message_size);
|
||||
}
|
||||
|
||||
int CefBrowserHostImpl::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(base::IgnoreResult(
|
||||
&CefBrowserHostImpl::ExecuteDevToolsMethod),
|
||||
this, message_id, method, params));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return 0;
|
||||
return devtools_manager_->ExecuteDevToolsMethod(message_id, method, params);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> CefBrowserHostImpl::AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
if (!observer)
|
||||
return nullptr;
|
||||
auto registration = CefDevToolsManager::CreateRegistration(observer);
|
||||
InitializeDevToolsRegistrationOnUIThread(registration);
|
||||
return registration.get();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::EnsureDevToolsManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!web_contents())
|
||||
return false;
|
||||
|
||||
if (!devtools_manager_) {
|
||||
devtools_manager_.reset(new CefDevToolsManager(this));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
&CefBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread, this,
|
||||
registration));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return;
|
||||
devtools_manager_->InitializeRegistrationOnUIThread(registration);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::GetNavigationEntries(
|
||||
@@ -1611,6 +1657,8 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
||||
recently_audible_timer_.Stop();
|
||||
audio_capturer_.reset(nullptr);
|
||||
|
||||
devtools_manager_.reset(nullptr);
|
||||
|
||||
// Delete the platform delegate.
|
||||
platform_delegate_.reset(nullptr);
|
||||
|
||||
@@ -2704,16 +2752,24 @@ void CefBrowserHostImpl::DidStopLoading() {
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
has_document_ = true;
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
has_document_ = true;
|
||||
}
|
||||
|
||||
if (client_) {
|
||||
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
|
||||
if (handler)
|
||||
handler->OnDocumentAvailableInMainFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidFailLoad(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
int error_code) {
|
||||
// The navigation failed after commit. OnLoadStart was called so we also call
|
||||
// OnLoadEnd.
|
||||
// The navigation failed after commit. OnLoadStart was called so we also
|
||||
// call OnLoadEnd.
|
||||
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
||||
frame->RefreshAttributes();
|
||||
OnLoadError(frame, validated_url, error_code);
|
||||
@@ -2949,18 +3005,6 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
platform_delegate_(std::move(platform_delegate)),
|
||||
is_windowless_(platform_delegate_->IsWindowless()),
|
||||
is_views_hosted_(platform_delegate_->IsViewsHosted()),
|
||||
host_window_handle_(kNullWindowHandle),
|
||||
is_loading_(false),
|
||||
can_go_back_(false),
|
||||
can_go_forward_(false),
|
||||
has_document_(false),
|
||||
is_fullscreen_(false),
|
||||
destruction_state_(DESTRUCTION_STATE_NONE),
|
||||
window_destroyed_(false),
|
||||
is_in_onsetfocus_(false),
|
||||
focus_on_editable_field_(false),
|
||||
mouse_cursor_change_disabled_(false),
|
||||
devtools_frontend_(nullptr),
|
||||
extension_(extension) {
|
||||
if (opener.get() && !platform_delegate_->IsViewsHosted()) {
|
||||
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
||||
@@ -3171,11 +3215,6 @@ void CefBrowserHostImpl::OnTitleChange(const base::string16& title) {
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnDevToolsWebContentsDestroyed() {
|
||||
devtools_observer_.reset();
|
||||
devtools_frontend_ = nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::EnsureFileDialogManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!file_dialog_manager_.get() && platform_delegate_) {
|
||||
|
@@ -51,7 +51,7 @@ class Widget;
|
||||
class CefAudioCapturer;
|
||||
class CefBrowserInfo;
|
||||
class CefBrowserPlatformDelegate;
|
||||
class CefDevToolsFrontend;
|
||||
class CefDevToolsManager;
|
||||
class SiteInstance;
|
||||
|
||||
// Implementation of CefBrowser.
|
||||
@@ -192,6 +192,12 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
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;
|
||||
@@ -523,8 +529,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
std::unique_ptr<NavigationLock> CreateNavigationLock();
|
||||
|
||||
private:
|
||||
class DevToolsWebContentsObserver;
|
||||
|
||||
static CefRefPtr<CefBrowserHostImpl> CreateInternal(
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
@@ -581,8 +585,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void OnFullscreenModeChange(bool fullscreen);
|
||||
void OnTitleChange(const base::string16& title);
|
||||
|
||||
void OnDevToolsWebContentsDestroyed();
|
||||
|
||||
// Create the CefFileDialogManager if it doesn't already exist.
|
||||
void EnsureFileDialogManager();
|
||||
|
||||
@@ -591,6 +593,10 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void StartAudioCapturer();
|
||||
void OnRecentlyAudibleTimerFired();
|
||||
|
||||
bool EnsureDevToolsManager();
|
||||
void InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration);
|
||||
|
||||
CefBrowserSettings settings_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
scoped_refptr<CefBrowserInfo> browser_info_;
|
||||
@@ -599,7 +605,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_;
|
||||
const bool is_windowless_;
|
||||
const bool is_views_hosted_;
|
||||
CefWindowHandle host_window_handle_;
|
||||
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
||||
|
||||
// Non-nullptr if this object owns the WebContents. Will be nullptr for popup
|
||||
// browsers between the calls to WebContentsCreated() and AddNewContents(),
|
||||
@@ -609,18 +615,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
// Volatile state information. All access must be protected by the state lock.
|
||||
base::Lock state_lock_;
|
||||
bool is_loading_;
|
||||
bool can_go_back_;
|
||||
bool can_go_forward_;
|
||||
bool has_document_;
|
||||
bool is_fullscreen_;
|
||||
bool is_loading_ = false;
|
||||
bool can_go_back_ = false;
|
||||
bool can_go_forward_ = false;
|
||||
bool has_document_ = false;
|
||||
bool is_fullscreen_ = false;
|
||||
|
||||
// The currently focused frame, or nullptr if the main frame is focused.
|
||||
CefRefPtr<CefFrameHostImpl> focused_frame_;
|
||||
|
||||
// Represents the current browser destruction state. Only accessed on the UI
|
||||
// thread.
|
||||
DestructionState destruction_state_;
|
||||
DestructionState destruction_state_ = DESTRUCTION_STATE_NONE;
|
||||
|
||||
// Navigation will not occur while |navigation_lock_count_| > 0.
|
||||
// |pending_navigation_action_| will be executed when the lock is released.
|
||||
@@ -630,18 +636,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
// True if the OS window hosting the browser has been destroyed. Only accessed
|
||||
// on the UI thread.
|
||||
bool window_destroyed_;
|
||||
bool window_destroyed_ = false;
|
||||
|
||||
// True if currently in the OnSetFocus callback. Only accessed on the UI
|
||||
// thread.
|
||||
bool is_in_onsetfocus_;
|
||||
bool is_in_onsetfocus_ = false;
|
||||
|
||||
// True if the focus is currently on an editable field on the page. Only
|
||||
// accessed on the UI thread.
|
||||
bool focus_on_editable_field_;
|
||||
bool focus_on_editable_field_ = false;
|
||||
|
||||
// True if mouse cursor change is disabled.
|
||||
bool mouse_cursor_change_disabled_;
|
||||
bool mouse_cursor_change_disabled_ = false;
|
||||
|
||||
// Used for managing notification subscriptions.
|
||||
std::unique_ptr<content::NotificationRegistrar> registrar_;
|
||||
@@ -655,12 +661,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Used for creating and managing context menus.
|
||||
std::unique_ptr<CefMenuManager> menu_manager_;
|
||||
|
||||
// Track the lifespan of the frontend WebContents associated with this
|
||||
// browser.
|
||||
std::unique_ptr<DevToolsWebContentsObserver> devtools_observer_;
|
||||
// CefDevToolsFrontend will delete itself when the frontend WebContents is
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend_;
|
||||
// Used for creating and managing DevTools instances.
|
||||
std::unique_ptr<CefDevToolsManager> devtools_manager_;
|
||||
|
||||
// Observers that want to be notified of changes to this object.
|
||||
base::ObserverList<Observer>::Unchecked observers_;
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/child_process_host.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "extensions/common/constants.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -115,26 +117,13 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
bool* no_javascript_access) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
bool is_guest_view = false;
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
extensions::GetOwnerBrowserForHost(opener, &is_guest_view);
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get()) {
|
||||
// Cancel the popup.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_guest_view) {
|
||||
content::OpenURLParams params(target_url, referrer, disposition,
|
||||
ui::PAGE_TRANSITION_LINK, true);
|
||||
params.user_gesture = user_gesture;
|
||||
|
||||
// Pass navigation to the owner browser.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(base::IgnoreResult(&CefBrowserHostImpl::OpenURLFromTab),
|
||||
browser.get(), nullptr, params));
|
||||
content::OpenURLParams params(target_url, referrer, disposition,
|
||||
ui::PAGE_TRANSITION_LINK,
|
||||
/*is_renderer_initiated=*/true);
|
||||
params.user_gesture = user_gesture;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser;
|
||||
if (!MaybeAllowNavigation(opener, params, browser) || !browser) {
|
||||
// Cancel the popup.
|
||||
return false;
|
||||
}
|
||||
@@ -369,6 +358,38 @@ CefBrowserInfoManager::GetBrowserInfoForFrameRoute(int render_process_id,
|
||||
return GetBrowserInfo(render_process_id, render_routing_id, is_guest_view);
|
||||
}
|
||||
|
||||
bool CefBrowserInfoManager::MaybeAllowNavigation(
|
||||
content::RenderFrameHost* opener,
|
||||
const content::OpenURLParams& params,
|
||||
CefRefPtr<CefBrowserHostImpl>& browser_out) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
bool is_guest_view = false;
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
extensions::GetOwnerBrowserForHost(opener, &is_guest_view);
|
||||
if (!browser) {
|
||||
// Print preview uses a modal dialog where we don't own the WebContents.
|
||||
// Allow that navigation to proceed.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_guest_view && !params.url.SchemeIs(extensions::kExtensionScheme) &&
|
||||
!params.url.SchemeIs(content::kChromeUIScheme)) {
|
||||
// The PDF viewer will load the PDF extension in the guest view, and print
|
||||
// preview will load chrome://print in the guest view. All other navigations
|
||||
// are passed to the owner browser.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(base::IgnoreResult(&CefBrowserHostImpl::OpenURLFromTab),
|
||||
browser.get(), nullptr, params));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
browser_out = browser;
|
||||
return true;
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo>
|
||||
CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id,
|
||||
bool* is_guest_view) {
|
||||
|
@@ -25,6 +25,7 @@ struct WebWindowFeatures;
|
||||
}
|
||||
|
||||
namespace content {
|
||||
struct OpenURLParams;
|
||||
struct Referrer;
|
||||
class RenderFrameHost;
|
||||
class RenderViewHostDelegateView;
|
||||
@@ -138,6 +139,13 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
typedef std::list<scoped_refptr<CefBrowserInfo>> BrowserInfoList;
|
||||
BrowserInfoList GetBrowserInfoList();
|
||||
|
||||
// Returns true if the navigation should be allowed to proceed, or false if
|
||||
// the navigation will instead be sent via OpenURLFromTab. If allowed,
|
||||
// |browser| will be set to the target browser if any.
|
||||
bool MaybeAllowNavigation(content::RenderFrameHost* opener,
|
||||
const content::OpenURLParams& params,
|
||||
CefRefPtr<CefBrowserHostImpl>& browser) const;
|
||||
|
||||
private:
|
||||
// RenderProcessHostObserver methods:
|
||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||
|
@@ -71,19 +71,21 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
||||
// is_immediate() returns true if the next task is ready right away.
|
||||
more_immediate_work = next_work_info.is_immediate();
|
||||
if (!more_immediate_work) {
|
||||
// DoIdleWork() returns true if idle work was all done.
|
||||
more_idle_work = !delegate->DoIdleWork();
|
||||
|
||||
// Check the next PendingTask's |delayed_run_time|.
|
||||
// is_max() returns true if there are no more immediate nor delayed tasks.
|
||||
more_delayed_work = !next_work_info.delayed_run_time.is_max();
|
||||
if (more_delayed_work && !more_idle_work) {
|
||||
if (more_delayed_work) {
|
||||
// The only remaining work that we know about is the PendingTask.
|
||||
// Consider the run time for that task in the time slice calculation.
|
||||
*next_run_time = next_work_info.delayed_run_time;
|
||||
}
|
||||
}
|
||||
|
||||
if (!more_immediate_work && !more_delayed_work) {
|
||||
// DoIdleWork() returns true if idle work was all done.
|
||||
more_idle_work = !delegate->DoIdleWork();
|
||||
}
|
||||
|
||||
return more_immediate_work || more_idle_work || more_delayed_work;
|
||||
}
|
||||
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#include "chrome/browser/profiles/renderer_updater_factory.h"
|
||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
|
||||
#include "chrome/common/chrome_content_client.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/google_url_loader_throttle.h"
|
||||
@@ -448,10 +449,20 @@ bool NavigationOnUIThread(
|
||||
const navigation_interception::NavigationParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
content::OpenURLParams open_params(
|
||||
params.url(), params.referrer(), WindowOpenDisposition::CURRENT_TAB,
|
||||
params.transition_type(), params.is_renderer_initiated());
|
||||
open_params.user_gesture = params.has_user_gesture();
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser;
|
||||
if (!CefBrowserInfoManager::GetInstance()->MaybeAllowNavigation(
|
||||
source->GetMainFrame(), open_params, browser)) {
|
||||
// Cancel the navigation.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ignore_navigation = false;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(source);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
@@ -1318,6 +1329,15 @@ void CefContentBrowserClient::ConfigureNetworkContextParams(
|
||||
const base::FilePath& relative_partition_path,
|
||||
network::mojom::NetworkContextParams* network_context_params,
|
||||
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
|
||||
// This method may be called during shutdown when using multi-threaded
|
||||
// message loop mode. In that case exit early to avoid crashes.
|
||||
if (!SystemNetworkContextManager::GetInstance()) {
|
||||
// This must match the value expected in
|
||||
// StoragePartitionImpl::InitNetworkContext.
|
||||
network_context_params->context_name = "magic_shutting_down";
|
||||
return;
|
||||
}
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(context);
|
||||
profile->ConfigureNetworkContextParams(in_memory, relative_partition_path,
|
||||
network_context_params,
|
||||
@@ -1482,6 +1502,31 @@ CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
return mime_types;
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::ShouldAllowPluginCreation(
|
||||
const url::Origin& embedder_origin,
|
||||
const content::PepperPluginInfo& plugin_info) {
|
||||
if (plugin_info.name == ChromeContentClient::kPDFInternalPluginName) {
|
||||
// Allow embedding the internal PDF plugin in the built-in PDF extension.
|
||||
if (embedder_origin.scheme() == extensions::kExtensionScheme &&
|
||||
embedder_origin.host() == extension_misc::kPdfExtensionId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow embedding the internal PDF plugin in chrome://print.
|
||||
if (embedder_origin ==
|
||||
url::Origin::Create(GURL(chrome::kChromeUIPrintURL))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only allow the PDF plugin in the known, trustworthy origins that are
|
||||
// allowlisted above. See also https://crbug.com/520422 and
|
||||
// https://crbug.com/1027173.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> CefContentBrowserClient::request_context()
|
||||
const {
|
||||
return browser_main_parts_->request_context();
|
||||
|
@@ -211,6 +211,9 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
blink::UserAgentMetadata GetUserAgentMetadata() override;
|
||||
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
||||
content::BrowserContext* browser_context) override;
|
||||
bool ShouldAllowPluginCreation(
|
||||
const url::Origin& embedder_origin,
|
||||
const content::PepperPluginInfo& plugin_info) override;
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> request_context() const;
|
||||
CefDevToolsDelegate* devtools_delegate() const;
|
||||
|
137
libcef/browser/devtools/devtools_controller.cc
Normal file
137
libcef/browser/devtools/devtools_controller.cc
Normal file
@@ -0,0 +1,137 @@
|
||||
// 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.
|
||||
|
||||
#include "libcef/browser/devtools/devtools_controller.h"
|
||||
|
||||
#include "libcef/browser/devtools/devtools_util.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
|
||||
CefDevToolsController::CefDevToolsController(
|
||||
content::WebContents* inspected_contents)
|
||||
: inspected_contents_(inspected_contents), weak_ptr_factory_(this) {
|
||||
DCHECK(inspected_contents_);
|
||||
}
|
||||
|
||||
CefDevToolsController::~CefDevToolsController() {
|
||||
if (agent_host_) {
|
||||
agent_host_->DetachClient(this);
|
||||
AgentHostClosed(agent_host_.get());
|
||||
}
|
||||
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnDevToolsControllerDestroyed();
|
||||
}
|
||||
}
|
||||
|
||||
bool CefDevToolsController::SendDevToolsMessage(
|
||||
const base::StringPiece& message) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!EnsureAgentHost())
|
||||
return false;
|
||||
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(message)));
|
||||
return true;
|
||||
}
|
||||
|
||||
int CefDevToolsController::ExecuteDevToolsMethod(
|
||||
int suggested_message_id,
|
||||
const std::string& method,
|
||||
const base::DictionaryValue* params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!EnsureAgentHost())
|
||||
return 0;
|
||||
|
||||
// Message IDs must always be increasing and unique.
|
||||
int message_id = suggested_message_id;
|
||||
if (message_id < next_message_id_)
|
||||
message_id = next_message_id_++;
|
||||
else
|
||||
next_message_id_ = message_id + 1;
|
||||
|
||||
base::DictionaryValue message;
|
||||
message.SetIntKey("id", message_id);
|
||||
message.SetStringKey("method", method);
|
||||
if (params)
|
||||
message.SetKey("params", params->Clone());
|
||||
|
||||
std::string protocol_message;
|
||||
if (!base::JSONWriter::Write(message, &protocol_message))
|
||||
return 0;
|
||||
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(protocol_message)));
|
||||
return message_id;
|
||||
}
|
||||
|
||||
void CefDevToolsController::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
DCHECK(agent_host == agent_host_.get());
|
||||
agent_host_ = nullptr;
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnDevToolsAgentDetached();
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsController::AddObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void CefDevToolsController::RemoveObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void CefDevToolsController::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
base::span<const uint8_t> message) {
|
||||
if (!observers_.might_have_observers())
|
||||
return;
|
||||
|
||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||
message.size());
|
||||
if (!devtools_util::ProtocolParser::IsValidMessage(str_message)) {
|
||||
LOG(WARNING) << "Invalid message: " << str_message.substr(0, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
devtools_util::ProtocolParser parser;
|
||||
|
||||
for (auto& observer : observers_) {
|
||||
if (observer.OnDevToolsMessage(str_message)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only perform parsing a single time.
|
||||
if (parser.Initialize(str_message) && parser.IsFailure()) {
|
||||
LOG(WARNING) << "Failed to parse message: " << str_message.substr(0, 100);
|
||||
}
|
||||
|
||||
if (parser.IsEvent()) {
|
||||
observer.OnDevToolsEvent(parser.method_, parser.params_);
|
||||
} else if (parser.IsResult()) {
|
||||
observer.OnDevToolsMethodResult(parser.message_id_, parser.success_,
|
||||
parser.params_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CefDevToolsController::EnsureAgentHost() {
|
||||
if (!agent_host_) {
|
||||
agent_host_ =
|
||||
content::DevToolsAgentHost::GetOrCreateFor(inspected_contents_);
|
||||
if (agent_host_) {
|
||||
agent_host_->AttachClient(this);
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnDevToolsAgentAttached();
|
||||
}
|
||||
}
|
||||
}
|
||||
return !!agent_host_;
|
||||
}
|
79
libcef/browser/devtools/devtools_controller.h
Normal file
79
libcef/browser/devtools/devtools_controller.h
Normal file
@@ -0,0 +1,79 @@
|
||||
// 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_CONTROLLER_H_
|
||||
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_CONTROLLER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "content/public/browser/devtools_agent_host_client.h"
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "base/values.h"
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
}
|
||||
|
||||
class CefDevToolsController : public content::DevToolsAgentHostClient {
|
||||
public:
|
||||
class Observer : public base::CheckedObserver {
|
||||
public:
|
||||
// See CefDevToolsMessageObserver documentation.
|
||||
virtual bool OnDevToolsMessage(const base::StringPiece& message) = 0;
|
||||
virtual void OnDevToolsMethodResult(int message_id,
|
||||
bool success,
|
||||
const base::StringPiece& result) = 0;
|
||||
virtual void OnDevToolsEvent(const base::StringPiece& method,
|
||||
const base::StringPiece& params) = 0;
|
||||
virtual void OnDevToolsAgentAttached() = 0;
|
||||
virtual void OnDevToolsAgentDetached() = 0;
|
||||
|
||||
virtual void OnDevToolsControllerDestroyed() = 0;
|
||||
|
||||
protected:
|
||||
~Observer() override {}
|
||||
};
|
||||
|
||||
// |inspected_contents| will outlive this object.
|
||||
explicit CefDevToolsController(content::WebContents* inspected_contents);
|
||||
~CefDevToolsController() override;
|
||||
|
||||
// See CefBrowserHost methods of the same name for documentation.
|
||||
bool SendDevToolsMessage(const base::StringPiece& message);
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const std::string& method,
|
||||
const base::DictionaryValue* params);
|
||||
|
||||
// |observer| must outlive this object or be removed.
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
|
||||
base::WeakPtr<CefDevToolsController> GetWeakPtr() {
|
||||
return weak_ptr_factory_.GetWeakPtr();
|
||||
}
|
||||
|
||||
private:
|
||||
// content::DevToolsAgentHostClient implementation:
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
base::span<const uint8_t> message) override;
|
||||
|
||||
bool EnsureAgentHost();
|
||||
|
||||
content::WebContents* const inspected_contents_;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
int next_message_id_ = 1;
|
||||
|
||||
base::ObserverList<Observer> observers_;
|
||||
|
||||
base::WeakPtrFactory<CefDevToolsController> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsController);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_CONTROLLER_H_
|
@@ -6,13 +6,18 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iomanip>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/net/devtools_scheme_handler.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/guid.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
@@ -48,6 +53,13 @@
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
#include "storage/browser/file_system/native_file_util.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#elif defined(OS_POSIX)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -86,6 +98,71 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
return response;
|
||||
}
|
||||
|
||||
const int kMaxLogLineLength = 1024;
|
||||
|
||||
void WriteTimestamp(std::stringstream& stream) {
|
||||
#if defined(OS_WIN)
|
||||
SYSTEMTIME local_time;
|
||||
GetLocalTime(&local_time);
|
||||
stream << std::setfill('0') << std::setw(2) << local_time.wMonth
|
||||
<< std::setw(2) << local_time.wDay << '/' << std::setw(2)
|
||||
<< local_time.wHour << std::setw(2) << local_time.wMinute
|
||||
<< std::setw(2) << local_time.wSecond << '.' << std::setw(3)
|
||||
<< local_time.wMilliseconds;
|
||||
#elif defined(OS_POSIX)
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
time_t t = tv.tv_sec;
|
||||
struct tm local_time;
|
||||
localtime_r(&t, &local_time);
|
||||
struct tm* tm_time = &local_time;
|
||||
stream << std::setfill('0') << std::setw(2) << 1 + tm_time->tm_mon
|
||||
<< std::setw(2) << tm_time->tm_mday << '/' << std::setw(2)
|
||||
<< tm_time->tm_hour << std::setw(2) << tm_time->tm_min << std::setw(2)
|
||||
<< tm_time->tm_sec << '.' << std::setw(6) << tv.tv_usec;
|
||||
#else
|
||||
#error Unsupported platform
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogProtocolMessage(const base::FilePath& log_file,
|
||||
ProtocolMessageType type,
|
||||
std::string to_log) {
|
||||
// Track if logging has failed, in which case we don't keep trying.
|
||||
static bool log_error = false;
|
||||
if (log_error)
|
||||
return;
|
||||
|
||||
if (storage::NativeFileUtil::EnsureFileExists(log_file, nullptr) !=
|
||||
base::File::FILE_OK) {
|
||||
LOG(ERROR) << "Failed to create file " << log_file.value();
|
||||
log_error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string type_label;
|
||||
switch (type) {
|
||||
case ProtocolMessageType::METHOD:
|
||||
type_label = "METHOD";
|
||||
break;
|
||||
case ProtocolMessageType::RESULT:
|
||||
type_label = "RESULT";
|
||||
break;
|
||||
case ProtocolMessageType::EVENT:
|
||||
type_label = "EVENT";
|
||||
break;
|
||||
}
|
||||
|
||||
std::stringstream stream;
|
||||
WriteTimestamp(stream);
|
||||
stream << ": " << type_label << ": " << to_log << "\n";
|
||||
const std::string& str = stream.str();
|
||||
if (!base::AppendToFile(log_file, str.c_str(), str.size())) {
|
||||
LOG(ERROR) << "Failed to write file " << log_file.value();
|
||||
log_error = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefDevToolsFrontend::NetworkResourceLoader
|
||||
@@ -156,11 +233,12 @@ const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
|
||||
|
||||
// static
|
||||
CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
||||
CefBrowserHostImpl* inspected_browser,
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure frontend_destroyed_callback) {
|
||||
CefBrowserSettings new_settings = settings;
|
||||
if (!windowInfo.windowless_rendering_enabled &&
|
||||
CefColorGetA(new_settings.background_color) != SK_AlphaOPAQUE) {
|
||||
@@ -187,7 +265,8 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
|
||||
static_cast<CefBrowserHostImpl*>(frontend_browser.get()),
|
||||
inspected_contents, inspect_element_at);
|
||||
inspected_contents, inspect_element_at,
|
||||
std::move(frontend_destroyed_callback));
|
||||
|
||||
// Need to load the URL after creating the DevTools objects.
|
||||
frontend_browser->GetMainFrame()->LoadURL(GetFrontendURL());
|
||||
@@ -216,23 +295,23 @@ void CefDevToolsFrontend::Close() {
|
||||
frontend_browser_.get(), true));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::DisconnectFromTarget() {
|
||||
if (!agent_host_)
|
||||
return;
|
||||
agent_host_->DetachClient(this);
|
||||
agent_host_ = nullptr;
|
||||
}
|
||||
|
||||
CefDevToolsFrontend::CefDevToolsFrontend(
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
||||
CefBrowserHostImpl* frontend_browser,
|
||||
content::WebContents* inspected_contents,
|
||||
const CefPoint& inspect_element_at)
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure frontend_destroyed_callback)
|
||||
: content::WebContentsObserver(frontend_browser->web_contents()),
|
||||
frontend_browser_(frontend_browser),
|
||||
inspected_contents_(inspected_contents),
|
||||
inspect_element_at_(inspect_element_at),
|
||||
file_manager_(frontend_browser.get(), GetPrefs()),
|
||||
weak_factory_(this) {}
|
||||
frontend_destroyed_callback_(std::move(frontend_destroyed_callback)),
|
||||
file_manager_(frontend_browser, GetPrefs()),
|
||||
protocol_log_file_(
|
||||
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
|
||||
switches::kDevToolsProtocolLogFile)),
|
||||
weak_factory_(this) {
|
||||
DCHECK(!frontend_destroyed_callback_.is_null());
|
||||
}
|
||||
|
||||
CefDevToolsFrontend::~CefDevToolsFrontend() {}
|
||||
|
||||
@@ -279,6 +358,7 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
agent_host_->DetachClient(this);
|
||||
agent_host_ = nullptr;
|
||||
}
|
||||
std::move(frontend_destroyed_callback_).Run();
|
||||
delete this;
|
||||
}
|
||||
|
||||
@@ -300,6 +380,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
std::string protocol_message;
|
||||
if (!agent_host_ || !params->GetString(0, &protocol_message))
|
||||
return;
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
LogProtocolMessage(ProtocolMessageType::METHOD, protocol_message);
|
||||
}
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(protocol_message)));
|
||||
} else if (method == "loadCompleted") {
|
||||
@@ -451,6 +534,14 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
base::span<const uint8_t> message) {
|
||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||
message.size());
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
// Quick check to avoid parsing the JSON object. Events begin with a
|
||||
// "method" value whereas method results begin with an "id" value.
|
||||
LogProtocolMessage(str_message.starts_with("{\"method\":")
|
||||
? ProtocolMessageType::EVENT
|
||||
: ProtocolMessageType::RESULT,
|
||||
str_message);
|
||||
}
|
||||
if (str_message.length() < kMaxMessageChunkSize) {
|
||||
std::string param;
|
||||
base::EscapeJSONString(str_message, true, ¶m);
|
||||
@@ -504,6 +595,23 @@ void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||
CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr);
|
||||
}
|
||||
|
||||
bool CefDevToolsFrontend::ProtocolLoggingEnabled() const {
|
||||
return !protocol_log_file_.empty();
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::LogProtocolMessage(ProtocolMessageType type,
|
||||
const base::StringPiece& message) {
|
||||
DCHECK(ProtocolLoggingEnabled());
|
||||
|
||||
std::string to_log = message.substr(0, kMaxLogLineLength).as_string();
|
||||
|
||||
// Execute in an ordered context that allows blocking.
|
||||
auto task_runner = CefContentBrowserClient::Get()->background_task_runner();
|
||||
task_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(::LogProtocolMessage, protocol_log_file_, type,
|
||||
std::move(to_log)));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
DCHECK(agent_host == agent_host_.get());
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include "libcef/browser/devtools/devtools_file_manager.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
@@ -31,36 +32,38 @@ class WebContents;
|
||||
|
||||
class PrefService;
|
||||
|
||||
enum class ProtocolMessageType {
|
||||
METHOD,
|
||||
RESULT,
|
||||
EVENT,
|
||||
};
|
||||
|
||||
class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
public content::DevToolsAgentHostClient {
|
||||
public:
|
||||
static CefDevToolsFrontend* Show(
|
||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
||||
CefBrowserHostImpl* inspected_browser,
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at);
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure frontend_destroyed_callback);
|
||||
|
||||
void Activate();
|
||||
void Focus();
|
||||
void InspectElementAt(int x, int y);
|
||||
void Close();
|
||||
|
||||
void DisconnectFromTarget();
|
||||
|
||||
void CallClientFunction(const std::string& function_name,
|
||||
const base::Value* arg1,
|
||||
const base::Value* arg2,
|
||||
const base::Value* arg3);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser() const {
|
||||
return frontend_browser_;
|
||||
}
|
||||
|
||||
private:
|
||||
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
||||
CefDevToolsFrontend(CefBrowserHostImpl* frontend_browser,
|
||||
content::WebContents* inspected_contents,
|
||||
const CefPoint& inspect_element_at);
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure destroyed_callback);
|
||||
~CefDevToolsFrontend() override;
|
||||
|
||||
// content::DevToolsAgentHostClient implementation.
|
||||
@@ -78,12 +81,17 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
|
||||
void SendMessageAck(int request_id, const base::Value* arg1);
|
||||
|
||||
bool ProtocolLoggingEnabled() const;
|
||||
void LogProtocolMessage(ProtocolMessageType type,
|
||||
const base::StringPiece& message);
|
||||
|
||||
PrefService* GetPrefs() const;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
|
||||
content::WebContents* inspected_contents_;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
CefPoint inspect_element_at_;
|
||||
base::OnceClosure frontend_destroyed_callback_;
|
||||
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
|
||||
|
||||
class NetworkResourceLoader;
|
||||
@@ -93,6 +101,9 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
using ExtensionsAPIs = std::map<std::string, std::string>;
|
||||
ExtensionsAPIs extensions_api_;
|
||||
CefDevToolsFileManager file_manager_;
|
||||
|
||||
const base::FilePath protocol_log_file_;
|
||||
|
||||
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
|
||||
|
200
libcef/browser/devtools/devtools_manager.cc
Normal file
200
libcef/browser/devtools/devtools_manager.cc
Normal file
@@ -0,0 +1,200 @@
|
||||
// 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.
|
||||
|
||||
#include "libcef/browser/devtools/devtools_manager.h"
|
||||
|
||||
#include "libcef/browser/devtools/devtools_controller.h"
|
||||
#include "libcef/browser/devtools/devtools_frontend.h"
|
||||
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// May be created on any thread but will be destroyed on the UI thread.
|
||||
class CefDevToolsRegistrationImpl : public CefRegistration,
|
||||
public CefDevToolsController::Observer {
|
||||
public:
|
||||
explicit CefDevToolsRegistrationImpl(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer)
|
||||
: observer_(observer) {
|
||||
DCHECK(observer_);
|
||||
}
|
||||
|
||||
~CefDevToolsRegistrationImpl() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// May be null if OnDevToolsControllerDestroyed was called.
|
||||
if (!controller_)
|
||||
return;
|
||||
|
||||
controller_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void Initialize(CefBrowserHostImpl* browser,
|
||||
base::WeakPtr<CefDevToolsController> controller) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(browser && controller);
|
||||
DCHECK(!browser_ && !controller_);
|
||||
browser_ = browser;
|
||||
controller_ = controller;
|
||||
|
||||
controller_->AddObserver(this);
|
||||
}
|
||||
|
||||
private:
|
||||
// CefDevToolsController::Observer methods:
|
||||
bool OnDevToolsMessage(const base::StringPiece& message) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
return observer_->OnDevToolsMessage(browser_, message.data(),
|
||||
message.size());
|
||||
}
|
||||
|
||||
void OnDevToolsMethodResult(int message_id,
|
||||
bool success,
|
||||
const base::StringPiece& result) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsMethodResult(browser_, message_id, success,
|
||||
result.data(), result.size());
|
||||
}
|
||||
|
||||
void OnDevToolsEvent(const base::StringPiece& method,
|
||||
const base::StringPiece& params) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsEvent(browser_, method.as_string(), params.data(),
|
||||
params.size());
|
||||
}
|
||||
|
||||
void OnDevToolsAgentAttached() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsAgentAttached(browser_);
|
||||
}
|
||||
|
||||
void OnDevToolsAgentDetached() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsAgentDetached(browser_);
|
||||
}
|
||||
|
||||
void OnDevToolsControllerDestroyed() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
browser_ = nullptr;
|
||||
controller_.reset();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer_;
|
||||
|
||||
CefBrowserHostImpl* browser_ = nullptr;
|
||||
base::WeakPtr<CefDevToolsController> controller_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDevToolsRegistrationImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsRegistrationImpl);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
CefDevToolsManager::CefDevToolsManager(CefBrowserHostImpl* inspected_browser)
|
||||
: inspected_browser_(inspected_browser), weak_ptr_factory_(this) {
|
||||
CEF_REQUIRE_UIT();
|
||||
}
|
||||
|
||||
CefDevToolsManager::~CefDevToolsManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
}
|
||||
|
||||
void CefDevToolsManager::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (devtools_frontend_) {
|
||||
if (!inspect_element_at.IsEmpty()) {
|
||||
devtools_frontend_->InspectElementAt(inspect_element_at.x,
|
||||
inspect_element_at.y);
|
||||
}
|
||||
devtools_frontend_->Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
devtools_frontend_ = CefDevToolsFrontend::Show(
|
||||
inspected_browser_, windowInfo, client, settings, inspect_element_at,
|
||||
base::BindOnce(&CefDevToolsManager::OnFrontEndDestroyed,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
void CefDevToolsManager::CloseDevTools() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!devtools_frontend_)
|
||||
return;
|
||||
devtools_frontend_->Close();
|
||||
}
|
||||
|
||||
bool CefDevToolsManager::HasDevTools() {
|
||||
CEF_REQUIRE_UIT();
|
||||
return !!devtools_frontend_;
|
||||
}
|
||||
|
||||
bool CefDevToolsManager::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!message || message_size == 0)
|
||||
return false;
|
||||
|
||||
if (!EnsureController())
|
||||
return false;
|
||||
|
||||
return devtools_controller_->SendDevToolsMessage(
|
||||
base::StringPiece(static_cast<const char*>(message), message_size));
|
||||
}
|
||||
|
||||
int CefDevToolsManager::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (method.empty())
|
||||
return 0;
|
||||
|
||||
if (!EnsureController())
|
||||
return 0;
|
||||
|
||||
if (params && params->IsValid()) {
|
||||
CefDictionaryValueImpl* impl =
|
||||
static_cast<CefDictionaryValueImpl*>(params.get());
|
||||
CefValueController::AutoLock lock_scope(impl->controller());
|
||||
return devtools_controller_->ExecuteDevToolsMethod(message_id, method,
|
||||
impl->GetValueUnsafe());
|
||||
} else {
|
||||
return devtools_controller_->ExecuteDevToolsMethod(message_id, method,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefRegistration> CefDevToolsManager::CreateRegistration(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
DCHECK(observer);
|
||||
return new CefDevToolsRegistrationImpl(observer);
|
||||
}
|
||||
|
||||
void CefDevToolsManager::InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (!EnsureController())
|
||||
return;
|
||||
|
||||
static_cast<CefDevToolsRegistrationImpl*>(registration.get())
|
||||
->Initialize(inspected_browser_, devtools_controller_->GetWeakPtr());
|
||||
}
|
||||
|
||||
void CefDevToolsManager::OnFrontEndDestroyed() {
|
||||
devtools_frontend_ = nullptr;
|
||||
}
|
||||
|
||||
bool CefDevToolsManager::EnsureController() {
|
||||
if (!devtools_controller_) {
|
||||
devtools_controller_.reset(
|
||||
new CefDevToolsController(inspected_browser_->web_contents()));
|
||||
}
|
||||
return true;
|
||||
}
|
69
libcef/browser/devtools/devtools_manager.h
Normal file
69
libcef/browser/devtools/devtools_manager.h
Normal file
@@ -0,0 +1,69 @@
|
||||
// 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_
|
||||
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_browser.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
class CefDevToolsController;
|
||||
class CefDevToolsFrontend;
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
}
|
||||
|
||||
// Manages DevTools instances. Methods must be called on the UI thread unless
|
||||
// otherwise indicated.
|
||||
class CefDevToolsManager {
|
||||
public:
|
||||
// |inspected_browser| will outlive this object.
|
||||
explicit CefDevToolsManager(CefBrowserHostImpl* inspected_browser);
|
||||
~CefDevToolsManager();
|
||||
|
||||
// See CefBrowserHost methods of the same name for documentation.
|
||||
void ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at);
|
||||
void CloseDevTools();
|
||||
bool HasDevTools();
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size);
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> param);
|
||||
|
||||
// These methods are used to implement
|
||||
// CefBrowserHost::AddDevToolsMessageObserver. CreateRegistration is safe to
|
||||
// call on any thread. InitializeRegistrationOnUIThread should be called
|
||||
// immediately afterwards on the UI thread.
|
||||
static CefRefPtr<CefRegistration> CreateRegistration(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer);
|
||||
void InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration);
|
||||
|
||||
private:
|
||||
void OnFrontEndDestroyed();
|
||||
|
||||
bool EnsureController();
|
||||
|
||||
CefBrowserHostImpl* const inspected_browser_;
|
||||
|
||||
// CefDevToolsFrontend will delete itself when the frontend WebContents is
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend_ = nullptr;
|
||||
|
||||
// Used for sending DevTools protocol messages without an active frontend.
|
||||
std::unique_ptr<CefDevToolsController> devtools_controller_;
|
||||
|
||||
base::WeakPtrFactory<CefDevToolsManager> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsManager);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_
|
@@ -132,9 +132,8 @@ CefDevToolsManagerDelegate::CreateNewTarget(const GURL& url) {
|
||||
}
|
||||
|
||||
std::string CefDevToolsManagerDelegate::GetDiscoveryPageHTML() {
|
||||
return ui::ResourceBundle::GetSharedInstance()
|
||||
.GetRawDataResource(IDR_CEF_DEVTOOLS_DISCOVERY_PAGE)
|
||||
.as_string();
|
||||
return ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_DEVTOOLS_DISCOVERY_PAGE);
|
||||
}
|
||||
|
||||
bool CefDevToolsManagerDelegate::HasBundledFrontendResources() {
|
||||
|
131
libcef/browser/devtools/devtools_util.cc
Normal file
131
libcef/browser/devtools/devtools_util.cc
Normal file
@@ -0,0 +1,131 @@
|
||||
// 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.
|
||||
|
||||
#include "libcef/browser/devtools/devtools_util.h"
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
|
||||
namespace devtools_util {
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsValidDictionary(const base::StringPiece& str, bool allow_empty) {
|
||||
return str.length() >= (allow_empty ? 2 : 3) && str[0] == '{' &&
|
||||
str[str.length() - 1] == '}';
|
||||
}
|
||||
|
||||
// Example:
|
||||
// {"method":"Target.targetDestroyed","params":{"targetId":"1234..."}}
|
||||
bool ParseEvent(const base::StringPiece& message,
|
||||
base::StringPiece& method,
|
||||
base::StringPiece& params) {
|
||||
static const char kMethodStart[] = "{\"method\":\"";
|
||||
static const char kMethodEnd[] = "\"";
|
||||
static const char kParamsStart[] = ",\"params\":";
|
||||
|
||||
if (!message.starts_with(kMethodStart))
|
||||
return false;
|
||||
|
||||
const size_t method_start = sizeof(kMethodStart) - 1;
|
||||
const size_t method_end = message.find(kMethodEnd, method_start);
|
||||
if (method_end < 0U)
|
||||
return false;
|
||||
method = message.substr(method_start, method_end - method_start);
|
||||
if (method.empty())
|
||||
return false;
|
||||
|
||||
size_t remainder_start = method_end + sizeof(kMethodEnd) - 1;
|
||||
if (remainder_start == message.size() - 1) {
|
||||
// No more contents.
|
||||
params = base::StringPiece();
|
||||
} else {
|
||||
const base::StringPiece& remainder = message.substr(remainder_start);
|
||||
if (remainder.starts_with(kParamsStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kParamsStart) - 1;
|
||||
params =
|
||||
message.substr(remainder_start, message.size() - 1 - remainder_start);
|
||||
} else {
|
||||
// Invalid format.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValidDictionary(params, /*allow_empty=*/true))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Examples:
|
||||
// {"id":3,"result":{}}
|
||||
// {"id":4,"result":{"debuggerId":"-2193881606781505058.81393575456727957"}}
|
||||
// {"id":5,"error":{"code":-32000,"message":"Not supported"}}
|
||||
bool ParseResult(const base::StringPiece& message,
|
||||
int& message_id,
|
||||
bool& success,
|
||||
base::StringPiece& result) {
|
||||
static const char kIdStart[] = "{\"id\":";
|
||||
static const char kIdEnd[] = ",";
|
||||
static const char kResultStart[] = "\"result\":";
|
||||
static const char kErrorStart[] = "\"error\":";
|
||||
|
||||
if (!message.starts_with(kIdStart))
|
||||
return false;
|
||||
|
||||
const size_t id_start = sizeof(kIdStart) - 1;
|
||||
const size_t id_end = message.find(kIdEnd, id_start);
|
||||
if (id_end < 0U)
|
||||
return false;
|
||||
const base::StringPiece& id_str = message.substr(id_start, id_end - id_start);
|
||||
if (id_str.empty() || !base::StringToInt(id_str, &message_id))
|
||||
return false;
|
||||
|
||||
size_t remainder_start = id_end + sizeof(kIdEnd) - 1;
|
||||
const base::StringPiece& remainder = message.substr(remainder_start);
|
||||
if (remainder.starts_with(kResultStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kResultStart) - 1;
|
||||
result =
|
||||
message.substr(remainder_start, message.size() - 1 - remainder_start);
|
||||
success = true;
|
||||
} else if (remainder.starts_with(kErrorStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kErrorStart) - 1;
|
||||
result =
|
||||
message.substr(remainder_start, message.size() - 1 - remainder_start);
|
||||
success = false;
|
||||
} else {
|
||||
// Invalid format.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValidDictionary(result, /*allow_empty=*/true))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
bool ProtocolParser::IsValidMessage(const base::StringPiece& message) {
|
||||
return IsValidDictionary(message, /*allow_empty=*/false);
|
||||
}
|
||||
|
||||
bool ProtocolParser::Initialize(const base::StringPiece& message) {
|
||||
if (status_ != UNINITIALIZED)
|
||||
return false;
|
||||
|
||||
if (ParseEvent(message, method_, params_)) {
|
||||
status_ = EVENT;
|
||||
} else if (ParseResult(message, message_id_, success_, params_)) {
|
||||
status_ = RESULT;
|
||||
} else {
|
||||
status_ = FAILURE;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace devtools_util
|
72
libcef/browser/devtools/devtools_util.h
Normal file
72
libcef/browser/devtools/devtools_util.h
Normal file
@@ -0,0 +1,72 @@
|
||||
// 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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "base/strings/string_piece.h"
|
||||
|
||||
namespace devtools_util {
|
||||
|
||||
// Fast parser for DevTools JSON protocol messages. This implementation makes
|
||||
// certain assumptions about the JSON object structure (value order and
|
||||
// formatting) to avoid stateful parsing of messages that may be large
|
||||
// (sometimes > 1MB in size). The message must be a JSON dictionary that starts
|
||||
// with a "method" or "id" value which is non-empty and of the expected data
|
||||
// type. Messages that have a "method" value (event message) may optionally have
|
||||
// a "params" dictionary. Messages that have an "id" value (result message) must
|
||||
// have a "result" or "error" dictionary. The dictionary contents are not
|
||||
// validated and may be empty ("{}").
|
||||
//
|
||||
// Example event message:
|
||||
// {"method":"Target.targetDestroyed","params":{"targetId":"1234..."}}
|
||||
//
|
||||
// Example result messages:
|
||||
// {"id":3,"result":{}}
|
||||
// {"id":4,"result":{"debuggerId":"-2193881606781505058.81393575456727957"}}
|
||||
// {"id":5,"error":{"code":-32000,"message":"Not supported"}}
|
||||
struct ProtocolParser {
|
||||
ProtocolParser() = default;
|
||||
|
||||
// Checks for a non-empty JSON dictionary.
|
||||
static bool IsValidMessage(const base::StringPiece& message);
|
||||
|
||||
// Returns false if already initialized.
|
||||
bool Initialize(const base::StringPiece& message);
|
||||
|
||||
bool IsInitialized() const { return status_ != UNINITIALIZED; }
|
||||
bool IsEvent() const { return status_ == EVENT; }
|
||||
bool IsResult() const { return status_ == RESULT; }
|
||||
bool IsFailure() const { return status_ == FAILURE; }
|
||||
|
||||
void Reset() { status_ = UNINITIALIZED; }
|
||||
|
||||
// For event messages:
|
||||
// "method" string:
|
||||
base::StringPiece method_;
|
||||
|
||||
// For result messages:
|
||||
// "id" int:
|
||||
int message_id_ = 0;
|
||||
// true if "result" value, false if "error" value:
|
||||
bool success_ = false;
|
||||
|
||||
// For both:
|
||||
// "params", "result" or "error" dictionary:
|
||||
base::StringPiece params_;
|
||||
|
||||
private:
|
||||
enum Status {
|
||||
UNINITIALIZED,
|
||||
EVENT, // Event message.
|
||||
RESULT, // Result message.
|
||||
FAILURE, // Parsing failure.
|
||||
};
|
||||
Status status_ = UNINITIALIZED;
|
||||
};
|
||||
|
||||
} // namespace devtools_util
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_UTIL_H_
|
204
libcef/browser/devtools/devtools_util_unittest.cc
Normal file
204
libcef/browser/devtools/devtools_util_unittest.cc
Normal file
@@ -0,0 +1,204 @@
|
||||
// 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.
|
||||
|
||||
#include "libcef/browser/devtools/devtools_util.h"
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using namespace devtools_util;
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_IsValidMessage) {
|
||||
// Empty dictionary is not valid.
|
||||
EXPECT_FALSE(ProtocolParser::IsValidMessage(""));
|
||||
EXPECT_FALSE(ProtocolParser::IsValidMessage("{}"));
|
||||
|
||||
// Incorrectly formatted dictionary is not valid.
|
||||
EXPECT_FALSE(ProtocolParser::IsValidMessage("{ ]"));
|
||||
|
||||
// Everything else is valid (we don't verify JSON structure).
|
||||
EXPECT_TRUE(ProtocolParser::IsValidMessage("{ }"));
|
||||
EXPECT_TRUE(ProtocolParser::IsValidMessage("{blah blah}"));
|
||||
EXPECT_TRUE(ProtocolParser::IsValidMessage("{method:\"foobar\"}"));
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_Unknown) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Empty message is invalid.
|
||||
EXPECT_TRUE(parser.Initialize(""));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Empty dictionary is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Unrecognized dictionary type is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{blah blah}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_EventMalformed) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Empty method is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"method\":\"\"}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Unrecognized value is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"method\":\"foo\",oops:false}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Params must be a dictionary.
|
||||
EXPECT_TRUE(parser.Initialize("{\"method\":\",params:[]}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsEvent) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Method without params is valid.
|
||||
std::string message = "{\"method\":\"Test.myMethod\"}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod", parser.method_.as_string().data());
|
||||
EXPECT_TRUE(parser.params_.empty());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Method with empty params dictionary is valid.
|
||||
message = "{\"method\":\"Test.myMethod2\",\"params\":{}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod2", parser.method_.as_string().data());
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Method with non-empty params dictionary is valid.
|
||||
message = "{\"method\":\"Test.myMethod3\",\"params\":{\"foo\":\"bar\"}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod3", parser.method_.as_string().data());
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_ResultMalformed) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Empty ID is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":,result:{}}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Missing result or error value is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":1}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Unrecognized value is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":1,oops:false}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Result must be a dictionary.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":1,\"result\":[]}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Error must be a dictionary.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":1,\"error\":[]}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Result) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Id with empty result dictionary is valid.
|
||||
std::string message = "{\"id\":1,\"result\":{}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(1, parser.message_id_);
|
||||
EXPECT_TRUE(parser.success_);
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Id with non-empty result dictionary is valid.
|
||||
message = "{\"id\":2,\"result\":{\"foo\":\"bar\"}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(2, parser.message_id_);
|
||||
EXPECT_TRUE(parser.success_);
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Id with empty error dictionary is valid.
|
||||
std::string message = "{\"id\":1,\"error\":{}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(1, parser.message_id_);
|
||||
EXPECT_FALSE(parser.success_);
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Id with non-empty error dictionary is valid.
|
||||
message = "{\"id\":2,\"error\":{\"foo\":\"bar\"}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(2, parser.message_id_);
|
||||
EXPECT_FALSE(parser.success_);
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
}
|
@@ -32,9 +32,9 @@ const char kPdfResourceIdentifier[] = "chromium-pdf";
|
||||
const char kPdfPluginName[] = "Chrome PDF Viewer";
|
||||
|
||||
std::string GetManifest() {
|
||||
std::string manifest_contents = ui::ResourceBundle::GetSharedInstance()
|
||||
.GetRawDataResource(IDR_PDF_MANIFEST)
|
||||
.as_string();
|
||||
std::string manifest_contents =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_PDF_MANIFEST);
|
||||
DCHECK(manifest_contents.find(kNameTag) != std::string::npos);
|
||||
base::ReplaceFirstSubstringAfterOffset(&manifest_contents, 0, kNameTag,
|
||||
kPdfPluginName);
|
||||
|
@@ -4,6 +4,84 @@
|
||||
|
||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
||||
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h"
|
||||
#include "chrome/browser/media/router/providers/cast/dual_media_sink_service.h"
|
||||
#include "chrome/common/media_router/discovery/media_sink_internal.h"
|
||||
#include "chrome/common/media_router/discovery/media_sink_service_base.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using SinkServiceVector = std::vector<media_router::MediaSinkServiceBase*>;
|
||||
|
||||
SinkServiceVector GetSinkServices() {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto sink_service = media_router::DualMediaSinkService::GetInstance();
|
||||
return {sink_service->GetCastMediaSinkServiceImpl(),
|
||||
sink_service->GetDialMediaSinkServiceImpl()};
|
||||
}
|
||||
|
||||
void GetSinkInternalAndContinue(
|
||||
SinkServiceVector services,
|
||||
const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
CefMediaSinkDeviceInfo device_info;
|
||||
const media_router::MediaSinkInternal* sink_internal = nullptr;
|
||||
|
||||
for (auto service : services) {
|
||||
sink_internal = service->GetSinkById(sink_id);
|
||||
if (sink_internal)
|
||||
break;
|
||||
}
|
||||
|
||||
if (sink_internal) {
|
||||
if (sink_internal->is_cast_sink()) {
|
||||
const auto& cast_data = sink_internal->cast_data();
|
||||
CefString(&device_info.ip_address) =
|
||||
cast_data.ip_endpoint.ToStringWithoutPort();
|
||||
device_info.port = cast_data.ip_endpoint.port();
|
||||
CefString(&device_info.model_name) = cast_data.model_name;
|
||||
} else if (sink_internal->is_dial_sink()) {
|
||||
const auto& dial_data = sink_internal->dial_data();
|
||||
CefString(&device_info.ip_address) = dial_data.ip_address.ToString();
|
||||
if (dial_data.app_url.is_valid() && dial_data.app_url.has_port()) {
|
||||
base::StringToInt(dial_data.app_url.port_piece(), &device_info.port);
|
||||
}
|
||||
CefString(&device_info.model_name) = dial_data.model_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Execute the callback on the UI thread.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefMediaSinkDeviceInfoCallback::OnMediaSinkDeviceInfo,
|
||||
callback, device_info));
|
||||
}
|
||||
|
||||
void GetDeviceInfo(const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
auto next_step = base::BindOnce(
|
||||
[](const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::BindOnce(GetSinkInternalAndContinue,
|
||||
GetSinkServices(), sink_id, callback));
|
||||
},
|
||||
sink_id, callback);
|
||||
|
||||
if (CEF_CURRENTLY_ON(CEF_UIT)) {
|
||||
std::move(next_step).Run();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, std::move(next_step));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink& sink)
|
||||
: sink_(sink) {}
|
||||
|
||||
@@ -36,6 +114,11 @@ CefMediaSink::IconType CefMediaSinkImpl::GetIconType() {
|
||||
return static_cast<CefMediaSink::IconType>(sink_.icon_type());
|
||||
}
|
||||
|
||||
void CefMediaSinkImpl::GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
::GetDeviceInfo(sink_.id(), callback);
|
||||
}
|
||||
|
||||
bool CefMediaSinkImpl::IsCastSink() {
|
||||
return sink_.provider_id() == media_router::CAST;
|
||||
}
|
||||
|
@@ -23,6 +23,8 @@ class CefMediaSinkImpl : public CefMediaSink {
|
||||
CefString GetName() override;
|
||||
CefString GetDescription() override;
|
||||
IconType GetIconType() override;
|
||||
void GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) override;
|
||||
bool IsCastSink() override;
|
||||
bool IsDialSink() override;
|
||||
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) override;
|
||||
|
@@ -79,6 +79,31 @@ std::wstring FormatFilterForExtensions(
|
||||
|
||||
std::wstring result;
|
||||
|
||||
// Create all supported .ext filter if more than one filter.
|
||||
if (file_ext.size() > 1) {
|
||||
std::set<base::WStringPiece> unique_exts;
|
||||
for (const auto& exts : file_ext) {
|
||||
for (const auto& ext : base::SplitStringPiece(
|
||||
exts, L";", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
|
||||
unique_exts.insert(ext);
|
||||
}
|
||||
}
|
||||
|
||||
if (unique_exts.size() > 1) {
|
||||
std::wstring ext;
|
||||
auto it = unique_exts.cbegin();
|
||||
ext = it->as_string();
|
||||
for (++it; it != unique_exts.cend(); ++it) {
|
||||
ext += L";" + it->as_string();
|
||||
}
|
||||
std::wstring desc =
|
||||
l10n_util::GetStringUTF16(IDS_CUSTOM_FILES) + L" (" + ext + L")";
|
||||
|
||||
result.append(desc.c_str(), desc.size() + 1); // Append NULL too.
|
||||
result.append(ext.c_str(), ext.size() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < file_ext.size(); ++i) {
|
||||
std::wstring ext = file_ext[i];
|
||||
std::wstring desc;
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
using extensions::api::cef::kSupportedAPIs;
|
||||
@@ -74,6 +75,7 @@ const char* kAllowedWebUIHosts[] = {
|
||||
content::kChromeUIAppCacheInternalsHost,
|
||||
chrome::kChromeUIAccessibilityHost,
|
||||
content::kChromeUIBlobInternalsHost,
|
||||
chrome::kChromeUIChromeURLsHost,
|
||||
chrome::kChromeUICreditsHost,
|
||||
kChromeUIExtensionsSupportHost,
|
||||
content::kChromeUIGpuHost,
|
||||
@@ -118,6 +120,7 @@ const struct {
|
||||
const char* host;
|
||||
ChromeHostId host_id;
|
||||
} kAllowedCefHosts[] = {
|
||||
{chrome::kChromeUIChromeURLsHost, CHROME_WEBUI_HOSTS},
|
||||
{kChromeUIExtensionsSupportHost, CHROME_EXTENSIONS_SUPPORT},
|
||||
{kChromeUILicenseHost, CHROME_LICENSE},
|
||||
{chrome::kChromeUIVersionHost, CHROME_VERSION},
|
||||
@@ -341,16 +344,17 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
|
||||
}
|
||||
|
||||
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
||||
IDR_CEF_LICENSE_TXT, ui::SCALE_FACTOR_NONE);
|
||||
std::string piece =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_LICENSE_TXT);
|
||||
if (piece.empty()) {
|
||||
NOTREACHED() << "Failed to load license txt resource.";
|
||||
return false;
|
||||
}
|
||||
|
||||
*mime_type = "text/html";
|
||||
*output = "<html><head><title>License</title></head><body><pre>" +
|
||||
piece.as_string() + "</pre></body></html>";
|
||||
*output = "<html><head><title>License</title></head><body><pre>" + piece +
|
||||
"</pre></body></html>";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -358,9 +362,10 @@ bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
bool OnVersionUI(Profile* profile,
|
||||
std::string* mime_type,
|
||||
std::string* output) {
|
||||
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
||||
IDR_CEF_VERSION_HTML, ui::SCALE_FACTOR_NONE);
|
||||
if (piece.empty()) {
|
||||
std::string tmpl =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_VERSION_HTML);
|
||||
if (tmpl.empty()) {
|
||||
NOTREACHED() << "Failed to load version html resource.";
|
||||
return false;
|
||||
}
|
||||
@@ -381,7 +386,6 @@ bool OnVersionUI(Profile* profile,
|
||||
parser.Add("MODULEPATH", GetModulePath());
|
||||
parser.Add("CACHEPATH", CefString(profile->GetPath().value()));
|
||||
|
||||
std::string tmpl = piece.as_string();
|
||||
parser.Parse(&tmpl);
|
||||
|
||||
*mime_type = "text/html";
|
||||
@@ -392,8 +396,8 @@ bool OnVersionUI(Profile* profile,
|
||||
|
||||
bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
|
||||
std::string html =
|
||||
"<html>\n<head><title>WebUI Hosts</title></head>\n"
|
||||
"<body bgcolor=\"white\"><h3>WebUI Hosts</h3>\n<ul>\n";
|
||||
"<html>\n<head><title>Chrome URLs</title></head>\n"
|
||||
"<body bgcolor=\"white\"><h3>List of Chrome URLs</h3>\n<ul>\n";
|
||||
|
||||
std::vector<std::string> list;
|
||||
GetAllowedHosts(&list);
|
||||
|
@@ -158,13 +158,15 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
|
||||
action.mime_type = GetMimeType(url.path());
|
||||
|
||||
if (!action.bytes && action.resource_id >= 0) {
|
||||
action.bytes =
|
||||
CefContentClient::Get()->GetDataResourceBytes(action.resource_id);
|
||||
if (!action.bytes) {
|
||||
std::string str =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
action.resource_id);
|
||||
if (str.empty()) {
|
||||
NOTREACHED() << "Failed to load internal resource for id: "
|
||||
<< action.resource_id << " URL: " << url.spec().c_str();
|
||||
return nullptr;
|
||||
}
|
||||
action.bytes = base::RefCountedString::TakeString(&str);
|
||||
}
|
||||
|
||||
if (action.bytes) {
|
||||
|
@@ -229,6 +229,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
const uint32_t options_;
|
||||
bool input_stream_previously_failed_ = false;
|
||||
bool request_was_redirected_ = false;
|
||||
int redirect_limit_ = net::URLRequest::kMaxRedirects;
|
||||
|
||||
// To avoid sending multiple OnReceivedError callbacks.
|
||||
bool sent_error_callback_ = false;
|
||||
@@ -485,6 +486,11 @@ void InterceptedRequest::OnReceiveRedirect(
|
||||
needs_callback = true;
|
||||
}
|
||||
|
||||
if (--redirect_limit_ == 0) {
|
||||
SendErrorAndCompleteImmediately(net::ERR_TOO_MANY_REDIRECTS);
|
||||
return;
|
||||
}
|
||||
|
||||
net::RedirectInfo new_redirect_info;
|
||||
|
||||
// When we redirect via ContinueToHandleOverrideHeaders the |redirect_info|
|
||||
|
@@ -66,6 +66,20 @@ void CefBrowserPlatformDelegateOsr::BrowserCreated(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::NotifyBrowserDestroyed() {
|
||||
content::WebContents* web_contents = browser_->web_contents();
|
||||
content::RenderViewHost* host = web_contents->GetRenderViewHost();
|
||||
if (host) {
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||
if (view) {
|
||||
view->ReleaseCompositor();
|
||||
}
|
||||
}
|
||||
|
||||
CefBrowserPlatformDelegate::NotifyBrowserDestroyed();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::BrowserDestroyed(
|
||||
CefBrowserHostImpl* browser) {
|
||||
CefBrowserPlatformDelegate::BrowserDestroyed(browser);
|
||||
|
@@ -26,6 +26,7 @@ class CefBrowserPlatformDelegateOsr
|
||||
content::RenderViewHostDelegateView** delegate_view) override;
|
||||
void WebContentsCreated(content::WebContents* web_contents) override;
|
||||
void BrowserCreated(CefBrowserHostImpl* browser) override;
|
||||
void NotifyBrowserDestroyed() override;
|
||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||
SkColor GetBackgroundColor() const override;
|
||||
bool CanUseSharedTexture() const override;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "components/viz/common/frame_sinks/begin_frame_args.h"
|
||||
#include "components/viz/common/frame_sinks/copy_output_request.h"
|
||||
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
|
||||
#include "components/viz/common/surfaces/frame_sink_id_allocator.h"
|
||||
#include "components/viz/common/switches.h"
|
||||
#include "content/browser/bad_message.h"
|
||||
#include "content/browser/gpu/gpu_data_manager_impl.h"
|
||||
@@ -275,6 +276,23 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
}
|
||||
|
||||
CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
||||
ReleaseCompositor();
|
||||
root_layer_.reset(nullptr);
|
||||
|
||||
DCHECK(!parent_host_view_);
|
||||
DCHECK(!popup_host_view_);
|
||||
DCHECK(!child_host_view_);
|
||||
DCHECK(guest_host_views_.empty());
|
||||
|
||||
if (text_input_manager_)
|
||||
text_input_manager_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ReleaseCompositor() {
|
||||
if (!compositor_) {
|
||||
return; // already released
|
||||
}
|
||||
|
||||
// Marking the DelegatedFrameHost as removed from the window hierarchy is
|
||||
// necessary to remove all connections to its old ui::Compositor.
|
||||
if (is_showing_) {
|
||||
@@ -285,15 +303,6 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
||||
|
||||
delegated_frame_host_.reset(nullptr);
|
||||
compositor_.reset(nullptr);
|
||||
root_layer_.reset(nullptr);
|
||||
|
||||
DCHECK(!parent_host_view_);
|
||||
DCHECK(!popup_host_view_);
|
||||
DCHECK(!child_host_view_);
|
||||
DCHECK(guest_host_views_.empty());
|
||||
|
||||
if (text_input_manager_)
|
||||
text_input_manager_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
// Called for full-screen widgets.
|
||||
@@ -335,7 +344,9 @@ bool CefRenderWidgetHostViewOSR::HasFocus() {
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::IsSurfaceAvailableForCopy() {
|
||||
return delegated_frame_host_->CanCopyFromCompositingSurface();
|
||||
return delegated_frame_host_
|
||||
? delegated_frame_host_->CanCopyFromCompositingSurface()
|
||||
: false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::Show() {
|
||||
@@ -364,10 +375,12 @@ void CefRenderWidgetHostViewOSR::Show() {
|
||||
base::nullopt /* record_tab_switch_time_request */);
|
||||
}
|
||||
|
||||
delegated_frame_host_->AttachToCompositor(compositor_.get());
|
||||
delegated_frame_host_->WasShown(
|
||||
GetLocalSurfaceIdAllocation().local_surface_id(), GetViewBounds().size(),
|
||||
base::nullopt);
|
||||
if (delegated_frame_host_) {
|
||||
delegated_frame_host_->AttachToCompositor(compositor_.get());
|
||||
delegated_frame_host_->WasShown(
|
||||
GetLocalSurfaceIdAllocation().local_surface_id(),
|
||||
GetViewBounds().size(), base::nullopt);
|
||||
}
|
||||
|
||||
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
|
||||
// Start generating frames when we're visible and at the correct size.
|
||||
@@ -402,9 +415,11 @@ void CefRenderWidgetHostViewOSR::Hide() {
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->WasHidden();
|
||||
|
||||
delegated_frame_host_->WasHidden(
|
||||
content::DelegatedFrameHost::HiddenCause::kOther);
|
||||
delegated_frame_host_->DetachFromCompositor();
|
||||
if (delegated_frame_host_) {
|
||||
delegated_frame_host_->WasHidden(
|
||||
content::DelegatedFrameHost::HiddenCause::kOther);
|
||||
delegated_frame_host_->DetachFromCompositor();
|
||||
}
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::IsShowing() {
|
||||
@@ -538,7 +553,9 @@ void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t sequence,
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
||||
delegated_frame_host_->ResetFallbackToFirstNavigationSurface();
|
||||
if (delegated_frame_host_) {
|
||||
delegated_frame_host_->ResetFallbackToFirstNavigationSurface();
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||
@@ -702,8 +719,10 @@ void CefRenderWidgetHostViewOSR::CopyFromSurface(
|
||||
const gfx::Rect& src_rect,
|
||||
const gfx::Size& output_size,
|
||||
base::OnceCallback<void(const SkBitmap&)> callback) {
|
||||
delegated_frame_host_->CopyFromCompositingSurface(src_rect, output_size,
|
||||
std::move(callback));
|
||||
if (delegated_frame_host_) {
|
||||
delegated_frame_host_->CopyFromCompositingSurface(src_rect, output_size,
|
||||
std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::GetScreenInfo(content::ScreenInfo* results) {
|
||||
@@ -878,11 +897,13 @@ CefRenderWidgetHostViewOSR::GetLocalSurfaceIdAllocation() const {
|
||||
}
|
||||
|
||||
const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
|
||||
return delegated_frame_host_->frame_sink_id();
|
||||
return delegated_frame_host_
|
||||
? delegated_frame_host_->frame_sink_id()
|
||||
: viz::FrameSinkIdAllocator::InvalidFrameSinkId();
|
||||
}
|
||||
|
||||
viz::FrameSinkId CefRenderWidgetHostViewOSR::GetRootFrameSinkId() {
|
||||
return compositor_->frame_sink_id();
|
||||
return compositor_ ? compositor_->frame_sink_id() : viz::FrameSinkId();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation() {
|
||||
@@ -1061,10 +1082,12 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->ProgressFlingIfNeeded(frame_time);
|
||||
|
||||
compositor_->IssueExternalBeginFrame(
|
||||
begin_frame_args, /* force= */ true,
|
||||
base::BindOnce(&CefRenderWidgetHostViewOSR::OnFrameComplete,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
if (compositor_) {
|
||||
compositor_->IssueExternalBeginFrame(
|
||||
begin_frame_args, /* force= */ true,
|
||||
base::BindOnce(&CefRenderWidgetHostViewOSR::OnFrameComplete,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
if (!IsPopupWidget() && popup_host_view_) {
|
||||
popup_host_view_->SendExternalBeginFrame();
|
||||
|
@@ -265,6 +265,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void OnDidUpdateVisualPropertiesComplete(
|
||||
const cc::RenderFrameMetadata& metadata);
|
||||
|
||||
void ReleaseCompositor();
|
||||
|
||||
private:
|
||||
void SetFrameRate();
|
||||
bool SetDeviceScaleFactor();
|
||||
|
@@ -29,11 +29,7 @@ void CefWebContentsViewOSR::WebContentsCreated(
|
||||
DCHECK(!web_contents_);
|
||||
web_contents_ = web_contents;
|
||||
|
||||
auto host = web_contents_->GetRenderViewHost();
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||
if (view)
|
||||
view->InstallTransparency();
|
||||
RenderViewReady();
|
||||
}
|
||||
|
||||
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
|
||||
@@ -124,7 +120,15 @@ CefWebContentsViewOSR::CreateViewForChildWidget(
|
||||
|
||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewReady() {}
|
||||
void CefWebContentsViewOSR::RenderViewReady() {
|
||||
if (web_contents_) {
|
||||
auto host = web_contents_->GetRenderViewHost();
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||
if (view)
|
||||
view->InstallTransparency();
|
||||
}
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewHostChanged(
|
||||
content::RenderViewHost* old_host,
|
||||
|
@@ -114,11 +114,13 @@ const char kPluginPolicy_Block[] = "block";
|
||||
const char kEnablePreferenceTesting[] = "enable-preference-testing";
|
||||
|
||||
// Enable print preview.
|
||||
extern const char kEnablePrintPreview[] = "enable-print-preview";
|
||||
const char kEnablePrintPreview[] = "enable-print-preview";
|
||||
|
||||
// Disable the timeout for delivering new browser info to the renderer process.
|
||||
extern const char kDisableNewBrowserInfoTimeout[] =
|
||||
"disable-new-browser-info-timeout";
|
||||
const char kDisableNewBrowserInfoTimeout[] = "disable-new-browser-info-timeout";
|
||||
|
||||
// File used for logging DevTools protocol messages.
|
||||
const char kDevToolsProtocolLogFile[] = "devtools-protocol-log-file";
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
// Path to the framework directory.
|
||||
|
@@ -53,6 +53,7 @@ extern const char kPluginPolicy_Block[];
|
||||
extern const char kEnablePreferenceTesting[];
|
||||
extern const char kEnablePrintPreview[];
|
||||
extern const char kDisableNewBrowserInfoTimeout[];
|
||||
extern const char kDevToolsProtocolLogFile[];
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
extern const char kFrameworkDirPath[];
|
||||
|
@@ -162,10 +162,12 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
|
||||
std::string manifest_data;
|
||||
if (!base::ReadFileToString(manifest_path, &manifest_data))
|
||||
return false;
|
||||
std::unique_ptr<base::Value> manifest_value(base::Value::ToUniquePtrValue(
|
||||
std::move(base::JSONReader::Read(manifest_data,
|
||||
base::JSON_ALLOW_TRAILING_COMMAS)
|
||||
.value())));
|
||||
auto json_manifest_value =
|
||||
base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS);
|
||||
if (!json_manifest_value.has_value())
|
||||
return false;
|
||||
std::unique_ptr<base::Value> manifest_value(
|
||||
base::Value::ToUniquePtrValue(std::move(json_manifest_value.value())));
|
||||
if (!manifest_value.get())
|
||||
return false;
|
||||
base::DictionaryValue* manifest = nullptr;
|
||||
|
@@ -34,8 +34,17 @@ int GetJSONWriterOptions(cef_json_writer_options_t options) {
|
||||
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||
cef_json_parser_options_t options) {
|
||||
const std::string& json = json_string.ToString();
|
||||
base::Optional<base::Value> parse_result =
|
||||
base::JSONReader::Read(json, GetJSONReaderOptions(options));
|
||||
return CefParseJSON(json.data(), json.size(), options);
|
||||
}
|
||||
|
||||
CefRefPtr<CefValue> CefParseJSON(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options) {
|
||||
if (!json || json_size == 0)
|
||||
return nullptr;
|
||||
base::Optional<base::Value> parse_result = base::JSONReader::Read(
|
||||
base::StringPiece(static_cast<const char*>(json), json_size),
|
||||
GetJSONReaderOptions(options));
|
||||
if (parse_result) {
|
||||
return new CefValueImpl(
|
||||
base::Value::ToUniquePtrValue(std::move(parse_result.value()))
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "libcef/common/resource_bundle_impl.h"
|
||||
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
CefResourceBundleImpl::CefResourceBundleImpl() {}
|
||||
@@ -15,29 +16,24 @@ CefString CefResourceBundleImpl::GetLocalizedString(int string_id) {
|
||||
return ui::ResourceBundle::GetSharedInstance().GetLocalizedString(string_id);
|
||||
}
|
||||
|
||||
bool CefResourceBundleImpl::GetDataResource(int resource_id,
|
||||
void*& data,
|
||||
size_t& data_size) {
|
||||
return GetDataResourceForScale(resource_id, SCALE_FACTOR_NONE, data,
|
||||
data_size);
|
||||
CefRefPtr<CefBinaryValue> CefResourceBundleImpl::GetDataResource(
|
||||
int resource_id) {
|
||||
return GetDataResourceForScale(resource_id, SCALE_FACTOR_NONE);
|
||||
}
|
||||
|
||||
bool CefResourceBundleImpl::GetDataResourceForScale(int resource_id,
|
||||
ScaleFactor scale_factor,
|
||||
void*& data,
|
||||
size_t& data_size) {
|
||||
CefRefPtr<CefBinaryValue> CefResourceBundleImpl::GetDataResourceForScale(
|
||||
int resource_id,
|
||||
ScaleFactor scale_factor) {
|
||||
if (!ui::ResourceBundle::HasSharedInstance())
|
||||
return false;
|
||||
return nullptr;
|
||||
|
||||
const base::StringPiece& result =
|
||||
ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(
|
||||
base::RefCountedMemory* result =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
|
||||
resource_id, static_cast<ui::ScaleFactor>(scale_factor));
|
||||
if (result.empty())
|
||||
return false;
|
||||
if (!result)
|
||||
return nullptr;
|
||||
|
||||
data = const_cast<char*>(result.data());
|
||||
data_size = result.size();
|
||||
return true;
|
||||
return CefBinaryValue::Create(result->data(), result->size());
|
||||
}
|
||||
|
||||
// static
|
||||
|
@@ -14,13 +14,10 @@ class CefResourceBundleImpl : public CefResourceBundle {
|
||||
|
||||
// CefResourceBundle methods.
|
||||
CefString GetLocalizedString(int string_id) override;
|
||||
bool GetDataResource(int resource_id,
|
||||
void*& data,
|
||||
size_t& data_size) override;
|
||||
bool GetDataResourceForScale(int resource_id,
|
||||
ScaleFactor scale_factor,
|
||||
void*& data,
|
||||
size_t& data_size) override;
|
||||
CefRefPtr<CefBinaryValue> GetDataResource(int resource_id) override;
|
||||
CefRefPtr<CefBinaryValue> GetDataResourceForScale(
|
||||
int resource_id,
|
||||
ScaleFactor scale_factor) override;
|
||||
|
||||
private:
|
||||
IMPLEMENT_REFCOUNTING(CefResourceBundleImpl);
|
||||
|
@@ -20,6 +20,16 @@ void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time) {
|
||||
}
|
||||
|
||||
void cef_time_from_basetime(const base::Time& time, cef_time_t& cef_time) {
|
||||
#if defined(OS_WIN)
|
||||
int64_t t = time.ToDeltaSinceWindowsEpoch().InMicroseconds();
|
||||
// From MSDN, FILETIME "Contains a 64-bit value representing the number of
|
||||
// 100-nanosecond intervals since January 1, 1601 (UTC)." This value must
|
||||
// be less than 0x8000000000000000. Otherwise, the function
|
||||
// FileTimeToSystemTime fails.
|
||||
if (t < 0 || static_cast<uint64_t>(t * 10) >= 0x8000000000000000)
|
||||
return;
|
||||
#endif
|
||||
|
||||
base::Time::Exploded exploded;
|
||||
time.UTCExplode(&exploded);
|
||||
cef_time.year = exploded.year;
|
||||
|
@@ -261,9 +261,6 @@ void CefContentRendererClient::WebKitInitialized() {
|
||||
// Create global objects associated with the default Isolate.
|
||||
CefV8IsolateCreated();
|
||||
|
||||
// TODO(cef): Enable these once the implementation supports it.
|
||||
blink::WebRuntimeFeatures::EnableNotifications(false);
|
||||
|
||||
const CefContentClient::SchemeInfoList* schemes =
|
||||
CefContentClient::Get()->GetCustomSchemes();
|
||||
if (!schemes->empty()) {
|
||||
@@ -365,6 +362,13 @@ void CefContentRendererClient::RunSingleProcessCleanup() {
|
||||
} while (!complete);
|
||||
}
|
||||
|
||||
void CefContentRendererClient::PostIOThreadCreated(
|
||||
base::SingleThreadTaskRunner*) {
|
||||
// TODO(cef): Enable these once the implementation supports it.
|
||||
blink::WebRuntimeFeatures::EnableNotifications(false);
|
||||
blink::WebRuntimeFeatures::EnablePushMessaging(false);
|
||||
}
|
||||
|
||||
void CefContentRendererClient::RenderThreadStarted() {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
|
@@ -103,6 +103,8 @@ class CefContentRendererClient
|
||||
void RunSingleProcessCleanup();
|
||||
|
||||
// ContentRendererClient implementation.
|
||||
void PostIOThreadCreated(
|
||||
base::SingleThreadTaskRunner* io_thread_task_runner) override;
|
||||
void RenderThreadStarted() override;
|
||||
void ExposeInterfacesToBrowser(mojo::BinderMap* binders) override;
|
||||
void RenderThreadConnected() override;
|
||||
|
@@ -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,11 +9,12 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=3a295e7d6703e2e8effd94da8e97d8b7f451dc32$
|
||||
// $hash=f9893b2a7c5cd519d32d06a022e503340aa66bc3$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_source_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
@@ -105,6 +106,26 @@ media_sink_get_icon_type(struct _cef_media_sink_t* self) {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK media_sink_get_device_info(
|
||||
struct _cef_media_sink_t* self,
|
||||
struct _cef_media_sink_device_info_callback_t* callback) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback);
|
||||
if (!callback)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaSinkCppToC::Get(self)->GetDeviceInfo(
|
||||
CefMediaSinkDeviceInfoCallbackCToCpp::Wrap(callback));
|
||||
}
|
||||
|
||||
int CEF_CALLBACK media_sink_is_cast_sink(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
@@ -170,6 +191,7 @@ CefMediaSinkCppToC::CefMediaSinkCppToC() {
|
||||
GetStruct()->get_name = media_sink_get_name;
|
||||
GetStruct()->get_description = media_sink_get_description;
|
||||
GetStruct()->get_icon_type = media_sink_get_icon_type;
|
||||
GetStruct()->get_device_info = media_sink_get_device_info;
|
||||
GetStruct()->is_cast_sink = media_sink_is_cast_sink;
|
||||
GetStruct()->is_dial_sink = media_sink_is_dial_sink;
|
||||
GetStruct()->is_compatible_with = media_sink_is_compatible_with;
|
||||
|
78
libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.cc
Normal file
78
libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.cc
Normal file
@@ -0,0 +1,78 @@
|
||||
// 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=c22023ad9e7d7d80d72729dbebdf03f0b60f4dc9$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK media_sink_device_info_callback_on_media_sink_device_info(
|
||||
struct _cef_media_sink_device_info_callback_t* self,
|
||||
const struct _cef_media_sink_device_info_t* device_info) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: device_info; type: struct_byref_const
|
||||
DCHECK(device_info);
|
||||
if (!device_info)
|
||||
return;
|
||||
|
||||
// Translate param: device_info; type: struct_byref_const
|
||||
CefMediaSinkDeviceInfo device_infoObj;
|
||||
if (device_info)
|
||||
device_infoObj.Set(*device_info, false);
|
||||
|
||||
// Execute
|
||||
CefMediaSinkDeviceInfoCallbackCppToC::Get(self)->OnMediaSinkDeviceInfo(
|
||||
device_infoObj);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkDeviceInfoCallbackCppToC::CefMediaSinkDeviceInfoCallbackCppToC() {
|
||||
GetStruct()->on_media_sink_device_info =
|
||||
media_sink_device_info_callback_on_media_sink_device_info;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkDeviceInfoCallbackCppToC::~CefMediaSinkDeviceInfoCallbackCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback>
|
||||
CefCppToCRefCounted<CefMediaSinkDeviceInfoCallbackCppToC,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t>::
|
||||
UnwrapDerived(CefWrapperType type,
|
||||
cef_media_sink_device_info_callback_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCppToCRefCounted<CefMediaSinkDeviceInfoCallbackCppToC,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t>::kWrapperType =
|
||||
WT_MEDIA_SINK_DEVICE_INFO_CALLBACK;
|
38
libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h
Normal file
38
libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// 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=5313c2346d5db18dca956f2dac98b73e049a4995$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_DEVICE_INFO_CALLBACK_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_DEVICE_INFO_CALLBACK_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.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 CefMediaSinkDeviceInfoCallbackCppToC
|
||||
: public CefCppToCRefCounted<CefMediaSinkDeviceInfoCallbackCppToC,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t> {
|
||||
public:
|
||||
CefMediaSinkDeviceInfoCallbackCppToC();
|
||||
virtual ~CefMediaSinkDeviceInfoCallbackCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_DEVICE_INFO_CALLBACK_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,10 +9,11 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=ba0a12367019906d32dae965d7d1b5245d02b442$
|
||||
// $hash=0dc6766f75f9b051daf582009455efb08c969e9f$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/resource_bundle_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/binary_value_cpptoc.h"
|
||||
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
@@ -47,83 +48,40 @@ resource_bundle_get_localized_string(struct _cef_resource_bundle_t* self,
|
||||
return _retval.DetachToUserFree();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK
|
||||
struct _cef_binary_value_t* CEF_CALLBACK
|
||||
resource_bundle_get_data_resource(struct _cef_resource_bundle_t* self,
|
||||
int resource_id,
|
||||
void** data,
|
||||
size_t* data_size) {
|
||||
int resource_id) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: data; type: simple_byref
|
||||
DCHECK(data);
|
||||
if (!data)
|
||||
return 0;
|
||||
// Verify param: data_size; type: simple_byref
|
||||
DCHECK(data_size);
|
||||
if (!data_size)
|
||||
return 0;
|
||||
|
||||
// Translate param: data; type: simple_byref
|
||||
void* dataVal = data ? *data : NULL;
|
||||
// Translate param: data_size; type: simple_byref
|
||||
size_t data_sizeVal = data_size ? *data_size : 0;
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefResourceBundleCppToC::Get(self)->GetDataResource(
|
||||
resource_id, dataVal, data_sizeVal);
|
||||
CefRefPtr<CefBinaryValue> _retval =
|
||||
CefResourceBundleCppToC::Get(self)->GetDataResource(resource_id);
|
||||
|
||||
// Restore param: data; type: simple_byref
|
||||
if (data)
|
||||
*data = dataVal;
|
||||
// Restore param: data_size; type: simple_byref
|
||||
if (data_size)
|
||||
*data_size = data_sizeVal;
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
// Return type: refptr_same
|
||||
return CefBinaryValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
int CEF_CALLBACK
|
||||
struct _cef_binary_value_t* CEF_CALLBACK
|
||||
resource_bundle_get_data_resource_for_scale(struct _cef_resource_bundle_t* self,
|
||||
int resource_id,
|
||||
cef_scale_factor_t scale_factor,
|
||||
void** data,
|
||||
size_t* data_size) {
|
||||
cef_scale_factor_t scale_factor) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: data; type: simple_byref
|
||||
DCHECK(data);
|
||||
if (!data)
|
||||
return 0;
|
||||
// Verify param: data_size; type: simple_byref
|
||||
DCHECK(data_size);
|
||||
if (!data_size)
|
||||
return 0;
|
||||
|
||||
// Translate param: data; type: simple_byref
|
||||
void* dataVal = data ? *data : NULL;
|
||||
// Translate param: data_size; type: simple_byref
|
||||
size_t data_sizeVal = data_size ? *data_size : 0;
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefResourceBundleCppToC::Get(self)->GetDataResourceForScale(
|
||||
resource_id, scale_factor, dataVal, data_sizeVal);
|
||||
CefRefPtr<CefBinaryValue> _retval =
|
||||
CefResourceBundleCppToC::Get(self)->GetDataResourceForScale(resource_id,
|
||||
scale_factor);
|
||||
|
||||
// Restore param: data; type: simple_byref
|
||||
if (data)
|
||||
*data = dataVal;
|
||||
// Restore param: data_size; type: simple_byref
|
||||
if (data_size)
|
||||
*data_size = data_sizeVal;
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
// Return type: refptr_same
|
||||
return CefBinaryValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@@ -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,10 +9,11 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=63071af2d949b451ad0e7273ca0f5d7bfec425db$
|
||||
// $hash=8aa27e34aea83e91b04d21764f3ab985b04bbf9b$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
@@ -105,6 +106,27 @@ CefMediaSink::IconType CefMediaSinkCToCpp::GetIconType() {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaSinkCToCpp::GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_device_info))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->get_device_info(
|
||||
_struct, CefMediaSinkDeviceInfoCallbackCppToC::Wrap(callback));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMediaSinkCToCpp::IsCastSink() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c57a82e66fdcd26f70a69fbd92554ca8aa38495c$
|
||||
// $hash=81437a10eeb422cf962af49b782275dd24bea500$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_CTOCPP_H_
|
||||
@@ -39,6 +39,8 @@ class CefMediaSinkCToCpp : public CefCToCppRefCounted<CefMediaSinkCToCpp,
|
||||
CefString GetName() OVERRIDE;
|
||||
CefString GetDescription() OVERRIDE;
|
||||
IconType GetIconType() OVERRIDE;
|
||||
void GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) OVERRIDE;
|
||||
bool IsCastSink() OVERRIDE;
|
||||
bool IsDialSink() OVERRIDE;
|
||||
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) OVERRIDE;
|
||||
|
60
libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.cc
Normal file
60
libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.cc
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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=c56362ea79609562dacc4bf8303f2bd920ddeada$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaSinkDeviceInfoCallbackCToCpp::OnMediaSinkDeviceInfo(
|
||||
const CefMediaSinkDeviceInfo& device_info) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_device_info_callback_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_media_sink_device_info))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->on_media_sink_device_info(_struct, &device_info);
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkDeviceInfoCallbackCToCpp::CefMediaSinkDeviceInfoCallbackCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkDeviceInfoCallbackCToCpp::~CefMediaSinkDeviceInfoCallbackCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_media_sink_device_info_callback_t*
|
||||
CefCToCppRefCounted<CefMediaSinkDeviceInfoCallbackCToCpp,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t>::
|
||||
UnwrapDerived(CefWrapperType type, CefMediaSinkDeviceInfoCallback* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCToCppRefCounted<CefMediaSinkDeviceInfoCallbackCToCpp,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t>::kWrapperType =
|
||||
WT_MEDIA_SINK_DEVICE_INFO_CALLBACK;
|
42
libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h
Normal file
42
libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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=e48d0b8482168d355e04460ea6ea5b7662dbe4fd$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_DEVICE_INFO_CALLBACK_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_DEVICE_INFO_CALLBACK_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.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 CefMediaSinkDeviceInfoCallbackCToCpp
|
||||
: public CefCToCppRefCounted<CefMediaSinkDeviceInfoCallbackCToCpp,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t> {
|
||||
public:
|
||||
CefMediaSinkDeviceInfoCallbackCToCpp();
|
||||
virtual ~CefMediaSinkDeviceInfoCallbackCToCpp();
|
||||
|
||||
// CefMediaSinkDeviceInfoCallback methods.
|
||||
void OnMediaSinkDeviceInfo(
|
||||
const CefMediaSinkDeviceInfo& device_info) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_DEVICE_INFO_CALLBACK_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,10 +9,11 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=026dabca1d46cfbe911d71ede9d5bb79cb7c553d$
|
||||
// $hash=12bfdabd19a9a90eb4c7b88cb0d8d225c8142115$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/resource_bundle_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/binary_value_ctocpp.h"
|
||||
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
|
||||
@@ -48,40 +49,38 @@ CefString CefResourceBundleCToCpp::GetLocalizedString(int string_id) {
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefResourceBundleCToCpp::GetDataResource(int resource_id,
|
||||
void*& data,
|
||||
size_t& data_size) {
|
||||
CefRefPtr<CefBinaryValue> CefResourceBundleCToCpp::GetDataResource(
|
||||
int resource_id) {
|
||||
cef_resource_bundle_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_data_resource))
|
||||
return false;
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval =
|
||||
_struct->get_data_resource(_struct, resource_id, &data, &data_size);
|
||||
cef_binary_value_t* _retval =
|
||||
_struct->get_data_resource(_struct, resource_id);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
// Return type: refptr_same
|
||||
return CefBinaryValueCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefResourceBundleCToCpp::GetDataResourceForScale(int resource_id,
|
||||
ScaleFactor scale_factor,
|
||||
void*& data,
|
||||
size_t& data_size) {
|
||||
CefRefPtr<CefBinaryValue> CefResourceBundleCToCpp::GetDataResourceForScale(
|
||||
int resource_id,
|
||||
ScaleFactor scale_factor) {
|
||||
cef_resource_bundle_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_data_resource_for_scale))
|
||||
return false;
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->get_data_resource_for_scale(
|
||||
_struct, resource_id, scale_factor, &data, &data_size);
|
||||
cef_binary_value_t* _retval =
|
||||
_struct->get_data_resource_for_scale(_struct, resource_id, scale_factor);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
// Return type: refptr_same
|
||||
return CefBinaryValueCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c0d4e71c707c9d63a00ca1a497aaede3e429e970$
|
||||
// $hash=7668efc00e13bb790df91f26c2a5683bd74ff677$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_RESOURCE_BUNDLE_CTOCPP_H_
|
||||
@@ -36,13 +36,10 @@ class CefResourceBundleCToCpp
|
||||
|
||||
// CefResourceBundle methods.
|
||||
CefString GetLocalizedString(int string_id) OVERRIDE;
|
||||
bool GetDataResource(int resource_id,
|
||||
void*& data,
|
||||
size_t& data_size) OVERRIDE;
|
||||
bool GetDataResourceForScale(int resource_id,
|
||||
ScaleFactor scale_factor,
|
||||
void*& data,
|
||||
size_t& data_size) OVERRIDE;
|
||||
CefRefPtr<CefBinaryValue> GetDataResource(int resource_id) OVERRIDE;
|
||||
CefRefPtr<CefBinaryValue> GetDataResourceForScale(
|
||||
int resource_id,
|
||||
ScaleFactor scale_factor) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_RESOURCE_BUNDLE_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=6e7cec57ce98a10f0b0668d47c9935639963c215$
|
||||
//
|
||||
|
||||
#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,
|
||||
@@ -79,6 +80,7 @@ enum CefWrapperType {
|
||||
WT_MEDIA_ROUTE_CREATE_CALLBACK,
|
||||
WT_MEDIA_ROUTER,
|
||||
WT_MEDIA_SINK,
|
||||
WT_MEDIA_SINK_DEVICE_INFO_CALLBACK,
|
||||
WT_MEDIA_SOURCE,
|
||||
WT_MENU_BUTTON,
|
||||
WT_MENU_BUTTON_DELEGATE,
|
||||
|
@@ -396,7 +396,7 @@ patches = [
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2718
|
||||
#
|
||||
# Fix shutdown crash in InitNetworkContext with multi-threaded message loop.
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2703
|
||||
# https://bitbucket.org/chromiumembedded/cef/issues/2985
|
||||
#
|
||||
# Compute correct default quota when cache_path is unspecified.
|
||||
'name': 'services_network_2718',
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
|
||||
index ffbec39c3e56..573ee6f18653 100644
|
||||
index ab78eae16b47..e0d841bee4a3 100644
|
||||
--- chrome/browser/BUILD.gn
|
||||
+++ chrome/browser/BUILD.gn
|
||||
@@ -11,6 +11,7 @@ import("//build/config/crypto.gni")
|
||||
@@ -10,7 +10,7 @@ index ffbec39c3e56..573ee6f18653 100644
|
||||
import("//chrome/browser/buildflags.gni")
|
||||
import("//chrome/browser/downgrade/buildflags.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
@@ -1979,6 +1980,7 @@ static_library("browser") {
|
||||
@@ -1967,6 +1968,7 @@ static_library("browser") {
|
||||
"//base/util/values:values_util",
|
||||
"//build:branding_buildflags",
|
||||
"//cc",
|
||||
@@ -18,7 +18,7 @@ index ffbec39c3e56..573ee6f18653 100644
|
||||
"//chrome:extra_resources",
|
||||
"//chrome:resources",
|
||||
"//chrome:strings",
|
||||
@@ -2313,6 +2315,10 @@ static_library("browser") {
|
||||
@@ -2300,6 +2302,10 @@ static_library("browser") {
|
||||
]
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
|
||||
index 284154368652..cdd775136329 100644
|
||||
index 4a31f9315ce8..157c35764f76 100644
|
||||
--- chrome/browser/ui/BUILD.gn
|
||||
+++ chrome/browser/ui/BUILD.gn
|
||||
@@ -9,6 +9,7 @@ import("//build/config/crypto.gni")
|
||||
@@ -10,7 +10,7 @@ index 284154368652..cdd775136329 100644
|
||||
import("//chrome/browser/buildflags.gni")
|
||||
import("//chrome/common/features.gni")
|
||||
import("//chromeos/assistant/assistant.gni")
|
||||
@@ -362,6 +363,10 @@ static_library("ui") {
|
||||
@@ -358,6 +359,10 @@ static_library("ui") {
|
||||
"//build/config/compiler:wexit_time_destructors",
|
||||
]
|
||||
|
||||
@@ -21,7 +21,7 @@ index 284154368652..cdd775136329 100644
|
||||
# Since browser and browser_ui actually depend on each other,
|
||||
# we must omit the dependency from browser_ui to browser.
|
||||
# However, this means browser_ui and browser should more or less
|
||||
@@ -383,6 +388,7 @@ static_library("ui") {
|
||||
@@ -379,6 +384,7 @@ static_library("ui") {
|
||||
"//base/allocator:buildflags",
|
||||
"//build:branding_buildflags",
|
||||
"//cc/paint",
|
||||
@@ -29,7 +29,7 @@ index 284154368652..cdd775136329 100644
|
||||
"//chrome:extra_resources",
|
||||
"//chrome:resources",
|
||||
"//chrome:strings",
|
||||
@@ -1489,6 +1495,7 @@ static_library("ui") {
|
||||
@@ -1491,6 +1497,7 @@ static_library("ui") {
|
||||
"//components/keep_alive_registry",
|
||||
"//components/network_session_configurator/common",
|
||||
"//components/page_load_metrics/browser",
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
|
||||
index dd86e2e35910..624904c5fef2 100644
|
||||
index b4087b7737c2..ff13279d154e 100644
|
||||
--- chrome/browser/chrome_content_browser_client.cc
|
||||
+++ chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -1001,10 +1001,6 @@ void LaunchURL(const GURL& url,
|
||||
@@ -1003,10 +1003,6 @@ void LaunchURL(const GURL& url,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ index dd86e2e35910..624904c5fef2 100644
|
||||
void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) {
|
||||
// |allowlist| combines pref/policy + cmdline switch in the browser process.
|
||||
// For renderer and utility (e.g. NetworkService) processes the switch is the
|
||||
@@ -1171,6 +1167,14 @@ const blink::UserAgentBrandList& GetBrandVersionList() {
|
||||
@@ -1173,6 +1169,14 @@ const blink::UserAgentBrandList& GetBrandVersionList() {
|
||||
return *greased_brand_version_list;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ index dd86e2e35910..624904c5fef2 100644
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
if (command_line->HasSwitch(switches::kUserAgent)) {
|
||||
diff --git chrome/browser/chrome_content_browser_client.h chrome/browser/chrome_content_browser_client.h
|
||||
index cd96f6bf1cb7..007d024f7dc8 100644
|
||||
index 219eac813d9b..f933fc41ab85 100644
|
||||
--- chrome/browser/chrome_content_browser_client.h
|
||||
+++ chrome/browser/chrome_content_browser_client.h
|
||||
@@ -90,7 +90,8 @@ class ChromeXrIntegrationClient;
|
||||
|
@@ -1,5 +1,46 @@
|
||||
diff --git chrome/browser/themes/theme_service.cc chrome/browser/themes/theme_service.cc
|
||||
index 2a6df8119a44..15fd775888f0 100644
|
||||
--- chrome/browser/themes/theme_service.cc
|
||||
+++ chrome/browser/themes/theme_service.cc
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "build/build_config.h"
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/chrome_notification_types.h"
|
||||
#include "chrome/browser/extensions/extension_service.h"
|
||||
#include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
|
||||
@@ -54,6 +55,10 @@
|
||||
#include "extensions/common/extension_set.h"
|
||||
#include "ui/base/layout.h"
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#include "cef/libcef/common/extensions/extensions_util.h"
|
||||
+#endif
|
||||
+
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#include "base/scoped_observer.h"
|
||||
#include "extensions/browser/extension_registry_observer.h"
|
||||
@@ -270,11 +275,17 @@ void ThemeService::Init() {
|
||||
// OnExtensionServiceReady. Otherwise, the ThemeObserver won't be
|
||||
// constructed in time to observe the corresponding events.
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (extensions::ExtensionsEnabled()) {
|
||||
+#endif
|
||||
theme_observer_ = std::make_unique<ThemeObserver>(this);
|
||||
|
||||
extensions::ExtensionSystem::Get(profile_)->ready().Post(
|
||||
FROM_HERE, base::Bind(&ThemeService::OnExtensionServiceReady,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ }
|
||||
+#endif
|
||||
#endif
|
||||
theme_syncable_service_.reset(new ThemeSyncableService(profile_, this));
|
||||
|
||||
diff --git chrome/browser/themes/theme_service_factory.cc chrome/browser/themes/theme_service_factory.cc
|
||||
index caec77bbe3ba..1640307eef65 100644
|
||||
index caec77bbe3ba..dff5de50793b 100644
|
||||
--- chrome/browser/themes/theme_service_factory.cc
|
||||
+++ chrome/browser/themes/theme_service_factory.cc
|
||||
@@ -6,6 +6,7 @@
|
||||
@@ -10,17 +51,17 @@ index caec77bbe3ba..1640307eef65 100644
|
||||
#include "chrome/browser/extensions/extension_system_factory.h"
|
||||
#include "chrome/browser/profiles/incognito_helpers.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
@@ -41,6 +42,10 @@ const ThemeHelper& GetThemeHelper() {
|
||||
|
||||
} // namespace
|
||||
@@ -27,6 +28,10 @@
|
||||
#include "ui/views/linux_ui/linux_ui.h"
|
||||
#endif
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#include "cef/libcef/common/extensions/extensions_util.h"
|
||||
+#endif
|
||||
+
|
||||
// static
|
||||
ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) {
|
||||
return static_cast<ThemeService*>(
|
||||
namespace {
|
||||
|
||||
const ThemeHelper& GetThemeHelper() {
|
||||
@@ -70,7 +75,13 @@ ThemeServiceFactory::ThemeServiceFactory()
|
||||
BrowserContextDependencyManager::GetInstance()) {
|
||||
DependsOn(extensions::ExtensionRegistryFactory::GetInstance());
|
||||
|
@@ -165,7 +165,7 @@ index 4e64db143b8a..71322b0261a1 100644
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
std::vector<std::string> whitelist = MimeTypesHandler::GetMIMETypeWhitelist();
|
||||
diff --git chrome/common/google_url_loader_throttle.cc chrome/common/google_url_loader_throttle.cc
|
||||
index a9ee607a2cb0..347261030e0e 100644
|
||||
index 5af3086ef4d1..938a00f72501 100644
|
||||
--- chrome/common/google_url_loader_throttle.cc
|
||||
+++ chrome/common/google_url_loader_throttle.cc
|
||||
@@ -5,10 +5,15 @@
|
||||
@@ -184,7 +184,7 @@ index a9ee607a2cb0..347261030e0e 100644
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
#include "extensions/common/extension_urls.h"
|
||||
#endif
|
||||
@@ -126,6 +131,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
|
||||
@@ -130,6 +135,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
|
||||
const GURL& response_url,
|
||||
network::mojom::URLResponseHead* response_head,
|
||||
bool* defer) {
|
||||
|
@@ -224,10 +224,10 @@ index 632ae86c6fd6..55b749ec1242 100644
|
||||
const std::vector<WebPluginInfo>& all_plugins);
|
||||
|
||||
diff --git content/common/frame_messages.h content/common/frame_messages.h
|
||||
index 0821c7061118..fed37861b6b2 100644
|
||||
index bec2919abc99..4186be149a81 100644
|
||||
--- content/common/frame_messages.h
|
||||
+++ content/common/frame_messages.h
|
||||
@@ -615,9 +615,10 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
|
||||
@@ -621,9 +621,10 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
|
||||
// type. If there is no matching plugin, |found| is false.
|
||||
// |actual_mime_type| is the actual mime type supported by the
|
||||
// found plugin.
|
||||
@@ -240,7 +240,7 @@ index 0821c7061118..fed37861b6b2 100644
|
||||
std::string /* mime_type */,
|
||||
bool /* found */,
|
||||
diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
|
||||
index 5c344d9b9ff7..776e506d2a10 100644
|
||||
index c8c1e668d087..f8e7f39dd96f 100644
|
||||
--- content/public/browser/content_browser_client.cc
|
||||
+++ content/public/browser/content_browser_client.cc
|
||||
@@ -9,7 +9,7 @@
|
||||
@@ -253,7 +253,7 @@ index 5c344d9b9ff7..776e506d2a10 100644
|
||||
#include <utility>
|
||||
|
||||
diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
|
||||
index d6c203ab546d..621bf11f32e9 100644
|
||||
index b211fea98791..1492a74be337 100644
|
||||
--- content/public/browser/content_browser_client.h
|
||||
+++ content/public/browser/content_browser_client.h
|
||||
@@ -28,6 +28,7 @@
|
||||
@@ -340,10 +340,10 @@ index 7da02ee54143..6436dc300c43 100644
|
||||
// started.
|
||||
virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {}
|
||||
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
|
||||
index 34cdad7f7205..60042cb8b4e6 100644
|
||||
index d34614191378..14ab0168132d 100644
|
||||
--- content/renderer/render_frame_impl.cc
|
||||
+++ content/renderer/render_frame_impl.cc
|
||||
@@ -3663,7 +3663,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
|
||||
@@ -3670,7 +3670,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin(
|
||||
std::string mime_type;
|
||||
bool found = false;
|
||||
Send(new FrameHostMsg_GetPluginInfo(
|
||||
@@ -354,7 +354,7 @@ index 34cdad7f7205..60042cb8b4e6 100644
|
||||
if (!found)
|
||||
return nullptr;
|
||||
diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc
|
||||
index 3b99b09c45e9..a6b9562d1c5c 100644
|
||||
index b305148481d7..8d776083561c 100644
|
||||
--- content/renderer/render_thread_impl.cc
|
||||
+++ content/renderer/render_thread_impl.cc
|
||||
@@ -633,6 +633,8 @@ void RenderThreadImpl::Init() {
|
||||
|
@@ -41,10 +41,10 @@ index cc4b13a7b9c6..84f3b9ed7cf4 100644
|
||||
|
||||
} // namespace content
|
||||
diff --git content/browser/renderer_host/render_widget_host_impl.cc content/browser/renderer_host/render_widget_host_impl.cc
|
||||
index bb483be1fbfb..d33a95e2dee3 100644
|
||||
index a0e62a06462d..00d3fd88abad 100644
|
||||
--- content/browser/renderer_host/render_widget_host_impl.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_impl.cc
|
||||
@@ -2735,6 +2735,11 @@ void RenderWidgetHostImpl::OnInvalidInputEventSource() {
|
||||
@@ -2740,6 +2740,11 @@ void RenderWidgetHostImpl::OnInvalidInputEventSource() {
|
||||
GetProcess(), bad_message::INPUT_ROUTER_INVALID_EVENT_SOURCE);
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ index bb483be1fbfb..d33a95e2dee3 100644
|
||||
const WebInputEvent& event) {
|
||||
if ((base::FeatureList::IsEnabled(
|
||||
diff --git content/browser/renderer_host/render_widget_host_impl.h content/browser/renderer_host/render_widget_host_impl.h
|
||||
index 7200b0616892..733833deb5e0 100644
|
||||
index 950fc6e8e5e6..dfd00881ac39 100644
|
||||
--- content/browser/renderer_host/render_widget_host_impl.h
|
||||
+++ content/browser/renderer_host/render_widget_host_impl.h
|
||||
@@ -741,6 +741,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
@@ -738,6 +738,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl
|
||||
|
||||
void ProgressFlingIfNeeded(base::TimeTicks current_time);
|
||||
void StopFling();
|
||||
|
@@ -262,7 +262,7 @@ index 0881b3dd9303..4df6883d4d05 100644
|
||||
Profile* const profile_;
|
||||
PrintPreviewStickySettings* const sticky_settings_;
|
||||
diff --git chrome/browser/ui/webui/print_preview/print_preview_handler.cc chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
index 1d2254cefc2c..7aa5fe7f11a4 100644
|
||||
index deefb4213851..044a09a8bb3d 100644
|
||||
--- chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
+++ chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
||||
@@ -24,6 +24,7 @@
|
||||
@@ -273,7 +273,7 @@ index 1d2254cefc2c..7aa5fe7f11a4 100644
|
||||
#include "chrome/browser/app_mode/app_mode_utils.h"
|
||||
#include "chrome/browser/bad_message.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
@@ -1243,7 +1244,7 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
@@ -1245,7 +1246,7 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
}
|
||||
return extension_printer_handler_.get();
|
||||
}
|
||||
@@ -282,7 +282,7 @@ index 1d2254cefc2c..7aa5fe7f11a4 100644
|
||||
if (printer_type == PrinterType::kPrivet) {
|
||||
if (!privet_printer_handler_) {
|
||||
privet_printer_handler_ =
|
||||
@@ -1251,6 +1252,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
@@ -1253,6 +1254,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler(
|
||||
}
|
||||
return privet_printer_handler_.get();
|
||||
}
|
||||
@@ -292,7 +292,7 @@ index 1d2254cefc2c..7aa5fe7f11a4 100644
|
||||
#endif
|
||||
if (printer_type == PrinterType::kPdf) {
|
||||
if (!pdf_printer_handler_) {
|
||||
@@ -1323,6 +1327,7 @@ void PrintPreviewHandler::OnPrintResult(const std::string& callback_id,
|
||||
@@ -1325,6 +1329,7 @@ void PrintPreviewHandler::OnPrintResult(const std::string& callback_id,
|
||||
}
|
||||
|
||||
void PrintPreviewHandler::RegisterForGaiaCookieChanges() {
|
||||
@@ -300,7 +300,7 @@ index 1d2254cefc2c..7aa5fe7f11a4 100644
|
||||
DCHECK(!identity_manager_);
|
||||
cloud_print_enabled_ =
|
||||
!base::Contains(printer_type_deny_list_, PrinterType::kCloud) &&
|
||||
@@ -1339,6 +1344,7 @@ void PrintPreviewHandler::RegisterForGaiaCookieChanges() {
|
||||
@@ -1341,6 +1346,7 @@ void PrintPreviewHandler::RegisterForGaiaCookieChanges() {
|
||||
|
||||
identity_manager_ = IdentityManagerFactory::GetForProfile(profile);
|
||||
identity_manager_->AddObserver(this);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py
|
||||
index 9c936c69d684..13be02ae33f8 100644
|
||||
index 9c936c69d684..40825f4950b7 100644
|
||||
--- build/toolchain/win/setup_toolchain.py
|
||||
+++ build/toolchain/win/setup_toolchain.py
|
||||
@@ -142,22 +142,25 @@ def _LoadToolchainEnv(cpu, sdk_dir, target_store):
|
||||
@@ -142,21 +142,29 @@ def _LoadToolchainEnv(cpu, sdk_dir, target_store):
|
||||
# variable.
|
||||
if 'VSINSTALLDIR' in os.environ:
|
||||
del os.environ['VSINSTALLDIR']
|
||||
@@ -14,34 +14,31 @@ index 9c936c69d684..13be02ae33f8 100644
|
||||
- raise Exception('%s is missing - make sure VC++ tools are installed.' %
|
||||
- script_path)
|
||||
- script_path = other_path
|
||||
- cpu_arg = "amd64"
|
||||
- if (cpu != 'x64'):
|
||||
- # x64 is default target CPU thus any other CPU requires a target set
|
||||
- cpu_arg += '_' + cpu
|
||||
- args = [script_path, cpu_arg]
|
||||
- # Store target must come before any SDK version declaration
|
||||
- if (target_store):
|
||||
- args.append(['store'])
|
||||
- variables = _LoadEnvFromBat(args)
|
||||
+ if os.path.exists(script_path):
|
||||
+ cpu_arg = "amd64"
|
||||
+ if (cpu != 'x64'):
|
||||
+ # x64 is default target CPU thus any other CPU requires a target set
|
||||
+ cpu_arg += '_' + cpu
|
||||
+ args = [script_path, cpu_arg]
|
||||
+ # Store target must come before any SDK version declaration
|
||||
+ if (target_store):
|
||||
+ args.append(['store'])
|
||||
+ variables = _LoadEnvFromBat(args)
|
||||
+ else:
|
||||
+ if not os.path.exists(script_path):
|
||||
+ # Compiler environment variables must already be specified.
|
||||
+ variables = []
|
||||
+ for k in sorted(os.environ.keys()):
|
||||
+ variables.append('%s=%s' % (str(k), str(os.environ[k])))
|
||||
+ variables = '\n'.join(variables)
|
||||
+ return _ExtractImportantEnvironment(variables)
|
||||
+
|
||||
cpu_arg = "amd64"
|
||||
if (cpu != 'x64'):
|
||||
# x64 is default target CPU thus any other CPU requires a target set
|
||||
cpu_arg += '_' + cpu
|
||||
- args = [script_path, cpu_arg]
|
||||
+ args = [script_path, cpu_arg, ]
|
||||
# Store target must come before any SDK version declaration
|
||||
if (target_store):
|
||||
- args.append(['store'])
|
||||
+ args.append('store')
|
||||
+ # Explicitly specifying the SDK version to build with to avoid accidentally
|
||||
+ # building with a new and untested SDK. This should stay in sync with the
|
||||
+ # packaged toolchain in build/vs_toolchain.py.
|
||||
+ args.append('10.0.18362.0')
|
||||
variables = _LoadEnvFromBat(args)
|
||||
return _ExtractImportantEnvironment(variables)
|
||||
|
||||
|
||||
diff --git build/vs_toolchain.py build/vs_toolchain.py
|
||||
index f3557ad32eea..b3e056acccdb 100755
|
||||
--- build/vs_toolchain.py
|
||||
|
@@ -58,7 +58,7 @@ index a48ead96b3f7..967a5975c330 100644
|
||||
// specified isolated app (or for the profile itself, if |relative_path| is
|
||||
// empty).
|
||||
diff --git net/cookies/cookie_monster.cc net/cookies/cookie_monster.cc
|
||||
index 69652bdb5952..f1554d00df7b 100644
|
||||
index 533cc97ba715..36d9f1f3b511 100644
|
||||
--- net/cookies/cookie_monster.cc
|
||||
+++ net/cookies/cookie_monster.cc
|
||||
@@ -476,6 +476,25 @@ void CookieMonster::SetCookieableSchemes(
|
||||
@@ -181,7 +181,7 @@ index 2c3f75ea4ad1..2e639893913b 100644
|
||||
trust_token_store_ = std::make_unique<PendingTrustTokenStore>();
|
||||
|
||||
diff --git services/network/public/mojom/network_context.mojom services/network/public/mojom/network_context.mojom
|
||||
index 6589fe215cfa..481fabeef3a1 100644
|
||||
index 93a2baf855d3..87e8ba113005 100644
|
||||
--- services/network/public/mojom/network_context.mojom
|
||||
+++ services/network/public/mojom/network_context.mojom
|
||||
@@ -258,6 +258,9 @@ struct NetworkContextParams {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git content/browser/storage_partition_impl.cc content/browser/storage_partition_impl.cc
|
||||
index f06c5b512342..1e8d5eef47fc 100644
|
||||
index f06c5b512342..ba2c1eae9324 100644
|
||||
--- content/browser/storage_partition_impl.cc
|
||||
+++ content/browser/storage_partition_impl.cc
|
||||
@@ -489,10 +489,6 @@ class LoginHandlerDelegate {
|
||||
@@ -40,15 +40,15 @@ index f06c5b512342..1e8d5eef47fc 100644
|
||||
storage::GetDefaultDeviceInfoHelper(), std::move(callback));
|
||||
}
|
||||
|
||||
@@ -2387,7 +2381,10 @@ void StoragePartitionImpl::InitNetworkContext() {
|
||||
network_context_.reset();
|
||||
GetNetworkService()->CreateNetworkContext(
|
||||
network_context_.BindNewPipeAndPassReceiver(), std::move(context_params));
|
||||
- DCHECK(network_context_);
|
||||
+ if (!network_context_) {
|
||||
+ // May happen during shutdown.
|
||||
@@ -2376,6 +2370,11 @@ void StoragePartitionImpl::InitNetworkContext() {
|
||||
GetContentClient()->browser()->ConfigureNetworkContextParams(
|
||||
browser_context_, is_in_memory_, relative_partition_path_,
|
||||
context_params.get(), cert_verifier_creation_params.get());
|
||||
+ if (context_params->context_name &&
|
||||
+ *context_params->context_name == "magic_shutting_down") {
|
||||
+ // Don't re-initialize the network context during shutdown.
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
network_context_client_receiver_.reset();
|
||||
network_context_->SetClient(
|
||||
DCHECK(!context_params->cert_verifier_creation_params)
|
||||
<< "|cert_verifier_creation_params| should not be set in the "
|
||||
"NetworkContextParams, as they will eventually be removed when the "
|
||||
|
@@ -13,10 +13,10 @@ index f90e9fce0675..33551a2874bc 100644
|
||||
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
|
||||
diff --git content/browser/browser_context.cc content/browser/browser_context.cc
|
||||
index 05473c622dbd..9cd0e465fd2d 100644
|
||||
index 85251cbcd6b5..27e09121205f 100644
|
||||
--- content/browser/browser_context.cc
|
||||
+++ content/browser/browser_context.cc
|
||||
@@ -129,7 +129,7 @@ StoragePartition* GetStoragePartitionFromConfig(
|
||||
@@ -130,7 +130,7 @@ StoragePartition* GetStoragePartitionFromConfig(
|
||||
StoragePartitionImplMap* partition_map =
|
||||
GetStoragePartitionMap(browser_context);
|
||||
|
||||
@@ -25,7 +25,7 @@ index 05473c622dbd..9cd0e465fd2d 100644
|
||||
in_memory = true;
|
||||
|
||||
return partition_map->Get(partition_domain, partition_name, in_memory,
|
||||
@@ -543,7 +543,7 @@ media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() {
|
||||
@@ -546,7 +546,7 @@ media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() {
|
||||
kUseInMemoryDBDefault);
|
||||
|
||||
std::unique_ptr<media::VideoDecodeStatsDB> stats_db;
|
||||
|
@@ -144,7 +144,7 @@ index 2bb30e5318b6..535535dd6c10 100644
|
||||
|
||||
TRACE_EVENT_ASYNC_BEGIN0("viz", "SoftwareOutputDeviceWinProxy::Draw", this);
|
||||
diff --git content/browser/compositor/viz_process_transport_factory.cc content/browser/compositor/viz_process_transport_factory.cc
|
||||
index ffb3a04236be..fa746c7fd350 100644
|
||||
index 69e54c41c610..43d312d65a88 100644
|
||||
--- content/browser/compositor/viz_process_transport_factory.cc
|
||||
+++ content/browser/compositor/viz_process_transport_factory.cc
|
||||
@@ -404,8 +404,13 @@ void VizProcessTransportFactory::OnEstablishedGpuChannel(
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
|
||||
index 024415bb096e..0166b65c74ad 100644
|
||||
index 7908a60e1743..895d5fc53021 100644
|
||||
--- content/browser/web_contents/web_contents_impl.cc
|
||||
+++ content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -2096,15 +2096,22 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
@@ -2102,15 +2102,22 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
|
||||
std::string unique_name;
|
||||
frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
|
||||
|
||||
@@ -33,7 +33,7 @@ index 024415bb096e..0166b65c74ad 100644
|
||||
}
|
||||
CHECK(render_view_host_delegate_view_);
|
||||
CHECK(view_.get());
|
||||
@@ -2905,6 +2912,15 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
|
||||
@@ -2911,6 +2918,15 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
|
||||
// objects.
|
||||
create_params.renderer_initiated_creation = !is_new_browsing_instance;
|
||||
|
||||
@@ -49,7 +49,7 @@ index 024415bb096e..0166b65c74ad 100644
|
||||
std::unique_ptr<WebContentsImpl> new_contents;
|
||||
if (!is_guest) {
|
||||
create_params.context = view_->GetNativeView();
|
||||
@@ -6262,6 +6278,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
|
||||
@@ -6268,6 +6284,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
|
||||
// This is an outermost WebContents.
|
||||
SetAsFocusedWebContentsIfNecessary();
|
||||
}
|
||||
@@ -131,10 +131,10 @@ index 7757c7720406..356fb0577bae 100644
|
||||
// typically happens when popups are created.
|
||||
virtual void WebContentsCreated(WebContents* source_contents,
|
||||
diff --git content/public/browser/web_contents_observer.h content/public/browser/web_contents_observer.h
|
||||
index f80da27979a7..0a04f21c131d 100644
|
||||
index f0f6c11f5998..80e6b3efcde9 100644
|
||||
--- content/public/browser/web_contents_observer.h
|
||||
+++ content/public/browser/web_contents_observer.h
|
||||
@@ -570,6 +570,10 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener {
|
||||
@@ -573,6 +573,10 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener {
|
||||
// WebContents has gained/lost focus.
|
||||
virtual void OnFocusChangedInPage(FocusedNodeDetails* details) {}
|
||||
|
||||
|
@@ -44,7 +44,7 @@ index 8d1802954e22..4ec2caa2fd92 100644
|
||||
|
||||
DocumentInit& DocumentInit::WithTypeFrom(const String& mime_type) {
|
||||
diff --git third_party/blink/renderer/core/frame/local_frame.cc third_party/blink/renderer/core/frame/local_frame.cc
|
||||
index 453cc53860af..f42e2a34ab23 100644
|
||||
index 923913ab9dd9..c7870736ab29 100644
|
||||
--- third_party/blink/renderer/core/frame/local_frame.cc
|
||||
+++ third_party/blink/renderer/core/frame/local_frame.cc
|
||||
@@ -1365,7 +1365,7 @@ WebContentSettingsClient* LocalFrame::GetContentSettingsClient() {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git third_party/blink/renderer/core/input/pointer_event_manager.cc third_party/blink/renderer/core/input/pointer_event_manager.cc
|
||||
index 08a017090502..6ef3584b2fe6 100644
|
||||
index 6c62af01ad24..5817ddf75b61 100644
|
||||
--- third_party/blink/renderer/core/input/pointer_event_manager.cc
|
||||
+++ third_party/blink/renderer/core/input/pointer_event_manager.cc
|
||||
@@ -310,7 +310,7 @@ void PointerEventManager::HandlePointerInterruption(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user