mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
69 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
eeeb5d7395 | ||
|
959c7445a2 | ||
|
af831b6bff | ||
|
13ddc6bf15 | ||
|
753baf17b7 | ||
|
25a0d02077 | ||
|
22354a9e04 | ||
|
d81997a899 | ||
|
44e39a88bc | ||
|
4e2a218957 | ||
|
cb50417c32 | ||
|
27a32dbe03 | ||
|
a5f63034f9 | ||
|
cd80306c37 | ||
|
0655c8e58b | ||
|
364cd863b1 | ||
|
069c2fd9f6 | ||
|
19201cdc7f | ||
|
62bdceef3a | ||
|
4479216031 | ||
|
fbf54ad6a3 | ||
|
765455a0b1 | ||
|
7fadcf3edc | ||
|
20052b6e10 | ||
|
4dd897f977 | ||
|
3abfa07bee | ||
|
f14a117445 | ||
|
b63c85110d | ||
|
2071058036 | ||
|
54647945f1 | ||
|
fe68aee82c | ||
|
d2f48f6e08 | ||
|
7de882ece3 | ||
|
70f51c972a | ||
|
c01f40017b | ||
|
8fa8af357b | ||
|
b08f0ed713 | ||
|
10f9a9484f | ||
|
f8909fe9e0 | ||
|
16125bdbbd | ||
|
6eaf11f07a | ||
|
fbc8b983d5 | ||
|
c8c3ef4792 | ||
|
6ed4fe96b8 | ||
|
bd1b80198f | ||
|
e4867b5afb | ||
|
b7556bdddf | ||
|
c82ef82c21 | ||
|
897c0f01ed | ||
|
43001c0a94 | ||
|
54424d0edc | ||
|
feaca0ddf2 | ||
|
4054d66de0 | ||
|
903da5e452 | ||
|
0a62a4dca8 | ||
|
0afcb82ee6 | ||
|
07ba48b082 | ||
|
9dd0ca2661 | ||
|
aa398d8798 | ||
|
fda2f34c75 | ||
|
661fa722a7 | ||
|
caef479ae0 | ||
|
d6531b9fe6 | ||
|
94f604975d | ||
|
a90b50f1ff | ||
|
30451b7ca5 | ||
|
5c160e018b | ||
|
a56ac9782e | ||
|
dda50912ed |
7
BUILD.gn
7
BUILD.gn
@@ -118,7 +118,6 @@ if (is_linux) {
|
|||||||
}
|
}
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
import("//build/config/mac/rules.gni")
|
import("//build/config/mac/rules.gni")
|
||||||
import("//build_overrides/v8.gni")
|
|
||||||
import("//build/mac/tweak_info_plist.gni")
|
import("//build/mac/tweak_info_plist.gni")
|
||||||
import("//build/util/version.gni")
|
import("//build/util/version.gni")
|
||||||
import("//media/cdm/ppapi/cdm_paths.gni")
|
import("//media/cdm/ppapi/cdm_paths.gni")
|
||||||
@@ -755,7 +754,7 @@ static_library("libcef_static") {
|
|||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
"//build/linux:fontconfig",
|
"//build/linux:fontconfig",
|
||||||
"//third_party/freetype2",
|
"//build/linux:freetype2",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1025,7 +1024,7 @@ repack("pak_devtools") {
|
|||||||
# Each input pak file should also have a deps line for completeness.
|
# Each input pak file should also have a deps line for completeness.
|
||||||
# Add associated .h files in the make_pack_header("resources") target.
|
# Add associated .h files in the make_pack_header("resources") target.
|
||||||
sources = [
|
sources = [
|
||||||
"$root_gen_dir/blink/devtools_resources.pak",
|
"$root_gen_dir/content/browser/devtools/devtools_resources.pak",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Use public_deps so that generated grit headers are discoverable from
|
# Use public_deps so that generated grit headers are discoverable from
|
||||||
@@ -1163,7 +1162,6 @@ template("make_pack_header") {
|
|||||||
make_pack_header("resources") {
|
make_pack_header("resources") {
|
||||||
header = "$root_out_dir/includes/include/cef_pack_resources.h"
|
header = "$root_out_dir/includes/include/cef_pack_resources.h"
|
||||||
inputs = [
|
inputs = [
|
||||||
"$root_gen_dir/blink/grit/devtools_resources.h",
|
|
||||||
"$root_gen_dir/blink/public/resources/grit/blink_image_resources.h",
|
"$root_gen_dir/blink/public/resources/grit/blink_image_resources.h",
|
||||||
"$root_gen_dir/blink/public/resources/grit/blink_resources.h",
|
"$root_gen_dir/blink/public/resources/grit/blink_resources.h",
|
||||||
"$root_gen_dir/cef/grit/cef_resources.h",
|
"$root_gen_dir/cef/grit/cef_resources.h",
|
||||||
@@ -1173,6 +1171,7 @@ make_pack_header("resources") {
|
|||||||
"$root_gen_dir/chrome/grit/net_internals_resources.h",
|
"$root_gen_dir/chrome/grit/net_internals_resources.h",
|
||||||
"$root_gen_dir/chrome/grit/renderer_resources.h",
|
"$root_gen_dir/chrome/grit/renderer_resources.h",
|
||||||
"$root_gen_dir/components/grit/components_resources.h",
|
"$root_gen_dir/components/grit/components_resources.h",
|
||||||
|
"$root_gen_dir/content/browser/devtools/grit/devtools_resources.h",
|
||||||
"$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
|
"$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
|
||||||
"$root_gen_dir/content/grit/content_resources.h",
|
"$root_gen_dir/content/grit/content_resources.h",
|
||||||
"$root_gen_dir/extensions/grit/extensions_browser_resources.h",
|
"$root_gen_dir/extensions/grit/extensions_browser_resources.h",
|
||||||
|
@@ -7,5 +7,5 @@
|
|||||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||||
|
|
||||||
{
|
{
|
||||||
'chromium_checkout': 'refs/tags/57.0.2987.133',
|
'chromium_checkout': 'refs/tags/58.0.3029.81',
|
||||||
}
|
}
|
||||||
|
@@ -48,13 +48,13 @@
|
|||||||
# libgtkglext1-dev (required by the cefclient target only)
|
# libgtkglext1-dev (required by the cefclient target only)
|
||||||
#
|
#
|
||||||
# - Mac OS X requirements:
|
# - Mac OS X requirements:
|
||||||
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 7.2
|
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 8.3
|
||||||
# and OS X 10.11 are recommended. The Xcode command-line tools must also be
|
# 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.
|
# installed. Only 64-bit builds are supported on OS X.
|
||||||
#
|
#
|
||||||
# - Windows requirements:
|
# - Windows requirements:
|
||||||
# Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio
|
# Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio
|
||||||
# 2015 Update 2 and Windows 10 64-bit are recommended.
|
# 2015 Update 3 and Windows 10 64-bit are recommended.
|
||||||
#
|
#
|
||||||
# BUILD EXAMPLES
|
# BUILD EXAMPLES
|
||||||
#
|
#
|
||||||
|
@@ -47,7 +47,8 @@ The base CEF framework includes support for the C and C++ programming languages.
|
|||||||
* .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue
|
* .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue
|
||||||
* .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx
|
* .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx
|
||||||
* Delphi (CEF1) - http://code.google.com/p/delphichromiumembedded/
|
* Delphi (CEF1) - http://code.google.com/p/delphichromiumembedded/
|
||||||
* Delphi (CEF3) - http://code.google.com/p/dcef3/
|
* Delphi (CEF3) - https://github.com/hgourvest/dcef3
|
||||||
|
* Delphi (CEF3) - https://github.com/salvadordf/CEF4Delphi
|
||||||
* Go - https://github.com/CzarekTomczak/cef2go
|
* Go - https://github.com/CzarekTomczak/cef2go
|
||||||
* Java - https://bitbucket.org/chromiumembedded/java-cef
|
* Java - https://bitbucket.org/chromiumembedded/java-cef
|
||||||
* Java - http://code.google.com/p/javacef/
|
* Java - http://code.google.com/p/javacef/
|
||||||
|
@@ -19,7 +19,7 @@ macro(PRINT_CEF_CONFIG)
|
|||||||
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
|
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
|
||||||
message(STATUS "Project architecture: ${PROJECT_ARCH}")
|
message(STATUS "Project architecture: ${PROJECT_ARCH}")
|
||||||
|
|
||||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
if(GEN_NINJA OR GEN_MAKEFILES)
|
||||||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -81,8 +81,7 @@ endmacro()
|
|||||||
|
|
||||||
# Determine the target output directory based on platform and generator.
|
# Determine the target output directory based on platform and generator.
|
||||||
macro(SET_CEF_TARGET_OUT_DIR)
|
macro(SET_CEF_TARGET_OUT_DIR)
|
||||||
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR
|
if(GEN_NINJA OR GEN_MAKEFILES)
|
||||||
${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
|
||||||
# By default Ninja and Make builds don't create a subdirectory named after
|
# By default Ninja and Make builds don't create a subdirectory named after
|
||||||
# the configuration.
|
# the configuration.
|
||||||
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
|
set(CEF_TARGET_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
|
||||||
@@ -276,17 +275,17 @@ endmacro()
|
|||||||
# SET_EXECUTABLE_TARGET_PROPERTIES() instead of calling this macro directly.
|
# SET_EXECUTABLE_TARGET_PROPERTIES() instead of calling this macro directly.
|
||||||
macro(SET_COMMON_TARGET_PROPERTIES target)
|
macro(SET_COMMON_TARGET_PROPERTIES target)
|
||||||
# Compile flags.
|
# Compile flags.
|
||||||
target_compile_options(${target} PUBLIC ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS})
|
target_compile_options(${target} PRIVATE ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS})
|
||||||
target_compile_options(${target} PUBLIC $<$<CONFIG:Debug>:${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}>)
|
target_compile_options(${target} PRIVATE $<$<CONFIG:Debug>:${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}>)
|
||||||
target_compile_options(${target} PUBLIC $<$<CONFIG:Release>:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>)
|
target_compile_options(${target} PRIVATE $<$<CONFIG:Release>:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>)
|
||||||
|
|
||||||
# Compile definitions.
|
# Compile definitions.
|
||||||
target_compile_definitions(${target} PUBLIC ${CEF_COMPILER_DEFINES})
|
target_compile_definitions(${target} PRIVATE ${CEF_COMPILER_DEFINES})
|
||||||
target_compile_definitions(${target} PUBLIC $<$<CONFIG:Debug>:${CEF_COMPILER_DEFINES_DEBUG}>)
|
target_compile_definitions(${target} PRIVATE $<$<CONFIG:Debug>:${CEF_COMPILER_DEFINES_DEBUG}>)
|
||||||
target_compile_definitions(${target} PUBLIC $<$<CONFIG:Release>:${CEF_COMPILER_DEFINES_RELEASE}>)
|
target_compile_definitions(${target} PRIVATE $<$<CONFIG:Release>:${CEF_COMPILER_DEFINES_RELEASE}>)
|
||||||
|
|
||||||
# Include directories.
|
# Include directories.
|
||||||
target_include_directories(${target} PUBLIC ${CEF_INCLUDE_PATH})
|
target_include_directories(${target} PRIVATE ${CEF_INCLUDE_PATH})
|
||||||
|
|
||||||
# Linker flags.
|
# Linker flags.
|
||||||
if(CEF_LINKER_FLAGS)
|
if(CEF_LINKER_FLAGS)
|
||||||
|
@@ -37,9 +37,14 @@ if(NOT DEFINED PROJECT_ARCH)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
|
||||||
|
set(GEN_NINJA 1)
|
||||||
|
elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||||
|
set(GEN_MAKEFILES 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Determine the build type.
|
# Determine the build type.
|
||||||
if(NOT CMAKE_BUILD_TYPE AND
|
if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES))
|
||||||
(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles"))
|
|
||||||
# CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
|
# CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
|
message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
|
||||||
@@ -314,6 +319,14 @@ endif()
|
|||||||
#
|
#
|
||||||
|
|
||||||
if(OS_WINDOWS)
|
if(OS_WINDOWS)
|
||||||
|
if (GEN_NINJA)
|
||||||
|
# When using the Ninja generator clear the CMake defaults to avoid excessive
|
||||||
|
# console warnings (see issue #2120).
|
||||||
|
set(CMAKE_CXX_FLAGS "")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Configure use of the sandbox.
|
# Configure use of the sandbox.
|
||||||
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
|
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
|
||||||
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900)
|
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900)
|
||||||
@@ -359,8 +372,13 @@ if(OS_WINDOWS)
|
|||||||
# defaults here.
|
# defaults here.
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "")
|
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||||
|
|
||||||
|
# These flags are required to successfully link and run applications using
|
||||||
|
# the sandbox library.
|
||||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||||
/MT # Multithreaded release runtime
|
/MT # Multithreaded release runtime
|
||||||
|
/O2 # Maximize speed optimization
|
||||||
|
/Zc:inline # Remove unreferenced functions or data
|
||||||
|
/Oy- # Disable frame-pointer omission
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||||
@@ -463,10 +481,19 @@ if(OS_WINDOWS)
|
|||||||
# Configure use of ATL.
|
# Configure use of ATL.
|
||||||
option(USE_ATL "Enable or disable use of ATL." ON)
|
option(USE_ATL "Enable or disable use of ATL." ON)
|
||||||
if(USE_ATL)
|
if(USE_ATL)
|
||||||
|
# Locate the VC directory. The cl.exe path returned by CMAKE_CXX_COMPILER
|
||||||
|
# may be at different directory depths depending on the toolchain version
|
||||||
|
# (e.g. "VC/bin/cl.exe", "VC/bin/amd64_x86/cl.exe", etc).
|
||||||
|
get_filename_component(VC_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
||||||
|
get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
|
||||||
|
while(NOT ${VC_DIR_NAME} STREQUAL "VC")
|
||||||
|
get_filename_component(VC_DIR ${VC_DIR} DIRECTORY)
|
||||||
|
get_filename_component(VC_DIR_NAME ${VC_DIR} NAME)
|
||||||
|
endwhile()
|
||||||
|
|
||||||
# Determine if the Visual Studio install supports ATL.
|
# Determine if the Visual Studio install supports ATL.
|
||||||
get_filename_component(VC_BIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
|
|
||||||
get_filename_component(VC_DIR ${VC_BIN_DIR} DIRECTORY)
|
|
||||||
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
|
if(NOT IS_DIRECTORY "${VC_DIR}/atlmfc")
|
||||||
|
message(WARNING "ATL is not supported by your VC installation.")
|
||||||
set(USE_ATL OFF)
|
set(USE_ATL OFF)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@@ -430,12 +430,15 @@ typedef struct _cef_browser_host_t {
|
|||||||
struct _cef_pdf_print_callback_t* callback);
|
struct _cef_pdf_print_callback_t* callback);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Search for |searchText|. |identifier| can be used to have multiple searches
|
// Search for |searchText|. |identifier| must be a unique ID and these IDs
|
||||||
// running simultaniously. |forward| indicates whether to search forward or
|
// must strictly increase so that newer requests always have greater IDs than
|
||||||
// backward within the page. |matchCase| indicates whether the search should
|
// older requests. If |identifier| is zero or less than the previous ID value
|
||||||
// be case-sensitive. |findNext| indicates whether this is the first request
|
// then it will be automatically assigned a new valid ID. |forward| indicates
|
||||||
// or a follow-up. The cef_find_handler_t instance, if any, returned via
|
// whether to search forward or backward within the page. |matchCase|
|
||||||
// cef_client_t::GetFindHandler will be called to report find results.
|
// indicates whether the search should be case-sensitive. |findNext| indicates
|
||||||
|
// whether this is the first request or a follow-up. The cef_find_handler_t
|
||||||
|
// instance, if any, returned via cef_client_t::GetFindHandler will be called
|
||||||
|
// to report find results.
|
||||||
///
|
///
|
||||||
void (CEF_CALLBACK *find)(struct _cef_browser_host_t* self, int identifier,
|
void (CEF_CALLBACK *find)(struct _cef_browser_host_t* self, int identifier,
|
||||||
const cef_string_t* searchText, int forward, int matchCase,
|
const cef_string_t* searchText, int forward, int matchCase,
|
||||||
|
@@ -76,7 +76,9 @@ typedef struct _cef_life_span_handler_t {
|
|||||||
// is set to false (0) the new browser will not be scriptable and may not be
|
// is set to false (0) the new browser will not be scriptable and may not be
|
||||||
// hosted in the same renderer process as the source browser. Any
|
// hosted in the same renderer process as the source browser. Any
|
||||||
// modifications to |windowInfo| will be ignored if the parent browser is
|
// modifications to |windowInfo| will be ignored if the parent browser is
|
||||||
// wrapped in a cef_browser_view_t.
|
// wrapped in a cef_browser_view_t. Popup browser creation will be canceled if
|
||||||
|
// the parent browser is destroyed before the popup browser creation completes
|
||||||
|
// (indicated by a call to OnAfterCreated for the popup browser).
|
||||||
///
|
///
|
||||||
int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self,
|
int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self,
|
||||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
|
@@ -70,15 +70,16 @@ typedef struct _cef_load_handler_t {
|
|||||||
int canGoForward);
|
int canGoForward);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called when the browser begins loading a frame. The |frame| value will
|
// Called after a navigation has been committed and before the browser begins
|
||||||
// never be NULL -- call the is_main() function to check if this frame is the
|
// loading contents in the frame. The |frame| value will never be NULL -- call
|
||||||
// main frame. |transition_type| provides information about the source of the
|
// the is_main() function to check if this frame is the main frame.
|
||||||
// navigation and an accurate value is only available in the browser process.
|
// |transition_type| provides information about the source of the navigation
|
||||||
// Multiple frames may be loading at the same time. Sub-frames may start or
|
// and an accurate value is only available in the browser process. Multiple
|
||||||
// continue loading after the main frame load has ended. This function will
|
// frames may be loading at the same time. Sub-frames may start or continue
|
||||||
// always be called for all frames irrespective of whether the request
|
// loading after the main frame load has ended. This function will not be
|
||||||
// completes successfully. For notification of overall browser load status use
|
// called for same page navigations (fragments, history state, etc.) or for
|
||||||
// OnLoadingStateChange instead.
|
// navigations that fail or are canceled before commit. For notification of
|
||||||
|
// overall browser load status use OnLoadingStateChange instead.
|
||||||
///
|
///
|
||||||
void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
|
void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
|
||||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
@@ -89,19 +90,21 @@ typedef struct _cef_load_handler_t {
|
|||||||
// never be NULL -- call the is_main() function to check if this frame is the
|
// never be NULL -- call the is_main() function to check if this frame is the
|
||||||
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||||
// start or continue loading after the main frame load has ended. This
|
// start or continue loading after the main frame load has ended. This
|
||||||
// function will always be called for all frames irrespective of whether the
|
// function will not be called for same page navigations (fragments, history
|
||||||
// request completes successfully. For notification of overall browser load
|
// state, etc.) or for navigations that fail or are canceled before commit.
|
||||||
// status use OnLoadingStateChange instead.
|
// For notification of overall browser load status use OnLoadingStateChange
|
||||||
|
// instead.
|
||||||
///
|
///
|
||||||
void (CEF_CALLBACK *on_load_end)(struct _cef_load_handler_t* self,
|
void (CEF_CALLBACK *on_load_end)(struct _cef_load_handler_t* self,
|
||||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
int httpStatusCode);
|
int httpStatusCode);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called when the resource load for a navigation fails or is canceled.
|
// Called when a navigation fails or is canceled. This function may be called
|
||||||
// |errorCode| is the error code number, |errorText| is the error text and
|
// by itself if before commit or in combination with OnLoadStart/OnLoadEnd if
|
||||||
// |failedUrl| is the URL that failed to load. See net\base\net_error_list.h
|
// after commit. |errorCode| is the error code number, |errorText| is the
|
||||||
// for complete descriptions of the error codes.
|
// error text and |failedUrl| is the URL that failed to load. See
|
||||||
|
// net\base\net_error_list.h for complete descriptions of the error codes.
|
||||||
///
|
///
|
||||||
void (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self,
|
void (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self,
|
||||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
|
@@ -108,9 +108,12 @@ typedef struct _cef_scheme_registrar_t {
|
|||||||
// security rules as those applied to "https" URLs. For example, loading this
|
// security rules as those applied to "https" URLs. For example, loading this
|
||||||
// scheme from other secure schemes will not trigger mixed content warnings.
|
// scheme from other secure schemes will not trigger mixed content warnings.
|
||||||
//
|
//
|
||||||
// If |is_cors_enabled| is true (1) the scheme that can be sent CORS requests.
|
// If |is_cors_enabled| is true (1) the scheme can be sent CORS requests. This
|
||||||
// This value should be true (1) in most cases where |is_standard| is true
|
// value should be true (1) in most cases where |is_standard| is true (1).
|
||||||
// (1).
|
//
|
||||||
|
// If |is_csp_bypassing| is true (1) the scheme can bypass Content-Security-
|
||||||
|
// Policy (CSP) checks. This value should be false (0) in most cases where
|
||||||
|
// |is_standard| is true (1).
|
||||||
//
|
//
|
||||||
// This function may be called on any thread. It should only be called once
|
// This function may be called on any thread. It should only be called once
|
||||||
// per unique |scheme_name| value. If |scheme_name| is already registered or
|
// per unique |scheme_name| value. If |scheme_name| is already registered or
|
||||||
@@ -118,7 +121,8 @@ typedef struct _cef_scheme_registrar_t {
|
|||||||
///
|
///
|
||||||
int (CEF_CALLBACK *add_custom_scheme)(struct _cef_scheme_registrar_t* self,
|
int (CEF_CALLBACK *add_custom_scheme)(struct _cef_scheme_registrar_t* self,
|
||||||
const cef_string_t* scheme_name, int is_standard, int is_local,
|
const cef_string_t* scheme_name, int is_standard, int is_local,
|
||||||
int is_display_isolated, int is_secure, int is_cors_enabled);
|
int is_display_isolated, int is_secure, int is_cors_enabled,
|
||||||
|
int is_csp_bypassing);
|
||||||
} cef_scheme_registrar_t;
|
} cef_scheme_registrar_t;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ class CefAuthCallback : public virtual CefBaseRefCounted {
|
|||||||
///
|
///
|
||||||
// Continue the authentication request.
|
// Continue the authentication request.
|
||||||
///
|
///
|
||||||
/*--cef(capi_name=cont)--*/
|
/*--cef(capi_name=cont,optional_param=password)--*/
|
||||||
virtual void Continue(const CefString& username,
|
virtual void Continue(const CefString& username,
|
||||||
const CefString& password) =0;
|
const CefString& password) =0;
|
||||||
|
|
||||||
|
@@ -472,12 +472,15 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
|||||||
CefRefPtr<CefPdfPrintCallback> callback) =0;
|
CefRefPtr<CefPdfPrintCallback> callback) =0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Search for |searchText|. |identifier| can be used to have multiple searches
|
// Search for |searchText|. |identifier| must be a unique ID and these IDs
|
||||||
// running simultaniously. |forward| indicates whether to search forward or
|
// must strictly increase so that newer requests always have greater IDs than
|
||||||
// backward within the page. |matchCase| indicates whether the search should
|
// older requests. If |identifier| is zero or less than the previous ID value
|
||||||
// be case-sensitive. |findNext| indicates whether this is the first request
|
// then it will be automatically assigned a new valid ID. |forward| indicates
|
||||||
// or a follow-up. The CefFindHandler instance, if any, returned via
|
// whether to search forward or backward within the page. |matchCase|
|
||||||
// CefClient::GetFindHandler will be called to report find results.
|
// indicates whether the search should be case-sensitive. |findNext| indicates
|
||||||
|
// whether this is the first request or a follow-up. The CefFindHandler
|
||||||
|
// instance, if any, returned via CefClient::GetFindHandler will be called to
|
||||||
|
// report find results.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void Find(int identifier, const CefString& searchText,
|
virtual void Find(int identifier, const CefString& searchText,
|
||||||
|
@@ -71,7 +71,9 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
|
|||||||
// false the new browser will not be scriptable and may not be hosted in the
|
// false the new browser will not be scriptable and may not be hosted in the
|
||||||
// same renderer process as the source browser. Any modifications to
|
// same renderer process as the source browser. Any modifications to
|
||||||
// |windowInfo| will be ignored if the parent browser is wrapped in a
|
// |windowInfo| will be ignored if the parent browser is wrapped in a
|
||||||
// CefBrowserView.
|
// CefBrowserView. Popup browser creation will be canceled if the parent
|
||||||
|
// browser is destroyed before the popup browser creation completes (indicated
|
||||||
|
// by a call to OnAfterCreated for the popup browser).
|
||||||
///
|
///
|
||||||
/*--cef(optional_param=target_url,optional_param=target_frame_name)--*/
|
/*--cef(optional_param=target_url,optional_param=target_frame_name)--*/
|
||||||
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
|
||||||
|
@@ -67,15 +67,16 @@ class CefLoadHandler : public virtual CefBaseRefCounted {
|
|||||||
bool canGoForward) {}
|
bool canGoForward) {}
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called when the browser begins loading a frame. The |frame| value will
|
// Called after a navigation has been committed and before the browser begins
|
||||||
// never be empty -- call the IsMain() method to check if this frame is the
|
// loading contents in the frame. The |frame| value will never be empty --
|
||||||
// main frame. |transition_type| provides information about the source of the
|
// call the IsMain() method to check if this frame is the main frame.
|
||||||
// navigation and an accurate value is only available in the browser process.
|
// |transition_type| provides information about the source of the navigation
|
||||||
// Multiple frames may be loading at the same time. Sub-frames may start or
|
// and an accurate value is only available in the browser process. Multiple
|
||||||
// continue loading after the main frame load has ended. This method will
|
// frames may be loading at the same time. Sub-frames may start or continue
|
||||||
// always be called for all frames irrespective of whether the request
|
// loading after the main frame load has ended. This method will not be called
|
||||||
// completes successfully. For notification of overall browser load status use
|
// for same page navigations (fragments, history state, etc.) or for
|
||||||
// OnLoadingStateChange instead.
|
// navigations that fail or are canceled before commit. For notification of
|
||||||
|
// overall browser load status use OnLoadingStateChange instead.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||||
@@ -87,9 +88,10 @@ class CefLoadHandler : public virtual CefBaseRefCounted {
|
|||||||
// never be empty -- call the IsMain() method to check if this frame is the
|
// never be empty -- call the IsMain() method to check if this frame is the
|
||||||
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||||
// start or continue loading after the main frame load has ended. This method
|
// start or continue loading after the main frame load has ended. This method
|
||||||
// will always be called for all frames irrespective of whether the request
|
// will not be called for same page navigations (fragments, history state,
|
||||||
// completes successfully. For notification of overall browser load status use
|
// etc.) or for navigations that fail or are canceled before commit. For
|
||||||
// OnLoadingStateChange instead.
|
// notification of overall browser load status use OnLoadingStateChange
|
||||||
|
// instead.
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||||
@@ -97,10 +99,11 @@ class CefLoadHandler : public virtual CefBaseRefCounted {
|
|||||||
int httpStatusCode) {}
|
int httpStatusCode) {}
|
||||||
|
|
||||||
///
|
///
|
||||||
// Called when the resource load for a navigation fails or is canceled.
|
// Called when a navigation fails or is canceled. This method may be called
|
||||||
// |errorCode| is the error code number, |errorText| is the error text and
|
// by itself if before commit or in combination with OnLoadStart/OnLoadEnd if
|
||||||
// |failedUrl| is the URL that failed to load. See net\base\net_error_list.h
|
// after commit. |errorCode| is the error code number, |errorText| is the
|
||||||
// for complete descriptions of the error codes.
|
// error text and |failedUrl| is the URL that failed to load.
|
||||||
|
// See net\base\net_error_list.h for complete descriptions of the error codes.
|
||||||
///
|
///
|
||||||
/*--cef(optional_param=errorText)--*/
|
/*--cef(optional_param=errorText)--*/
|
||||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||||
|
@@ -132,8 +132,12 @@ class CefSchemeRegistrar : public CefBaseScoped {
|
|||||||
// rules as those applied to "https" URLs. For example, loading this scheme
|
// rules as those applied to "https" URLs. For example, loading this scheme
|
||||||
// from other secure schemes will not trigger mixed content warnings.
|
// from other secure schemes will not trigger mixed content warnings.
|
||||||
//
|
//
|
||||||
// If |is_cors_enabled| is true the scheme that can be sent CORS requests.
|
// If |is_cors_enabled| is true the scheme can be sent CORS requests. This
|
||||||
// This value should be true in most cases where |is_standard| is true.
|
// value should be true in most cases where |is_standard| is true.
|
||||||
|
//
|
||||||
|
// If |is_csp_bypassing| is true the scheme can bypass Content-Security-Policy
|
||||||
|
// (CSP) checks. This value should be false in most cases where |is_standard|
|
||||||
|
// is true.
|
||||||
//
|
//
|
||||||
// This function may be called on any thread. It should only be called once
|
// This function may be called on any thread. It should only be called once
|
||||||
// per unique |scheme_name| value. If |scheme_name| is already registered or
|
// per unique |scheme_name| value. If |scheme_name| is already registered or
|
||||||
@@ -145,7 +149,8 @@ class CefSchemeRegistrar : public CefBaseScoped {
|
|||||||
bool is_local,
|
bool is_local,
|
||||||
bool is_display_isolated,
|
bool is_display_isolated,
|
||||||
bool is_secure,
|
bool is_secure,
|
||||||
bool is_cors_enabled) =0;
|
bool is_cors_enabled,
|
||||||
|
bool is_csp_bypassing) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -43,13 +43,17 @@
|
|||||||
#else
|
#else
|
||||||
#define CEF_EXPORT
|
#define CEF_EXPORT
|
||||||
#endif
|
#endif
|
||||||
#define CEF_CALLBACK __stdcall
|
|
||||||
|
|
||||||
#elif defined(COMPILER_GCC)
|
#elif defined(COMPILER_GCC)
|
||||||
|
|
||||||
#define CEF_EXPORT __attribute__ ((visibility("default")))
|
#define CEF_EXPORT __attribute__ ((visibility("default")))
|
||||||
#define CEF_CALLBACK
|
|
||||||
|
|
||||||
#endif // COMPILER_GCC
|
#endif // COMPILER_GCC
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
#define CEF_CALLBACK __stdcall
|
||||||
|
#else
|
||||||
|
#define CEF_CALLBACK
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
|
#endif // CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
|
||||||
|
@@ -186,10 +186,13 @@ using CefOwnPtr = scoped_ptr<T, D>;
|
|||||||
// A CefRawPtr<T> is the same as T*
|
// A CefRawPtr<T> is the same as T*
|
||||||
///
|
///
|
||||||
#if defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT)
|
#if defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT)
|
||||||
|
#define CEF_RAW_PTR_GET(r) r
|
||||||
template <class T>
|
template <class T>
|
||||||
using CefRawPtr = T*;
|
using CefRawPtr = T*;
|
||||||
#else
|
#else
|
||||||
// Simple wrapper implementation that behaves as much like T* as possible.
|
// Simple wrapper implementation that behaves as much like T* as possible.
|
||||||
|
// CEF_RAW_PTR_GET is required for VS2008 compatibility (Issue #2155).
|
||||||
|
#define CEF_RAW_PTR_GET(r) r.get()
|
||||||
template <class T>
|
template <class T>
|
||||||
class CefRawPtr {
|
class CefRawPtr {
|
||||||
public:
|
public:
|
||||||
|
@@ -1947,7 +1947,6 @@ typedef struct _cef_popup_features_t {
|
|||||||
|
|
||||||
int fullscreen;
|
int fullscreen;
|
||||||
int dialog;
|
int dialog;
|
||||||
cef_string_list_t additionalFeatures;
|
|
||||||
} cef_popup_features_t;
|
} cef_popup_features_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@@ -509,18 +509,10 @@ struct CefPopupFeaturesTraits {
|
|||||||
s->resizable = true;
|
s->resizable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void clear(struct_type* s) {
|
static inline void clear(struct_type* s) {}
|
||||||
if (s->additionalFeatures)
|
|
||||||
cef_string_list_free(s->additionalFeatures);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void set(const struct_type* src, struct_type* target,
|
static inline void set(const struct_type* src, struct_type* target,
|
||||||
bool copy) {
|
bool copy) {
|
||||||
if (target->additionalFeatures)
|
|
||||||
cef_string_list_free(target->additionalFeatures);
|
|
||||||
target->additionalFeatures = src->additionalFeatures ?
|
|
||||||
cef_string_list_copy(src->additionalFeatures) : NULL;
|
|
||||||
|
|
||||||
target->x = src->x;
|
target->x = src->x;
|
||||||
target->xSet = src->xSet;
|
target->xSet = src->xSet;
|
||||||
target->y = src->y;
|
target->y = src->y;
|
||||||
|
@@ -118,6 +118,7 @@
|
|||||||
// CefURLRequestContextGetter* destruction.
|
// CefURLRequestContextGetter* destruction.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
class CefRequestContextImpl;
|
||||||
class HostContentSettingsMap;
|
class HostContentSettingsMap;
|
||||||
class PrefService;
|
class PrefService;
|
||||||
|
|
||||||
@@ -146,6 +147,12 @@ class CefBrowserContext : public ChromeProfileStub {
|
|||||||
// Profile methods.
|
// Profile methods.
|
||||||
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
|
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
|
||||||
|
|
||||||
|
// Returns a RequestContext associated with this object. If this object is a
|
||||||
|
// *Proxy then it will return the single associated proxy RequestContext. If
|
||||||
|
// this object is an *Impl then it will return the first non-proxy
|
||||||
|
// RequestContext, if one exists, otherwise the first proxy RequestContext.
|
||||||
|
virtual CefRequestContextImpl* GetCefRequestContext() const = 0;
|
||||||
|
|
||||||
// Returns the settings associated with this object. Safe to call from any
|
// Returns the settings associated with this object. Safe to call from any
|
||||||
// thread.
|
// thread.
|
||||||
virtual const CefRequestContextSettings& GetSettings() const = 0;
|
virtual const CefRequestContextSettings& GetSettings() const = 0;
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include "libcef/browser/extensions/extension_system.h"
|
#include "libcef/browser/extensions/extension_system.h"
|
||||||
#include "libcef/browser/permissions/permission_manager.h"
|
#include "libcef/browser/permissions/permission_manager.h"
|
||||||
#include "libcef/browser/prefs/browser_prefs.h"
|
#include "libcef/browser/prefs/browser_prefs.h"
|
||||||
|
#include "libcef/browser/request_context_impl.h"
|
||||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
#include "libcef/common/cef_switches.h"
|
#include "libcef/common/cef_switches.h"
|
||||||
@@ -211,7 +212,7 @@ CefBrowserContextImpl::~CefBrowserContextImpl() {
|
|||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
// No CefRequestContextImpl should be referencing this object any longer.
|
// No CefRequestContextImpl should be referencing this object any longer.
|
||||||
DCHECK_EQ(request_context_count_, 0);
|
DCHECK(request_context_set_.empty());
|
||||||
|
|
||||||
// Unregister the context first to avoid re-entrancy during shutdown.
|
// Unregister the context first to avoid re-entrancy during shutdown.
|
||||||
g_manager.Get().RemoveImpl(this, cache_path_);
|
g_manager.Get().RemoveImpl(this, cache_path_);
|
||||||
@@ -308,21 +309,33 @@ void CefBrowserContextImpl::RemoveProxy(const CefBrowserContextProxy* proxy) {
|
|||||||
visitedlink_listener_->RemoveListenerForContext(proxy);
|
visitedlink_listener_->RemoveListenerForContext(proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContextImpl::AddRequestContext() {
|
void CefBrowserContextImpl::AddCefRequestContext(
|
||||||
|
CefRequestContextImpl* context) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
request_context_count_++;
|
request_context_set_.insert(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContextImpl::RemoveRequestContext() {
|
void CefBrowserContextImpl::RemoveCefRequestContext(
|
||||||
|
CefRequestContextImpl* context) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
request_context_count_--;
|
request_context_set_.erase(context);
|
||||||
DCHECK_GE(request_context_count_, 0);
|
|
||||||
|
|
||||||
// Delete non-global contexts when the reference count reaches zero.
|
// Delete ourselves when the reference count reaches zero.
|
||||||
if (request_context_count_ == 0 &&
|
if (request_context_set_.empty())
|
||||||
this != CefContentBrowserClient::Get()->browser_context()) {
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefRequestContextImpl* CefBrowserContextImpl::GetCefRequestContext(
|
||||||
|
bool impl_only) const {
|
||||||
|
CEF_REQUIRE_UIT();
|
||||||
|
// First try to find a non-proxy RequestContext.
|
||||||
|
for (CefRequestContextImpl* impl : request_context_set_) {
|
||||||
|
if (!impl->GetHandler())
|
||||||
|
return impl;
|
||||||
|
}
|
||||||
|
if (impl_only)
|
||||||
|
return nullptr;
|
||||||
|
return *request_context_set_.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -463,6 +476,10 @@ const PrefService* CefBrowserContextImpl::GetPrefs() const {
|
|||||||
return pref_service_.get();
|
return pref_service_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefRequestContextImpl* CefBrowserContextImpl::GetCefRequestContext() const {
|
||||||
|
return GetCefRequestContext(false);
|
||||||
|
}
|
||||||
|
|
||||||
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
|
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
|
||||||
return settings_;
|
return settings_;
|
||||||
}
|
}
|
||||||
|
@@ -52,10 +52,11 @@ class CefBrowserContextImpl : public CefBrowserContext,
|
|||||||
void AddProxy(const CefBrowserContextProxy* proxy);
|
void AddProxy(const CefBrowserContextProxy* proxy);
|
||||||
void RemoveProxy(const CefBrowserContextProxy* proxy);
|
void RemoveProxy(const CefBrowserContextProxy* proxy);
|
||||||
|
|
||||||
// Track associated CefRequestContextImpl objects. If this object is a non-
|
// Track associated CefRequestContextImpl objects. This object will delete
|
||||||
// global context then it will delete itself when the count reaches zero.
|
// itself when the count reaches zero.
|
||||||
void AddRequestContext();
|
void AddCefRequestContext(CefRequestContextImpl* context);
|
||||||
void RemoveRequestContext();
|
void RemoveCefRequestContext(CefRequestContextImpl* context);
|
||||||
|
CefRequestContextImpl* GetCefRequestContext(bool impl_only) const;
|
||||||
|
|
||||||
// BrowserContext methods.
|
// BrowserContext methods.
|
||||||
base::FilePath GetPath() const override;
|
base::FilePath GetPath() const override;
|
||||||
@@ -88,6 +89,7 @@ class CefBrowserContextImpl : public CefBrowserContext,
|
|||||||
const PrefService* GetPrefs() const override;
|
const PrefService* GetPrefs() const override;
|
||||||
|
|
||||||
// CefBrowserContext methods.
|
// CefBrowserContext methods.
|
||||||
|
CefRequestContextImpl* GetCefRequestContext() const override;
|
||||||
const CefRequestContextSettings& GetSettings() const override;
|
const CefRequestContextSettings& GetSettings() const override;
|
||||||
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
||||||
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
||||||
@@ -97,7 +99,7 @@ class CefBrowserContextImpl : public CefBrowserContext,
|
|||||||
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
|
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
|
||||||
|
|
||||||
// Guaranteed to exist once this object has been initialized.
|
// Guaranteed to exist once this object has been initialized.
|
||||||
scoped_refptr<CefURLRequestContextGetterImpl> request_context() const {
|
scoped_refptr<CefURLRequestContextGetterImpl> request_context_getter() const {
|
||||||
return url_request_getter_;
|
return url_request_getter_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,8 +113,8 @@ class CefBrowserContextImpl : public CefBrowserContext,
|
|||||||
CefRequestContextSettings settings_;
|
CefRequestContextSettings settings_;
|
||||||
base::FilePath cache_path_;
|
base::FilePath cache_path_;
|
||||||
|
|
||||||
// Number of CefRequestContextImpl objects referencing this object.
|
// CefRequestContextImpl objects referencing this object.
|
||||||
int request_context_count_ = 0;
|
std::set<CefRequestContextImpl*> request_context_set_;
|
||||||
|
|
||||||
std::unique_ptr<PrefService> pref_service_;
|
std::unique_ptr<PrefService> pref_service_;
|
||||||
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
||||||
|
@@ -58,9 +58,11 @@ bool ShouldProxyUserData(const void* key) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CefBrowserContextProxy::CefBrowserContextProxy(
|
CefBrowserContextProxy::CefBrowserContextProxy(
|
||||||
|
CefRequestContextImpl* const request_context,
|
||||||
CefRefPtr<CefRequestContextHandler> handler,
|
CefRefPtr<CefRequestContextHandler> handler,
|
||||||
CefBrowserContextImpl* parent)
|
CefBrowserContextImpl* parent)
|
||||||
: CefBrowserContext(true),
|
: CefBrowserContext(true),
|
||||||
|
request_context_(request_context),
|
||||||
handler_(handler),
|
handler_(handler),
|
||||||
parent_(parent) {
|
parent_(parent) {
|
||||||
DCHECK(handler_.get());
|
DCHECK(handler_.get());
|
||||||
@@ -98,6 +100,14 @@ void CefBrowserContextProxy::SetUserData(const void* key, Data* data) {
|
|||||||
BrowserContext::SetUserData(key, data);
|
BrowserContext::SetUserData(key, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserContextProxy::SetUserData(const void* key,
|
||||||
|
std::unique_ptr<Data> data) {
|
||||||
|
if (ShouldProxyUserData(key))
|
||||||
|
parent_->SetUserData(key, std::move(data));
|
||||||
|
else
|
||||||
|
BrowserContext::SetUserData(key, std::move(data));
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserContextProxy::RemoveUserData(const void* key) {
|
void CefBrowserContextProxy::RemoveUserData(const void* key) {
|
||||||
if (ShouldProxyUserData(key))
|
if (ShouldProxyUserData(key))
|
||||||
parent_->RemoveUserData(key);
|
parent_->RemoveUserData(key);
|
||||||
@@ -182,6 +192,10 @@ const PrefService* CefBrowserContextProxy::GetPrefs() const {
|
|||||||
return parent_->GetPrefs();
|
return parent_->GetPrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefRequestContextImpl* CefBrowserContextProxy::GetCefRequestContext() const {
|
||||||
|
return request_context_;
|
||||||
|
}
|
||||||
|
|
||||||
const CefRequestContextSettings& CefBrowserContextProxy::GetSettings() const {
|
const CefRequestContextSettings& CefBrowserContextProxy::GetSettings() const {
|
||||||
return parent_->GetSettings();
|
return parent_->GetSettings();
|
||||||
}
|
}
|
||||||
@@ -206,7 +220,7 @@ CefBrowserContextProxy::GetOrCreateStoragePartitionProxy(
|
|||||||
if (!storage_partition_proxy_) {
|
if (!storage_partition_proxy_) {
|
||||||
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter =
|
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter =
|
||||||
new CefURLRequestContextGetterProxy(handler_,
|
new CefURLRequestContextGetterProxy(handler_,
|
||||||
parent_->request_context());
|
parent_->request_context_getter());
|
||||||
resource_context()->set_url_request_context_getter(
|
resource_context()->set_url_request_context_getter(
|
||||||
url_request_getter.get());
|
url_request_getter.get());
|
||||||
storage_partition_proxy_.reset(
|
storage_partition_proxy_.reset(
|
||||||
|
@@ -20,7 +20,8 @@ class CefStoragePartitionProxy;
|
|||||||
// browser_context.h for an object relationship diagram.
|
// browser_context.h for an object relationship diagram.
|
||||||
class CefBrowserContextProxy : public CefBrowserContext {
|
class CefBrowserContextProxy : public CefBrowserContext {
|
||||||
public:
|
public:
|
||||||
CefBrowserContextProxy(CefRefPtr<CefRequestContextHandler> handler,
|
CefBrowserContextProxy(CefRequestContextImpl* const request_context,
|
||||||
|
CefRefPtr<CefRequestContextHandler> handler,
|
||||||
CefBrowserContextImpl* parent);
|
CefBrowserContextImpl* parent);
|
||||||
|
|
||||||
// Must be called immediately after this object is created.
|
// Must be called immediately after this object is created.
|
||||||
@@ -29,6 +30,7 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
|||||||
// SupportsUserData methods.
|
// SupportsUserData methods.
|
||||||
Data* GetUserData(const void* key) const override;
|
Data* GetUserData(const void* key) const override;
|
||||||
void SetUserData(const void* key, Data* data) override;
|
void SetUserData(const void* key, Data* data) override;
|
||||||
|
void SetUserData(const void* key, std::unique_ptr<Data> data) override;
|
||||||
void RemoveUserData(const void* key) override;
|
void RemoveUserData(const void* key) override;
|
||||||
|
|
||||||
// BrowserContext methods.
|
// BrowserContext methods.
|
||||||
@@ -59,6 +61,7 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
|||||||
const PrefService* GetPrefs() const override;
|
const PrefService* GetPrefs() const override;
|
||||||
|
|
||||||
// CefBrowserContext methods.
|
// CefBrowserContext methods.
|
||||||
|
CefRequestContextImpl* GetCefRequestContext() const override;
|
||||||
const CefRequestContextSettings& GetSettings() const override;
|
const CefRequestContextSettings& GetSettings() const override;
|
||||||
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
|
||||||
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
HostContentSettingsMap* GetHostContentSettingsMap() override;
|
||||||
@@ -77,6 +80,9 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
|||||||
|
|
||||||
~CefBrowserContextProxy() override;
|
~CefBrowserContextProxy() override;
|
||||||
|
|
||||||
|
// Guaranteed to outlive this object.
|
||||||
|
CefRequestContextImpl* const request_context_;
|
||||||
|
|
||||||
// Members initialized during construction are safe to access from any thread.
|
// Members initialized during construction are safe to access from any thread.
|
||||||
CefRefPtr<CefRequestContextHandler> handler_;
|
CefRefPtr<CefRequestContextHandler> handler_;
|
||||||
CefBrowserContextImpl* parent_; // Guaranteed to outlive this object.
|
CefBrowserContextImpl* parent_; // Guaranteed to outlive this object.
|
||||||
|
@@ -44,10 +44,10 @@
|
|||||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||||
#include "components/zoom/zoom_controller.h"
|
#include "components/zoom/zoom_controller.h"
|
||||||
#include "content/browser/frame_host/navigation_handle_impl.h"
|
|
||||||
#include "content/browser/renderer_host/render_view_host_impl.h"
|
#include "content/browser/renderer_host/render_view_host_impl.h"
|
||||||
#include "content/browser/gpu/compositor_util.h"
|
#include "content/browser/gpu/compositor_util.h"
|
||||||
#include "content/common/view_messages.h"
|
#include "content/common/view_messages.h"
|
||||||
|
#include "content/public/browser/desktop_media_id.h"
|
||||||
#include "content/public/browser/download_manager.h"
|
#include "content/public/browser/download_manager.h"
|
||||||
#include "content/public/browser/download_url_parameters.h"
|
#include "content/public/browser/download_url_parameters.h"
|
||||||
#include "content/public/browser/host_zoom_map.h"
|
#include "content/public/browser/host_zoom_map.h"
|
||||||
@@ -352,6 +352,11 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
|
|||||||
DCHECK(!opener.get() || browser_info->is_popup());
|
DCHECK(!opener.get() || browser_info->is_popup());
|
||||||
|
|
||||||
if (opener) {
|
if (opener) {
|
||||||
|
if (!opener->platform_delegate_) {
|
||||||
|
// The opener window is being destroyed. Cancel the popup.
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Give the opener browser's platform delegate an opportunity to modify the
|
// Give the opener browser's platform delegate an opportunity to modify the
|
||||||
// new browser's platform delegate.
|
// new browser's platform delegate.
|
||||||
opener->platform_delegate_->PopupWebContentsCreated(
|
opener->platform_delegate_->PopupWebContentsCreated(
|
||||||
@@ -383,7 +388,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
|
|||||||
// CefBrowserViewDelegate::OnBrowserCreated().
|
// CefBrowserViewDelegate::OnBrowserCreated().
|
||||||
browser->platform_delegate_->NotifyBrowserCreated();
|
browser->platform_delegate_->NotifyBrowserCreated();
|
||||||
|
|
||||||
if (opener) {
|
if (opener && opener->platform_delegate_) {
|
||||||
// 3. Notify the opener browser's platform delegate. With Views this will
|
// 3. Notify the opener browser's platform delegate. With Views this will
|
||||||
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
|
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
|
||||||
opener->platform_delegate_->PopupBrowserCreated(browser.get(),
|
opener->platform_delegate_->PopupBrowserCreated(browser.get(),
|
||||||
@@ -781,6 +786,14 @@ void CefBrowserHostImpl::Find(int identifier, const CefString& searchText,
|
|||||||
if (!web_contents_)
|
if (!web_contents_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Every find request must have a unique ID and these IDs must strictly
|
||||||
|
// increase so that newer requests always have greater IDs than older
|
||||||
|
// requests.
|
||||||
|
if (identifier <= find_request_id_counter_)
|
||||||
|
identifier = ++find_request_id_counter_;
|
||||||
|
else
|
||||||
|
find_request_id_counter_ = identifier;
|
||||||
|
|
||||||
blink::WebFindOptions options;
|
blink::WebFindOptions options;
|
||||||
options.forward = forward;
|
options.forward = forward;
|
||||||
options.matchCase = matchCase;
|
options.matchCase = matchCase;
|
||||||
@@ -2275,18 +2288,17 @@ void CefBrowserHostImpl::WebContentsCreated(
|
|||||||
DCHECK(info->is_popup());
|
DCHECK(info->is_popup());
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> opener = GetBrowserForContents(source_contents);
|
CefRefPtr<CefBrowserHostImpl> opener = GetBrowserForContents(source_contents);
|
||||||
DCHECK(opener.get());
|
if (!opener.get())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Popups must share the same BrowserContext as the parent.
|
||||||
CefBrowserContext* browser_context =
|
CefBrowserContext* browser_context =
|
||||||
static_cast<CefBrowserContext*>(new_contents->GetBrowserContext());
|
static_cast<CefBrowserContext*>(new_contents->GetBrowserContext());
|
||||||
DCHECK(browser_context);
|
DCHECK(browser_context);
|
||||||
CefRefPtr<CefRequestContext> request_context =
|
|
||||||
CefRequestContextImpl::CreateForBrowserContext(browser_context).get();
|
|
||||||
DCHECK(request_context.get());
|
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal(
|
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal(
|
||||||
settings, client, new_contents, info, opener, false, request_context,
|
settings, client, new_contents, info, opener, false,
|
||||||
std::move(platform_delegate));
|
browser_context->GetCefRequestContext(), std::move(platform_delegate));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::DidNavigateMainFramePostCommit(
|
void CefBrowserHostImpl::DidNavigateMainFramePostCommit(
|
||||||
@@ -2356,7 +2368,9 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
|||||||
(request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE);
|
(request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE);
|
||||||
bool webcam_requested =
|
bool webcam_requested =
|
||||||
(request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
|
(request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
|
||||||
if (microphone_requested || webcam_requested) {
|
bool screen_requested =
|
||||||
|
(request.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE);
|
||||||
|
if (microphone_requested || webcam_requested || screen_requested) {
|
||||||
// Pick the desired device or fall back to the first available of the
|
// Pick the desired device or fall back to the first available of the
|
||||||
// given type.
|
// given type.
|
||||||
if (microphone_requested) {
|
if (microphone_requested) {
|
||||||
@@ -2373,6 +2387,19 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
|
|||||||
true,
|
true,
|
||||||
&devices);
|
&devices);
|
||||||
}
|
}
|
||||||
|
if (screen_requested) {
|
||||||
|
content::DesktopMediaID media_id;
|
||||||
|
if (request.requested_video_device_id.empty()) {
|
||||||
|
media_id = content::DesktopMediaID(
|
||||||
|
content::DesktopMediaID::TYPE_SCREEN,
|
||||||
|
-1 /* webrtc::kFullDesktopScreenId */);
|
||||||
|
} else {
|
||||||
|
media_id =
|
||||||
|
content::DesktopMediaID::Parse(request.requested_video_device_id);
|
||||||
|
}
|
||||||
|
devices.push_back(content::MediaStreamDevice(
|
||||||
|
content::MEDIA_DESKTOP_VIDEO_CAPTURE, media_id.ToString(), "Screen"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callback.Run(devices, content::MEDIA_DEVICE_OK,
|
callback.Run(devices, content::MEDIA_DEVICE_OK,
|
||||||
@@ -2553,8 +2580,7 @@ void CefBrowserHostImpl::DidFinishNavigation(
|
|||||||
if (!context)
|
if (!context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
context->AddVisitedURLs(static_cast<content::NavigationHandleImpl*>(
|
context->AddVisitedURLs(navigation_handle->GetRedirectChain());
|
||||||
navigation_handle)->redirect_chain());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||||
|
@@ -637,6 +637,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
// Observers that want to be notified of changes to this object.
|
// Observers that want to be notified of changes to this object.
|
||||||
base::ObserverList<Observer> observers_;
|
base::ObserverList<Observer> observers_;
|
||||||
|
|
||||||
|
// Used to provide unique incremental IDs for each find request.
|
||||||
|
int find_request_id_counter_ = 0;
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
|
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
|
||||||
};
|
};
|
||||||
|
@@ -23,35 +23,26 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void TranslatePopupFeatures(const blink::WebWindowFeatures& webKitFeatures,
|
void TranslatePopupFeatures(const blink::mojom::WindowFeatures& webKitFeatures,
|
||||||
CefPopupFeatures& features) {
|
CefPopupFeatures& features) {
|
||||||
features.x = static_cast<int>(webKitFeatures.x);
|
features.x = static_cast<int>(webKitFeatures.x);
|
||||||
features.xSet = webKitFeatures.xSet;
|
features.xSet = webKitFeatures.has_x;
|
||||||
features.y = static_cast<int>(webKitFeatures.y);
|
features.y = static_cast<int>(webKitFeatures.y);
|
||||||
features.ySet = webKitFeatures.ySet;
|
features.ySet = webKitFeatures.has_y;
|
||||||
features.width = static_cast<int>(webKitFeatures.width);
|
features.width = static_cast<int>(webKitFeatures.width);
|
||||||
features.widthSet = webKitFeatures.widthSet;
|
features.widthSet = webKitFeatures.has_width;
|
||||||
features.height = static_cast<int>(webKitFeatures.height);
|
features.height = static_cast<int>(webKitFeatures.height);
|
||||||
features.heightSet = webKitFeatures.heightSet;
|
features.heightSet = webKitFeatures.has_height;
|
||||||
|
|
||||||
features.menuBarVisible = webKitFeatures.menuBarVisible;
|
features.menuBarVisible = webKitFeatures.menu_bar_visible;
|
||||||
features.statusBarVisible = webKitFeatures.statusBarVisible;
|
features.statusBarVisible = webKitFeatures.status_bar_visible;
|
||||||
features.toolBarVisible = webKitFeatures.toolBarVisible;
|
features.toolBarVisible = webKitFeatures.tool_bar_visible;
|
||||||
features.locationBarVisible = webKitFeatures.locationBarVisible;
|
features.locationBarVisible = webKitFeatures.location_bar_visible;
|
||||||
features.scrollbarsVisible = webKitFeatures.scrollbarsVisible;
|
features.scrollbarsVisible = webKitFeatures.scrollbars_visible;
|
||||||
features.resizable = webKitFeatures.resizable;
|
features.resizable = webKitFeatures.resizable;
|
||||||
|
|
||||||
features.fullscreen = webKitFeatures.fullscreen;
|
features.fullscreen = webKitFeatures.fullscreen;
|
||||||
features.dialog = webKitFeatures.dialog;
|
features.dialog = webKitFeatures.dialog;
|
||||||
features.additionalFeatures = NULL;
|
|
||||||
if (webKitFeatures.additionalFeatures.size() > 0)
|
|
||||||
features.additionalFeatures = cef_string_list_alloc();
|
|
||||||
|
|
||||||
CefString str;
|
|
||||||
for (unsigned int i = 0; i < webKitFeatures.additionalFeatures.size(); ++i) {
|
|
||||||
str = base::string16(webKitFeatures.additionalFeatures[i]);
|
|
||||||
cef_string_list_append(features.additionalFeatures, str.GetStruct());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefBrowserInfoManager* g_info_manager = nullptr;
|
CefBrowserInfoManager* g_info_manager = nullptr;
|
||||||
@@ -142,7 +133,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
|||||||
const content::Referrer& referrer,
|
const content::Referrer& referrer,
|
||||||
const std::string& frame_name,
|
const std::string& frame_name,
|
||||||
WindowOpenDisposition disposition,
|
WindowOpenDisposition disposition,
|
||||||
const blink::WebWindowFeatures& features,
|
const blink::mojom::WindowFeatures& features,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
bool opener_suppressed,
|
bool opener_suppressed,
|
||||||
int opener_render_process_id,
|
int opener_render_process_id,
|
||||||
@@ -418,11 +409,13 @@ void CefBrowserInfoManager::GetBrowserInfoList(BrowserInfoList& list) {
|
|||||||
|
|
||||||
void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
||||||
content::RenderProcessHost* host) {
|
content::RenderProcessHost* host) {
|
||||||
base::AutoLock lock_scope(browser_info_lock_);
|
|
||||||
|
|
||||||
const int render_process_id = host->GetID();
|
const int render_process_id = host->GetID();
|
||||||
|
DCHECK_GT(render_process_id, 0);
|
||||||
|
|
||||||
// Remove all pending requests that reference the destroyed host.
|
// Remove all pending requests that reference the destroyed host.
|
||||||
|
{
|
||||||
|
base::AutoLock lock_scope(browser_info_lock_);
|
||||||
|
|
||||||
PendingNewBrowserInfoList::iterator it =
|
PendingNewBrowserInfoList::iterator it =
|
||||||
pending_new_browser_info_list_.begin();
|
pending_new_browser_info_list_.begin();
|
||||||
while (it != pending_new_browser_info_list_.end()) {
|
while (it != pending_new_browser_info_list_.end()) {
|
||||||
@@ -434,18 +427,37 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove all pending popups that reference the destroyed host as the opener.
|
||||||
|
{
|
||||||
|
base::AutoLock lock_scope(pending_popup_lock_);
|
||||||
|
|
||||||
|
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||||
|
while (it != pending_popup_list_.end()) {
|
||||||
|
PendingPopup* popup = *it;
|
||||||
|
if (popup->opener_process_id == render_process_id) {
|
||||||
|
it = pending_popup_list_.erase(it);
|
||||||
|
} else {
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserInfoManager::FilterPendingPopupURL(
|
void CefBrowserInfoManager::FilterPendingPopupURL(
|
||||||
int opener_process_id,
|
int opener_process_id,
|
||||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup) {
|
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup) {
|
||||||
|
// |host| may be nullptr if the parent browser is destroyed while the popup is
|
||||||
|
// pending.
|
||||||
content::RenderProcessHost* host =
|
content::RenderProcessHost* host =
|
||||||
content::RenderProcessHost::FromID(opener_process_id);
|
content::RenderProcessHost::FromID(opener_process_id);
|
||||||
DCHECK(host);
|
if (host) {
|
||||||
host->FilterURL(false, &pending_popup->target_url);
|
host->FilterURL(false, &pending_popup->target_url);
|
||||||
|
|
||||||
GetInstance()->PushPendingPopup(std::move(pending_popup));
|
GetInstance()->PushPendingPopup(std::move(pending_popup));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserInfoManager::PushPendingPopup(std::unique_ptr<PendingPopup> popup) {
|
void CefBrowserInfoManager::PushPendingPopup(
|
||||||
|
std::unique_ptr<PendingPopup> popup) {
|
||||||
base::AutoLock lock_scope(pending_popup_lock_);
|
base::AutoLock lock_scope(pending_popup_lock_);
|
||||||
pending_popup_list_.push_back(std::move(popup));
|
pending_popup_list_.push_back(std::move(popup));
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
#include "base/memory/scoped_vector.h"
|
#include "base/memory/scoped_vector.h"
|
||||||
#include "base/synchronization/lock.h"
|
#include "base/synchronization/lock.h"
|
||||||
#include "content/public/browser/render_process_host_observer.h"
|
#include "content/public/browser/render_process_host_observer.h"
|
||||||
|
#include "third_party/WebKit/public/web/window_features.mojom.h"
|
||||||
#include "ui/base/window_open_disposition.h"
|
#include "ui/base/window_open_disposition.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
|||||||
const content::Referrer& referrer,
|
const content::Referrer& referrer,
|
||||||
const std::string& frame_name,
|
const std::string& frame_name,
|
||||||
WindowOpenDisposition disposition,
|
WindowOpenDisposition disposition,
|
||||||
const blink::WebWindowFeatures& features,
|
const blink::mojom::WindowFeatures& features,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
bool opener_suppressed,
|
bool opener_suppressed,
|
||||||
int opener_render_process_id,
|
int opener_render_process_id,
|
||||||
|
@@ -45,6 +45,7 @@
|
|||||||
#include "ui/display/screen.h"
|
#include "ui/display/screen.h"
|
||||||
#include "ui/views/test/desktop_test_views_delegate.h"
|
#include "ui/views/test/desktop_test_views_delegate.h"
|
||||||
#include "ui/views/widget/desktop_aura/desktop_screen.h"
|
#include "ui/views/widget/desktop_aura/desktop_screen.h"
|
||||||
|
#include "ui/wm/core/wm_state.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "ui/base/cursor/cursor_loader_win.h"
|
#include "ui/base/cursor/cursor_loader_win.h"
|
||||||
@@ -133,6 +134,8 @@ void CefBrowserMainParts::ToolkitInitialized() {
|
|||||||
|
|
||||||
new views::DesktopTestViewsDelegate;
|
new views::DesktopTestViewsDelegate;
|
||||||
|
|
||||||
|
wm_state_.reset(new wm::WMState);
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
ui::CursorLoaderWin::SetCursorResourceModule(
|
ui::CursorLoaderWin::SetCursorResourceModule(
|
||||||
CefContentBrowserClient::Get()->GetResourceDllName());
|
CefContentBrowserClient::Get()->GetResourceDllName());
|
||||||
@@ -187,18 +190,20 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
CefRequestContextSettings settings;
|
CefRequestContextSettings settings;
|
||||||
CefContext::Get()->PopulateRequestContextSettings(&settings);
|
CefContext::Get()->PopulateRequestContextSettings(&settings);
|
||||||
|
|
||||||
// Create the global BrowserContext.
|
// Create the global RequestContext.
|
||||||
global_browser_context_.reset(new CefBrowserContextImpl(settings));
|
global_request_context_ =
|
||||||
global_browser_context_->Initialize();
|
CefRequestContextImpl::CreateGlobalRequestContext(settings);
|
||||||
|
CefBrowserContextImpl* browser_context = static_cast<CefBrowserContextImpl*>(
|
||||||
|
global_request_context_->GetBrowserContext());
|
||||||
|
|
||||||
CefDevToolsManagerDelegate::StartHttpHandler(global_browser_context_.get());
|
CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
|
||||||
|
|
||||||
// Triggers initialization of the singleton instance on UI thread.
|
// Triggers initialization of the singleton instance on UI thread.
|
||||||
PluginFinder::GetInstance()->Init();
|
PluginFinder::GetInstance()->Init();
|
||||||
|
|
||||||
device::GeolocationProvider::SetGeolocationDelegate(
|
device::GeolocationProvider::SetGeolocationDelegate(
|
||||||
new CefGeolocationDelegate(
|
new CefGeolocationDelegate(
|
||||||
global_browser_context_->request_context().get()));
|
browser_context->request_context_getter().get()));
|
||||||
|
|
||||||
scheme::RegisterWebUIControllerFactory();
|
scheme::RegisterWebUIControllerFactory();
|
||||||
}
|
}
|
||||||
@@ -207,7 +212,7 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
|
|||||||
// NOTE: Destroy objects in reverse order of creation.
|
// NOTE: Destroy objects in reverse order of creation.
|
||||||
CefDevToolsManagerDelegate::StopHttpHandler();
|
CefDevToolsManagerDelegate::StopHttpHandler();
|
||||||
|
|
||||||
global_browser_context_.reset(nullptr);
|
global_request_context_ = NULL;
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled()) {
|
if (extensions::ExtensionsEnabled()) {
|
||||||
extensions::ExtensionsBrowserClient::Set(NULL);
|
extensions::ExtensionsBrowserClient::Set(NULL);
|
||||||
|
@@ -7,6 +7,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||||
|
#include "libcef/browser/request_context_impl.h"
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_vector.h"
|
#include "base/memory/scoped_vector.h"
|
||||||
@@ -30,7 +31,12 @@ class ExtensionsBrowserClient;
|
|||||||
class ExtensionsClient;
|
class ExtensionsClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CefBrowserContextImpl;
|
#if defined(USE_AURA)
|
||||||
|
namespace wm {
|
||||||
|
class WMState;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class CefDevToolsDelegate;
|
class CefDevToolsDelegate;
|
||||||
|
|
||||||
class CefBrowserMainParts : public content::BrowserMainParts {
|
class CefBrowserMainParts : public content::BrowserMainParts {
|
||||||
@@ -47,8 +53,8 @@ class CefBrowserMainParts : public content::BrowserMainParts {
|
|||||||
void PostMainMessageLoopRun() override;
|
void PostMainMessageLoopRun() override;
|
||||||
void PostDestroyThreads() override;
|
void PostDestroyThreads() override;
|
||||||
|
|
||||||
CefBrowserContextImpl* browser_context() const {
|
CefRefPtr<CefRequestContextImpl> request_context() const {
|
||||||
return global_browser_context_.get();
|
return global_request_context_;
|
||||||
}
|
}
|
||||||
CefDevToolsDelegate* devtools_delegate() const {
|
CefDevToolsDelegate* devtools_delegate() const {
|
||||||
return devtools_delegate_;
|
return devtools_delegate_;
|
||||||
@@ -59,13 +65,17 @@ class CefBrowserMainParts : public content::BrowserMainParts {
|
|||||||
void PlatformInitialize();
|
void PlatformInitialize();
|
||||||
#endif // defined(OS_WIN)
|
#endif // defined(OS_WIN)
|
||||||
|
|
||||||
std::unique_ptr<CefBrowserContextImpl> global_browser_context_;
|
CefRefPtr<CefRequestContextImpl> global_request_context_;
|
||||||
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
|
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
|
||||||
std::unique_ptr<base::MessageLoop> message_loop_;
|
std::unique_ptr<base::MessageLoop> message_loop_;
|
||||||
|
|
||||||
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
||||||
std::unique_ptr<extensions::ExtensionsBrowserClient> extensions_browser_client_;
|
std::unique_ptr<extensions::ExtensionsBrowserClient> extensions_browser_client_;
|
||||||
|
|
||||||
|
#if defined(USE_AURA)
|
||||||
|
std::unique_ptr<wm::WMState> wm_state_;
|
||||||
|
#endif
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts);
|
DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -112,6 +112,11 @@ WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ukm::UkmService* ChromeBrowserProcessStub::ukm_service() {
|
||||||
|
NOTREACHED();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
||||||
DCHECK(context_initialized_);
|
DCHECK(context_initialized_);
|
||||||
return profile_manager_.get();
|
return profile_manager_.get();
|
||||||
|
@@ -47,6 +47,7 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
|||||||
rappor::RapporServiceImpl* rappor_service() override;
|
rappor::RapporServiceImpl* rappor_service() override;
|
||||||
IOThread* io_thread() override;
|
IOThread* io_thread() override;
|
||||||
WatchDogThread* watchdog_thread() override;
|
WatchDogThread* watchdog_thread() override;
|
||||||
|
ukm::UkmService* ukm_service() override;
|
||||||
ProfileManager* profile_manager() override;
|
ProfileManager* profile_manager() override;
|
||||||
PrefService* local_state() override;
|
PrefService* local_state() override;
|
||||||
net::URLRequestContextGetter* system_request_context() override;
|
net::URLRequestContextGetter* system_request_context() override;
|
||||||
|
@@ -21,7 +21,8 @@ namespace {
|
|||||||
// Return the main context for now since we don't currently have a good way to
|
// Return the main context for now since we don't currently have a good way to
|
||||||
// determine that.
|
// determine that.
|
||||||
CefBrowserContextImpl* GetActiveBrowserContext() {
|
CefBrowserContextImpl* GetActiveBrowserContext() {
|
||||||
return CefContentBrowserClient::Get()->browser_context();
|
return static_cast<CefBrowserContextImpl*>(
|
||||||
|
CefContentBrowserClient::Get()->request_context()->GetBrowserContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@@ -51,7 +51,9 @@
|
|||||||
#include "content/browser/frame_host/navigation_handle_impl.h"
|
#include "content/browser/frame_host/navigation_handle_impl.h"
|
||||||
#include "content/browser/frame_host/render_frame_host_impl.h"
|
#include "content/browser/frame_host/render_frame_host_impl.h"
|
||||||
#include "content/browser/plugin_service_impl.h"
|
#include "content/browser/plugin_service_impl.h"
|
||||||
|
#include "content/public/browser/browser_context.h"
|
||||||
#include "content/public/browser/browser_ppapi_host.h"
|
#include "content/public/browser/browser_ppapi_host.h"
|
||||||
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/child_process_security_policy.h"
|
#include "content/public/browser/child_process_security_policy.h"
|
||||||
#include "content/public/browser/client_certificate_delegate.h"
|
#include "content/public/browser/client_certificate_delegate.h"
|
||||||
#include "content/public/browser/navigation_handle.h"
|
#include "content/public/browser/navigation_handle.h"
|
||||||
@@ -63,6 +65,7 @@
|
|||||||
#include "content/public/browser/render_widget_host.h"
|
#include "content/public/browser/render_widget_host.h"
|
||||||
#include "content/public/browser/render_widget_host_view.h"
|
#include "content/public/browser/render_widget_host_view.h"
|
||||||
#include "content/public/browser/resource_dispatcher_host.h"
|
#include "content/public/browser/resource_dispatcher_host.h"
|
||||||
|
#include "content/public/browser/storage_partition.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "content/public/common/service_names.mojom.h"
|
#include "content/public/common/service_names.mojom.h"
|
||||||
#include "content/public/common/storage_quota_params.h"
|
#include "content/public/common/storage_quota_params.h"
|
||||||
@@ -76,6 +79,7 @@
|
|||||||
#include "extensions/common/switches.h"
|
#include "extensions/common/switches.h"
|
||||||
#include "net/ssl/ssl_cert_request_info.h"
|
#include "net/ssl/ssl_cert_request_info.h"
|
||||||
#include "ppapi/host/ppapi_host.h"
|
#include "ppapi/host/ppapi_host.h"
|
||||||
|
#include "storage/browser/quota/quota_settings.h"
|
||||||
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
|
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
|
||||||
#include "ui/base/resource/resource_bundle.h"
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
#include "ui/base/ui_base_switches.h"
|
#include "ui/base/ui_base_switches.h"
|
||||||
@@ -722,6 +726,17 @@ content::QuotaPermissionContext*
|
|||||||
return new CefQuotaPermissionContext();
|
return new CefQuotaPermissionContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefContentBrowserClient::GetQuotaSettings(
|
||||||
|
content::BrowserContext* context,
|
||||||
|
content::StoragePartition* partition,
|
||||||
|
const storage::OptionalQuotaSettingsCallback& callback) {
|
||||||
|
content::BrowserThread::PostTaskAndReplyWithResult(
|
||||||
|
content::BrowserThread::FILE, FROM_HERE,
|
||||||
|
base::Bind(&storage::CalculateNominalDynamicSettings,
|
||||||
|
partition->GetPath(), context->IsOffTheRecord()),
|
||||||
|
callback);
|
||||||
|
}
|
||||||
|
|
||||||
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
|
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
|
||||||
return CefMediaCaptureDevicesDispatcher::GetInstance();
|
return CefMediaCaptureDevicesDispatcher::GetInstance();
|
||||||
}
|
}
|
||||||
@@ -829,12 +844,12 @@ bool CefContentBrowserClient::CanCreateWindow(
|
|||||||
const GURL& opener_url,
|
const GURL& opener_url,
|
||||||
const GURL& opener_top_level_frame_url,
|
const GURL& opener_top_level_frame_url,
|
||||||
const GURL& source_origin,
|
const GURL& source_origin,
|
||||||
WindowContainerType container_type,
|
content::mojom::WindowContainerType container_type,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
const content::Referrer& referrer,
|
const content::Referrer& referrer,
|
||||||
const std::string& frame_name,
|
const std::string& frame_name,
|
||||||
WindowOpenDisposition disposition,
|
WindowOpenDisposition disposition,
|
||||||
const blink::WebWindowFeatures& features,
|
const blink::mojom::WindowFeatures& features,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
bool opener_suppressed,
|
bool opener_suppressed,
|
||||||
content::ResourceContext* context,
|
content::ResourceContext* context,
|
||||||
@@ -981,8 +996,9 @@ void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
|
|||||||
policy->RegisterWebSafeScheme(scheme);
|
policy->RegisterWebSafeScheme(scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
CefBrowserContextImpl* CefContentBrowserClient::browser_context() const {
|
CefRefPtr<CefRequestContextImpl>
|
||||||
return browser_main_parts_->browser_context();
|
CefContentBrowserClient::request_context() const {
|
||||||
|
return browser_main_parts_->request_context();
|
||||||
}
|
}
|
||||||
|
|
||||||
CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const {
|
CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const {
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "include/cef_request_context_handler.h"
|
#include "include/cef_request_context_handler.h"
|
||||||
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
||||||
|
#include "libcef/browser/request_context_impl.h"
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
@@ -19,7 +20,6 @@
|
|||||||
#include "third_party/skia/include/core/SkColor.h"
|
#include "third_party/skia/include/core/SkColor.h"
|
||||||
|
|
||||||
class CefBrowserMainParts;
|
class CefBrowserMainParts;
|
||||||
class CefBrowserContextImpl;
|
|
||||||
class CefDevToolsDelegate;
|
class CefDevToolsDelegate;
|
||||||
class CefResourceDispatcherHostDelegate;
|
class CefResourceDispatcherHostDelegate;
|
||||||
|
|
||||||
@@ -56,6 +56,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
int child_process_id) override;
|
int child_process_id) override;
|
||||||
content::QuotaPermissionContext*
|
content::QuotaPermissionContext*
|
||||||
CreateQuotaPermissionContext() override;
|
CreateQuotaPermissionContext() override;
|
||||||
|
void GetQuotaSettings(
|
||||||
|
content::BrowserContext* context,
|
||||||
|
content::StoragePartition* partition,
|
||||||
|
const storage::OptionalQuotaSettingsCallback& callback) override;
|
||||||
content::MediaObserver* GetMediaObserver() override;
|
content::MediaObserver* GetMediaObserver() override;
|
||||||
content::SpeechRecognitionManagerDelegate*
|
content::SpeechRecognitionManagerDelegate*
|
||||||
CreateSpeechRecognitionManagerDelegate() override;
|
CreateSpeechRecognitionManagerDelegate() override;
|
||||||
@@ -79,12 +83,12 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
const GURL& opener_url,
|
const GURL& opener_url,
|
||||||
const GURL& opener_top_level_frame_url,
|
const GURL& opener_top_level_frame_url,
|
||||||
const GURL& source_origin,
|
const GURL& source_origin,
|
||||||
WindowContainerType container_type,
|
content::mojom::WindowContainerType container_type,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
const content::Referrer& referrer,
|
const content::Referrer& referrer,
|
||||||
const std::string& frame_name,
|
const std::string& frame_name,
|
||||||
WindowOpenDisposition disposition,
|
WindowOpenDisposition disposition,
|
||||||
const blink::WebWindowFeatures& features,
|
const blink::mojom::WindowFeatures& features,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
bool opener_suppressed,
|
bool opener_suppressed,
|
||||||
content::ResourceContext* context,
|
content::ResourceContext* context,
|
||||||
@@ -117,7 +121,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
// Perform browser process registration for the custom scheme.
|
// Perform browser process registration for the custom scheme.
|
||||||
void RegisterCustomScheme(const std::string& scheme);
|
void RegisterCustomScheme(const std::string& scheme);
|
||||||
|
|
||||||
CefBrowserContextImpl* browser_context() const;
|
CefRefPtr<CefRequestContextImpl> request_context() const;
|
||||||
CefDevToolsDelegate* devtools_delegate() const;
|
CefDevToolsDelegate* devtools_delegate() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -587,7 +587,6 @@ void CefCookieManagerImpl::SetCookieInternal(
|
|||||||
cookie.secure ? true : false,
|
cookie.secure ? true : false,
|
||||||
cookie.httponly ? true : false,
|
cookie.httponly ? true : false,
|
||||||
net::CookieSameSite::DEFAULT_MODE,
|
net::CookieSameSite::DEFAULT_MODE,
|
||||||
CefNetworkDelegate::AreStrictSecureCookiesEnabled(),
|
|
||||||
net::COOKIE_PRIORITY_DEFAULT,
|
net::COOKIE_PRIORITY_DEFAULT,
|
||||||
base::Bind(SetCookieCallbackImpl, callback));
|
base::Bind(SetCookieCallbackImpl, callback));
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
|
|||||||
if (!base::IsStringUTF8(chunk))
|
if (!base::IsStringUTF8(chunk))
|
||||||
return num_bytes;
|
return num_bytes;
|
||||||
|
|
||||||
base::FundamentalValue* id = new base::FundamentalValue(stream_id_);
|
base::Value* id = new base::Value(stream_id_);
|
||||||
base::StringValue* chunkValue = new base::StringValue(chunk);
|
base::StringValue* chunkValue = new base::StringValue(chunk);
|
||||||
|
|
||||||
content::BrowserThread::PostTask(
|
content::BrowserThread::PostTask(
|
||||||
@@ -322,6 +322,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
|||||||
} else if (method == "requestFileSystems") {
|
} else if (method == "requestFileSystems") {
|
||||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||||
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"));
|
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"));
|
||||||
|
} else if (method == "reattach") {
|
||||||
|
agent_host_->DetachClient(this);
|
||||||
|
agent_host_->AttachClient(this);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -404,7 +407,7 @@ void CefDevToolsFrontend::CallClientFunction(
|
|||||||
|
|
||||||
void CefDevToolsFrontend::SendMessageAck(int request_id,
|
void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||||
const base::Value* arg) {
|
const base::Value* arg) {
|
||||||
base::FundamentalValue id_value(request_id);
|
base::Value id_value(request_id);
|
||||||
CallClientFunction("DevToolsAPI.embedderMessageAck",
|
CallClientFunction("DevToolsAPI.embedderMessageAck",
|
||||||
&id_value, arg, nullptr);
|
&id_value, arg, nullptr);
|
||||||
}
|
}
|
||||||
|
@@ -12,10 +12,6 @@ CefPDFWebContentsHelperClient::CefPDFWebContentsHelperClient() {
|
|||||||
CefPDFWebContentsHelperClient::~CefPDFWebContentsHelperClient() {
|
CefPDFWebContentsHelperClient::~CefPDFWebContentsHelperClient() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPDFWebContentsHelperClient::UpdateLocationBar(
|
|
||||||
content::WebContents* contents) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefPDFWebContentsHelperClient::UpdateContentRestrictions(
|
void CefPDFWebContentsHelperClient::UpdateContentRestrictions(
|
||||||
content::WebContents* contents,
|
content::WebContents* contents,
|
||||||
int content_restrictions) {
|
int content_restrictions) {
|
||||||
|
@@ -18,13 +18,9 @@ class CefPDFWebContentsHelperClient
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// pdf::PDFWebContentsHelperClient:
|
// pdf::PDFWebContentsHelperClient:
|
||||||
void UpdateLocationBar(content::WebContents* contents) override;
|
|
||||||
|
|
||||||
void UpdateContentRestrictions(content::WebContents* contents,
|
void UpdateContentRestrictions(content::WebContents* contents,
|
||||||
int content_restrictions) override;
|
int content_restrictions) override;
|
||||||
|
|
||||||
void OnPDFHasUnsupportedFeature(content::WebContents* contents) override;
|
void OnPDFHasUnsupportedFeature(content::WebContents* contents) override;
|
||||||
|
|
||||||
void OnSaveURL(content::WebContents* contents) override;
|
void OnSaveURL(content::WebContents* contents) override;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefPDFWebContentsHelperClient);
|
DISALLOW_COPY_AND_ASSIGN(CefPDFWebContentsHelperClient);
|
||||||
|
@@ -11,7 +11,6 @@
|
|||||||
#include "libcef/browser/browser_host_impl.h"
|
#include "libcef/browser/browser_host_impl.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
#include "base/threading/worker_pool.h"
|
|
||||||
#include "content/public/browser/render_frame_host.h"
|
#include "content/public/browser/render_frame_host.h"
|
||||||
#include "content/public/common/file_chooser_file_info.h"
|
#include "content/public/common/file_chooser_file_info.h"
|
||||||
#include "net/base/directory_lister.h"
|
#include "net/base/directory_lister.h"
|
||||||
@@ -363,7 +362,7 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
|||||||
new UploadFolderHelper(
|
new UploadFolderHelper(
|
||||||
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||||
weak_ptr_factory_.GetWeakPtr(), mode))));
|
weak_ptr_factory_.GetWeakPtr(), mode))));
|
||||||
lister_->Start(base::WorkerPool::GetTaskRunner(true).get());
|
lister_->Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ void CefJavaScriptDialogManager::Destroy() {
|
|||||||
void CefJavaScriptDialogManager::RunJavaScriptDialog(
|
void CefJavaScriptDialogManager::RunJavaScriptDialog(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
const GURL& origin_url,
|
const GURL& origin_url,
|
||||||
content::JavaScriptMessageType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& message_text,
|
const base::string16& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const base::string16& default_prompt_text,
|
||||||
const DialogClosedCallback& callback,
|
const DialogClosedCallback& callback,
|
||||||
@@ -187,7 +187,7 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
|||||||
dialog_running_ = true;
|
dialog_running_ = true;
|
||||||
|
|
||||||
runner_->Run(browser_,
|
runner_->Run(browser_,
|
||||||
content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM,
|
content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
|
||||||
base::string16(), // display_url
|
base::string16(), // display_url
|
||||||
message_text,
|
message_text,
|
||||||
base::string16(), // default_prompt_text
|
base::string16(), // default_prompt_text
|
||||||
@@ -197,7 +197,6 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
|||||||
|
|
||||||
void CefJavaScriptDialogManager::CancelDialogs(
|
void CefJavaScriptDialogManager::CancelDialogs(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
bool suppress_callbacks,
|
|
||||||
bool reset_state) {
|
bool reset_state) {
|
||||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
if (client.get()) {
|
if (client.get()) {
|
||||||
|
@@ -32,7 +32,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
|||||||
void RunJavaScriptDialog(
|
void RunJavaScriptDialog(
|
||||||
content::WebContents* web_contents,
|
content::WebContents* web_contents,
|
||||||
const GURL& origin_url,
|
const GURL& origin_url,
|
||||||
content::JavaScriptMessageType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& message_text,
|
const base::string16& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const base::string16& default_prompt_text,
|
||||||
const DialogClosedCallback& callback,
|
const DialogClosedCallback& callback,
|
||||||
@@ -42,7 +42,6 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
|||||||
bool is_reload,
|
bool is_reload,
|
||||||
const DialogClosedCallback& callback) override;
|
const DialogClosedCallback& callback) override;
|
||||||
void CancelDialogs(content::WebContents* web_contents,
|
void CancelDialogs(content::WebContents* web_contents,
|
||||||
bool suppress_callbacks,
|
|
||||||
bool reset_state) override;
|
bool reset_state) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "content/public/common/javascript_message_type.h"
|
#include "content/public/common/javascript_dialog_type.h"
|
||||||
|
|
||||||
class CefBrowserHostImpl;
|
class CefBrowserHostImpl;
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ class CefJavaScriptDialogRunner {
|
|||||||
// Run the dialog. Execute |callback| on completion.
|
// Run the dialog. Execute |callback| on completion.
|
||||||
virtual void Run(
|
virtual void Run(
|
||||||
CefBrowserHostImpl* browser,
|
CefBrowserHostImpl* browser,
|
||||||
content::JavaScriptMessageType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const base::string16& display_url,
|
||||||
const base::string16& message_text,
|
const base::string16& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const base::string16& default_prompt_text,
|
||||||
|
@@ -160,15 +160,10 @@ class CefSimpleMenuModel : public ui::MenuModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool GetTextColor(int index,
|
bool GetTextColor(int index,
|
||||||
|
bool is_minor,
|
||||||
bool is_hovered,
|
bool is_hovered,
|
||||||
SkColor* override_color) const override {
|
SkColor* override_color) const override {
|
||||||
return impl_->GetTextColor(index, false, is_hovered, override_color);
|
return impl_->GetTextColor(index, is_minor, is_hovered, override_color);
|
||||||
}
|
|
||||||
|
|
||||||
bool GetMinorTextColor(int index,
|
|
||||||
bool is_hovered,
|
|
||||||
SkColor* override_color) const override {
|
|
||||||
return impl_->GetTextColor(index, true, is_hovered, override_color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetBackgroundColor(int index,
|
bool GetBackgroundColor(int index,
|
||||||
|
@@ -26,7 +26,7 @@ class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner {
|
|||||||
// CefJavaScriptDialogRunner methods:
|
// CefJavaScriptDialogRunner methods:
|
||||||
void Run(
|
void Run(
|
||||||
CefBrowserHostImpl* browser,
|
CefBrowserHostImpl* browser,
|
||||||
content::JavaScriptMessageType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const base::string16& display_url,
|
||||||
const base::string16& message_text,
|
const base::string16& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const base::string16& default_prompt_text,
|
||||||
|
@@ -89,7 +89,7 @@ CefJavaScriptDialogRunnerMac::~CefJavaScriptDialogRunnerMac() {
|
|||||||
|
|
||||||
void CefJavaScriptDialogRunnerMac::Run(
|
void CefJavaScriptDialogRunnerMac::Run(
|
||||||
CefBrowserHostImpl* browser,
|
CefBrowserHostImpl* browser,
|
||||||
content::JavaScriptMessageType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const base::string16& display_url,
|
||||||
const base::string16& message_text,
|
const base::string16& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const base::string16& default_prompt_text,
|
||||||
@@ -98,9 +98,9 @@ void CefJavaScriptDialogRunnerMac::Run(
|
|||||||
callback_ = callback;
|
callback_ = callback;
|
||||||
|
|
||||||
bool text_field =
|
bool text_field =
|
||||||
message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT;
|
message_type == content::JAVASCRIPT_DIALOG_TYPE_PROMPT;
|
||||||
bool one_button =
|
bool one_button =
|
||||||
message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT;
|
message_type == content::JAVASCRIPT_DIALOG_TYPE_ALERT;
|
||||||
|
|
||||||
helper_.reset(
|
helper_.reset(
|
||||||
[[CefJavaScriptDialogHelper alloc] initHelperWithCallback:
|
[[CefJavaScriptDialogHelper alloc] initHelperWithCallback:
|
||||||
@@ -119,13 +119,13 @@ void CefJavaScriptDialogRunnerMac::Run(
|
|||||||
|
|
||||||
base::string16 label;
|
base::string16 label;
|
||||||
switch (message_type) {
|
switch (message_type) {
|
||||||
case content::JAVASCRIPT_MESSAGE_TYPE_ALERT:
|
case content::JAVASCRIPT_DIALOG_TYPE_ALERT:
|
||||||
label = base::ASCIIToUTF16("JavaScript Alert");
|
label = base::ASCIIToUTF16("JavaScript Alert");
|
||||||
break;
|
break;
|
||||||
case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT:
|
case content::JAVASCRIPT_DIALOG_TYPE_PROMPT:
|
||||||
label = base::ASCIIToUTF16("JavaScript Prompt");
|
label = base::ASCIIToUTF16("JavaScript Prompt");
|
||||||
break;
|
break;
|
||||||
case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM:
|
case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM:
|
||||||
label = base::ASCIIToUTF16("JavaScript Confirm");
|
label = base::ASCIIToUTF16("JavaScript Confirm");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(
|
|||||||
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(lparam);
|
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(lparam);
|
||||||
owner->dialog_win_ = dialog;
|
owner->dialog_win_ = dialog;
|
||||||
SetDlgItemText(dialog, IDC_DIALOGTEXT, owner->message_text_.c_str());
|
SetDlgItemText(dialog, IDC_DIALOGTEXT, owner->message_text_.c_str());
|
||||||
if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT)
|
if (owner->message_type_ == content::JAVASCRIPT_DIALOG_TYPE_PROMPT)
|
||||||
SetDlgItemText(dialog, IDC_PROMPTEDIT,
|
SetDlgItemText(dialog, IDC_PROMPTEDIT,
|
||||||
owner->default_prompt_text_.c_str());
|
owner->default_prompt_text_.c_str());
|
||||||
break;
|
break;
|
||||||
@@ -57,7 +57,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(
|
|||||||
case IDOK:
|
case IDOK:
|
||||||
finish = true;
|
finish = true;
|
||||||
result = true;
|
result = true;
|
||||||
if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) {
|
if (owner->message_type_ == content::JAVASCRIPT_DIALOG_TYPE_PROMPT) {
|
||||||
size_t length =
|
size_t length =
|
||||||
GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1;
|
GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1;
|
||||||
if (length > 1) {
|
if (length > 1) {
|
||||||
@@ -95,7 +95,7 @@ CefJavaScriptDialogRunnerWin::~CefJavaScriptDialogRunnerWin() {
|
|||||||
|
|
||||||
void CefJavaScriptDialogRunnerWin::Run(
|
void CefJavaScriptDialogRunnerWin::Run(
|
||||||
CefBrowserHostImpl* browser,
|
CefBrowserHostImpl* browser,
|
||||||
content::JavaScriptMessageType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const base::string16& display_url,
|
||||||
const base::string16& message_text,
|
const base::string16& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const base::string16& default_prompt_text,
|
||||||
@@ -111,11 +111,11 @@ void CefJavaScriptDialogRunnerWin::Run(
|
|||||||
hook_installed_ = true;
|
hook_installed_ = true;
|
||||||
|
|
||||||
int dialog_type;
|
int dialog_type;
|
||||||
if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT)
|
if (message_type == content::JAVASCRIPT_DIALOG_TYPE_ALERT)
|
||||||
dialog_type = IDD_ALERT;
|
dialog_type = IDD_ALERT;
|
||||||
else if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM)
|
else if (message_type == content::JAVASCRIPT_DIALOG_TYPE_CONFIRM)
|
||||||
dialog_type = IDD_CONFIRM;
|
dialog_type = IDD_CONFIRM;
|
||||||
else // JAVASCRIPT_MESSAGE_TYPE_PROMPT
|
else // JAVASCRIPT_DIALOG_TYPE_PROMPT
|
||||||
dialog_type = IDD_PROMPT;
|
dialog_type = IDD_PROMPT;
|
||||||
|
|
||||||
base::FilePath file_path;
|
base::FilePath file_path;
|
||||||
|
@@ -17,7 +17,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
|
|||||||
// CefJavaScriptDialogRunner methods:
|
// CefJavaScriptDialogRunner methods:
|
||||||
void Run(
|
void Run(
|
||||||
CefBrowserHostImpl* browser,
|
CefBrowserHostImpl* browser,
|
||||||
content::JavaScriptMessageType message_type,
|
content::JavaScriptDialogType message_type,
|
||||||
const base::string16& display_url,
|
const base::string16& display_url,
|
||||||
const base::string16& message_text,
|
const base::string16& message_text,
|
||||||
const base::string16& default_prompt_text,
|
const base::string16& default_prompt_text,
|
||||||
@@ -28,7 +28,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
|
|||||||
HWND dialog_win_;
|
HWND dialog_win_;
|
||||||
HWND parent_win_;
|
HWND parent_win_;
|
||||||
|
|
||||||
content::JavaScriptMessageType message_type_;
|
content::JavaScriptDialogType message_type_;
|
||||||
base::string16 message_text_;
|
base::string16 message_text_;
|
||||||
base::string16 default_prompt_text_;
|
base::string16 default_prompt_text_;
|
||||||
DialogClosedCallback callback_;
|
DialogClosedCallback callback_;
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/threading/thread_task_runner_handle.h"
|
#include "base/threading/thread_task_runner_handle.h"
|
||||||
#include "base/win/wrapped_window_proc.h"
|
#include "base/win/wrapped_window_proc.h"
|
||||||
|
#include "skia/ext/platform_canvas.h"
|
||||||
#include "skia/ext/skia_utils_win.h"
|
#include "skia/ext/skia_utils_win.h"
|
||||||
#include "ui/base/accelerators/accelerator.h"
|
#include "ui/base/accelerators/accelerator.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <X11/extensions/XInput2.h>
|
#include <X11/extensions/XInput2.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
#include "ui/base/x/x11_util.h"
|
#include "ui/base/x/x11_util.h"
|
||||||
|
@@ -7,7 +7,10 @@
|
|||||||
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_X11_H_
|
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_X11_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
// Avoid including <X11/Xlib.h>
|
||||||
|
typedef unsigned long Window;
|
||||||
|
struct _XDisplay;
|
||||||
|
typedef struct _XDisplay Display;
|
||||||
|
|
||||||
#include "libcef/browser/browser_host_impl.h"
|
#include "libcef/browser/browser_host_impl.h"
|
||||||
|
|
||||||
|
@@ -49,7 +49,6 @@ void CefCookieStoreProxy::SetCookieWithDetailsAsync(
|
|||||||
bool secure,
|
bool secure,
|
||||||
bool http_only,
|
bool http_only,
|
||||||
net::CookieSameSite same_site,
|
net::CookieSameSite same_site,
|
||||||
bool enforce_strict_secure,
|
|
||||||
net::CookiePriority priority,
|
net::CookiePriority priority,
|
||||||
const SetCookiesCallback& callback) {
|
const SetCookiesCallback& callback) {
|
||||||
net::CookieStore* cookie_store = GetCookieStore();
|
net::CookieStore* cookie_store = GetCookieStore();
|
||||||
@@ -57,8 +56,7 @@ void CefCookieStoreProxy::SetCookieWithDetailsAsync(
|
|||||||
cookie_store->SetCookieWithDetailsAsync(url, name, value, domain, path,
|
cookie_store->SetCookieWithDetailsAsync(url, name, value, domain, path,
|
||||||
creation_time, expiration_time,
|
creation_time, expiration_time,
|
||||||
last_access_time, secure, http_only,
|
last_access_time, secure, http_only,
|
||||||
same_site, enforce_strict_secure,
|
same_site, priority, callback);
|
||||||
priority, callback);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,7 +39,6 @@ class CefCookieStoreProxy : public net::CookieStore {
|
|||||||
bool secure,
|
bool secure,
|
||||||
bool http_only,
|
bool http_only,
|
||||||
net::CookieSameSite same_site,
|
net::CookieSameSite same_site,
|
||||||
bool enforce_strict_secure,
|
|
||||||
net::CookiePriority priority,
|
net::CookiePriority priority,
|
||||||
const SetCookiesCallback& callback) override;
|
const SetCookiesCallback& callback) override;
|
||||||
void GetCookiesWithOptionsAsync(
|
void GetCookiesWithOptionsAsync(
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "blink/grit/devtools_resources_map.h"
|
#include "content/browser/devtools/grit/devtools_resources_map.h"
|
||||||
#include "content/public/common/url_constants.h"
|
#include "content/public/common/url_constants.h"
|
||||||
|
|
||||||
namespace scheme {
|
namespace scheme {
|
||||||
|
@@ -252,15 +252,6 @@ bool CefNetworkDelegate::AreExperimentalCookieFeaturesEnabled() {
|
|||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
bool CefNetworkDelegate::AreStrictSecureCookiesEnabled() {
|
|
||||||
const std::string enforce_strict_secure_group =
|
|
||||||
base::FieldTrialList::FindFullName("StrictSecureCookies");
|
|
||||||
return AreExperimentalCookieFeaturesEnabled() ||
|
|
||||||
base::StartsWith(enforce_strict_secure_group, "Enabled",
|
|
||||||
base::CompareCase::INSENSITIVE_ASCII);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<net::SourceStream> CefNetworkDelegate::CreateSourceStream(
|
std::unique_ptr<net::SourceStream> CefNetworkDelegate::CreateSourceStream(
|
||||||
net::URLRequest* request,
|
net::URLRequest* request,
|
||||||
std::unique_ptr<net::SourceStream> upstream) {
|
std::unique_ptr<net::SourceStream> upstream) {
|
||||||
@@ -468,7 +459,3 @@ bool CefNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
|
|||||||
bool CefNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
|
bool CefNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
|
||||||
return AreExperimentalCookieFeaturesEnabled();
|
return AreExperimentalCookieFeaturesEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefNetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
|
|
||||||
return AreStrictSecureCookiesEnabled();
|
|
||||||
}
|
|
||||||
|
@@ -22,7 +22,6 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
|||||||
// Match the logic from ChromeNetworkDelegate and
|
// Match the logic from ChromeNetworkDelegate and
|
||||||
// RenderFrameMessageFilter::OnSetCookie.
|
// RenderFrameMessageFilter::OnSetCookie.
|
||||||
static bool AreExperimentalCookieFeaturesEnabled();
|
static bool AreExperimentalCookieFeaturesEnabled();
|
||||||
static bool AreStrictSecureCookiesEnabled();
|
|
||||||
|
|
||||||
void set_force_google_safesearch(
|
void set_force_google_safesearch(
|
||||||
BooleanPrefMember* force_google_safesearch) {
|
BooleanPrefMember* force_google_safesearch) {
|
||||||
@@ -46,7 +45,6 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
|||||||
bool OnCanAccessFile(const net::URLRequest& request,
|
bool OnCanAccessFile(const net::URLRequest& request,
|
||||||
const base::FilePath& path) const override;
|
const base::FilePath& path) const override;
|
||||||
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
bool OnAreExperimentalCookieFeaturesEnabled() const override;
|
||||||
bool OnAreStrictSecureCookiesEnabled() const override;
|
|
||||||
|
|
||||||
// Weak, owned by our owner (CefURLRequestContextGetterImpl).
|
// Weak, owned by our owner (CefURLRequestContextGetterImpl).
|
||||||
BooleanPrefMember* force_google_safesearch_;
|
BooleanPrefMember* force_google_safesearch_;
|
||||||
|
@@ -116,16 +116,18 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
|||||||
std::unique_ptr<net::ProxyConfigService> proxy_config_service,
|
std::unique_ptr<net::ProxyConfigService> proxy_config_service,
|
||||||
content::URLRequestInterceptorScopedVector request_interceptors)
|
content::URLRequestInterceptorScopedVector request_interceptors)
|
||||||
: settings_(settings),
|
: settings_(settings),
|
||||||
net_log_(g_browser_process->net_log()),
|
io_state_(base::MakeUnique<IOState>()) {
|
||||||
io_task_runner_(std::move(io_task_runner)),
|
|
||||||
file_task_runner_(std::move(file_task_runner)),
|
|
||||||
proxy_config_service_(std::move(proxy_config_service)),
|
|
||||||
request_interceptors_(std::move(request_interceptors)) {
|
|
||||||
// Must first be created on the UI thread.
|
// Must first be created on the UI thread.
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
DCHECK(net_log_);
|
|
||||||
|
|
||||||
std::swap(protocol_handlers_, *protocol_handlers);
|
io_state_->net_log_ = g_browser_process->net_log(),
|
||||||
|
DCHECK(io_state_->net_log_);
|
||||||
|
io_state_->io_task_runner_ = std::move(io_task_runner);
|
||||||
|
io_state_->file_task_runner_ = std::move(file_task_runner);
|
||||||
|
io_state_->proxy_config_service_ = std::move(proxy_config_service);
|
||||||
|
io_state_->request_interceptors_ = std::move(request_interceptors);
|
||||||
|
|
||||||
|
std::swap(io_state_->protocol_handlers_, *protocol_handlers);
|
||||||
|
|
||||||
auto io_thread_proxy =
|
auto io_thread_proxy =
|
||||||
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
|
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
|
||||||
@@ -141,7 +143,8 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
|||||||
force_google_safesearch_.MoveToThread(io_thread_proxy);
|
force_google_safesearch_.MoveToThread(io_thread_proxy);
|
||||||
|
|
||||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||||
gsapi_library_name_ = pref_service->GetString(prefs::kGSSAPILibraryName);
|
io_state_->gsapi_library_name_ =
|
||||||
|
pref_service->GetString(prefs::kGSSAPILibraryName);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auth_server_whitelist_.Init(
|
auth_server_whitelist_.Init(
|
||||||
@@ -159,11 +162,8 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
|||||||
|
|
||||||
CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
|
CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
// This destructor may not be called during shutdown. Perform any required
|
||||||
// Delete the ProxyService object here so that any pending requests will be
|
// shutdown in ShutdownOnIOThread() instead.
|
||||||
// canceled before the associated URLRequestContext is destroyed in this
|
|
||||||
// object's destructor.
|
|
||||||
storage_->set_proxy_service(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -187,12 +187,32 @@ void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
|
|||||||
force_google_safesearch_.Destroy();
|
force_google_safesearch_.Destroy();
|
||||||
auth_server_whitelist_.Destroy();
|
auth_server_whitelist_.Destroy();
|
||||||
auth_negotiate_delegate_whitelist_.Destroy();
|
auth_negotiate_delegate_whitelist_.Destroy();
|
||||||
|
|
||||||
|
CEF_POST_TASK(CEF_IOT,
|
||||||
|
base::Bind(&CefURLRequestContextGetterImpl::ShutdownOnIOThread, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefURLRequestContextGetterImpl::ShutdownOnIOThread() {
|
||||||
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
|
shutting_down_ = true;
|
||||||
|
|
||||||
|
// Delete the ProxyService object here so that any pending requests will be
|
||||||
|
// canceled before the URLRequestContext is destroyed.
|
||||||
|
io_state_->storage_->set_proxy_service(NULL);
|
||||||
|
|
||||||
|
io_state_.reset();
|
||||||
|
|
||||||
|
NotifyContextShuttingDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
if (!url_request_context_.get()) {
|
if (shutting_down_)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (!io_state_->url_request_context_.get()) {
|
||||||
const base::CommandLine* command_line =
|
const base::CommandLine* command_line =
|
||||||
base::CommandLine::ForCurrentProcess();
|
base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
@@ -200,11 +220,11 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||||||
if (settings_.cache_path.length > 0)
|
if (settings_.cache_path.length > 0)
|
||||||
cache_path = base::FilePath(CefString(&settings_.cache_path));
|
cache_path = base::FilePath(CefString(&settings_.cache_path));
|
||||||
|
|
||||||
url_request_context_.reset(new CefURLRequestContextImpl());
|
io_state_->url_request_context_.reset(new CefURLRequestContextImpl());
|
||||||
url_request_context_->set_net_log(net_log_);
|
io_state_->url_request_context_->set_net_log(io_state_->net_log_);
|
||||||
|
|
||||||
storage_.reset(
|
io_state_->storage_.reset(new net::URLRequestContextStorage(
|
||||||
new net::URLRequestContextStorage(url_request_context_.get()));
|
io_state_->url_request_context_.get()));
|
||||||
|
|
||||||
SetCookieStoragePath(cache_path,
|
SetCookieStoragePath(cache_path,
|
||||||
settings_.persist_session_cookies ? true : false);
|
settings_.persist_session_cookies ? true : false);
|
||||||
@@ -212,49 +232,51 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||||||
std::unique_ptr<CefNetworkDelegate> network_delegate(
|
std::unique_ptr<CefNetworkDelegate> network_delegate(
|
||||||
new CefNetworkDelegate());
|
new CefNetworkDelegate());
|
||||||
network_delegate->set_force_google_safesearch(&force_google_safesearch_);
|
network_delegate->set_force_google_safesearch(&force_google_safesearch_);
|
||||||
storage_->set_network_delegate(std::move(network_delegate));
|
io_state_->storage_->set_network_delegate(std::move(network_delegate));
|
||||||
|
|
||||||
const std::string& accept_language =
|
const std::string& accept_language =
|
||||||
settings_.accept_language_list.length > 0 ?
|
settings_.accept_language_list.length > 0 ?
|
||||||
CefString(&settings_.accept_language_list): "en-US,en";
|
CefString(&settings_.accept_language_list): "en-US,en";
|
||||||
storage_->set_http_user_agent_settings(base::WrapUnique(
|
io_state_->storage_->set_http_user_agent_settings(base::WrapUnique(
|
||||||
new CefHttpUserAgentSettings(accept_language)));
|
new CefHttpUserAgentSettings(accept_language)));
|
||||||
|
|
||||||
storage_->set_host_resolver(
|
io_state_->storage_->set_host_resolver(
|
||||||
net::HostResolver::CreateDefaultResolver(net_log_));
|
net::HostResolver::CreateDefaultResolver(io_state_->net_log_));
|
||||||
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
|
io_state_->storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
|
||||||
|
|
||||||
std::unique_ptr<net::TransportSecurityState> transport_security_state(
|
std::unique_ptr<net::TransportSecurityState> transport_security_state(
|
||||||
new net::TransportSecurityState);
|
new net::TransportSecurityState);
|
||||||
transport_security_state->set_enforce_net_security_expiration(
|
transport_security_state->set_enforce_net_security_expiration(
|
||||||
settings_.enable_net_security_expiration ? true : false);
|
settings_.enable_net_security_expiration ? true : false);
|
||||||
storage_->set_transport_security_state(std::move(transport_security_state));
|
io_state_->storage_->set_transport_security_state(
|
||||||
|
std::move(transport_security_state));
|
||||||
|
|
||||||
std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs(
|
std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs(
|
||||||
net::ct::CreateLogVerifiersForKnownLogs());
|
net::ct::CreateLogVerifiersForKnownLogs());
|
||||||
std::unique_ptr<net::MultiLogCTVerifier> ct_verifier(
|
std::unique_ptr<net::MultiLogCTVerifier> ct_verifier(
|
||||||
new net::MultiLogCTVerifier());
|
new net::MultiLogCTVerifier());
|
||||||
ct_verifier->AddLogs(ct_logs);
|
ct_verifier->AddLogs(ct_logs);
|
||||||
storage_->set_cert_transparency_verifier(std::move(ct_verifier));
|
io_state_->storage_->set_cert_transparency_verifier(std::move(ct_verifier));
|
||||||
|
|
||||||
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer(
|
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer(
|
||||||
new net::CTPolicyEnforcer);
|
new net::CTPolicyEnforcer);
|
||||||
ct_policy_enforcer->set_enforce_net_security_expiration(
|
ct_policy_enforcer->set_enforce_net_security_expiration(
|
||||||
settings_.enable_net_security_expiration ? true : false);
|
settings_.enable_net_security_expiration ? true : false);
|
||||||
storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer));
|
io_state_->storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer));
|
||||||
|
|
||||||
std::unique_ptr<net::ProxyService> system_proxy_service =
|
std::unique_ptr<net::ProxyService> system_proxy_service =
|
||||||
ProxyServiceFactory::CreateProxyService(
|
ProxyServiceFactory::CreateProxyService(
|
||||||
net_log_,
|
io_state_->net_log_,
|
||||||
url_request_context_.get(),
|
io_state_->url_request_context_.get(),
|
||||||
url_request_context_->network_delegate(),
|
io_state_->url_request_context_->network_delegate(),
|
||||||
std::move(proxy_config_service_),
|
std::move(io_state_->proxy_config_service_),
|
||||||
*command_line,
|
*command_line,
|
||||||
quick_check_enabled_.GetValue(),
|
quick_check_enabled_.GetValue(),
|
||||||
pac_https_url_stripping_enabled_.GetValue());
|
pac_https_url_stripping_enabled_.GetValue());
|
||||||
storage_->set_proxy_service(std::move(system_proxy_service));
|
io_state_->storage_->set_proxy_service(std::move(system_proxy_service));
|
||||||
|
|
||||||
storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults);
|
io_state_->storage_->set_ssl_config_service(
|
||||||
|
new net::SSLConfigServiceDefaults);
|
||||||
|
|
||||||
std::vector<std::string> supported_schemes;
|
std::vector<std::string> supported_schemes;
|
||||||
supported_schemes.push_back("basic");
|
supported_schemes.push_back("basic");
|
||||||
@@ -262,18 +284,18 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||||||
supported_schemes.push_back("ntlm");
|
supported_schemes.push_back("ntlm");
|
||||||
supported_schemes.push_back("negotiate");
|
supported_schemes.push_back("negotiate");
|
||||||
|
|
||||||
http_auth_preferences_.reset(
|
io_state_->http_auth_preferences_.reset(
|
||||||
new net::HttpAuthPreferences(supported_schemes
|
new net::HttpAuthPreferences(supported_schemes
|
||||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||||
, gsapi_library_name_
|
, io_state_->gsapi_library_name_
|
||||||
#endif
|
#endif
|
||||||
));
|
));
|
||||||
|
|
||||||
storage_->set_http_auth_handler_factory(
|
io_state_->storage_->set_http_auth_handler_factory(
|
||||||
net::HttpAuthHandlerRegistryFactory::Create(
|
net::HttpAuthHandlerRegistryFactory::Create(
|
||||||
http_auth_preferences_.get(),
|
io_state_->http_auth_preferences_.get(),
|
||||||
url_request_context_->host_resolver()));
|
io_state_->url_request_context_->host_resolver()));
|
||||||
storage_->set_http_server_properties(base::WrapUnique(
|
io_state_->storage_->set_http_server_properties(base::WrapUnique(
|
||||||
new net::HttpServerPropertiesImpl));
|
new net::HttpServerPropertiesImpl));
|
||||||
|
|
||||||
base::FilePath http_cache_path;
|
base::FilePath http_cache_path;
|
||||||
@@ -294,74 +316,77 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
|||||||
|
|
||||||
net::HttpNetworkSession::Params network_session_params;
|
net::HttpNetworkSession::Params network_session_params;
|
||||||
network_session_params.host_resolver =
|
network_session_params.host_resolver =
|
||||||
url_request_context_->host_resolver();
|
io_state_->url_request_context_->host_resolver();
|
||||||
network_session_params.cert_verifier =
|
network_session_params.cert_verifier =
|
||||||
url_request_context_->cert_verifier();
|
io_state_->url_request_context_->cert_verifier();
|
||||||
network_session_params.transport_security_state =
|
network_session_params.transport_security_state =
|
||||||
url_request_context_->transport_security_state();
|
io_state_->url_request_context_->transport_security_state();
|
||||||
network_session_params.cert_transparency_verifier =
|
network_session_params.cert_transparency_verifier =
|
||||||
url_request_context_->cert_transparency_verifier();
|
io_state_->url_request_context_->cert_transparency_verifier();
|
||||||
network_session_params.ct_policy_enforcer =
|
network_session_params.ct_policy_enforcer =
|
||||||
url_request_context_->ct_policy_enforcer();
|
io_state_->url_request_context_->ct_policy_enforcer();
|
||||||
network_session_params.proxy_service =
|
network_session_params.proxy_service =
|
||||||
url_request_context_->proxy_service();
|
io_state_->url_request_context_->proxy_service();
|
||||||
network_session_params.ssl_config_service =
|
network_session_params.ssl_config_service =
|
||||||
url_request_context_->ssl_config_service();
|
io_state_->url_request_context_->ssl_config_service();
|
||||||
network_session_params.http_auth_handler_factory =
|
network_session_params.http_auth_handler_factory =
|
||||||
url_request_context_->http_auth_handler_factory();
|
io_state_->url_request_context_->http_auth_handler_factory();
|
||||||
network_session_params.http_server_properties =
|
network_session_params.http_server_properties =
|
||||||
url_request_context_->http_server_properties();
|
io_state_->url_request_context_->http_server_properties();
|
||||||
network_session_params.ignore_certificate_errors =
|
network_session_params.ignore_certificate_errors =
|
||||||
settings_.ignore_certificate_errors ? true : false;
|
settings_.ignore_certificate_errors ? true : false;
|
||||||
network_session_params.net_log = net_log_;
|
network_session_params.net_log = io_state_->net_log_;
|
||||||
|
|
||||||
storage_->set_http_network_session(
|
io_state_->storage_->set_http_network_session(
|
||||||
base::WrapUnique(new net::HttpNetworkSession(network_session_params)));
|
base::WrapUnique(new net::HttpNetworkSession(network_session_params)));
|
||||||
storage_->set_http_transaction_factory(base::WrapUnique(
|
io_state_->storage_->set_http_transaction_factory(base::WrapUnique(
|
||||||
new net::HttpCache(storage_->http_network_session(),
|
new net::HttpCache(io_state_->storage_->http_network_session(),
|
||||||
std::move(main_backend),
|
std::move(main_backend),
|
||||||
true /* set_up_quic_server_info */)));
|
true /* set_up_quic_server_info */)));
|
||||||
|
|
||||||
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
||||||
new net::URLRequestJobFactoryImpl());
|
new net::URLRequestJobFactoryImpl());
|
||||||
url_request_manager_.reset(new CefURLRequestManager(job_factory.get()));
|
io_state_->url_request_manager_.reset(
|
||||||
|
new CefURLRequestManager(job_factory.get()));
|
||||||
|
|
||||||
// Install internal scheme handlers that cannot be overridden.
|
// Install internal scheme handlers that cannot be overridden.
|
||||||
scheme::InstallInternalProtectedHandlers(
|
scheme::InstallInternalProtectedHandlers(
|
||||||
job_factory.get(),
|
job_factory.get(),
|
||||||
url_request_manager_.get(),
|
io_state_->url_request_manager_.get(),
|
||||||
&protocol_handlers_,
|
&io_state_->protocol_handlers_,
|
||||||
network_session_params.host_resolver);
|
network_session_params.host_resolver);
|
||||||
protocol_handlers_.clear();
|
io_state_->protocol_handlers_.clear();
|
||||||
|
|
||||||
// Register internal scheme handlers that can be overridden.
|
// Register internal scheme handlers that can be overridden.
|
||||||
scheme::RegisterInternalHandlers(url_request_manager_.get());
|
scheme::RegisterInternalHandlers(io_state_->url_request_manager_.get());
|
||||||
|
|
||||||
request_interceptors_.push_back(base::MakeUnique<CefRequestInterceptor>());
|
io_state_->request_interceptors_.push_back(
|
||||||
|
base::MakeUnique<CefRequestInterceptor>());
|
||||||
|
|
||||||
// Set up interceptors in the reverse order.
|
// Set up interceptors in the reverse order.
|
||||||
std::unique_ptr<net::URLRequestJobFactory> top_job_factory =
|
std::unique_ptr<net::URLRequestJobFactory> top_job_factory =
|
||||||
std::move(job_factory);
|
std::move(job_factory);
|
||||||
for (auto i = request_interceptors_.rbegin();
|
for (auto i = io_state_->request_interceptors_.rbegin();
|
||||||
i != request_interceptors_.rend(); ++i) {
|
i != io_state_->request_interceptors_.rend(); ++i) {
|
||||||
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
|
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
|
||||||
std::move(top_job_factory), std::move(*i)));
|
std::move(top_job_factory), std::move(*i)));
|
||||||
}
|
}
|
||||||
request_interceptors_.clear();
|
io_state_->request_interceptors_.clear();
|
||||||
|
|
||||||
storage_->set_job_factory(std::move(top_job_factory));
|
io_state_->storage_->set_job_factory(std::move(top_job_factory));
|
||||||
|
|
||||||
#if defined(USE_NSS_CERTS)
|
#if defined(USE_NSS_CERTS)
|
||||||
// Only do this for the first (global) request context.
|
// Only do this for the first (global) request context.
|
||||||
static bool request_context_for_nss_set = false;
|
static bool request_context_for_nss_set = false;
|
||||||
if (!request_context_for_nss_set) {
|
if (!request_context_for_nss_set) {
|
||||||
net::SetURLRequestContextForNSSHttpIO(url_request_context_.get());
|
net::SetURLRequestContextForNSSHttpIO(
|
||||||
|
io_state_->url_request_context_.get());
|
||||||
request_context_for_nss_set = true;
|
request_context_for_nss_set = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return url_request_context_.get();
|
return io_state_->url_request_context_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_refptr<base::SingleThreadTaskRunner>
|
scoped_refptr<base::SingleThreadTaskRunner>
|
||||||
@@ -370,7 +395,7 @@ scoped_refptr<base::SingleThreadTaskRunner>
|
|||||||
}
|
}
|
||||||
|
|
||||||
net::HostResolver* CefURLRequestContextGetterImpl::GetHostResolver() const {
|
net::HostResolver* CefURLRequestContextGetterImpl::GetHostResolver() const {
|
||||||
return url_request_context_->host_resolver();
|
return io_state_->url_request_context_->host_resolver();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
||||||
@@ -378,9 +403,9 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
|||||||
bool persist_session_cookies) {
|
bool persist_session_cookies) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
if (url_request_context_->cookie_store() &&
|
if (io_state_->url_request_context_->cookie_store() &&
|
||||||
((cookie_store_path_.empty() && path.empty()) ||
|
((io_state_->cookie_store_path_.empty() && path.empty()) ||
|
||||||
cookie_store_path_ == path)) {
|
io_state_->cookie_store_path_ == path)) {
|
||||||
// The path has not changed so don't do anything.
|
// The path has not changed so don't do anything.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -412,23 +437,23 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
|
|||||||
new net::CookieMonster(persistent_store.get(), NULL));
|
new net::CookieMonster(persistent_store.get(), NULL));
|
||||||
if (persistent_store.get() && persist_session_cookies)
|
if (persistent_store.get() && persist_session_cookies)
|
||||||
cookie_monster->SetPersistSessionCookies(true);
|
cookie_monster->SetPersistSessionCookies(true);
|
||||||
cookie_store_path_ = path;
|
io_state_->cookie_store_path_ = path;
|
||||||
|
|
||||||
// Restore the previously supported schemes.
|
// Restore the previously supported schemes.
|
||||||
CefCookieManagerImpl::SetCookieMonsterSchemes(cookie_monster.get(),
|
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||||
cookie_supported_schemes_);
|
cookie_monster.get(), io_state_->cookie_supported_schemes_);
|
||||||
|
|
||||||
storage_->set_cookie_store(std::move(cookie_monster));
|
io_state_->storage_->set_cookie_store(std::move(cookie_monster));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
|
void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
|
||||||
const std::vector<std::string>& schemes) {
|
const std::vector<std::string>& schemes) {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
cookie_supported_schemes_ = schemes;
|
io_state_->cookie_supported_schemes_ = schemes;
|
||||||
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
CefCookieManagerImpl::SetCookieMonsterSchemes(
|
||||||
static_cast<net::CookieMonster*>(GetExistingCookieStore()),
|
static_cast<net::CookieMonster*>(GetExistingCookieStore()),
|
||||||
cookie_supported_schemes_);
|
io_state_->cookie_supported_schemes_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::AddHandler(
|
void CefURLRequestContextGetterImpl::AddHandler(
|
||||||
@@ -438,34 +463,36 @@ void CefURLRequestContextGetterImpl::AddHandler(
|
|||||||
base::Bind(&CefURLRequestContextGetterImpl::AddHandler, this, handler));
|
base::Bind(&CefURLRequestContextGetterImpl::AddHandler, this, handler));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handler_list_.push_back(handler);
|
io_state_->handler_list_.push_back(handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
net::CookieStore*
|
net::CookieStore*
|
||||||
CefURLRequestContextGetterImpl::GetExistingCookieStore() const {
|
CefURLRequestContextGetterImpl::GetExistingCookieStore() const {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
if (url_request_context_ && url_request_context_->cookie_store())
|
if (io_state_->url_request_context_ &&
|
||||||
return url_request_context_->cookie_store();
|
io_state_->url_request_context_->cookie_store()) {
|
||||||
|
return io_state_->url_request_context_->cookie_store();
|
||||||
|
}
|
||||||
|
|
||||||
LOG(ERROR) << "Cookie store does not exist";
|
LOG(ERROR) << "Cookie store does not exist";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
|
void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
|
||||||
if (proxy_config_service_.get())
|
if (io_state_->proxy_config_service_.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
proxy_config_service_ =
|
io_state_->proxy_config_service_ =
|
||||||
net::ProxyService::CreateSystemProxyConfigService(
|
net::ProxyService::CreateSystemProxyConfigService(
|
||||||
io_task_runner_, file_task_runner_);
|
io_state_->io_task_runner_, io_state_->file_task_runner_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {
|
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {
|
||||||
http_auth_preferences_->set_server_whitelist(
|
io_state_->http_auth_preferences_->set_server_whitelist(
|
||||||
auth_server_whitelist_.GetValue());
|
auth_server_whitelist_.GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
|
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
|
||||||
http_auth_preferences_->set_delegate_whitelist(
|
io_state_->http_auth_preferences_->set_delegate_whitelist(
|
||||||
auth_negotiate_delegate_whitelist_.GetValue());
|
auth_negotiate_delegate_whitelist_.GetValue());
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,7 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
|||||||
net::CookieStore* GetExistingCookieStore() const;
|
net::CookieStore* GetExistingCookieStore() const;
|
||||||
|
|
||||||
CefURLRequestManager* request_manager() const {
|
CefURLRequestManager* request_manager() const {
|
||||||
return url_request_manager_.get();
|
return io_state_->url_request_manager_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -89,9 +89,16 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
|||||||
void UpdateServerWhitelist();
|
void UpdateServerWhitelist();
|
||||||
void UpdateDelegateWhitelist();
|
void UpdateDelegateWhitelist();
|
||||||
|
|
||||||
|
void ShutdownOnIOThread();
|
||||||
|
|
||||||
const CefRequestContextSettings settings_;
|
const CefRequestContextSettings settings_;
|
||||||
|
|
||||||
net::NetLog* net_log_; // Guaranteed to outlive this object.
|
bool shutting_down_ = false;
|
||||||
|
|
||||||
|
// State that is only accessed on the IO thread and will be reset in
|
||||||
|
// ShutdownOnIOThread().
|
||||||
|
struct IOState {
|
||||||
|
net::NetLog* net_log_ = nullptr; // Guaranteed to outlive this object.
|
||||||
|
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
|
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
|
||||||
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
|
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
|
||||||
@@ -112,6 +119,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
|||||||
std::vector<std::string> cookie_supported_schemes_;
|
std::vector<std::string> cookie_supported_schemes_;
|
||||||
|
|
||||||
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
|
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
|
||||||
|
};
|
||||||
|
std::unique_ptr<IOState> io_state_;
|
||||||
|
|
||||||
BooleanPrefMember quick_check_enabled_;
|
BooleanPrefMember quick_check_enabled_;
|
||||||
BooleanPrefMember pac_https_url_stripping_enabled_;
|
BooleanPrefMember pac_https_url_stripping_enabled_;
|
||||||
|
@@ -21,9 +21,26 @@ CefURLRequestContextGetterProxy::~CefURLRequestContextGetterProxy() {
|
|||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefURLRequestContextGetterProxy::ShutdownOnUIThread() {
|
||||||
|
CEF_REQUIRE_UIT();
|
||||||
|
CEF_POST_TASK(CEF_IOT,
|
||||||
|
base::Bind(&CefURLRequestContextGetterProxy::ShutdownOnIOThread, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefURLRequestContextGetterProxy::ShutdownOnIOThread() {
|
||||||
|
CEF_REQUIRE_IOT();
|
||||||
|
shutting_down_ = true;
|
||||||
|
context_proxy_.reset();
|
||||||
|
NotifyContextShuttingDown();
|
||||||
|
}
|
||||||
|
|
||||||
net::URLRequestContext*
|
net::URLRequestContext*
|
||||||
CefURLRequestContextGetterProxy::GetURLRequestContext() {
|
CefURLRequestContextGetterProxy::GetURLRequestContext() {
|
||||||
CEF_REQUIRE_IOT();
|
CEF_REQUIRE_IOT();
|
||||||
|
|
||||||
|
if (shutting_down_)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
if (!context_proxy_) {
|
if (!context_proxy_) {
|
||||||
context_proxy_.reset(
|
context_proxy_.reset(
|
||||||
new CefURLRequestContextProxy(static_cast<CefURLRequestContextImpl*>(
|
new CefURLRequestContextProxy(static_cast<CefURLRequestContextImpl*>(
|
||||||
|
@@ -24,6 +24,9 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
|
|||||||
scoped_refptr<CefURLRequestContextGetterImpl> parent);
|
scoped_refptr<CefURLRequestContextGetterImpl> parent);
|
||||||
~CefURLRequestContextGetterProxy() override;
|
~CefURLRequestContextGetterProxy() override;
|
||||||
|
|
||||||
|
// Called when the StoragePartitionProxy is destroyed.
|
||||||
|
void ShutdownOnUIThread();
|
||||||
|
|
||||||
// net::URLRequestContextGetter implementation.
|
// net::URLRequestContextGetter implementation.
|
||||||
net::URLRequestContext* GetURLRequestContext() override;
|
net::URLRequestContext* GetURLRequestContext() override;
|
||||||
scoped_refptr<base::SingleThreadTaskRunner>
|
scoped_refptr<base::SingleThreadTaskRunner>
|
||||||
@@ -35,6 +38,8 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
|
|||||||
CefRefPtr<CefRequestContextHandler> handler() const { return handler_; }
|
CefRefPtr<CefRequestContextHandler> handler() const { return handler_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void ShutdownOnIOThread();
|
||||||
|
|
||||||
CefRefPtr<CefRequestContextHandler> handler_;
|
CefRefPtr<CefRequestContextHandler> handler_;
|
||||||
|
|
||||||
// The CefURLRequestContextImpl owned by |parent_| is passed as a raw pointer
|
// The CefURLRequestContextImpl owned by |parent_| is passed as a raw pointer
|
||||||
@@ -44,6 +49,8 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
|
|||||||
|
|
||||||
std::unique_ptr<CefURLRequestContextProxy> context_proxy_;
|
std::unique_ptr<CefURLRequestContextProxy> context_proxy_;
|
||||||
|
|
||||||
|
bool shutting_down_ = false;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterProxy);
|
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterProxy);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -171,7 +171,8 @@ std::unique_ptr<CefJavaScriptDialogRunner>
|
|||||||
return native_delegate_->CreateJavaScriptDialogRunner();
|
return native_delegate_->CreateJavaScriptDialogRunner();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CefMenuRunner> CefBrowserPlatformDelegateOsr::CreateMenuRunner() {
|
std::unique_ptr<CefMenuRunner>
|
||||||
|
CefBrowserPlatformDelegateOsr::CreateMenuRunner() {
|
||||||
return native_delegate_->CreateMenuRunner();
|
return native_delegate_->CreateMenuRunner();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,6 +303,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const gfx::Point client_pt(event.x, event.y);
|
const gfx::Point client_pt(event.x, event.y);
|
||||||
|
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||||
|
|
||||||
gfx::Point transformed_pt;
|
gfx::Point transformed_pt;
|
||||||
content::RenderWidgetHostImpl* target_rwh =
|
content::RenderWidgetHostImpl* target_rwh =
|
||||||
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||||
@@ -309,15 +312,32 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
|||||||
client_pt, &transformed_pt);
|
client_pt, &transformed_pt);
|
||||||
|
|
||||||
if (target_rwh != current_rwh_for_drag_.get()) {
|
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||||
if (current_rwh_for_drag_)
|
if (current_rwh_for_drag_) {
|
||||||
current_rwh_for_drag_->DragTargetDragLeave();
|
gfx::Point transformed_leave_point = client_pt;
|
||||||
|
gfx::Point transformed_screen_point = screen_pt;
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
web_contents->GetRenderWidgetHostView())
|
||||||
|
->TransformPointToCoordSpaceForView(
|
||||||
|
client_pt,
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
current_rwh_for_drag_->GetView()),
|
||||||
|
&transformed_leave_point);
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
web_contents->GetRenderWidgetHostView())
|
||||||
|
->TransformPointToCoordSpaceForView(
|
||||||
|
screen_pt,
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
current_rwh_for_drag_->GetView()),
|
||||||
|
&transformed_screen_point);
|
||||||
|
current_rwh_for_drag_->DragTargetDragLeave(transformed_leave_point,
|
||||||
|
transformed_screen_point);
|
||||||
|
}
|
||||||
DragTargetDragEnter(drag_data_, event, drag_allowed_ops_);
|
DragTargetDragEnter(drag_data_, event, drag_allowed_ops_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!drag_data_)
|
if (!drag_data_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
|
||||||
blink::WebDragOperationsMask ops =
|
blink::WebDragOperationsMask ops =
|
||||||
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
||||||
int modifiers = TranslateModifiers(event.modifiers);
|
int modifiers = TranslateModifiers(event.modifiers);
|
||||||
@@ -332,7 +352,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (current_rwh_for_drag_) {
|
if (current_rwh_for_drag_) {
|
||||||
current_rwh_for_drag_->DragTargetDragLeave();
|
current_rwh_for_drag_->DragTargetDragLeave(gfx::Point(), gfx::Point());
|
||||||
current_rwh_for_drag_.reset();
|
current_rwh_for_drag_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,6 +369,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
gfx::Point client_pt(event.x, event.y);
|
gfx::Point client_pt(event.x, event.y);
|
||||||
|
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||||
|
|
||||||
gfx::Point transformed_pt;
|
gfx::Point transformed_pt;
|
||||||
content::RenderWidgetHostImpl* target_rwh =
|
content::RenderWidgetHostImpl* target_rwh =
|
||||||
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||||
@@ -356,8 +378,26 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
|||||||
client_pt, &transformed_pt);
|
client_pt, &transformed_pt);
|
||||||
|
|
||||||
if (target_rwh != current_rwh_for_drag_.get()) {
|
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||||
if (current_rwh_for_drag_)
|
if (current_rwh_for_drag_) {
|
||||||
current_rwh_for_drag_->DragTargetDragLeave();
|
gfx::Point transformed_leave_point = client_pt;
|
||||||
|
gfx::Point transformed_screen_point = screen_pt;
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
web_contents->GetRenderWidgetHostView())
|
||||||
|
->TransformPointToCoordSpaceForView(
|
||||||
|
client_pt,
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
current_rwh_for_drag_->GetView()),
|
||||||
|
&transformed_leave_point);
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
web_contents->GetRenderWidgetHostView())
|
||||||
|
->TransformPointToCoordSpaceForView(
|
||||||
|
screen_pt,
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
current_rwh_for_drag_->GetView()),
|
||||||
|
&transformed_screen_point);
|
||||||
|
current_rwh_for_drag_->DragTargetDragLeave(transformed_leave_point,
|
||||||
|
transformed_screen_point);
|
||||||
|
}
|
||||||
DragTargetDragEnter(drag_data_, event, drag_allowed_ops_);
|
DragTargetDragEnter(drag_data_, event, drag_allowed_ops_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,7 +409,6 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
|||||||
static_cast<CefDragDataImpl*>(drag_data_.get());
|
static_cast<CefDragDataImpl*>(drag_data_.get());
|
||||||
base::AutoLock lock_scope(data_impl->lock());
|
base::AutoLock lock_scope(data_impl->lock());
|
||||||
content::DropData* drop_data = data_impl->drop_data();
|
content::DropData* drop_data = data_impl->drop_data();
|
||||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
|
||||||
int modifiers = TranslateModifiers(event.modifiers);
|
int modifiers = TranslateModifiers(event.modifiers);
|
||||||
|
|
||||||
target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt,
|
target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt,
|
||||||
@@ -430,11 +469,36 @@ void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
|
|||||||
if (!web_contents)
|
if (!web_contents)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(x, y));
|
content::RenderWidgetHostImpl* source_rwh = drag_start_rwh_.get();
|
||||||
|
const gfx::Point client_loc(gfx::Point(x, y));
|
||||||
|
const gfx::Point& screen_loc = GetScreenPoint(client_loc);
|
||||||
blink::WebDragOperation drag_op = static_cast<blink::WebDragOperation>(op);
|
blink::WebDragOperation drag_op = static_cast<blink::WebDragOperation>(op);
|
||||||
|
|
||||||
web_contents->DragSourceEndedAt(x, y, screen_pt.x(), screen_pt.y(), drag_op,
|
// |client_loc| and |screen_loc| are in the root coordinate space, for
|
||||||
drag_start_rwh_.get());
|
// non-root RenderWidgetHosts they need to be transformed.
|
||||||
|
gfx::Point transformed_point = client_loc;
|
||||||
|
gfx::Point transformed_screen_point = screen_loc;
|
||||||
|
if (source_rwh && web_contents->GetRenderWidgetHostView()) {
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
web_contents->GetRenderWidgetHostView())
|
||||||
|
->TransformPointToCoordSpaceForView(
|
||||||
|
client_loc,
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
source_rwh->GetView()),
|
||||||
|
&transformed_point);
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
web_contents->GetRenderWidgetHostView())
|
||||||
|
->TransformPointToCoordSpaceForView(
|
||||||
|
screen_loc,
|
||||||
|
static_cast<content::RenderWidgetHostViewBase*>(
|
||||||
|
source_rwh->GetView()),
|
||||||
|
&transformed_screen_point);
|
||||||
|
}
|
||||||
|
|
||||||
|
web_contents->DragSourceEndedAt(transformed_point.x(), transformed_point.y(),
|
||||||
|
transformed_screen_point.x(),
|
||||||
|
transformed_screen_point.y(), drag_op,
|
||||||
|
source_rwh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() {
|
void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() {
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
||||||
#include "content/browser/renderer_host/dip_util.h"
|
#include "content/browser/renderer_host/dip_util.h"
|
||||||
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
#include "content/browser/renderer_host/render_widget_host_delegate.h"
|
||||||
|
#include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h"
|
||||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||||
#include "content/browser/renderer_host/resize_lock.h"
|
#include "content/browser/renderer_host/resize_lock.h"
|
||||||
#include "content/common/input_messages.h"
|
#include "content/common/input_messages.h"
|
||||||
@@ -33,8 +34,8 @@
|
|||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/context_factory.h"
|
#include "content/public/browser/context_factory.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
|
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
|
#include "media/base/video_frame.h"
|
||||||
#include "ui/gfx/geometry/dip_util.h"
|
#include "ui/gfx/geometry/dip_util.h"
|
||||||
#include "ui/gfx/geometry/size_conversions.h"
|
#include "ui/gfx/geometry/size_conversions.h"
|
||||||
#include "ui/gfx/image/image_skia_operations.h"
|
#include "ui/gfx/image/image_skia_operations.h"
|
||||||
@@ -451,7 +452,8 @@ class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
|
|||||||
CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||||
bool transparent,
|
bool transparent,
|
||||||
content::RenderWidgetHost* widget,
|
content::RenderWidgetHost* widget,
|
||||||
CefRenderWidgetHostViewOSR* parent_host_view)
|
CefRenderWidgetHostViewOSR* parent_host_view,
|
||||||
|
bool is_guest_view_hack)
|
||||||
: transparent_(transparent),
|
: transparent_(transparent),
|
||||||
scale_factor_(kDefaultScaleFactor),
|
scale_factor_(kDefaultScaleFactor),
|
||||||
frame_rate_threshold_ms_(0),
|
frame_rate_threshold_ms_(0),
|
||||||
@@ -483,20 +485,20 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(OS_MACOSX)
|
#if !defined(OS_MACOSX)
|
||||||
content::ImageTransportFactory* factory =
|
|
||||||
content::ImageTransportFactory::GetInstance();
|
|
||||||
ui::ContextFactoryPrivate* context_factory_private =
|
|
||||||
factory->GetContextFactoryPrivate();
|
|
||||||
delegated_frame_host_ = base::MakeUnique<content::DelegatedFrameHost>(
|
delegated_frame_host_ = base::MakeUnique<content::DelegatedFrameHost>(
|
||||||
context_factory_private->AllocateFrameSinkId(), this);
|
AllocateFrameSinkId(is_guest_view_hack), this);
|
||||||
|
|
||||||
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PlatformCreateCompositorWidget();
|
PlatformCreateCompositorWidget(is_guest_view_hack);
|
||||||
|
|
||||||
#if !defined(OS_MACOSX)
|
#if !defined(OS_MACOSX)
|
||||||
// On OS X the ui::Compositor is created/owned by the platform view.
|
// On macOS the ui::Compositor is created/owned by the platform view.
|
||||||
|
content::ImageTransportFactory* factory =
|
||||||
|
content::ImageTransportFactory::GetInstance();
|
||||||
|
ui::ContextFactoryPrivate* context_factory_private =
|
||||||
|
factory->GetContextFactoryPrivate();
|
||||||
compositor_.reset(
|
compositor_.reset(
|
||||||
new ui::Compositor(context_factory_private->AllocateFrameSinkId(),
|
new ui::Compositor(context_factory_private->AllocateFrameSinkId(),
|
||||||
content::GetContextFactory(), context_factory_private,
|
content::GetContextFactory(), context_factory_private,
|
||||||
@@ -593,7 +595,7 @@ bool CefRenderWidgetHostViewOSR::HasFocus() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefRenderWidgetHostViewOSR::IsSurfaceAvailableForCopy() const {
|
bool CefRenderWidgetHostViewOSR::IsSurfaceAvailableForCopy() const {
|
||||||
return GetDelegatedFrameHost()->CanCopyToBitmap();
|
return GetDelegatedFrameHost()->CanCopyFromCompositingSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::Show() {
|
void CefRenderWidgetHostViewOSR::Show() {
|
||||||
@@ -697,16 +699,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
|||||||
|
|
||||||
// The compositor will draw directly to the SoftwareOutputDevice which
|
// The compositor will draw directly to the SoftwareOutputDevice which
|
||||||
// then calls OnPaint.
|
// then calls OnPaint.
|
||||||
#if defined(OS_MACOSX)
|
// We would normally call BrowserCompositorMac::SwapCompositorFrame on
|
||||||
// We would normally call BrowserCompositorMac::SwapCompositorFrame,
|
// macOS, however it contains compositor resize logic that we don't want.
|
||||||
// however it contains compositor resize logic that we don't want.
|
|
||||||
// Consequently we instead call the SwapDelegatedFrame method directly.
|
// Consequently we instead call the SwapDelegatedFrame method directly.
|
||||||
browser_compositor_->GetDelegatedFrameHost()->SwapDelegatedFrame(
|
GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id,
|
||||||
output_surface_id, std::move(frame));
|
|
||||||
#else
|
|
||||||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
|
||||||
std::move(frame));
|
std::move(frame));
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
if (!copy_frame_generator_.get()) {
|
if (!copy_frame_generator_.get()) {
|
||||||
copy_frame_generator_.reset(
|
copy_frame_generator_.reset(
|
||||||
@@ -721,16 +718,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
|
|||||||
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
|
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
|
||||||
damage_rect.Intersect(gfx::Rect(frame_size));
|
damage_rect.Intersect(gfx::Rect(frame_size));
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
// We would normally call BrowserCompositorMac::SwapCompositorFrame on
|
||||||
// We would normally call BrowserCompositorMac::SwapCompositorFrame,
|
// macOS, however it contains compositor resize logic that we don't want.
|
||||||
// however it contains compositor resize logic that we don't want.
|
|
||||||
// Consequently we instead call the SwapDelegatedFrame method directly.
|
// Consequently we instead call the SwapDelegatedFrame method directly.
|
||||||
browser_compositor_->GetDelegatedFrameHost()->SwapDelegatedFrame(
|
GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id,
|
||||||
output_surface_id, std::move(frame));
|
|
||||||
#else
|
|
||||||
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
|
|
||||||
std::move(frame));
|
std::move(frame));
|
||||||
#endif
|
|
||||||
|
|
||||||
// Request a copy of the last compositor frame which will eventually call
|
// Request a copy of the last compositor frame which will eventually call
|
||||||
// OnPaint asynchronously.
|
// OnPaint asynchronously.
|
||||||
@@ -892,7 +884,7 @@ gfx::Size CefRenderWidgetHostViewOSR::GetPhysicalBackingSize() const {
|
|||||||
return gfx::ConvertSizeToPixel(scale_factor_, GetRequestedRendererSize());
|
return gfx::ConvertSizeToPixel(scale_factor_, GetRequestedRendererSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface(
|
void CefRenderWidgetHostViewOSR::CopyFromSurface(
|
||||||
const gfx::Rect& src_subrect,
|
const gfx::Rect& src_subrect,
|
||||||
const gfx::Size& dst_size,
|
const gfx::Size& dst_size,
|
||||||
const content::ReadbackRequestCallback& callback,
|
const content::ReadbackRequestCallback& callback,
|
||||||
@@ -901,18 +893,14 @@ void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface(
|
|||||||
src_subrect, dst_size, callback, color_type);
|
src_subrect, dst_size, callback, color_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::CopyFromCompositingSurfaceToVideoFrame(
|
void CefRenderWidgetHostViewOSR::CopyFromSurfaceToVideoFrame(
|
||||||
const gfx::Rect& src_subrect,
|
const gfx::Rect& src_subrect,
|
||||||
const scoped_refptr<media::VideoFrame>& target,
|
scoped_refptr<media::VideoFrame> target,
|
||||||
const base::Callback<void(const gfx::Rect&, bool)>& callback) {
|
const base::Callback<void(const gfx::Rect&, bool)>& callback) {
|
||||||
GetDelegatedFrameHost()->CopyFromCompositingSurfaceToVideoFrame(
|
GetDelegatedFrameHost()->CopyFromCompositingSurfaceToVideoFrame(
|
||||||
src_subrect, target, callback);
|
src_subrect, target, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefRenderWidgetHostViewOSR::CanCopyToVideoFrame() const {
|
|
||||||
return GetDelegatedFrameHost()->CanCopyToVideoFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::BeginFrameSubscription(
|
void CefRenderWidgetHostViewOSR::BeginFrameSubscription(
|
||||||
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) {
|
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) {
|
||||||
GetDelegatedFrameHost()->BeginFrameSubscription(std::move(subscriber));
|
GetDelegatedFrameHost()->BeginFrameSubscription(std::move(subscriber));
|
||||||
@@ -950,14 +938,6 @@ content::BrowserAccessibilityManager*
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::LockCompositingSurface() {
|
|
||||||
NOTIMPLEMENTED();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::UnlockCompositingSurface() {
|
|
||||||
NOTIMPLEMENTED();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
|
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
|
||||||
void CefRenderWidgetHostViewOSR::ShowDisambiguationPopup(
|
void CefRenderWidgetHostViewOSR::ShowDisambiguationPopup(
|
||||||
const gfx::Rect& rect_pixels,
|
const gfx::Rect& rect_pixels,
|
||||||
@@ -1046,6 +1026,40 @@ void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||||
|
const gfx::Point& point,
|
||||||
|
const cc::SurfaceId& original_surface,
|
||||||
|
gfx::Point* transformed_point) {
|
||||||
|
// Transformations use physical pixels rather than DIP, so conversion
|
||||||
|
// is necessary.
|
||||||
|
gfx::Point point_in_pixels =
|
||||||
|
gfx::ConvertPointToPixel(scale_factor_, point);
|
||||||
|
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace(
|
||||||
|
point_in_pixels, original_surface, transformed_point)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*transformed_point =
|
||||||
|
gfx::ConvertPointToDIP(scale_factor_, *transformed_point);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||||
|
const gfx::Point& point,
|
||||||
|
RenderWidgetHostViewBase* target_view,
|
||||||
|
gfx::Point* transformed_point) {
|
||||||
|
if (target_view == this) {
|
||||||
|
*transformed_point = point;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion,
|
||||||
|
// but it is not necessary here because the final target view is responsible
|
||||||
|
// for converting before computing the final transform.
|
||||||
|
return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView(
|
||||||
|
point, target_view, transformed_point);
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<cc::SoftwareOutputDevice>
|
std::unique_ptr<cc::SoftwareOutputDevice>
|
||||||
CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice(
|
CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice(
|
||||||
ui::Compositor* compositor) {
|
ui::Compositor* compositor) {
|
||||||
@@ -1613,3 +1627,20 @@ void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId(
|
||||||
|
bool is_guest_view_hack) {
|
||||||
|
// GuestViews have two RenderWidgetHostViews and so we need to make sure
|
||||||
|
// we don't have FrameSinkId collisions.
|
||||||
|
// The FrameSinkId generated here must be unique with FrameSinkId allocated
|
||||||
|
// in ContextFactoryPrivate.
|
||||||
|
content::ImageTransportFactory* factory =
|
||||||
|
content::ImageTransportFactory::GetInstance();
|
||||||
|
return is_guest_view_hack
|
||||||
|
? factory->GetContextFactoryPrivate()->AllocateFrameSinkId()
|
||||||
|
: cc::FrameSinkId(base::checked_cast<uint32_t>(
|
||||||
|
render_widget_host_->GetProcess()->GetID()),
|
||||||
|
base::checked_cast<uint32_t>(
|
||||||
|
render_widget_host_->GetRoutingID()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -91,7 +91,8 @@ class CefRenderWidgetHostViewOSR
|
|||||||
public:
|
public:
|
||||||
CefRenderWidgetHostViewOSR(const bool transparent,
|
CefRenderWidgetHostViewOSR(const bool transparent,
|
||||||
content::RenderWidgetHost* widget,
|
content::RenderWidgetHost* widget,
|
||||||
CefRenderWidgetHostViewOSR* parent_host_view);
|
CefRenderWidgetHostViewOSR* parent_host_view,
|
||||||
|
bool is_guest_view_hack);
|
||||||
~CefRenderWidgetHostViewOSR() override;
|
~CefRenderWidgetHostViewOSR() override;
|
||||||
|
|
||||||
// RenderWidgetHostView implementation.
|
// RenderWidgetHostView implementation.
|
||||||
@@ -142,16 +143,15 @@ class CefRenderWidgetHostViewOSR
|
|||||||
|
|
||||||
gfx::Size GetRequestedRendererSize() const override;
|
gfx::Size GetRequestedRendererSize() const override;
|
||||||
gfx::Size GetPhysicalBackingSize() const override;
|
gfx::Size GetPhysicalBackingSize() const override;
|
||||||
void CopyFromCompositingSurface(
|
void CopyFromSurface(
|
||||||
const gfx::Rect& src_subrect,
|
const gfx::Rect& src_subrect,
|
||||||
const gfx::Size& dst_size,
|
const gfx::Size& dst_size,
|
||||||
const content::ReadbackRequestCallback& callback,
|
const content::ReadbackRequestCallback& callback,
|
||||||
const SkColorType color_type) override;
|
const SkColorType color_type) override;
|
||||||
void CopyFromCompositingSurfaceToVideoFrame(
|
void CopyFromSurfaceToVideoFrame(
|
||||||
const gfx::Rect& src_subrect,
|
const gfx::Rect& src_subrect,
|
||||||
const scoped_refptr<media::VideoFrame>& target,
|
scoped_refptr<media::VideoFrame> target,
|
||||||
const base::Callback<void(const gfx::Rect&, bool)>& callback) override;
|
const base::Callback<void(const gfx::Rect&, bool)>& callback) override;
|
||||||
bool CanCopyToVideoFrame() const override;
|
|
||||||
void BeginFrameSubscription(
|
void BeginFrameSubscription(
|
||||||
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber)
|
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber)
|
||||||
override;
|
override;
|
||||||
@@ -162,8 +162,6 @@ class CefRenderWidgetHostViewOSR
|
|||||||
CreateBrowserAccessibilityManager(
|
CreateBrowserAccessibilityManager(
|
||||||
content::BrowserAccessibilityDelegate* delegate,
|
content::BrowserAccessibilityDelegate* delegate,
|
||||||
bool for_root_frame) override;
|
bool for_root_frame) override;
|
||||||
void LockCompositingSurface() override;
|
|
||||||
void UnlockCompositingSurface() override;
|
|
||||||
|
|
||||||
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
|
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
|
||||||
void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
|
void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
|
||||||
@@ -175,6 +173,15 @@ class CefRenderWidgetHostViewOSR
|
|||||||
|
|
||||||
void SetNeedsBeginFrames(bool enabled) override;
|
void SetNeedsBeginFrames(bool enabled) override;
|
||||||
|
|
||||||
|
bool TransformPointToLocalCoordSpace(
|
||||||
|
const gfx::Point& point,
|
||||||
|
const cc::SurfaceId& original_surface,
|
||||||
|
gfx::Point* transformed_point) override;
|
||||||
|
bool TransformPointToCoordSpaceForView(
|
||||||
|
const gfx::Point& point,
|
||||||
|
RenderWidgetHostViewBase* target_view,
|
||||||
|
gfx::Point* transformed_point) override;
|
||||||
|
|
||||||
// ui::CompositorDelegate implementation.
|
// ui::CompositorDelegate implementation.
|
||||||
std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
||||||
ui::Compositor* compositor) override;
|
ui::Compositor* compositor) override;
|
||||||
@@ -280,10 +287,12 @@ class CefRenderWidgetHostViewOSR
|
|||||||
|
|
||||||
void RequestImeCompositionUpdate(bool start_monitoring);
|
void RequestImeCompositionUpdate(bool start_monitoring);
|
||||||
|
|
||||||
|
cc::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack);
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
friend class MacHelper;
|
friend class MacHelper;
|
||||||
#endif
|
#endif
|
||||||
void PlatformCreateCompositorWidget();
|
void PlatformCreateCompositorWidget(bool is_guest_view_hack);
|
||||||
void PlatformResizeCompositorWidget(const gfx::Size& size);
|
void PlatformResizeCompositorWidget(const gfx::Size& size);
|
||||||
void PlatformDestroyCompositorWidget();
|
void PlatformDestroyCompositorWidget();
|
||||||
|
|
||||||
|
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <X11/cursorfont.h>
|
#include <X11/cursorfont.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#undef Status // Avoid conflicts with url_request_status.h
|
||||||
|
|
||||||
#include "libcef/browser/browser_host_impl.h"
|
|
||||||
#include "libcef/browser/native/window_x11.h"
|
#include "libcef/browser/native/window_x11.h"
|
||||||
|
|
||||||
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
|
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
|
||||||
@@ -166,13 +166,15 @@ XCursorCache* cursor_cache = nullptr;
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
|
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
|
||||||
|
bool is_guest_view_hack) {
|
||||||
// Create a hidden 1x1 window. It will delete itself on close.
|
// Create a hidden 1x1 window. It will delete itself on close.
|
||||||
window_ = new CefWindowX11(NULL, None, gfx::Rect(0, 0, 1, 1));
|
window_ = new CefWindowX11(NULL, None, gfx::Rect(0, 0, 1, 1));
|
||||||
compositor_widget_ = window_->xwindow();
|
compositor_widget_ = window_->xwindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) {
|
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(
|
||||||
|
const gfx::Size&) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
|
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
|
||||||
|
@@ -128,7 +128,8 @@ content::DelegatedFrameHost* CefRenderWidgetHostViewOSR::GetDelegatedFrameHost()
|
|||||||
return browser_compositor_->GetDelegatedFrameHost();
|
return browser_compositor_->GetDelegatedFrameHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
|
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
|
||||||
|
bool is_guest_view_hack) {
|
||||||
// Create a borderless non-visible 1x1 window.
|
// Create a borderless non-visible 1x1 window.
|
||||||
window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1)
|
window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1)
|
||||||
styleMask:NSBorderlessWindowMask
|
styleMask:NSBorderlessWindowMask
|
||||||
@@ -144,7 +145,8 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
|
|||||||
|
|
||||||
mac_helper_ = new MacHelper(this);
|
mac_helper_ = new MacHelper(this);
|
||||||
browser_compositor_.reset(new content::BrowserCompositorMac(
|
browser_compositor_.reset(new content::BrowserCompositorMac(
|
||||||
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true));
|
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true,
|
||||||
|
AllocateFrameSinkId(is_guest_view_hack)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) {
|
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) {
|
||||||
|
@@ -143,13 +143,15 @@ bool IsSystemCursorID(LPCWSTR cursor_id) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
|
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
|
||||||
|
bool is_guest_view_hack) {
|
||||||
DCHECK(!window_);
|
DCHECK(!window_);
|
||||||
window_.reset(new CefCompositorHostWin());
|
window_.reset(new CefCompositorHostWin());
|
||||||
compositor_widget_ = window_->hwnd();
|
compositor_widget_ = window_->hwnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size& size) {
|
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(
|
||||||
|
const gfx::Size& size) {
|
||||||
DCHECK(window_);
|
DCHECK(window_);
|
||||||
SetWindowPos(window_->hwnd(), NULL, 0, 0, size.width(), size.height(),
|
SetWindowPos(window_->hwnd(), NULL, 0, 0, size.width(), size.height(),
|
||||||
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE);
|
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE);
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
||||||
#include "libcef/browser/thread_util.h"
|
#include "libcef/browser/thread_util.h"
|
||||||
|
|
||||||
#include "third_party/skia/include/core/SkDevice.h"
|
#include "third_party/skia/src/core/SkDevice.h"
|
||||||
#include "ui/compositor/compositor.h"
|
#include "ui/compositor/compositor.h"
|
||||||
#include "ui/gfx/skia_util.h"
|
#include "ui/gfx/skia_util.h"
|
||||||
|
|
||||||
|
@@ -99,8 +99,10 @@ content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget(
|
|||||||
embedder_render_widget_host->GetView());
|
embedder_render_widget_host->GetView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool is_guest_view_hack = !!embedder_render_widget_host;
|
||||||
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host,
|
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host,
|
||||||
embedder_host_view);
|
embedder_host_view,
|
||||||
|
is_guest_view_hack);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called for popup and fullscreen widgets.
|
// Called for popup and fullscreen widgets.
|
||||||
@@ -110,7 +112,8 @@ content::RenderWidgetHostViewBase*
|
|||||||
CefRenderWidgetHostViewOSR* view = GetView();
|
CefRenderWidgetHostViewOSR* view = GetView();
|
||||||
CHECK(view);
|
CHECK(view);
|
||||||
|
|
||||||
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, view);
|
return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, view,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {
|
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {
|
||||||
|
@@ -159,8 +159,7 @@ void CefPermissionContext::DecidePermission(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ContentSetting content_setting =
|
ContentSetting content_setting =
|
||||||
profile_->GetHostContentSettingsMap()->
|
profile_->GetHostContentSettingsMap()->GetContentSetting(
|
||||||
GetContentSettingAndMaybeUpdateLastUsage(
|
|
||||||
requesting_origin,
|
requesting_origin,
|
||||||
embedding_origin,
|
embedding_origin,
|
||||||
permission_util::PermissionTypeToContentSetting(permission),
|
permission_util::PermissionTypeToContentSetting(permission),
|
||||||
|
@@ -294,21 +294,6 @@ PermissionStatus CefPermissionManager::GetPermissionStatus(
|
|||||||
embedding_origin));
|
embedding_origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefPermissionManager::RegisterPermissionUsage(
|
|
||||||
PermissionType permission,
|
|
||||||
const GURL& requesting_origin,
|
|
||||||
const GURL& embedding_origin) {
|
|
||||||
// This is required because constant permissions don't have a
|
|
||||||
// ContentSettingsType.
|
|
||||||
if (IsConstantPermission(permission))
|
|
||||||
return;
|
|
||||||
|
|
||||||
profile_->GetHostContentSettingsMap()->UpdateLastUsage(
|
|
||||||
requesting_origin,
|
|
||||||
embedding_origin,
|
|
||||||
permission_util::PermissionTypeToContentSetting(permission));
|
|
||||||
}
|
|
||||||
|
|
||||||
int CefPermissionManager::SubscribePermissionStatusChange(
|
int CefPermissionManager::SubscribePermissionStatusChange(
|
||||||
PermissionType permission,
|
PermissionType permission,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
|
@@ -55,9 +55,6 @@ class CefPermissionManager : public KeyedService,
|
|||||||
content::PermissionType permission,
|
content::PermissionType permission,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
const GURL& embedding_origin) override;
|
const GURL& embedding_origin) override;
|
||||||
void RegisterPermissionUsage(content::PermissionType permission,
|
|
||||||
const GURL& requesting_origin,
|
|
||||||
const GURL& embedding_origin) override;
|
|
||||||
int SubscribePermissionStatusChange(
|
int SubscribePermissionStatusChange(
|
||||||
content::PermissionType permission,
|
content::PermissionType permission,
|
||||||
const GURL& requesting_origin,
|
const GURL& requesting_origin,
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include "chrome/grit/locale_settings.h"
|
#include "chrome/grit/locale_settings.h"
|
||||||
#include "components/content_settings/core/browser/cookie_settings.h"
|
#include "components/content_settings/core/browser/cookie_settings.h"
|
||||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||||
|
#include "components/google/core/browser/google_url_tracker.h"
|
||||||
#include "components/prefs/json_pref_store.h"
|
#include "components/prefs/json_pref_store.h"
|
||||||
#include "components/prefs/pref_filter.h"
|
#include "components/prefs/pref_filter.h"
|
||||||
#include "components/prefs/pref_registry_simple.h"
|
#include "components/prefs/pref_registry_simple.h"
|
||||||
@@ -175,6 +176,7 @@ std::unique_ptr<PrefService> CreatePrefService(
|
|||||||
update_client::RegisterPrefs(registry.get());
|
update_client::RegisterPrefs(registry.get());
|
||||||
content_settings::CookieSettings::RegisterProfilePrefs(registry.get());
|
content_settings::CookieSettings::RegisterProfilePrefs(registry.get());
|
||||||
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
|
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
|
||||||
|
GoogleURLTracker::RegisterProfilePrefs(registry.get());
|
||||||
|
|
||||||
// Print preferences.
|
// Print preferences.
|
||||||
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
|
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);
|
||||||
|
@@ -280,7 +280,7 @@ void SetBool(CommandLinePrefStore* prefs,
|
|||||||
const std::string& key,
|
const std::string& key,
|
||||||
bool value) {
|
bool value) {
|
||||||
prefs->SetValue(key,
|
prefs->SetValue(key,
|
||||||
base::WrapUnique(new base::FundamentalValue(value)),
|
base::WrapUnique(new base::Value(value)),
|
||||||
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "base/auto_reset.h"
|
#include "base/auto_reset.h"
|
||||||
#include "base/bind.h"
|
#include "base/bind.h"
|
||||||
|
#include "base/feature_list.h"
|
||||||
#include "base/location.h"
|
#include "base/location.h"
|
||||||
#include "base/memory/ptr_util.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
#include "chrome/browser/printing/print_job_manager.h"
|
#include "chrome/browser/printing/print_job_manager.h"
|
||||||
#include "chrome/browser/printing/printer_query.h"
|
#include "chrome/browser/printing/printer_query.h"
|
||||||
#include "chrome/browser/profiles/profile.h"
|
#include "chrome/browser/profiles/profile.h"
|
||||||
|
#include "chrome/common/chrome_features.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "chrome/grit/generated_resources.h"
|
#include "chrome/grit/generated_resources.h"
|
||||||
#include "components/prefs/pref_service.h"
|
#include "components/prefs/pref_service.h"
|
||||||
@@ -163,24 +165,40 @@ void CefPrintViewManagerBase::OnDidPrintPage(
|
|||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
print_job_->AppendPrintedPage(params.page_number);
|
print_job_->AppendPrintedPage(params.page_number);
|
||||||
if (metafile_must_be_valid) {
|
if (metafile_must_be_valid) {
|
||||||
// TODO(thestig): Figure out why rendering text with GDI results in random
|
|
||||||
// missing characters for some users. https://crbug.com/658606
|
|
||||||
bool print_text_with_gdi =
|
|
||||||
document->settings().print_text_with_gdi() &&
|
|
||||||
!document->settings().printer_is_xps() &&
|
|
||||||
switches::GDITextPrintingEnabled();
|
|
||||||
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
|
scoped_refptr<base::RefCountedBytes> bytes = new base::RefCountedBytes(
|
||||||
reinterpret_cast<const unsigned char*>(shared_buf->memory()),
|
reinterpret_cast<const unsigned char*>(shared_buf->memory()),
|
||||||
params.data_size);
|
params.data_size);
|
||||||
|
|
||||||
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
|
document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf"));
|
||||||
|
|
||||||
|
const auto& settings = document->settings();
|
||||||
|
if ((settings.printer_is_ps2() || settings.printer_is_ps3()) &&
|
||||||
|
base::FeatureList::IsEnabled(features::kPostScriptPrinting)) {
|
||||||
|
print_job_->StartPdfToPostScriptConversion(bytes, params.content_area,
|
||||||
|
params.physical_offsets,
|
||||||
|
settings.printer_is_ps2());
|
||||||
|
} else {
|
||||||
|
// TODO(thestig): Figure out why rendering text with GDI results in random
|
||||||
|
// missing characters for some users. https://crbug.com/658606
|
||||||
|
// Update : The missing letters seem to have been caused by the same
|
||||||
|
// problem as https://crbug.com/659604 which was resolved. GDI printing
|
||||||
|
// seems to work with the fix for this bug applied.
|
||||||
|
bool print_text_with_gdi = settings.print_text_with_gdi() &&
|
||||||
|
!settings.printer_is_xps() &&
|
||||||
|
base::FeatureList::IsEnabled(
|
||||||
|
features::kGdiTextPrinting);
|
||||||
print_job_->StartPdfToEmfConversion(
|
print_job_->StartPdfToEmfConversion(
|
||||||
bytes, params.page_size, params.content_area,
|
bytes, params.page_size, params.content_area, print_text_with_gdi);
|
||||||
print_text_with_gdi);
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Update the rendered document. It will send notifications to the listener.
|
// Update the rendered document. It will send notifications to the listener.
|
||||||
document->SetPage(params.page_number, std::move(metafile), params.page_size,
|
document->SetPage(params.page_number,
|
||||||
|
std::move(metafile),
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
0.0f /* dummy shrink_factor */,
|
||||||
|
#endif
|
||||||
|
params.page_size,
|
||||||
params.content_area);
|
params.content_area);
|
||||||
|
|
||||||
ShouldQuitFromInnerMessageLoop();
|
ShouldQuitFromInnerMessageLoop();
|
||||||
|
@@ -90,7 +90,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::GetGlobalContext() {
|
|||||||
|
|
||||||
CefRequestContextImpl::Config config;
|
CefRequestContextImpl::Config config;
|
||||||
config.is_global = true;
|
config.is_global = true;
|
||||||
return new CefRequestContextImpl(config);
|
return CefRequestContextImpl::GetOrCreateRequestContext(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -107,7 +107,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
|
|||||||
config.settings = settings;
|
config.settings = settings;
|
||||||
config.handler = handler;
|
config.handler = handler;
|
||||||
config.unique_id = g_next_id.GetNext();
|
config.unique_id = g_next_id.GetNext();
|
||||||
return new CefRequestContextImpl(config);
|
return CefRequestContextImpl::GetOrCreateRequestContext(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -127,7 +127,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
|
|||||||
config.other = static_cast<CefRequestContextImpl*>(other.get());
|
config.other = static_cast<CefRequestContextImpl*>(other.get());
|
||||||
config.handler = handler;
|
config.handler = handler;
|
||||||
config.unique_id = g_next_id.GetNext();
|
config.unique_id = g_next_id.GetNext();
|
||||||
return new CefRequestContextImpl(config);
|
return CefRequestContextImpl::GetOrCreateRequestContext(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -139,12 +139,25 @@ CefRequestContextImpl::~CefRequestContextImpl() {
|
|||||||
browser_context_proxy_.reset(nullptr);
|
browser_context_proxy_.reset(nullptr);
|
||||||
|
|
||||||
if (browser_context_impl_) {
|
if (browser_context_impl_) {
|
||||||
// May result in |browser_context_impl_| being deleted if it's not the
|
// May result in |browser_context_impl_| being deleted if no other
|
||||||
// global context and no other CefRequestContextImpl are referencing it.
|
// CefRequestContextImpl are referencing it.
|
||||||
browser_context_impl_->RemoveRequestContext();
|
browser_context_impl_->RemoveCefRequestContext(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
CefRefPtr<CefRequestContextImpl>
|
||||||
|
CefRequestContextImpl::CreateGlobalRequestContext(
|
||||||
|
const CefRequestContextSettings& settings) {
|
||||||
|
// Create and initialize the global context immediately.
|
||||||
|
Config config;
|
||||||
|
config.is_global = true;
|
||||||
|
config.settings = settings;
|
||||||
|
CefRefPtr<CefRequestContextImpl> impl = new CefRequestContextImpl(config);
|
||||||
|
impl->Initialize();
|
||||||
|
return impl;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
CefRefPtr<CefRequestContextImpl>
|
CefRefPtr<CefRequestContextImpl>
|
||||||
CefRequestContextImpl::GetOrCreateForRequestContext(
|
CefRequestContextImpl::GetOrCreateForRequestContext(
|
||||||
@@ -155,22 +168,9 @@ CefRequestContextImpl::GetOrCreateForRequestContext(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use the global context.
|
// Use the global context.
|
||||||
CefRequestContextImpl::Config config;
|
Config config;
|
||||||
config.is_global = true;
|
config.is_global = true;
|
||||||
return new CefRequestContextImpl(config);
|
return CefRequestContextImpl::GetOrCreateRequestContext(config);
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
CefRefPtr<CefRequestContextImpl> CefRequestContextImpl::CreateForBrowserContext(
|
|
||||||
CefBrowserContext* browser_context) {
|
|
||||||
DCHECK(browser_context);
|
|
||||||
CefRequestContextImpl::Config config;
|
|
||||||
config.handler = browser_context->GetHandler();
|
|
||||||
CefRefPtr<CefRequestContextImpl> impl = new CefRequestContextImpl(config);
|
|
||||||
// Force immediate initialization because it's not safe to keep a raw pointer
|
|
||||||
// to |browser_context|.
|
|
||||||
impl->Initialize(browser_context);
|
|
||||||
return impl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CefBrowserContext* CefRequestContextImpl::GetBrowserContext() {
|
CefBrowserContext* CefRequestContextImpl::GetBrowserContext() {
|
||||||
@@ -191,7 +191,7 @@ void CefRequestContextImpl::GetRequestContextImpl(
|
|||||||
const RequestContextCallback& callback) {
|
const RequestContextCallback& callback) {
|
||||||
if (!task_runner.get())
|
if (!task_runner.get())
|
||||||
task_runner = base::MessageLoop::current()->task_runner();
|
task_runner = base::MessageLoop::current()->task_runner();
|
||||||
if (request_context_impl_) {
|
if (request_context_getter_impl_) {
|
||||||
// The browser context already exists.
|
// The browser context already exists.
|
||||||
DCHECK(browser_context());
|
DCHECK(browser_context());
|
||||||
GetRequestContextImplOnIOThread(task_runner, callback, browser_context());
|
GetRequestContextImplOnIOThread(task_runner, callback, browser_context());
|
||||||
@@ -257,9 +257,10 @@ bool CefRequestContextImpl::IsSharingWith(CefRefPtr<CefRequestContext> other) {
|
|||||||
return pending_other->IsSharingWith(this);
|
return pending_other->IsSharingWith(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request_context_impl_ && other_impl->request_context_impl_) {
|
if (request_context_getter_impl_ && other_impl->request_context_getter_impl_) {
|
||||||
// Both objects are initialized. Compare the request context objects.
|
// Both objects are initialized. Compare the request context objects.
|
||||||
return (request_context_impl_ == other_impl->request_context_impl_);
|
return (request_context_getter_impl_ ==
|
||||||
|
other_impl->request_context_getter_impl_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This or the other object is not initialized. Compare the cache path values.
|
// This or the other object is not initialized. Compare the cache path values.
|
||||||
@@ -479,12 +480,13 @@ cef_errorcode_t CefRequestContextImpl::ResolveHostCached(
|
|||||||
return ERR_FAILED;
|
return ERR_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!request_context_impl_)
|
if (!request_context_getter_impl_)
|
||||||
return ERR_FAILED;
|
return ERR_FAILED;
|
||||||
|
|
||||||
int retval = ERR_FAILED;
|
int retval = ERR_FAILED;
|
||||||
|
|
||||||
net::HostResolver* host_resolver = request_context_impl_->GetHostResolver();
|
net::HostResolver* host_resolver =
|
||||||
|
request_context_getter_impl_->GetHostResolver();
|
||||||
if (host_resolver) {
|
if (host_resolver) {
|
||||||
net::HostResolver::RequestInfo request_info(
|
net::HostResolver::RequestInfo request_info(
|
||||||
net::HostPortPair::FromURL(GURL(origin.ToString())));
|
net::HostPortPair::FromURL(GURL(origin.ToString())));
|
||||||
@@ -501,38 +503,34 @@ cef_errorcode_t CefRequestContextImpl::ResolveHostCached(
|
|||||||
return static_cast<cef_errorcode_t>(retval);
|
return static_cast<cef_errorcode_t>(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
CefRefPtr<CefRequestContextImpl>
|
||||||
|
CefRequestContextImpl::GetOrCreateRequestContext(const Config& config) {
|
||||||
|
if (config.is_global ||
|
||||||
|
(config.other && config.other->IsGlobal() && !config.handler)) {
|
||||||
|
// Return the singleton global context.
|
||||||
|
return CefContentBrowserClient::Get()->request_context();
|
||||||
|
}
|
||||||
|
|
||||||
|
// The new context will be initialized later by EnsureBrowserContext().
|
||||||
|
return new CefRequestContextImpl(config);
|
||||||
|
}
|
||||||
|
|
||||||
CefRequestContextImpl::CefRequestContextImpl(
|
CefRequestContextImpl::CefRequestContextImpl(
|
||||||
const CefRequestContextImpl::Config& config)
|
const CefRequestContextImpl::Config& config)
|
||||||
: config_(config) {
|
: config_(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRequestContextImpl::Initialize() {
|
void CefRequestContextImpl::Initialize() {
|
||||||
CefBrowserContext* other_browser_context = nullptr;
|
|
||||||
if (config_.is_global)
|
|
||||||
other_browser_context = CefContentBrowserClient::Get()->browser_context();
|
|
||||||
else if (config_.other.get())
|
|
||||||
other_browser_context = config_.other->GetBrowserContext();
|
|
||||||
|
|
||||||
Initialize(other_browser_context);
|
|
||||||
|
|
||||||
if (config_.other.get()) {
|
|
||||||
// Clear the reference to |other_| after setting |request_context_impl_|.
|
|
||||||
// This is the reverse order of checks in IsSharedWith().
|
|
||||||
config_.other = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefRequestContextImpl::Initialize(
|
|
||||||
CefBrowserContext* other_browser_context) {
|
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
DCHECK(!browser_context_impl_);
|
DCHECK(!browser_context_impl_);
|
||||||
DCHECK(!request_context_impl_);
|
DCHECK(!request_context_getter_impl_);
|
||||||
|
|
||||||
if (other_browser_context) {
|
if (config_.other) {
|
||||||
// Share storage with |other_browser_context|.
|
// Share storage with |config_.other|.
|
||||||
browser_context_impl_ = CefBrowserContextImpl::GetForContext(
|
browser_context_impl_ = CefBrowserContextImpl::GetForContext(
|
||||||
other_browser_context);
|
config_.other->GetBrowserContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser_context_impl_) {
|
if (!browser_context_impl_) {
|
||||||
@@ -556,7 +554,7 @@ void CefRequestContextImpl::Initialize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We'll disassociate from |browser_context_impl_| on destruction.
|
// We'll disassociate from |browser_context_impl_| on destruction.
|
||||||
browser_context_impl_->AddRequestContext();
|
browser_context_impl_->AddCefRequestContext(this);
|
||||||
|
|
||||||
// Force our settings to match |browser_context_impl_|.
|
// Force our settings to match |browser_context_impl_|.
|
||||||
config_.settings = browser_context_impl_->GetSettings();
|
config_.settings = browser_context_impl_->GetSettings();
|
||||||
@@ -565,21 +563,27 @@ void CefRequestContextImpl::Initialize(
|
|||||||
// Use a proxy that will execute handler callbacks where appropriate and
|
// Use a proxy that will execute handler callbacks where appropriate and
|
||||||
// otherwise forward all requests to |browser_context_impl_|.
|
// otherwise forward all requests to |browser_context_impl_|.
|
||||||
browser_context_proxy_.reset(
|
browser_context_proxy_.reset(
|
||||||
new CefBrowserContextProxy(config_.handler, browser_context_impl_));
|
new CefBrowserContextProxy(this, config_.handler,
|
||||||
|
browser_context_impl_));
|
||||||
browser_context_proxy_->Initialize();
|
browser_context_proxy_->Initialize();
|
||||||
DCHECK(!config_.is_global);
|
DCHECK(!config_.is_global);
|
||||||
} else {
|
|
||||||
config_.is_global = (browser_context_impl_ ==
|
|
||||||
CefContentBrowserClient::Get()->browser_context());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
request_context_impl_ = browser_context_impl_->request_context().get();
|
request_context_getter_impl_ =
|
||||||
DCHECK(request_context_impl_);
|
browser_context_impl_->request_context_getter().get();
|
||||||
|
DCHECK(request_context_getter_impl_);
|
||||||
|
|
||||||
if (config_.handler.get()) {
|
if (config_.handler.get()) {
|
||||||
// Keep the handler alive until the associated request context is
|
// Keep the handler alive until the associated request context is
|
||||||
// destroyed.
|
// destroyed.
|
||||||
request_context_impl_->AddHandler(config_.handler);
|
request_context_getter_impl_->AddHandler(config_.handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config_.other) {
|
||||||
|
// Clear the reference to |config_.other| after setting
|
||||||
|
// |request_context_getter_impl_|. This is the reverse order of checks in
|
||||||
|
// IsSharedWith().
|
||||||
|
config_.other = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +591,7 @@ void CefRequestContextImpl::EnsureBrowserContext() {
|
|||||||
if (!browser_context())
|
if (!browser_context())
|
||||||
Initialize();
|
Initialize();
|
||||||
DCHECK(browser_context());
|
DCHECK(browser_context());
|
||||||
DCHECK(request_context_impl_);
|
DCHECK(request_context_getter_impl_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRequestContextImpl::GetBrowserContextOnUIThread(
|
void CefRequestContextImpl::GetBrowserContextOnUIThread(
|
||||||
@@ -623,18 +627,18 @@ void CefRequestContextImpl::GetRequestContextImplOnIOThread(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DCHECK(request_context_impl_);
|
DCHECK(request_context_getter_impl_);
|
||||||
|
|
||||||
// Make sure the request context exists.
|
// Make sure the request context exists.
|
||||||
request_context_impl_->GetURLRequestContext();
|
request_context_getter_impl_->GetURLRequestContext();
|
||||||
|
|
||||||
if (task_runner->BelongsToCurrentThread()) {
|
if (task_runner->BelongsToCurrentThread()) {
|
||||||
// Execute the callback immediately.
|
// Execute the callback immediately.
|
||||||
callback.Run(request_context_impl_);
|
callback.Run(request_context_getter_impl_);
|
||||||
} else {
|
} else {
|
||||||
// Execute the callback on the target thread.
|
// Execute the callback on the target thread.
|
||||||
task_runner->PostTask(FROM_HERE,
|
task_runner->PostTask(FROM_HERE,
|
||||||
base::Bind(callback, make_scoped_refptr(request_context_impl_)));
|
base::Bind(callback, make_scoped_refptr(request_context_getter_impl_)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,16 +19,16 @@ class CefRequestContextImpl : public CefRequestContext {
|
|||||||
public:
|
public:
|
||||||
~CefRequestContextImpl() override;
|
~CefRequestContextImpl() override;
|
||||||
|
|
||||||
|
// Creates the singleton global RequestContext. Called from
|
||||||
|
// CefBrowserMainParts::PreMainMessageLoopRun.
|
||||||
|
static CefRefPtr<CefRequestContextImpl> CreateGlobalRequestContext(
|
||||||
|
const CefRequestContextSettings& settings);
|
||||||
|
|
||||||
// Returns a CefRequestContextImpl for the specified |request_context|.
|
// Returns a CefRequestContextImpl for the specified |request_context|.
|
||||||
// Will return the global context if |request_context| is NULL.
|
// Will return the global context if |request_context| is NULL.
|
||||||
static CefRefPtr<CefRequestContextImpl> GetOrCreateForRequestContext(
|
static CefRefPtr<CefRequestContextImpl> GetOrCreateForRequestContext(
|
||||||
CefRefPtr<CefRequestContext> request_context);
|
CefRefPtr<CefRequestContext> request_context);
|
||||||
|
|
||||||
// Returns a CefRequestContextImpl for the specified |browser_context|.
|
|
||||||
// |browser_context| must be non-NULL.
|
|
||||||
static CefRefPtr<CefRequestContextImpl> CreateForBrowserContext(
|
|
||||||
CefBrowserContext* browser_context);
|
|
||||||
|
|
||||||
// Returns the browser context object. Can only be called on the UI thread.
|
// Returns the browser context object. Can only be called on the UI thread.
|
||||||
CefBrowserContext* GetBrowserContext();
|
CefBrowserContext* GetBrowserContext();
|
||||||
|
|
||||||
@@ -108,10 +108,12 @@ class CefRequestContextImpl : public CefRequestContext {
|
|||||||
int unique_id = -1;
|
int unique_id = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static CefRefPtr<CefRequestContextImpl> GetOrCreateRequestContext(
|
||||||
|
const Config& config);
|
||||||
|
|
||||||
explicit CefRequestContextImpl(const Config& config);
|
explicit CefRequestContextImpl(const Config& config);
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
void Initialize(CefBrowserContext* other_browser_context);
|
|
||||||
|
|
||||||
// Make sure the browser context exists. Only called on the UI thread.
|
// Make sure the browser context exists. Only called on the UI thread.
|
||||||
void EnsureBrowserContext();
|
void EnsureBrowserContext();
|
||||||
@@ -155,7 +157,7 @@ class CefRequestContextImpl : public CefRequestContext {
|
|||||||
Config config_;
|
Config config_;
|
||||||
|
|
||||||
// Owned by the CefBrowserContext.
|
// Owned by the CefBrowserContext.
|
||||||
CefURLRequestContextGetterImpl* request_context_impl_ = nullptr;
|
CefURLRequestContextGetterImpl* request_context_getter_impl_ = nullptr;
|
||||||
|
|
||||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefRequestContextImpl);
|
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefRequestContextImpl);
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefRequestContextImpl);
|
DISALLOW_COPY_AND_ASSIGN(CefRequestContextImpl);
|
||||||
|
@@ -46,17 +46,6 @@ CefResourceContext::CefResourceContext(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefResourceContext::~CefResourceContext() {
|
CefResourceContext::~CefResourceContext() {
|
||||||
if (getter_.get()) {
|
|
||||||
// When the parent object (ResourceContext) destructor executes all
|
|
||||||
// associated URLRequests should be destroyed. If there are no other
|
|
||||||
// references it should then be safe to destroy the URLRequestContextGetter
|
|
||||||
// which owns the URLRequestContext.
|
|
||||||
getter_->AddRef();
|
|
||||||
CefURLRequestContextGetter* raw_getter = getter_.get();
|
|
||||||
getter_ = NULL;
|
|
||||||
content::BrowserThread::ReleaseSoon(
|
|
||||||
content::BrowserThread::IO, FROM_HERE, raw_getter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base::SupportsUserData::Data* CefResourceContext::GetUserData(const void* key)
|
base::SupportsUserData::Data* CefResourceContext::GetUserData(const void* key)
|
||||||
@@ -73,6 +62,14 @@ void CefResourceContext::SetUserData(const void* key, Data* data) {
|
|||||||
content::ResourceContext::SetUserData(key, data);
|
content::ResourceContext::SetUserData(key, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefResourceContext::SetUserData(const void* key,
|
||||||
|
std::unique_ptr<Data> data) {
|
||||||
|
if (parent_ && ShouldProxyUserData(key))
|
||||||
|
parent_->SetUserData(key, std::move(data));
|
||||||
|
else
|
||||||
|
content::ResourceContext::SetUserData(key, std::move(data));
|
||||||
|
}
|
||||||
|
|
||||||
void CefResourceContext::RemoveUserData(const void* key) {
|
void CefResourceContext::RemoveUserData(const void* key) {
|
||||||
if (parent_ && ShouldProxyUserData(key))
|
if (parent_ && ShouldProxyUserData(key))
|
||||||
parent_->RemoveUserData(key);
|
parent_->RemoveUserData(key);
|
||||||
|
@@ -35,6 +35,7 @@ class CefResourceContext : public content::ResourceContext {
|
|||||||
// SupportsUserData implementation.
|
// SupportsUserData implementation.
|
||||||
Data* GetUserData(const void* key) const override;
|
Data* GetUserData(const void* key) const override;
|
||||||
void SetUserData(const void* key, Data* data) override;
|
void SetUserData(const void* key, Data* data) override;
|
||||||
|
void SetUserData(const void* key, std::unique_ptr<Data> data) override;
|
||||||
void RemoveUserData(const void* key) override;
|
void RemoveUserData(const void* key) override;
|
||||||
|
|
||||||
// ResourceContext implementation.
|
// ResourceContext implementation.
|
||||||
|
@@ -53,6 +53,8 @@ void SendExecuteMimeTypeHandlerEvent(
|
|||||||
web_contents = content::WebContents::FromRenderFrameHost(
|
web_contents = content::WebContents::FromRenderFrameHost(
|
||||||
content::RenderFrameHost::FromID(render_process_id, render_frame_id));
|
content::RenderFrameHost::FromID(render_process_id, render_frame_id));
|
||||||
}
|
}
|
||||||
|
if (!web_contents)
|
||||||
|
return;
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> browser =
|
CefRefPtr<CefBrowserHostImpl> browser =
|
||||||
CefBrowserHostImpl::GetBrowserForContents(web_contents);
|
CefBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||||
|
@@ -11,6 +11,10 @@ CefStoragePartitionProxy::CefStoragePartitionProxy(
|
|||||||
url_request_context_(url_request_context) {
|
url_request_context_(url_request_context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefStoragePartitionProxy::~CefStoragePartitionProxy() {
|
||||||
|
url_request_context_->ShutdownOnUIThread();
|
||||||
|
}
|
||||||
|
|
||||||
base::FilePath CefStoragePartitionProxy::GetPath() {
|
base::FilePath CefStoragePartitionProxy::GetPath() {
|
||||||
return parent_->GetPath();
|
return parent_->GetPath();
|
||||||
}
|
}
|
||||||
@@ -91,6 +95,11 @@ CefStoragePartitionProxy::GetBroadcastChannelProvider() {
|
|||||||
return parent_->GetBroadcastChannelProvider();
|
return parent_->GetBroadcastChannelProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::BluetoothAllowedDevicesMap*
|
||||||
|
CefStoragePartitionProxy::GetBluetoothAllowedDevicesMap() {
|
||||||
|
return parent_->GetBluetoothAllowedDevicesMap();
|
||||||
|
}
|
||||||
|
|
||||||
void CefStoragePartitionProxy::ClearDataForOrigin(
|
void CefStoragePartitionProxy::ClearDataForOrigin(
|
||||||
uint32_t remove_mask,
|
uint32_t remove_mask,
|
||||||
uint32_t quota_storage_remove_mask,
|
uint32_t quota_storage_remove_mask,
|
||||||
@@ -129,6 +138,10 @@ void CefStoragePartitionProxy::Flush() {
|
|||||||
parent_->Flush();
|
parent_->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefStoragePartitionProxy::ClearBluetoothAllowedDevicesMapForTesting() {
|
||||||
|
parent_->ClearBluetoothAllowedDevicesMapForTesting();
|
||||||
|
}
|
||||||
|
|
||||||
void CefStoragePartitionProxy::Bind(
|
void CefStoragePartitionProxy::Bind(
|
||||||
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request) {
|
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request) {
|
||||||
parent_->Bind(std::move(request));
|
parent_->Bind(std::move(request));
|
||||||
|
@@ -18,6 +18,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
|||||||
CefStoragePartitionProxy(
|
CefStoragePartitionProxy(
|
||||||
content::StoragePartition* parent,
|
content::StoragePartition* parent,
|
||||||
CefURLRequestContextGetterProxy* url_request_context);
|
CefURLRequestContextGetterProxy* url_request_context);
|
||||||
|
~CefStoragePartitionProxy() override;
|
||||||
|
|
||||||
// StoragePartition methods:
|
// StoragePartition methods:
|
||||||
base::FilePath GetPath() override;
|
base::FilePath GetPath() override;
|
||||||
@@ -39,6 +40,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
|||||||
content::BackgroundSyncContext* GetBackgroundSyncContext() override;
|
content::BackgroundSyncContext* GetBackgroundSyncContext() override;
|
||||||
content::PaymentAppContextImpl* GetPaymentAppContext() override;
|
content::PaymentAppContextImpl* GetPaymentAppContext() override;
|
||||||
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
|
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
|
||||||
|
content::BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override;
|
||||||
void ClearDataForOrigin(uint32_t remove_mask,
|
void ClearDataForOrigin(uint32_t remove_mask,
|
||||||
uint32_t quota_storage_remove_mask,
|
uint32_t quota_storage_remove_mask,
|
||||||
const GURL& storage_origin,
|
const GURL& storage_origin,
|
||||||
@@ -59,6 +61,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
|
|||||||
const base::Time end,
|
const base::Time end,
|
||||||
const base::Closure& callback) override;
|
const base::Closure& callback) override;
|
||||||
void Flush() override;
|
void Flush() override;
|
||||||
|
void ClearBluetoothAllowedDevicesMapForTesting() override;
|
||||||
void Bind(
|
void Bind(
|
||||||
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request)
|
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request)
|
||||||
override;
|
override;
|
||||||
|
@@ -41,14 +41,15 @@ CEF_BUTTON_VIEW_T class CefButtonView : public CEF_VIEW_VIEW_D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// views::CustomButton methods:
|
// views::CustomButton methods:
|
||||||
void StateChanged() override;
|
void StateChanged(views::CustomButton::ButtonState old_state) override;
|
||||||
|
|
||||||
// views::ButtonListener methods:
|
// views::ButtonListener methods:
|
||||||
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
|
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::StateChanged() {
|
CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::StateChanged(
|
||||||
ParentClass::StateChanged();
|
views::CustomButton::ButtonState old_state) {
|
||||||
|
ParentClass::StateChanged(old_state);
|
||||||
if (ParentClass::cef_delegate())
|
if (ParentClass::cef_delegate())
|
||||||
ParentClass::cef_delegate()->OnButtonStateChanged(GetCefButton());
|
ParentClass::cef_delegate()->OnButtonStateChanged(GetCefButton());
|
||||||
}
|
}
|
||||||
|
@@ -265,8 +265,9 @@ bool CefZipReaderImpl::GetFileInfo() {
|
|||||||
time.tm_hour = file_info.tmu_date.tm_hour;
|
time.tm_hour = file_info.tmu_date.tm_hour;
|
||||||
time.tm_mday = file_info.tmu_date.tm_mday;
|
time.tm_mday = file_info.tmu_date.tm_mday;
|
||||||
time.tm_mon = file_info.tmu_date.tm_mon;
|
time.tm_mon = file_info.tmu_date.tm_mon;
|
||||||
time.tm_year = file_info.tmu_date.tm_year;
|
time.tm_year = file_info.tmu_date.tm_year - 1900; // Years since 1900.
|
||||||
filemodified_ = mktime(&time);
|
filemodified_ = mktime(&time);
|
||||||
|
DCHECK_NE(filemodified_, (time_t)-1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -50,8 +50,9 @@ CefCrashReportUploadThread::CefCrashReportUploadThread(
|
|||||||
CrashReportDatabase* database,
|
CrashReportDatabase* database,
|
||||||
const std::string& url,
|
const std::string& url,
|
||||||
bool rate_limit,
|
bool rate_limit,
|
||||||
|
bool upload_gzip,
|
||||||
int max_uploads)
|
int max_uploads)
|
||||||
: CrashReportUploadThread(database, url, rate_limit),
|
: CrashReportUploadThread(database, url, rate_limit, upload_gzip),
|
||||||
max_uploads_(max_uploads) {
|
max_uploads_(max_uploads) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread {
|
|||||||
CefCrashReportUploadThread(crashpad::CrashReportDatabase* database,
|
CefCrashReportUploadThread(crashpad::CrashReportDatabase* database,
|
||||||
const std::string& url,
|
const std::string& url,
|
||||||
bool rate_limit,
|
bool rate_limit,
|
||||||
|
bool upload_gzip,
|
||||||
int max_uploads);
|
int max_uploads);
|
||||||
~CefCrashReportUploadThread();
|
~CefCrashReportUploadThread();
|
||||||
|
|
||||||
|
@@ -76,6 +76,10 @@ class CefContentClient : public content::ContentClient,
|
|||||||
// A scheme that can be sent CORS requests. This value should be true in
|
// A scheme that can be sent CORS requests. This value should be true in
|
||||||
// most cases where |is_standard| is true.
|
// most cases where |is_standard| is true.
|
||||||
bool is_cors_enabled;
|
bool is_cors_enabled;
|
||||||
|
|
||||||
|
// A scheme that can bypass Content-Security-Policy (CSP) checks. This value
|
||||||
|
// should be false in most cases where |is_standard| is true.
|
||||||
|
bool is_csp_bypassing;
|
||||||
};
|
};
|
||||||
typedef std::list<SchemeInfo> SchemeInfoList;
|
typedef std::list<SchemeInfo> SchemeInfoList;
|
||||||
|
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#include "libcef/browser/stream_impl.h"
|
#include "libcef/browser/stream_impl.h"
|
||||||
#include "libcef/common/drag_data_impl.h"
|
#include "libcef/common/drag_data_impl.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "net/base/filename_util.h"
|
|
||||||
|
|
||||||
#define CHECK_READONLY_RETURN_VOID() \
|
#define CHECK_READONLY_RETURN_VOID() \
|
||||||
if (read_only_) { \
|
if (read_only_) { \
|
||||||
@@ -44,18 +43,21 @@ bool CefDragDataImpl::IsReadOnly() {
|
|||||||
|
|
||||||
bool CefDragDataImpl::IsLink() {
|
bool CefDragDataImpl::IsLink() {
|
||||||
base::AutoLock lock_scope(lock_);
|
base::AutoLock lock_scope(lock_);
|
||||||
return (data_.url.is_valid() && data_.file_description_filename.empty());
|
return (data_.url.is_valid() &&
|
||||||
|
data_.file_contents_content_disposition.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefDragDataImpl::IsFragment() {
|
bool CefDragDataImpl::IsFragment() {
|
||||||
base::AutoLock lock_scope(lock_);
|
base::AutoLock lock_scope(lock_);
|
||||||
return (!data_.url.is_valid() && data_.file_description_filename.empty() &&
|
return (!data_.url.is_valid() &&
|
||||||
|
data_.file_contents_content_disposition.empty() &&
|
||||||
data_.filenames.empty());
|
data_.filenames.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefDragDataImpl::IsFile() {
|
bool CefDragDataImpl::IsFile() {
|
||||||
base::AutoLock lock_scope(lock_);
|
base::AutoLock lock_scope(lock_);
|
||||||
return (!data_.file_description_filename.empty() || !data_.filenames.empty());
|
return (!data_.file_contents_content_disposition.empty() ||
|
||||||
|
!data_.filenames.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
CefString CefDragDataImpl::GetLinkURL() {
|
CefString CefDragDataImpl::GetLinkURL() {
|
||||||
@@ -90,20 +92,12 @@ CefString CefDragDataImpl::GetFragmentBaseURL() {
|
|||||||
|
|
||||||
CefString CefDragDataImpl::GetFileName() {
|
CefString CefDragDataImpl::GetFileName() {
|
||||||
base::AutoLock lock_scope(lock_);
|
base::AutoLock lock_scope(lock_);
|
||||||
if (data_.file_description_filename.empty())
|
if (data_.file_contents_content_disposition.empty())
|
||||||
return CefString();
|
return CefString();
|
||||||
|
|
||||||
base::FilePath file_name(CefString(data_.file_description_filename));
|
base::Optional<base::FilePath> filename =
|
||||||
// Images without ALT text will only have a file extension so we need to
|
data_.GetSafeFilenameForImageFileContents();
|
||||||
// synthesize one from the provided extension and URL.
|
return filename ? CefString(filename->value()) : CefString();
|
||||||
if (file_name.BaseName().RemoveExtension().empty()) {
|
|
||||||
base::FilePath::StringType extension = file_name.Extension();
|
|
||||||
// Retrieve the name from the URL.
|
|
||||||
CefString suggested_file_name =
|
|
||||||
net::GetSuggestedFilename(data_.url, "", "", "", "", "");
|
|
||||||
file_name = base::FilePath(suggested_file_name).ReplaceExtension(extension);
|
|
||||||
}
|
|
||||||
return file_name.value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CefDragDataImpl::GetFileContents(CefRefPtr<CefStreamWriter> writer) {
|
size_t CefDragDataImpl::GetFileContents(CefRefPtr<CefStreamWriter> writer) {
|
||||||
@@ -173,7 +167,9 @@ void CefDragDataImpl::ResetFileContents() {
|
|||||||
base::AutoLock lock_scope(lock_);
|
base::AutoLock lock_scope(lock_);
|
||||||
CHECK_READONLY_RETURN_VOID();
|
CHECK_READONLY_RETURN_VOID();
|
||||||
data_.file_contents.erase();
|
data_.file_contents.erase();
|
||||||
data_.file_description_filename.erase();
|
data_.file_contents_source_url = GURL();
|
||||||
|
data_.file_contents_filename_extension.erase();
|
||||||
|
data_.file_contents_content_disposition.erase();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefDragDataImpl::AddFile(const CefString& path,
|
void CefDragDataImpl::AddFile(const CefString& path,
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// This file defines extension APIs implemented in CEF.
|
// This file defines extension APIs implemented in CEF.
|
||||||
// See extensions/common/features/* to understand this file, in particular
|
// See extensions/common/features/* to understand this file, in particular
|
||||||
// feature.h, simple_feature.h, and base_feature_provider.h.
|
// feature.h, simple_feature.h, and feature_provider.h.
|
||||||
|
|
||||||
// If APIs are defined in chrome then entries must also be added in
|
// If APIs are defined in chrome then entries must also be added in
|
||||||
// libcef/browser/extensions/chrome_api_registration.cc.
|
// libcef/browser/extensions/chrome_api_registration.cc.
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
// This file defines permissions for extension APIs implemented by CEF.
|
// This file defines permissions for extension APIs implemented by CEF.
|
||||||
// See extensions/common/features/* to understand this file, in particular
|
// See extensions/common/features/* to understand this file, in particular
|
||||||
// feature.h, simple_feature.h, and base_feature_provider.h.
|
// feature.h, simple_feature.h, and feature_provider.h.
|
||||||
|
|
||||||
// If APIs are defined in chrome then entries must also be added in
|
// If APIs are defined in chrome then entries must also be added in
|
||||||
// libcef/browser/extensions/chrome_api_registration.cc.
|
// libcef/browser/extensions/chrome_api_registration.cc.
|
||||||
|
@@ -25,7 +25,8 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
|
|||||||
false, /* is_local */
|
false, /* is_local */
|
||||||
false, /* is_display_isolated */
|
false, /* is_display_isolated */
|
||||||
true, /* is_secure */
|
true, /* is_secure */
|
||||||
true /* is_cors_enabled */
|
true, /* is_cors_enabled */
|
||||||
|
true, /* is_csp_bypassing */
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,6 +43,8 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
|
|||||||
schemes->secure_schemes.push_back(internal_schemes[i].scheme_name);
|
schemes->secure_schemes.push_back(internal_schemes[i].scheme_name);
|
||||||
if (internal_schemes[i].is_cors_enabled)
|
if (internal_schemes[i].is_cors_enabled)
|
||||||
schemes->cors_enabled_schemes.push_back(internal_schemes[i].scheme_name);
|
schemes->cors_enabled_schemes.push_back(internal_schemes[i].scheme_name);
|
||||||
|
if (internal_schemes[i].is_csp_bypassing)
|
||||||
|
schemes->csp_bypassing_schemes.push_back(internal_schemes[i].scheme_name);
|
||||||
client->AddCustomScheme(internal_schemes[i]);
|
client->AddCustomScheme(internal_schemes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "components/navigation_interception/navigation_params.h"
|
#include "components/navigation_interception/navigation_params.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
@@ -139,9 +138,9 @@ std::string GetURLRequestReferrer(const GURL& referrer_url) {
|
|||||||
blink::WebString FilePathStringToWebString(
|
blink::WebString FilePathStringToWebString(
|
||||||
const base::FilePath::StringType& str) {
|
const base::FilePath::StringType& str) {
|
||||||
#if defined(OS_POSIX)
|
#if defined(OS_POSIX)
|
||||||
return base::WideToUTF16(base::SysNativeMBToWide(str));
|
return blink::WebString::fromUTF8(str);
|
||||||
#elif defined(OS_WIN)
|
#elif defined(OS_WIN)
|
||||||
return base::WideToUTF16(str);
|
return blink::WebString::fromUTF16(str);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,8 +178,8 @@ void GetHeaderMap(const blink::WebURLRequest& request,
|
|||||||
|
|
||||||
void visitHeader(const blink::WebString& name,
|
void visitHeader(const blink::WebString& name,
|
||||||
const blink::WebString& value) override {
|
const blink::WebString& value) override {
|
||||||
const base::string16& nameStr = name;
|
const base::string16& nameStr = name.utf16();
|
||||||
const base::string16& valueStr = value;
|
const base::string16& valueStr = value.utf16();
|
||||||
if (base::LowerCaseEqualsASCII(nameStr, kReferrerLowerCase))
|
if (base::LowerCaseEqualsASCII(nameStr, kReferrerLowerCase))
|
||||||
*referrer_ = GURL(valueStr);
|
*referrer_ = GURL(valueStr);
|
||||||
else
|
else
|
||||||
@@ -216,8 +215,8 @@ void SetHeaderMap(const CefRequest::HeaderMap& map,
|
|||||||
blink::WebURLRequest& request) {
|
blink::WebURLRequest& request) {
|
||||||
CefRequest::HeaderMap::const_iterator it = map.begin();
|
CefRequest::HeaderMap::const_iterator it = map.begin();
|
||||||
for (; it != map.end(); ++it) {
|
for (; it != map.end(); ++it) {
|
||||||
request.setHTTPHeaderField(base::string16(it->first),
|
request.setHTTPHeaderField(blink::WebString::fromUTF16(it->first),
|
||||||
base::string16(it->second));
|
blink::WebString::fromUTF16(it->second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,7 +619,7 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
|||||||
blink::WebURLRequest& request) {
|
blink::WebURLRequest& request) {
|
||||||
request.setURL(params.url);
|
request.setURL(params.url);
|
||||||
if (!params.method.empty())
|
if (!params.method.empty())
|
||||||
request.setHTTPMethod(base::ASCIIToUTF16(params.method));
|
request.setHTTPMethod(blink::WebString::fromASCII(params.method));
|
||||||
|
|
||||||
if (params.referrer.is_valid()) {
|
if (params.referrer.is_valid()) {
|
||||||
const blink::WebString& referrer =
|
const blink::WebString& referrer =
|
||||||
@@ -645,18 +644,18 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (params.upload_data.get()) {
|
if (params.upload_data.get()) {
|
||||||
const base::string16& method = request.httpMethod();
|
const base::string16& method = request.httpMethod().utf16();
|
||||||
if (method == base::ASCIIToUTF16("GET") ||
|
if (method == base::ASCIIToUTF16("GET") ||
|
||||||
method == base::ASCIIToUTF16("HEAD")) {
|
method == base::ASCIIToUTF16("HEAD")) {
|
||||||
request.setHTTPMethod(base::ASCIIToUTF16("POST"));
|
request.setHTTPMethod(blink::WebString::fromASCII("POST"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The comparison performed by httpHeaderField() is case insensitive.
|
// The comparison performed by httpHeaderField() is case insensitive.
|
||||||
if (request.httpHeaderField(base::ASCIIToUTF16(
|
if (request.httpHeaderField(blink::WebString::fromASCII(
|
||||||
net::HttpRequestHeaders::kContentType)).length()== 0) {
|
net::HttpRequestHeaders::kContentType)).length()== 0) {
|
||||||
request.setHTTPHeaderField(
|
request.setHTTPHeaderField(
|
||||||
base::ASCIIToUTF16(net::HttpRequestHeaders::kContentType),
|
blink::WebString::fromASCII(net::HttpRequestHeaders::kContentType),
|
||||||
base::ASCIIToUTF16(kApplicationFormURLEncoded));
|
blink::WebString::fromASCII(kApplicationFormURLEncoded));
|
||||||
}
|
}
|
||||||
|
|
||||||
blink::WebHTTPBody body;
|
blink::WebHTTPBody body;
|
||||||
@@ -1314,7 +1313,7 @@ void CefPostDataElementImpl::Set(const blink::WebHTTPBody::Element& element) {
|
|||||||
SetToBytes(element.data.size(),
|
SetToBytes(element.data.size(),
|
||||||
static_cast<const void*>(element.data.data()));
|
static_cast<const void*>(element.data.data()));
|
||||||
} else if (element.type == blink::WebHTTPBody::Element::TypeFile) {
|
} else if (element.type == blink::WebHTTPBody::Element::TypeFile) {
|
||||||
SetToFile(base::string16(element.filePath));
|
SetToFile(element.filePath.utf16());
|
||||||
} else {
|
} else {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
@@ -1329,7 +1328,8 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const {
|
|||||||
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
|
||||||
} else if (type_ == PDE_TYPE_FILE) {
|
} else if (type_ == PDE_TYPE_FILE) {
|
||||||
element.type = blink::WebHTTPBody::Element::TypeFile;
|
element.type = blink::WebHTTPBody::Element::TypeFile;
|
||||||
element.filePath.assign(base::string16(CefString(&data_.filename)));
|
element.filePath.assign(
|
||||||
|
blink::WebString::fromUTF16(CefString(&data_.filename)));
|
||||||
} else {
|
} else {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
@@ -193,9 +193,9 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) {
|
|||||||
blink::WebString str;
|
blink::WebString str;
|
||||||
status_code_ = response.httpStatusCode();
|
status_code_ = response.httpStatusCode();
|
||||||
str = response.httpStatusText();
|
str = response.httpStatusText();
|
||||||
status_text_ = CefString(str);
|
status_text_ = str.utf16();
|
||||||
str = response.mimeType();
|
str = response.mimeType();
|
||||||
mime_type_ = CefString(str);
|
mime_type_ = str.utf16();
|
||||||
|
|
||||||
class HeaderVisitor : public blink::WebHTTPHeaderVisitor {
|
class HeaderVisitor : public blink::WebHTTPHeaderVisitor {
|
||||||
public:
|
public:
|
||||||
@@ -203,8 +203,7 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) {
|
|||||||
|
|
||||||
void visitHeader(const blink::WebString& name,
|
void visitHeader(const blink::WebString& name,
|
||||||
const blink::WebString& value) override {
|
const blink::WebString& value) override {
|
||||||
map_->insert(std::make_pair(base::string16(name),
|
map_->insert(std::make_pair(name.utf16(), value.utf16()));
|
||||||
base::string16(value)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -33,7 +33,8 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(
|
|||||||
bool is_local,
|
bool is_local,
|
||||||
bool is_display_isolated,
|
bool is_display_isolated,
|
||||||
bool is_secure,
|
bool is_secure,
|
||||||
bool is_cors_enabled) {
|
bool is_cors_enabled,
|
||||||
|
bool is_csp_bypassing) {
|
||||||
const std::string& scheme = base::ToLowerASCII(scheme_name.ToString());
|
const std::string& scheme = base::ToLowerASCII(scheme_name.ToString());
|
||||||
if (scheme::IsInternalHandledScheme(scheme) ||
|
if (scheme::IsInternalHandledScheme(scheme) ||
|
||||||
registered_schemes_.find(scheme) != registered_schemes_.end()) {
|
registered_schemes_.find(scheme) != registered_schemes_.end()) {
|
||||||
@@ -52,10 +53,12 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(
|
|||||||
schemes_.secure_schemes.push_back(scheme);
|
schemes_.secure_schemes.push_back(scheme);
|
||||||
if (is_cors_enabled)
|
if (is_cors_enabled)
|
||||||
schemes_.cors_enabled_schemes.push_back(scheme);
|
schemes_.cors_enabled_schemes.push_back(scheme);
|
||||||
|
if (is_csp_bypassing)
|
||||||
|
schemes_.csp_bypassing_schemes.push_back(scheme);
|
||||||
|
|
||||||
CefContentClient::SchemeInfo scheme_info = {
|
CefContentClient::SchemeInfo scheme_info = {
|
||||||
scheme, is_standard, is_local, is_display_isolated, is_secure,
|
scheme, is_standard, is_local, is_display_isolated, is_secure,
|
||||||
is_cors_enabled
|
is_cors_enabled, is_csp_bypassing
|
||||||
};
|
};
|
||||||
CefContentClient::Get()->AddCustomScheme(scheme_info);
|
CefContentClient::Get()->AddCustomScheme(scheme_info);
|
||||||
|
|
||||||
@@ -68,4 +71,5 @@ void CefSchemeRegistrarImpl::GetSchemes(
|
|||||||
AppendArray(schemes_.local_schemes, &schemes->local_schemes);
|
AppendArray(schemes_.local_schemes, &schemes->local_schemes);
|
||||||
AppendArray(schemes_.secure_schemes, &schemes->secure_schemes);
|
AppendArray(schemes_.secure_schemes, &schemes->secure_schemes);
|
||||||
AppendArray(schemes_.cors_enabled_schemes, &schemes->cors_enabled_schemes);
|
AppendArray(schemes_.cors_enabled_schemes, &schemes->cors_enabled_schemes);
|
||||||
|
AppendArray(schemes_.csp_bypassing_schemes, &schemes->csp_bypassing_schemes);
|
||||||
}
|
}
|
||||||
|
@@ -23,14 +23,12 @@ class CefSchemeRegistrarImpl : public CefSchemeRegistrar {
|
|||||||
bool is_local,
|
bool is_local,
|
||||||
bool is_display_isolated,
|
bool is_display_isolated,
|
||||||
bool is_secure,
|
bool is_secure,
|
||||||
bool is_cors_enabled) override;
|
bool is_cors_enabled,
|
||||||
|
bool is_csp_bypassing) override;
|
||||||
|
|
||||||
void GetSchemes(content::ContentClient::Schemes* schemes);
|
void GetSchemes(content::ContentClient::Schemes* schemes);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Verify that the object is being accessed from the correct thread.
|
|
||||||
bool VerifyContext();
|
|
||||||
|
|
||||||
content::ContentClient::Schemes schemes_;
|
content::ContentClient::Schemes schemes_;
|
||||||
std::set<std::string> registered_schemes_;
|
std::set<std::string> registered_schemes_;
|
||||||
|
|
||||||
|
@@ -297,17 +297,17 @@ bool CefValueImpl::SetNull() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefValueImpl::SetBool(bool value) {
|
bool CefValueImpl::SetBool(bool value) {
|
||||||
SetValue(new base::FundamentalValue(value));
|
SetValue(new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefValueImpl::SetInt(int value) {
|
bool CefValueImpl::SetInt(int value) {
|
||||||
SetValue(new base::FundamentalValue(value));
|
SetValue(new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefValueImpl::SetDouble(double value) {
|
bool CefValueImpl::SetDouble(double value) {
|
||||||
SetValue(new base::FundamentalValue(value));
|
SetValue(new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +425,7 @@ CefRefPtr<CefBinaryValue> CefBinaryValue::Create(const void* data,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return new CefBinaryValueImpl(static_cast<char*>(const_cast<void*>(data)),
|
return new CefBinaryValueImpl(static_cast<char*>(const_cast<void*>(data)),
|
||||||
data_size, true);
|
data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -453,12 +453,9 @@ CefBinaryValueImpl::CefBinaryValueImpl(base::BinaryValue* value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefBinaryValueImpl::CefBinaryValueImpl(char* data,
|
CefBinaryValueImpl::CefBinaryValueImpl(char* data,
|
||||||
size_t data_size,
|
size_t data_size)
|
||||||
bool copy)
|
|
||||||
: CefValueBase<CefBinaryValue, base::BinaryValue>(
|
: CefValueBase<CefBinaryValue, base::BinaryValue>(
|
||||||
copy ? base::BinaryValue::CreateWithCopiedBuffer(data,
|
new base::BinaryValue(std::vector<char>(data, data + data_size)),
|
||||||
data_size).release() :
|
|
||||||
new base::BinaryValue(std::unique_ptr<char[]>(data), data_size),
|
|
||||||
NULL, kOwnerWillDelete, true, NULL) {
|
NULL, kOwnerWillDelete, true, NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,19 +895,19 @@ bool CefDictionaryValueImpl::SetNull(const CefString& key) {
|
|||||||
|
|
||||||
bool CefDictionaryValueImpl::SetBool(const CefString& key, bool value) {
|
bool CefDictionaryValueImpl::SetBool(const CefString& key, bool value) {
|
||||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||||
SetInternal(key, new base::FundamentalValue(value));
|
SetInternal(key, new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefDictionaryValueImpl::SetInt(const CefString& key, int value) {
|
bool CefDictionaryValueImpl::SetInt(const CefString& key, int value) {
|
||||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||||
SetInternal(key, new base::FundamentalValue(value));
|
SetInternal(key, new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) {
|
bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) {
|
||||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||||
SetInternal(key, new base::FundamentalValue(value));
|
SetInternal(key, new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1301,19 +1298,19 @@ bool CefListValueImpl::SetNull(size_t index) {
|
|||||||
|
|
||||||
bool CefListValueImpl::SetBool(size_t index, bool value) {
|
bool CefListValueImpl::SetBool(size_t index, bool value) {
|
||||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||||
SetInternal(index, new base::FundamentalValue(value));
|
SetInternal(index, new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefListValueImpl::SetInt(size_t index, int value) {
|
bool CefListValueImpl::SetInt(size_t index, int value) {
|
||||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||||
SetInternal(index, new base::FundamentalValue(value));
|
SetInternal(index, new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefListValueImpl::SetDouble(size_t index, double value) {
|
bool CefListValueImpl::SetDouble(size_t index, double value) {
|
||||||
CEF_VALUE_VERIFY_RETURN(true, false);
|
CEF_VALUE_VERIFY_RETURN(true, false);
|
||||||
SetInternal(index, new base::FundamentalValue(value));
|
SetInternal(index, new base::Value(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -143,11 +143,9 @@ class CefBinaryValueImpl
|
|||||||
CefBinaryValueImpl(base::BinaryValue* value,
|
CefBinaryValueImpl(base::BinaryValue* value,
|
||||||
bool will_delete);
|
bool will_delete);
|
||||||
|
|
||||||
// If |copy| is false this object will take ownership of the specified |data|
|
// The data will always be copied.
|
||||||
// buffer instead of copying it.
|
|
||||||
CefBinaryValueImpl(char* data,
|
CefBinaryValueImpl(char* data,
|
||||||
size_t data_size,
|
size_t data_size);
|
||||||
bool copy);
|
|
||||||
|
|
||||||
// Return a copy of the value.
|
// Return a copy of the value.
|
||||||
base::BinaryValue* CopyValue();
|
base::BinaryValue* CopyValue();
|
||||||
|
@@ -187,7 +187,7 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
|
|||||||
|
|
||||||
blink::WebView* web_view = render_view()->GetWebView();
|
blink::WebView* web_view = render_view()->GetWebView();
|
||||||
if (web_view) {
|
if (web_view) {
|
||||||
const blink::WebString& frame_name = name.ToString16();
|
const blink::WebString& frame_name = blink::WebString::fromUTF16(name);
|
||||||
// Search by assigned frame name (Frame::name).
|
// Search by assigned frame name (Frame::name).
|
||||||
WebFrame* frame = web_view->findFrameByName(frame_name,
|
WebFrame* frame = web_view->findFrameByName(frame_name,
|
||||||
web_view->mainFrame());
|
web_view->mainFrame());
|
||||||
@@ -325,7 +325,7 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
|
|||||||
int64_t parent_id = frame->parent() == NULL ?
|
int64_t parent_id = frame->parent() == NULL ?
|
||||||
webkit_glue::kInvalidFrameId :
|
webkit_glue::kInvalidFrameId :
|
||||||
webkit_glue::GetIdentifier(frame->parent());
|
webkit_glue::GetIdentifier(frame->parent());
|
||||||
base::string16 name = frame->uniqueName();
|
base::string16 name = frame->uniqueName().utf16();
|
||||||
|
|
||||||
// Notify the browser that the frame has been identified.
|
// Notify the browser that the frame has been identified.
|
||||||
Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name));
|
Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name));
|
||||||
@@ -562,7 +562,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
|
|||||||
|
|
||||||
if (is_javascript) {
|
if (is_javascript) {
|
||||||
web_frame->executeScript(
|
web_frame->executeScript(
|
||||||
WebScriptSource(base::UTF8ToUTF16(code),
|
WebScriptSource(blink::WebString::fromUTF8(code),
|
||||||
GURL(script_url),
|
GURL(script_url),
|
||||||
script_start_line));
|
script_start_line));
|
||||||
success = true;
|
success = true;
|
||||||
@@ -596,7 +596,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
|
|||||||
success = true;
|
success = true;
|
||||||
} else if (web_frame->isWebLocalFrame() &&
|
} else if (web_frame->isWebLocalFrame() &&
|
||||||
web_frame->toWebLocalFrame()->executeCommand(
|
web_frame->toWebLocalFrame()->executeCommand(
|
||||||
base::UTF8ToUTF16(command))) {
|
blink::WebString::fromUTF8(command))) {
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -151,8 +151,9 @@ void AppendParams(const std::vector<base::string16>& additional_names,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < additional_names.size(); ++i) {
|
for (size_t i = 0; i < additional_names.size(); ++i) {
|
||||||
names[existing_size + i] = additional_names[i];
|
names[existing_size + i] = blink::WebString::fromUTF16(additional_names[i]);
|
||||||
values[existing_size + i] = additional_values[i];
|
values[existing_size + i] =
|
||||||
|
blink::WebString::fromUTF16(additional_values[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
existing_names->swap(names);
|
existing_names->swap(names);
|
||||||
@@ -828,9 +829,8 @@ void CefContentRendererClient::BrowserCreated(
|
|||||||
render_view_routing_id,
|
render_view_routing_id,
|
||||||
render_frame_routing_id,
|
render_frame_routing_id,
|
||||||
¶ms));
|
¶ms));
|
||||||
DCHECK_GT(params.browser_id, 0);
|
|
||||||
if (params.browser_id == 0) {
|
if (params.browser_id == 0) {
|
||||||
// The request failed for some reason.
|
// The popup may have been canceled during creation.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,14 +77,14 @@ CefString CefDOMDocumentImpl::GetTitle() {
|
|||||||
const WebDocument& document = frame_->document();
|
const WebDocument& document = frame_->document();
|
||||||
const WebString& title = document.title();
|
const WebString& title = document.title();
|
||||||
if (!title.isNull())
|
if (!title.isNull())
|
||||||
str = title;
|
str = title.utf16();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetElementById(const CefString& id) {
|
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetElementById(const CefString& id) {
|
||||||
const WebDocument& document = frame_->document();
|
const WebDocument& document = frame_->document();
|
||||||
return GetOrCreateNode(document.getElementById(base::string16(id)));
|
return GetOrCreateNode(document.getElementById(WebString::fromUTF16(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetFocusedNode() {
|
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetFocusedNode() {
|
||||||
@@ -140,7 +140,7 @@ CefString CefDOMDocumentImpl::GetSelectionAsMarkup() {
|
|||||||
|
|
||||||
const WebString& markup = local_frame->selectionAsMarkup();
|
const WebString& markup = local_frame->selectionAsMarkup();
|
||||||
if (!markup.isNull())
|
if (!markup.isNull())
|
||||||
str = markup;
|
str = markup.utf16();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ CefString CefDOMDocumentImpl::GetSelectionAsText() {
|
|||||||
|
|
||||||
const WebString& text = local_frame->selectionAsText();
|
const WebString& text = local_frame->selectionAsText();
|
||||||
if (!text.isNull())
|
if (!text.isNull())
|
||||||
str = text;
|
str = text.utf16();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL) {
|
|||||||
return str;
|
return str;
|
||||||
|
|
||||||
const WebDocument& document = frame_->document();
|
const WebDocument& document = frame_->document();
|
||||||
const WebURL& url = document.completeURL(base::string16(partialURL));
|
const WebURL& url = document.completeURL(WebString::fromUTF16(partialURL));
|
||||||
if (!url.isNull()) {
|
if (!url.isNull()) {
|
||||||
GURL gurl = url;
|
GURL gurl = url;
|
||||||
str = gurl.spec();
|
str = gurl.spec();
|
||||||
|
@@ -121,7 +121,8 @@ CefString CefDOMNodeImpl::GetFormControlElementType() {
|
|||||||
const WebFormControlElement& formElement =
|
const WebFormControlElement& formElement =
|
||||||
node_.toConst<WebFormControlElement>();
|
node_.toConst<WebFormControlElement>();
|
||||||
|
|
||||||
const base::string16& form_control_type = formElement.formControlType();
|
const base::string16& form_control_type =
|
||||||
|
formElement.formControlType().utf16();
|
||||||
str = form_control_type;
|
str = form_control_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,7 +148,7 @@ CefString CefDOMNodeImpl::GetName() {
|
|||||||
|
|
||||||
const WebString& name = webkit_glue::GetNodeName(node_);
|
const WebString& name = webkit_glue::GetNodeName(node_);
|
||||||
if (!name.isNull())
|
if (!name.isNull())
|
||||||
str = name;
|
str = name.utf16();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -165,15 +166,16 @@ CefString CefDOMNodeImpl::GetValue() {
|
|||||||
node_.toConst<WebFormControlElement>();
|
node_.toConst<WebFormControlElement>();
|
||||||
|
|
||||||
base::string16 value;
|
base::string16 value;
|
||||||
const base::string16& form_control_type = formElement.formControlType();
|
const base::string16& form_control_type =
|
||||||
|
formElement.formControlType().utf16();
|
||||||
if (form_control_type == base::ASCIIToUTF16("text")) {
|
if (form_control_type == base::ASCIIToUTF16("text")) {
|
||||||
const WebInputElement& input_element =
|
const WebInputElement& input_element =
|
||||||
formElement.toConst<WebInputElement>();
|
formElement.toConst<WebInputElement>();
|
||||||
value = input_element.value();
|
value = input_element.value().utf16();
|
||||||
} else if (form_control_type == base::ASCIIToUTF16("select-one")) {
|
} else if (form_control_type == base::ASCIIToUTF16("select-one")) {
|
||||||
const WebSelectElement& select_element =
|
const WebSelectElement& select_element =
|
||||||
formElement.toConst<WebSelectElement>();
|
formElement.toConst<WebSelectElement>();
|
||||||
value = select_element.value();
|
value = select_element.value().utf16();
|
||||||
}
|
}
|
||||||
|
|
||||||
base::TrimWhitespace(value, base::TRIM_LEADING, &value);
|
base::TrimWhitespace(value, base::TRIM_LEADING, &value);
|
||||||
@@ -184,7 +186,7 @@ CefString CefDOMNodeImpl::GetValue() {
|
|||||||
if (str.empty()) {
|
if (str.empty()) {
|
||||||
const WebString& value = node_.nodeValue();
|
const WebString& value = node_.nodeValue();
|
||||||
if (!value.isNull())
|
if (!value.isNull())
|
||||||
str = value;
|
str = value.utf16();
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
@@ -197,7 +199,7 @@ bool CefDOMNodeImpl::SetValue(const CefString& value) {
|
|||||||
if (node_.isElementNode())
|
if (node_.isElementNode())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return webkit_glue::SetNodeValue(node_, base::string16(value));
|
return webkit_glue::SetNodeValue(node_, WebString::fromUTF16(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
CefString CefDOMNodeImpl::GetAsMarkup() {
|
CefString CefDOMNodeImpl::GetAsMarkup() {
|
||||||
@@ -207,7 +209,7 @@ CefString CefDOMNodeImpl::GetAsMarkup() {
|
|||||||
|
|
||||||
const WebString& markup = webkit_glue::CreateNodeMarkup(node_);
|
const WebString& markup = webkit_glue::CreateNodeMarkup(node_);
|
||||||
if (!markup.isNull())
|
if (!markup.isNull())
|
||||||
str = markup;
|
str = markup.utf16();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -274,7 +276,7 @@ CefString CefDOMNodeImpl::GetElementTagName() {
|
|||||||
const WebElement& element = node_.toConst<blink::WebElement>();
|
const WebElement& element = node_.toConst<blink::WebElement>();
|
||||||
const WebString& tagname = element.tagName();
|
const WebString& tagname = element.tagName();
|
||||||
if (!tagname.isNull())
|
if (!tagname.isNull())
|
||||||
str = tagname;
|
str = tagname.utf16();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -302,7 +304,7 @@ bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const WebElement& element = node_.toConst<blink::WebElement>();
|
const WebElement& element = node_.toConst<blink::WebElement>();
|
||||||
return element.hasAttribute(base::string16(attrName));
|
return element.hasAttribute(WebString::fromUTF16(attrName));
|
||||||
}
|
}
|
||||||
|
|
||||||
CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) {
|
CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) {
|
||||||
@@ -316,9 +318,9 @@ CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const WebElement& element = node_.toConst<blink::WebElement>();
|
const WebElement& element = node_.toConst<blink::WebElement>();
|
||||||
const WebString& attr = element.getAttribute(base::string16(attrName));
|
const WebString& attr = element.getAttribute(WebString::fromUTF16(attrName));
|
||||||
if (!attr.isNull())
|
if (!attr.isNull())
|
||||||
str = attr;
|
str = attr.utf16();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -338,8 +340,8 @@ void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < len; ++i) {
|
for (unsigned int i = 0; i < len; ++i) {
|
||||||
base::string16 name = element.attributeLocalName(i);
|
base::string16 name = element.attributeLocalName(i).utf16();
|
||||||
base::string16 value = element.attributeValue(i);
|
base::string16 value = element.attributeValue(i).utf16();
|
||||||
attrMap.insert(std::make_pair(name, value));
|
attrMap.insert(std::make_pair(name, value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -355,8 +357,8 @@ bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebElement element = node_.to<blink::WebElement>();
|
WebElement element = node_.to<blink::WebElement>();
|
||||||
element.setAttribute(base::string16(attrName),
|
element.setAttribute(WebString::fromUTF16(attrName),
|
||||||
base::string16(value));
|
WebString::fromUTF16(value));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +375,7 @@ CefString CefDOMNodeImpl::GetElementInnerText() {
|
|||||||
WebElement element = node_.to<blink::WebElement>();
|
WebElement element = node_.to<blink::WebElement>();
|
||||||
const WebString& text = element.textContent();
|
const WebString& text = element.textContent();
|
||||||
if (!text.isNull())
|
if (!text.isNull())
|
||||||
str = text;
|
str = text.utf16();
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user