Compare commits

..

69 Commits
2987 ... 3029

Author SHA1 Message Date
Marshall Greenblatt
eeeb5d7395 Make CMake target settings private (issue #2007) 2017-05-11 13:45:16 -04:00
Marshall Greenblatt
959c7445a2 CMake configuration improvements (issue #2120)
- Windows: Fix excessive Ninja build warnings.
- Windows: Fix ATL detection for different VC toolchain paths.
- Windows: Fix Ninja Debug build when official build sandbox is enabled.
- Update build tool version recommendations.
2017-05-11 13:25:58 -04:00
Marshall Greenblatt
af831b6bff Windows: Fix wrong calling convention with gcc compiler (issue 1209) 2017-05-10 16:35:34 -04:00
Marshall Greenblatt
13ddc6bf15 Make the CefAuthCallback::Continue password parameter optional (issue #1928) 2017-05-10 12:18:29 -04:00
Marshall Greenblatt
753baf17b7 Fix crash when parent is destroyed during popup creation (issue #2041) 2017-05-09 18:32:31 -04:00
Andrew Warnick
25a0d02077 Fix crash when a resource is cancelled due to browser closing (issue #2165) 2017-05-09 11:36:23 -04:00
Marshall Greenblatt
22354a9e04 Fix DCHECK during Find (issue #2050) 2017-05-05 15:34:57 -04:00
Marshall Greenblatt
d81997a899 Popups must share the parent context to avoid crashes on parent browser destruction (issue #2162) 2017-05-04 19:04:36 -04:00
Marshall Greenblatt
44e39a88bc cefclient: macOS: Fix Xcode 5 compile error (issue #2116) 2017-04-28 18:02:00 -04:00
Marshall Greenblatt
4e2a218957 Add support for WebRTC screen sharing (issue #1065) 2017-04-28 16:49:46 -04:00
Marshall Greenblatt
cb50417c32 Fix IndexedDB quota (issue #2070) 2017-04-27 15:26:15 -04:00
Marshall Greenblatt
27a32dbe03 cefclient: macOS: Fix crash during shutdown from full-screen (issue #2158) 2017-04-26 15:23:37 -04:00
Marshall Greenblatt
a5f63034f9 cefclient: macOS: Fix CefBrowser leak during OSR shutdown (issue #2151) 2017-04-26 15:23:31 -04:00
Marshall Greenblatt
cd80306c37 Windows: Fix crash on touch press text selection (issue #2149) 2017-04-26 12:51:06 -04:00
Marshall Greenblatt
0655c8e58b Windows: Fix VS2008 compile error (issue #2155) 2017-04-26 12:18:46 -04:00
Marshall Greenblatt
364cd863b1 Fix CefSchemeHandlerFactory leak during shutdown. 2017-04-24 20:13:43 -04:00
Marshall Greenblatt
069c2fd9f6 Update to Chromium version 58.0.3029.81 2017-04-24 19:57:53 -04:00
Marshall Greenblatt
19201cdc7f Fix DEPS.patch format 2017-04-06 14:14:21 -04:00
Marshall Greenblatt
62bdceef3a Fix print to PDF (issue #2129) 2017-04-06 11:48:34 -04:00
Marshall Greenblatt
4479216031 Fix RequestHandlerTest.ResponseFilter* test expectations 2017-04-05 16:48:38 -04:00
Marshall Greenblatt
fbf54ad6a3 cmake: macOS: Add Xcode 8.3 build support (issue #2140) 2017-04-05 13:43:23 -04:00
Marshall Greenblatt
765455a0b1 cefclient: Linux: Fix order and timing of OSR key events (issue #2139) 2017-04-04 12:40:41 -04:00
Marshall Greenblatt
7fadcf3edc crash_server.py: Add support for chunked requests 2017-03-28 16:21:57 -04:00
Marshall Greenblatt
20052b6e10 Update to Chromium version 58.0.3029.33 2017-03-28 14:02:31 -04:00
Marshall Greenblatt
4dd897f977 Add PDF print scale factor setting (issue #2106) 2017-03-16 17:48:19 -04:00
Marshall Greenblatt
3abfa07bee Fix DevTools inspect element at (issue #2115) 2017-03-16 17:21:11 -04:00
Marshall Greenblatt
f14a117445 Fix opening of popups from sandboxed iframes (issue #2121) 2017-03-15 18:05:41 -04:00
Marshall Greenblatt
b63c85110d Fix CHECK failure in CefBrowserHostImpl::DidFinishNavigation (issue #2125) 2017-03-15 17:08:17 -04:00
Marshall Greenblatt
2071058036 Update to Chromium version 58.0.3029.6 2017-03-09 13:31:23 -05:00
Marshall Greenblatt
54647945f1 Update to Chromium revision 939b32ee (#454471) 2017-03-08 13:33:05 -08:00
Marshall Greenblatt
fe68aee82c Persist DevTools preferences with CefSettings.persist_user_preferences (issue #2077) 2017-02-28 17:41:11 -05:00
Marshall Greenblatt
d2f48f6e08 Windows: Fix VS2010 compile error 2017-02-28 15:41:31 -05:00
Marshall Greenblatt
7de882ece3 cmake: Update target platform versions (issue #2109)
- macOS: Allow selection of 10.11 SDK and set target version to 10.9 SDK.
- Windows: Set target version to Windows 7.
2017-02-28 15:26:28 -05:00
Marshall Greenblatt
70f51c972a Fix configuration of CefSettings.framework_dir_path (issue #2110) 2017-02-28 14:40:03 -05:00
Marshall Greenblatt
c01f40017b Windows: Fix AtExitManager assertion in SupervisedUserSettingsServiceFactory on shutdown when running with multi-threaded message loop (issue #1680) 2017-02-28 13:16:26 -05:00
Marshall Greenblatt
8fa8af357b views: Support styling of menus (issue #2102) 2017-02-28 12:17:47 -05:00
Marshall Greenblatt
b08f0ed713 views: Fix layout calculation for LabelButton with mnemonics (issue #2102) 2017-02-28 12:17:47 -05:00
Marshall Greenblatt
10f9a9484f views: Support ink drop effect on buttons (issue #2102) 2017-02-28 12:17:47 -05:00
Marshall Greenblatt
f8909fe9e0 README.md edited online with Bitbucket 2017-02-24 16:33:17 +00:00
Marshall Greenblatt
16125bdbbd views: Support accelerators in MenuButton label (issue #2102) 2017-02-23 12:47:20 -08:00
Marshall Greenblatt
6eaf11f07a views: Support top menu switching with mouse and arrow keys (issue #2102)
- cefclient: Add example ViewsMenuBar implementation and show top menu
  by default (specify `--hide-top-menu` to hide it).
2017-02-22 18:15:36 -05:00
Marshall Greenblatt
fbc8b983d5 Windows: Support crash upload URLs with query component (issue #1995) 2017-02-21 13:38:50 -05:00
Marshall Greenblatt
c8c3ef4792 views: cefclient: Fix top menu placement (issue #2102) 2017-02-17 21:42:15 -05:00
Marshall Greenblatt
6ed4fe96b8 views: Add groups and focus/blur callbacks (issue #2102)
- cefclient: Only make menus focusable when ALT is pressed.
- cefclient: Display sample top menu when passed the `--show-top-menu`
  command-line flag.
2017-02-17 21:08:55 -05:00
Marshall Greenblatt
bd1b80198f views: Add support for accelerators (issue #2102) 2017-02-17 14:11:19 -08:00
Marshall Greenblatt
e4867b5afb Fix type comparison error 2017-02-16 18:31:07 -05:00
Marshall Greenblatt
b7556bdddf Fix CefZipReader::GetFileLastModified (issue #1899) 2017-02-15 18:44:42 -05:00
Marshall Greenblatt
c82ef82c21 Fix OSR popup transparency (issue #2099) 2017-02-15 16:03:00 -05:00
Marshall Greenblatt
897c0f01ed Simplify ownership of CefBrowserContext objects (issue #2083) 2017-02-15 08:53:34 -08:00
Marshall Greenblatt
43001c0a94 Fix unreferenced variable warning (issue #2090) 2017-02-14 10:15:12 -08:00
Marshall Greenblatt
54424d0edc Fix crash during process shutdown (issue #2096) 2017-02-14 10:09:42 -08:00
Marshall Greenblatt
feaca0ddf2 Simplify StoragePartition changes 2017-02-14 11:47:27 -05:00
Marshall Greenblatt
4054d66de0 Fix SupervisedUserSettingsService initialization (issue #2093) 2017-02-13 17:12:57 -05:00
Marshall Greenblatt
903da5e452 Simplify OSR guest view implementation 2017-02-13 13:28:10 -05:00
Marshall Greenblatt
0a62a4dca8 Enable leak detection for translator test classes (issue #2090) 2017-02-09 18:11:28 -05:00
Marshall Greenblatt
0afcb82ee6 Rename CefBase to CefBaseRefCounted (issue #2090) 2017-02-09 17:50:59 -05:00
Marshall Greenblatt
07ba48b082 Add support for non-ref-counted interface classes (issue #2090) 2017-02-09 17:50:46 -05:00
Marshall Greenblatt
9dd0ca2661 Allow empty value param to CefSetCrashKeyValue (issue #1995) 2017-02-08 12:35:21 -05:00
Marshall Greenblatt
aa398d8798 macOS: Generate correct framework and Info.plist version numbers (issue #1969) 2017-02-06 18:15:42 -05:00
Marshall Greenblatt
fda2f34c75 macOS: Fix incorrect OSR compositor resize in OnSwapCompositorFrame (issue #2065) 2017-02-06 16:24:25 -05:00
Marshall Greenblatt
661fa722a7 macOS: Add option for forwarding browser process crashes to the system crash reporter (issue #1995) 2017-02-06 15:06:25 -05:00
Marshall Greenblatt
caef479ae0 macOS: Update xib files to 10.9 deployment target 2017-02-02 18:16:43 -05:00
Marshall Greenblatt
d6531b9fe6 macOS: cefclient: Create Tests menu with Interface Builder 2017-02-02 15:43:41 -05:00
Marshall Greenblatt
94f604975d Fix localization of default context menu labels (issue #2081) 2017-02-01 15:24:20 -05:00
Marshall Greenblatt
a90b50f1ff Fix KeyedServiceFactory assertion during shutdown (issue #2083) 2017-01-31 17:23:27 -05:00
Marshall Greenblatt
30451b7ca5 Fix crash using WebRTC with TLS certs (issue #2080) 2017-01-31 15:25:12 -05:00
Marshall Greenblatt
5c160e018b Windows: Fix command line parsing for crash handler (issue #1995) 2017-01-30 16:21:12 -05:00
Marshall Greenblatt
a56ac9782e macOS: Support crash reporting from unbundled apps (issue #1532) 2017-01-27 14:16:04 -05:00
Marshall Greenblatt
dda50912ed macOS: Allow configuration of framework path (issue #1532) 2017-01-26 19:14:56 -05:00
167 changed files with 1967 additions and 1748 deletions

View File

@@ -118,7 +118,6 @@ if (is_linux) {
}
if (is_mac) {
import("//build/config/mac/rules.gni")
import("//build_overrides/v8.gni")
import("//build/mac/tweak_info_plist.gni")
import("//build/util/version.gni")
import("//media/cdm/ppapi/cdm_paths.gni")
@@ -755,7 +754,7 @@ static_library("libcef_static") {
deps += [
"//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.
# Add associated .h files in the make_pack_header("resources") target.
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
@@ -1163,7 +1162,6 @@ template("make_pack_header") {
make_pack_header("resources") {
header = "$root_out_dir/includes/include/cef_pack_resources.h"
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_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/renderer_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/grit/content_resources.h",
"$root_gen_dir/extensions/grit/extensions_browser_resources.h",

View File

@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/57.0.2987.133',
'chromium_checkout': 'refs/tags/58.0.3029.81',
}

View File

@@ -48,13 +48,13 @@
# libgtkglext1-dev (required by the cefclient target only)
#
# - Mac OS X requirements:
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 7.2
# and OS X 10.11 are recommended. The Xcode command-line tools must also be
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 8.3
# and OS X 10.12 are recommended. The Xcode command-line tools must also be
# installed. Only 64-bit builds are supported on OS X.
#
# - Windows requirements:
# 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
#

View File

@@ -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 (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx
* 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
* Java - https://bitbucket.org/chromiumembedded/java-cef
* Java - http://code.google.com/p/javacef/

View File

@@ -19,7 +19,7 @@ macro(PRINT_CEF_CONFIG)
message(STATUS "Platform: ${CMAKE_SYSTEM_NAME}")
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}")
endif()
@@ -81,8 +81,7 @@ endmacro()
# Determine the target output directory based on platform and generator.
macro(SET_CEF_TARGET_OUT_DIR)
if(${CMAKE_GENERATOR} STREQUAL "Ninja" OR
${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
if(GEN_NINJA OR GEN_MAKEFILES)
# By default Ninja and Make builds don't create a subdirectory named after
# the configuration.
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.
macro(SET_COMMON_TARGET_PROPERTIES target)
# Compile flags.
target_compile_options(${target} PUBLIC ${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} PUBLIC $<$<CONFIG:Release>:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>)
target_compile_options(${target} PRIVATE ${CEF_COMPILER_FLAGS} ${CEF_CXX_COMPILER_FLAGS})
target_compile_options(${target} PRIVATE $<$<CONFIG:Debug>:${CEF_COMPILER_FLAGS_DEBUG} ${CEF_CXX_COMPILER_FLAGS_DEBUG}>)
target_compile_options(${target} PRIVATE $<$<CONFIG:Release>:${CEF_COMPILER_FLAGS_RELEASE} ${CEF_CXX_COMPILER_FLAGS_RELEASE}>)
# Compile definitions.
target_compile_definitions(${target} PUBLIC ${CEF_COMPILER_DEFINES})
target_compile_definitions(${target} PUBLIC $<$<CONFIG:Debug>:${CEF_COMPILER_DEFINES_DEBUG}>)
target_compile_definitions(${target} PUBLIC $<$<CONFIG:Release>:${CEF_COMPILER_DEFINES_RELEASE}>)
target_compile_definitions(${target} PRIVATE ${CEF_COMPILER_DEFINES})
target_compile_definitions(${target} PRIVATE $<$<CONFIG:Debug>:${CEF_COMPILER_DEFINES_DEBUG}>)
target_compile_definitions(${target} PRIVATE $<$<CONFIG:Release>:${CEF_COMPILER_DEFINES_RELEASE}>)
# Include directories.
target_include_directories(${target} PUBLIC ${CEF_INCLUDE_PATH})
target_include_directories(${target} PRIVATE ${CEF_INCLUDE_PATH})
# Linker flags.
if(CEF_LINKER_FLAGS)

View File

@@ -37,9 +37,14 @@ if(NOT DEFINED PROJECT_ARCH)
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.
if(NOT CMAKE_BUILD_TYPE AND
(${CMAKE_GENERATOR} STREQUAL "Ninja" OR ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles"))
if(NOT CMAKE_BUILD_TYPE AND (GEN_NINJA OR GEN_MAKEFILES))
# CMAKE_BUILD_TYPE should be specified when using Ninja or Unix Makefiles.
set(CMAKE_BUILD_TYPE Release)
message(WARNING "No CMAKE_BUILD_TYPE value selected, using ${CMAKE_BUILD_TYPE}")
@@ -314,6 +319,14 @@ endif()
#
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.
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
if(USE_SANDBOX AND NOT MSVC_VERSION EQUAL 1900)
@@ -359,8 +372,13 @@ if(OS_WINDOWS)
# defaults here.
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
/MT # Multithreaded release runtime
/O2 # Maximize speed optimization
/Zc:inline # Remove unreferenced functions or data
/Oy- # Disable frame-pointer omission
)
else()
list(APPEND CEF_COMPILER_FLAGS_DEBUG
@@ -463,10 +481,19 @@ if(OS_WINDOWS)
# Configure use of ATL.
option(USE_ATL "Enable or disable use of ATL." ON)
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.
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")
message(WARNING "ATL is not supported by your VC installation.")
set(USE_ATL OFF)
endif()
endif()

View File

@@ -430,12 +430,15 @@ typedef struct _cef_browser_host_t {
struct _cef_pdf_print_callback_t* callback);
///
// Search for |searchText|. |identifier| can be used to have multiple searches
// running simultaniously. |forward| indicates whether to search forward or
// backward within the page. |matchCase| 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.
// Search for |searchText|. |identifier| must be a unique ID and these IDs
// must strictly increase so that newer requests always have greater IDs than
// older requests. If |identifier| is zero or less than the previous ID value
// then it will be automatically assigned a new valid ID. |forward| indicates
// whether to search forward or backward within the page. |matchCase|
// 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,
const cef_string_t* searchText, int forward, int matchCase,

View File

@@ -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
// hosted in the same renderer process as the source browser. Any
// 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,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,

View File

@@ -70,15 +70,16 @@ typedef struct _cef_load_handler_t {
int canGoForward);
///
// Called when the browser begins loading a frame. The |frame| value will
// never be NULL -- call the is_main() function to check if this frame is the
// main frame. |transition_type| provides information about the source of the
// navigation and an accurate value is only available in the browser process.
// Multiple frames may be loading at the same time. Sub-frames may start or
// continue loading after the main frame load has ended. This function will
// always be called for all frames irrespective of whether the request
// completes successfully. For notification of overall browser load status use
// OnLoadingStateChange instead.
// Called after a navigation has been committed and before the browser begins
// loading contents in the frame. The |frame| value will never be NULL -- call
// the is_main() function to check if this frame is the main frame.
// |transition_type| provides information about the source of the navigation
// and an accurate value is only available in the browser process. Multiple
// frames may be loading at the same time. Sub-frames may start or continue
// loading after the main frame load has ended. This function will not be
// called for same page navigations (fragments, history state, etc.) or for
// 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,
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
// 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
// function will always be called for all frames irrespective of whether the
// request completes successfully. For notification of overall browser load
// status use OnLoadingStateChange instead.
// function will not be called for same page navigations (fragments, history
// state, etc.) or for navigations that fail or are canceled before commit.
// For notification of overall browser load status use OnLoadingStateChange
// instead.
///
void (CEF_CALLBACK *on_load_end)(struct _cef_load_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
int httpStatusCode);
///
// Called when the resource load for a navigation fails or is canceled.
// |errorCode| is the error code number, |errorText| is the 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.
// Called when a navigation fails or is canceled. This function may be called
// by itself if before commit or in combination with OnLoadStart/OnLoadEnd if
// after commit. |errorCode| is the error code number, |errorText| is the
// 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,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,

View File

@@ -108,9 +108,12 @@ typedef struct _cef_scheme_registrar_t {
// security rules as those applied to "https" URLs. For example, loading this
// 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.
// This value should be true (1) in most cases where |is_standard| is true
// (1).
// If |is_cors_enabled| is true (1) the scheme can be sent CORS requests. This
// value should be true (1) in most cases where |is_standard| is true (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
// 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,
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;

View File

@@ -50,7 +50,7 @@ class CefAuthCallback : public virtual CefBaseRefCounted {
///
// Continue the authentication request.
///
/*--cef(capi_name=cont)--*/
/*--cef(capi_name=cont,optional_param=password)--*/
virtual void Continue(const CefString& username,
const CefString& password) =0;

View File

@@ -472,12 +472,15 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
CefRefPtr<CefPdfPrintCallback> callback) =0;
///
// Search for |searchText|. |identifier| can be used to have multiple searches
// running simultaniously. |forward| indicates whether to search forward or
// backward within the page. |matchCase| 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.
// Search for |searchText|. |identifier| must be a unique ID and these IDs
// must strictly increase so that newer requests always have greater IDs than
// older requests. If |identifier| is zero or less than the previous ID value
// then it will be automatically assigned a new valid ID. |forward| indicates
// whether to search forward or backward within the page. |matchCase|
// 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()--*/
virtual void Find(int identifier, const CefString& searchText,

View File

@@ -71,7 +71,9 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
// 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
// |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)--*/
virtual bool OnBeforePopup(CefRefPtr<CefBrowser> browser,

View File

@@ -67,15 +67,16 @@ class CefLoadHandler : public virtual CefBaseRefCounted {
bool canGoForward) {}
///
// Called when the browser begins loading a frame. The |frame| value will
// never be empty -- call the IsMain() method to check if this frame is the
// main frame. |transition_type| provides information about the source of the
// navigation and an accurate value is only available in the browser process.
// 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 will
// always be called for all frames irrespective of whether the request
// completes successfully. For notification of overall browser load status use
// OnLoadingStateChange instead.
// Called after a navigation has been committed and before the browser begins
// loading contents in the frame. The |frame| value will never be empty --
// call the IsMain() method to check if this frame is the main frame.
// |transition_type| provides information about the source of the navigation
// and an accurate value is only available in the browser process. 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 will not be called
// for same page navigations (fragments, history state, etc.) or for
// navigations that fail or are canceled before commit. For notification of
// overall browser load status use OnLoadingStateChange instead.
///
/*--cef()--*/
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
// 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
// will always be called for all frames irrespective of whether the request
// completes successfully. For notification of overall browser load status use
// OnLoadingStateChange instead.
// will not be called for same page navigations (fragments, history state,
// etc.) or for navigations that fail or are canceled before commit. For
// notification of overall browser load status use OnLoadingStateChange
// instead.
///
/*--cef()--*/
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
@@ -97,10 +99,11 @@ class CefLoadHandler : public virtual CefBaseRefCounted {
int httpStatusCode) {}
///
// Called when the resource load for a navigation fails or is canceled.
// |errorCode| is the error code number, |errorText| is the 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.
// Called when a navigation fails or is canceled. This method may be called
// by itself if before commit or in combination with OnLoadStart/OnLoadEnd if
// after commit. |errorCode| is the error code number, |errorText| is the
// 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)--*/
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,

View File

@@ -132,8 +132,12 @@ class CefSchemeRegistrar : public CefBaseScoped {
// rules as those applied to "https" URLs. For example, loading this scheme
// from other secure schemes will not trigger mixed content warnings.
//
// If |is_cors_enabled| is true the scheme that can be sent CORS requests.
// This value should be true in most cases where |is_standard| is true.
// If |is_cors_enabled| is true the scheme can be sent CORS requests. This
// 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
// 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_display_isolated,
bool is_secure,
bool is_cors_enabled) =0;
bool is_cors_enabled,
bool is_csp_bypassing) =0;
};

View File

@@ -43,13 +43,17 @@
#else
#define CEF_EXPORT
#endif
#define CEF_CALLBACK __stdcall
#elif defined(COMPILER_GCC)
#define CEF_EXPORT __attribute__ ((visibility("default")))
#define CEF_CALLBACK
#endif // COMPILER_GCC
#if defined(OS_WIN)
#define CEF_CALLBACK __stdcall
#else
#define CEF_CALLBACK
#endif
#endif // CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_

View File

@@ -186,10 +186,13 @@ using CefOwnPtr = scoped_ptr<T, D>;
// A CefRawPtr<T> is the same as T*
///
#if defined(HAS_CPP11_TEMPLATE_ALIAS_SUPPORT)
#define CEF_RAW_PTR_GET(r) r
template <class T>
using CefRawPtr = T*;
#else
// 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>
class CefRawPtr {
public:

View File

@@ -1947,7 +1947,6 @@ typedef struct _cef_popup_features_t {
int fullscreen;
int dialog;
cef_string_list_t additionalFeatures;
} cef_popup_features_t;
///

View File

@@ -509,18 +509,10 @@ struct CefPopupFeaturesTraits {
s->resizable = true;
}
static inline void clear(struct_type* s) {
if (s->additionalFeatures)
cef_string_list_free(s->additionalFeatures);
}
static inline void clear(struct_type* s) {}
static inline void set(const struct_type* src, struct_type* target,
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->xSet = src->xSet;
target->y = src->y;

View File

@@ -118,6 +118,7 @@
// CefURLRequestContextGetter* destruction.
*/
class CefRequestContextImpl;
class HostContentSettingsMap;
class PrefService;
@@ -146,6 +147,12 @@ class CefBrowserContext : public ChromeProfileStub {
// Profile methods.
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
// thread.
virtual const CefRequestContextSettings& GetSettings() const = 0;

View File

@@ -14,6 +14,7 @@
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/permissions/permission_manager.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/thread_util.h"
#include "libcef/common/cef_switches.h"
@@ -211,7 +212,7 @@ CefBrowserContextImpl::~CefBrowserContextImpl() {
CEF_REQUIRE_UIT();
// 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.
g_manager.Get().RemoveImpl(this, cache_path_);
@@ -308,21 +309,33 @@ void CefBrowserContextImpl::RemoveProxy(const CefBrowserContextProxy* proxy) {
visitedlink_listener_->RemoveListenerForContext(proxy);
}
void CefBrowserContextImpl::AddRequestContext() {
void CefBrowserContextImpl::AddCefRequestContext(
CefRequestContextImpl* context) {
CEF_REQUIRE_UIT();
request_context_count_++;
request_context_set_.insert(context);
}
void CefBrowserContextImpl::RemoveRequestContext() {
void CefBrowserContextImpl::RemoveCefRequestContext(
CefRequestContextImpl* context) {
CEF_REQUIRE_UIT();
request_context_count_--;
DCHECK_GE(request_context_count_, 0);
request_context_set_.erase(context);
// Delete non-global contexts when the reference count reaches zero.
if (request_context_count_ == 0 &&
this != CefContentBrowserClient::Get()->browser_context()) {
// Delete ourselves when the reference count reaches zero.
if (request_context_set_.empty())
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
@@ -463,6 +476,10 @@ const PrefService* CefBrowserContextImpl::GetPrefs() const {
return pref_service_.get();
}
CefRequestContextImpl* CefBrowserContextImpl::GetCefRequestContext() const {
return GetCefRequestContext(false);
}
const CefRequestContextSettings& CefBrowserContextImpl::GetSettings() const {
return settings_;
}

View File

@@ -52,10 +52,11 @@ class CefBrowserContextImpl : public CefBrowserContext,
void AddProxy(const CefBrowserContextProxy* proxy);
void RemoveProxy(const CefBrowserContextProxy* proxy);
// Track associated CefRequestContextImpl objects. If this object is a non-
// global context then it will delete itself when the count reaches zero.
void AddRequestContext();
void RemoveRequestContext();
// Track associated CefRequestContextImpl objects. This object will delete
// itself when the count reaches zero.
void AddCefRequestContext(CefRequestContextImpl* context);
void RemoveCefRequestContext(CefRequestContextImpl* context);
CefRequestContextImpl* GetCefRequestContext(bool impl_only) const;
// BrowserContext methods.
base::FilePath GetPath() const override;
@@ -88,6 +89,7 @@ class CefBrowserContextImpl : public CefBrowserContext,
const PrefService* GetPrefs() const override;
// CefBrowserContext methods.
CefRequestContextImpl* GetCefRequestContext() const override;
const CefRequestContextSettings& GetSettings() const override;
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
HostContentSettingsMap* GetHostContentSettingsMap() override;
@@ -97,7 +99,7 @@ class CefBrowserContextImpl : public CefBrowserContext,
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
// 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_;
}
@@ -111,8 +113,8 @@ class CefBrowserContextImpl : public CefBrowserContext,
CefRequestContextSettings settings_;
base::FilePath cache_path_;
// Number of CefRequestContextImpl objects referencing this object.
int request_context_count_ = 0;
// CefRequestContextImpl objects referencing this object.
std::set<CefRequestContextImpl*> request_context_set_;
std::unique_ptr<PrefService> pref_service_;
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;

View File

@@ -58,9 +58,11 @@ bool ShouldProxyUserData(const void* key) {
} // namespace
CefBrowserContextProxy::CefBrowserContextProxy(
CefRequestContextImpl* const request_context,
CefRefPtr<CefRequestContextHandler> handler,
CefBrowserContextImpl* parent)
: CefBrowserContext(true),
request_context_(request_context),
handler_(handler),
parent_(parent) {
DCHECK(handler_.get());
@@ -98,6 +100,14 @@ void CefBrowserContextProxy::SetUserData(const void* key, Data* 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) {
if (ShouldProxyUserData(key))
parent_->RemoveUserData(key);
@@ -182,6 +192,10 @@ const PrefService* CefBrowserContextProxy::GetPrefs() const {
return parent_->GetPrefs();
}
CefRequestContextImpl* CefBrowserContextProxy::GetCefRequestContext() const {
return request_context_;
}
const CefRequestContextSettings& CefBrowserContextProxy::GetSettings() const {
return parent_->GetSettings();
}
@@ -206,7 +220,7 @@ CefBrowserContextProxy::GetOrCreateStoragePartitionProxy(
if (!storage_partition_proxy_) {
scoped_refptr<CefURLRequestContextGetterProxy> url_request_getter =
new CefURLRequestContextGetterProxy(handler_,
parent_->request_context());
parent_->request_context_getter());
resource_context()->set_url_request_context_getter(
url_request_getter.get());
storage_partition_proxy_.reset(

View File

@@ -20,7 +20,8 @@ class CefStoragePartitionProxy;
// browser_context.h for an object relationship diagram.
class CefBrowserContextProxy : public CefBrowserContext {
public:
CefBrowserContextProxy(CefRefPtr<CefRequestContextHandler> handler,
CefBrowserContextProxy(CefRequestContextImpl* const request_context,
CefRefPtr<CefRequestContextHandler> handler,
CefBrowserContextImpl* parent);
// Must be called immediately after this object is created.
@@ -29,6 +30,7 @@ class CefBrowserContextProxy : public CefBrowserContext {
// SupportsUserData methods.
Data* GetUserData(const void* key) const 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;
// BrowserContext methods.
@@ -59,6 +61,7 @@ class CefBrowserContextProxy : public CefBrowserContext {
const PrefService* GetPrefs() const override;
// CefBrowserContext methods.
CefRequestContextImpl* GetCefRequestContext() const override;
const CefRequestContextSettings& GetSettings() const override;
CefRefPtr<CefRequestContextHandler> GetHandler() const override;
HostContentSettingsMap* GetHostContentSettingsMap() override;
@@ -77,6 +80,9 @@ class CefBrowserContextProxy : public CefBrowserContext {
~CefBrowserContextProxy() override;
// Guaranteed to outlive this object.
CefRequestContextImpl* const request_context_;
// Members initialized during construction are safe to access from any thread.
CefRefPtr<CefRequestContextHandler> handler_;
CefBrowserContextImpl* parent_; // Guaranteed to outlive this object.

View File

@@ -44,10 +44,10 @@
#include "chrome/browser/spellchecker/spellcheck_service.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.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/gpu/compositor_util.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_url_parameters.h"
#include "content/public/browser/host_zoom_map.h"
@@ -352,6 +352,11 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
DCHECK(!opener.get() || browser_info->is_popup());
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
// new browser's platform delegate.
opener->platform_delegate_->PopupWebContentsCreated(
@@ -383,7 +388,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::CreateInternal(
// CefBrowserViewDelegate::OnBrowserCreated().
browser->platform_delegate_->NotifyBrowserCreated();
if (opener) {
if (opener && opener->platform_delegate_) {
// 3. Notify the opener browser's platform delegate. With Views this will
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
opener->platform_delegate_->PopupBrowserCreated(browser.get(),
@@ -781,6 +786,14 @@ void CefBrowserHostImpl::Find(int identifier, const CefString& searchText,
if (!web_contents_)
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;
options.forward = forward;
options.matchCase = matchCase;
@@ -2275,18 +2288,17 @@ void CefBrowserHostImpl::WebContentsCreated(
DCHECK(info->is_popup());
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 =
static_cast<CefBrowserContext*>(new_contents->GetBrowserContext());
DCHECK(browser_context);
CefRefPtr<CefRequestContext> request_context =
CefRequestContextImpl::CreateForBrowserContext(browser_context).get();
DCHECK(request_context.get());
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::CreateInternal(
settings, client, new_contents, info, opener, false, request_context,
std::move(platform_delegate));
settings, client, new_contents, info, opener, false,
browser_context->GetCefRequestContext(), std::move(platform_delegate));
}
void CefBrowserHostImpl::DidNavigateMainFramePostCommit(
@@ -2356,7 +2368,9 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
(request.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE);
bool webcam_requested =
(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
// given type.
if (microphone_requested) {
@@ -2373,6 +2387,19 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
true,
&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,
@@ -2553,8 +2580,7 @@ void CefBrowserHostImpl::DidFinishNavigation(
if (!context)
return;
context->AddVisitedURLs(static_cast<content::NavigationHandleImpl*>(
navigation_handle)->redirect_chain());
context->AddVisitedURLs(navigation_handle->GetRedirectChain());
}
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {

View File

@@ -637,6 +637,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Observers that want to be notified of changes to this object.
base::ObserverList<Observer> observers_;
// Used to provide unique incremental IDs for each find request.
int find_request_id_counter_ = 0;
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
};

View File

@@ -23,35 +23,26 @@
namespace {
void TranslatePopupFeatures(const blink::WebWindowFeatures& webKitFeatures,
void TranslatePopupFeatures(const blink::mojom::WindowFeatures& webKitFeatures,
CefPopupFeatures& features) {
features.x = static_cast<int>(webKitFeatures.x);
features.xSet = webKitFeatures.xSet;
features.xSet = webKitFeatures.has_x;
features.y = static_cast<int>(webKitFeatures.y);
features.ySet = webKitFeatures.ySet;
features.ySet = webKitFeatures.has_y;
features.width = static_cast<int>(webKitFeatures.width);
features.widthSet = webKitFeatures.widthSet;
features.widthSet = webKitFeatures.has_width;
features.height = static_cast<int>(webKitFeatures.height);
features.heightSet = webKitFeatures.heightSet;
features.heightSet = webKitFeatures.has_height;
features.menuBarVisible = webKitFeatures.menuBarVisible;
features.statusBarVisible = webKitFeatures.statusBarVisible;
features.toolBarVisible = webKitFeatures.toolBarVisible;
features.locationBarVisible = webKitFeatures.locationBarVisible;
features.scrollbarsVisible = webKitFeatures.scrollbarsVisible;
features.menuBarVisible = webKitFeatures.menu_bar_visible;
features.statusBarVisible = webKitFeatures.status_bar_visible;
features.toolBarVisible = webKitFeatures.tool_bar_visible;
features.locationBarVisible = webKitFeatures.location_bar_visible;
features.scrollbarsVisible = webKitFeatures.scrollbars_visible;
features.resizable = webKitFeatures.resizable;
features.fullscreen = webKitFeatures.fullscreen;
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;
@@ -142,7 +133,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const blink::mojom::WindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
int opener_render_process_id,
@@ -418,11 +409,13 @@ void CefBrowserInfoManager::GetBrowserInfoList(BrowserInfoList& list) {
void CefBrowserInfoManager::RenderProcessHostDestroyed(
content::RenderProcessHost* host) {
base::AutoLock lock_scope(browser_info_lock_);
const int render_process_id = host->GetID();
DCHECK_GT(render_process_id, 0);
// Remove all pending requests that reference the destroyed host.
{
base::AutoLock lock_scope(browser_info_lock_);
PendingNewBrowserInfoList::iterator it =
pending_new_browser_info_list_.begin();
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(
int opener_process_id,
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::FromID(opener_process_id);
DCHECK(host);
if (host) {
host->FilterURL(false, &pending_popup->target_url);
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_);
pending_popup_list_.push_back(std::move(popup));
}

View File

@@ -15,6 +15,7 @@
#include "base/memory/scoped_vector.h"
#include "base/synchronization/lock.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 "url/gurl.h"
@@ -64,7 +65,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const blink::mojom::WindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
int opener_render_process_id,

View File

@@ -45,6 +45,7 @@
#include "ui/display/screen.h"
#include "ui/views/test/desktop_test_views_delegate.h"
#include "ui/views/widget/desktop_aura/desktop_screen.h"
#include "ui/wm/core/wm_state.h"
#if defined(OS_WIN)
#include "ui/base/cursor/cursor_loader_win.h"
@@ -133,6 +134,8 @@ void CefBrowserMainParts::ToolkitInitialized() {
new views::DesktopTestViewsDelegate;
wm_state_.reset(new wm::WMState);
#if defined(OS_WIN)
ui::CursorLoaderWin::SetCursorResourceModule(
CefContentBrowserClient::Get()->GetResourceDllName());
@@ -187,18 +190,20 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
CefRequestContextSettings settings;
CefContext::Get()->PopulateRequestContextSettings(&settings);
// Create the global BrowserContext.
global_browser_context_.reset(new CefBrowserContextImpl(settings));
global_browser_context_->Initialize();
// Create the global RequestContext.
global_request_context_ =
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.
PluginFinder::GetInstance()->Init();
device::GeolocationProvider::SetGeolocationDelegate(
new CefGeolocationDelegate(
global_browser_context_->request_context().get()));
browser_context->request_context_getter().get()));
scheme::RegisterWebUIControllerFactory();
}
@@ -207,7 +212,7 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
// NOTE: Destroy objects in reverse order of creation.
CefDevToolsManagerDelegate::StopHttpHandler();
global_browser_context_.reset(nullptr);
global_request_context_ = NULL;
if (extensions::ExtensionsEnabled()) {
extensions::ExtensionsBrowserClient::Set(NULL);

View File

@@ -7,6 +7,7 @@
#pragma once
#include "libcef/browser/net/url_request_context_getter_impl.h"
#include "libcef/browser/request_context_impl.h"
#include "base/macros.h"
#include "base/memory/scoped_vector.h"
@@ -30,7 +31,12 @@ class ExtensionsBrowserClient;
class ExtensionsClient;
}
class CefBrowserContextImpl;
#if defined(USE_AURA)
namespace wm {
class WMState;
}
#endif
class CefDevToolsDelegate;
class CefBrowserMainParts : public content::BrowserMainParts {
@@ -47,8 +53,8 @@ class CefBrowserMainParts : public content::BrowserMainParts {
void PostMainMessageLoopRun() override;
void PostDestroyThreads() override;
CefBrowserContextImpl* browser_context() const {
return global_browser_context_.get();
CefRefPtr<CefRequestContextImpl> request_context() const {
return global_request_context_;
}
CefDevToolsDelegate* devtools_delegate() const {
return devtools_delegate_;
@@ -59,13 +65,17 @@ class CefBrowserMainParts : public content::BrowserMainParts {
void PlatformInitialize();
#endif // defined(OS_WIN)
std::unique_ptr<CefBrowserContextImpl> global_browser_context_;
CefRefPtr<CefRequestContextImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
std::unique_ptr<base::MessageLoop> message_loop_;
std::unique_ptr<extensions::ExtensionsClient> extensions_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);
};

View File

@@ -112,6 +112,11 @@ WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
return NULL;
}
ukm::UkmService* ChromeBrowserProcessStub::ukm_service() {
NOTREACHED();
return NULL;
}
ProfileManager* ChromeBrowserProcessStub::profile_manager() {
DCHECK(context_initialized_);
return profile_manager_.get();

View File

@@ -47,6 +47,7 @@ class ChromeBrowserProcessStub : public BrowserProcess,
rappor::RapporServiceImpl* rappor_service() override;
IOThread* io_thread() override;
WatchDogThread* watchdog_thread() override;
ukm::UkmService* ukm_service() override;
ProfileManager* profile_manager() override;
PrefService* local_state() override;
net::URLRequestContextGetter* system_request_context() override;

View File

@@ -21,7 +21,8 @@ namespace {
// Return the main context for now since we don't currently have a good way to
// determine that.
CefBrowserContextImpl* GetActiveBrowserContext() {
return CefContentBrowserClient::Get()->browser_context();
return static_cast<CefBrowserContextImpl*>(
CefContentBrowserClient::Get()->request_context()->GetBrowserContext());
}
} // namespace

View File

@@ -51,7 +51,9 @@
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/browser/frame_host/render_frame_host_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_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/client_certificate_delegate.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_view.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/service_names.mojom.h"
#include "content/public/common/storage_quota_params.h"
@@ -76,6 +79,7 @@
#include "extensions/common/switches.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h"
#include "storage/browser/quota/quota_settings.h"
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
@@ -722,6 +726,17 @@ content::QuotaPermissionContext*
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() {
return CefMediaCaptureDevicesDispatcher::GetInstance();
}
@@ -829,12 +844,12 @@ bool CefContentBrowserClient::CanCreateWindow(
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
content::mojom::WindowContainerType container_type,
const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const blink::mojom::WindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
@@ -981,8 +996,9 @@ void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
policy->RegisterWebSafeScheme(scheme);
}
CefBrowserContextImpl* CefContentBrowserClient::browser_context() const {
return browser_main_parts_->browser_context();
CefRefPtr<CefRequestContextImpl>
CefContentBrowserClient::request_context() const {
return browser_main_parts_->request_context();
}
CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const {

View File

@@ -11,6 +11,7 @@
#include "include/cef_request_context_handler.h"
#include "libcef/browser/net/url_request_context_getter_impl.h"
#include "libcef/browser/request_context_impl.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
@@ -19,7 +20,6 @@
#include "third_party/skia/include/core/SkColor.h"
class CefBrowserMainParts;
class CefBrowserContextImpl;
class CefDevToolsDelegate;
class CefResourceDispatcherHostDelegate;
@@ -56,6 +56,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
int child_process_id) override;
content::QuotaPermissionContext*
CreateQuotaPermissionContext() override;
void GetQuotaSettings(
content::BrowserContext* context,
content::StoragePartition* partition,
const storage::OptionalQuotaSettingsCallback& callback) override;
content::MediaObserver* GetMediaObserver() override;
content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override;
@@ -79,12 +83,12 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
const GURL& opener_url,
const GURL& opener_top_level_frame_url,
const GURL& source_origin,
WindowContainerType container_type,
content::mojom::WindowContainerType container_type,
const GURL& target_url,
const content::Referrer& referrer,
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::WebWindowFeatures& features,
const blink::mojom::WindowFeatures& features,
bool user_gesture,
bool opener_suppressed,
content::ResourceContext* context,
@@ -117,7 +121,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
// Perform browser process registration for the custom scheme.
void RegisterCustomScheme(const std::string& scheme);
CefBrowserContextImpl* browser_context() const;
CefRefPtr<CefRequestContextImpl> request_context() const;
CefDevToolsDelegate* devtools_delegate() const;
private:

View File

@@ -587,7 +587,6 @@ void CefCookieManagerImpl::SetCookieInternal(
cookie.secure ? true : false,
cookie.httponly ? true : false,
net::CookieSameSite::DEFAULT_MODE,
CefNetworkDelegate::AreStrictSecureCookiesEnabled(),
net::COOKIE_PRIORITY_DEFAULT,
base::Bind(SetCookieCallbackImpl, callback));
}

View File

@@ -81,7 +81,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
if (!base::IsStringUTF8(chunk))
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);
content::BrowserThread::PostTask(
@@ -322,6 +322,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
} else if (method == "requestFileSystems") {
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"));
} else if (method == "reattach") {
agent_host_->DetachClient(this);
agent_host_->AttachClient(this);
} else {
return;
}
@@ -404,7 +407,7 @@ void CefDevToolsFrontend::CallClientFunction(
void CefDevToolsFrontend::SendMessageAck(int request_id,
const base::Value* arg) {
base::FundamentalValue id_value(request_id);
base::Value id_value(request_id);
CallClientFunction("DevToolsAPI.embedderMessageAck",
&id_value, arg, nullptr);
}

View File

@@ -12,10 +12,6 @@ CefPDFWebContentsHelperClient::CefPDFWebContentsHelperClient() {
CefPDFWebContentsHelperClient::~CefPDFWebContentsHelperClient() {
}
void CefPDFWebContentsHelperClient::UpdateLocationBar(
content::WebContents* contents) {
}
void CefPDFWebContentsHelperClient::UpdateContentRestrictions(
content::WebContents* contents,
int content_restrictions) {

View File

@@ -18,13 +18,9 @@ class CefPDFWebContentsHelperClient
private:
// pdf::PDFWebContentsHelperClient:
void UpdateLocationBar(content::WebContents* contents) override;
void UpdateContentRestrictions(content::WebContents* contents,
int content_restrictions) override;
void OnPDFHasUnsupportedFeature(content::WebContents* contents) override;
void OnSaveURL(content::WebContents* contents) override;
DISALLOW_COPY_AND_ASSIGN(CefPDFWebContentsHelperClient);

View File

@@ -11,7 +11,6 @@
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/thread_util.h"
#include "base/threading/worker_pool.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/file_chooser_file_info.h"
#include "net/base/directory_lister.h"
@@ -363,7 +362,7 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
new UploadFolderHelper(
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
weak_ptr_factory_.GetWeakPtr(), mode))));
lister_->Start(base::WorkerPool::GetTaskRunner(true).get());
lister_->Start();
}
}

View File

@@ -90,7 +90,7 @@ void CefJavaScriptDialogManager::Destroy() {
void CefJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
content::JavaScriptMessageType message_type,
content::JavaScriptDialogType message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
@@ -187,7 +187,7 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
dialog_running_ = true;
runner_->Run(browser_,
content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM,
content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
base::string16(), // display_url
message_text,
base::string16(), // default_prompt_text
@@ -197,7 +197,6 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
void CefJavaScriptDialogManager::CancelDialogs(
content::WebContents* web_contents,
bool suppress_callbacks,
bool reset_state) {
CefRefPtr<CefClient> client = browser_->GetClient();
if (client.get()) {

View File

@@ -32,7 +32,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
void RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
content::JavaScriptMessageType message_type,
content::JavaScriptDialogType message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
@@ -42,7 +42,6 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
bool is_reload,
const DialogClosedCallback& callback) override;
void CancelDialogs(content::WebContents* web_contents,
bool suppress_callbacks,
bool reset_state) override;
private:

View File

@@ -9,7 +9,7 @@
#include "base/callback.h"
#include "base/strings/string16.h"
#include "content/public/common/javascript_message_type.h"
#include "content/public/common/javascript_dialog_type.h"
class CefBrowserHostImpl;
@@ -22,7 +22,7 @@ class CefJavaScriptDialogRunner {
// Run the dialog. Execute |callback| on completion.
virtual void Run(
CefBrowserHostImpl* browser,
content::JavaScriptMessageType message_type,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,

View File

@@ -160,15 +160,10 @@ class CefSimpleMenuModel : public ui::MenuModel {
}
bool GetTextColor(int index,
bool is_minor,
bool is_hovered,
SkColor* override_color) const override {
return impl_->GetTextColor(index, false, 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);
return impl_->GetTextColor(index, is_minor, is_hovered, override_color);
}
bool GetBackgroundColor(int index,

View File

@@ -26,7 +26,7 @@ class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner {
// CefJavaScriptDialogRunner methods:
void Run(
CefBrowserHostImpl* browser,
content::JavaScriptMessageType message_type,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,

View File

@@ -89,7 +89,7 @@ CefJavaScriptDialogRunnerMac::~CefJavaScriptDialogRunnerMac() {
void CefJavaScriptDialogRunnerMac::Run(
CefBrowserHostImpl* browser,
content::JavaScriptMessageType message_type,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
@@ -98,9 +98,9 @@ void CefJavaScriptDialogRunnerMac::Run(
callback_ = callback;
bool text_field =
message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT;
message_type == content::JAVASCRIPT_DIALOG_TYPE_PROMPT;
bool one_button =
message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT;
message_type == content::JAVASCRIPT_DIALOG_TYPE_ALERT;
helper_.reset(
[[CefJavaScriptDialogHelper alloc] initHelperWithCallback:
@@ -119,13 +119,13 @@ void CefJavaScriptDialogRunnerMac::Run(
base::string16 label;
switch (message_type) {
case content::JAVASCRIPT_MESSAGE_TYPE_ALERT:
case content::JAVASCRIPT_DIALOG_TYPE_ALERT:
label = base::ASCIIToUTF16("JavaScript Alert");
break;
case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT:
case content::JAVASCRIPT_DIALOG_TYPE_PROMPT:
label = base::ASCIIToUTF16("JavaScript Prompt");
break;
case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM:
case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM:
label = base::ASCIIToUTF16("JavaScript Confirm");
break;
}

View File

@@ -27,7 +27,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(
reinterpret_cast<CefJavaScriptDialogRunnerWin*>(lparam);
owner->dialog_win_ = dialog;
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,
owner->default_prompt_text_.c_str());
break;
@@ -57,7 +57,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(
case IDOK:
finish = true;
result = true;
if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) {
if (owner->message_type_ == content::JAVASCRIPT_DIALOG_TYPE_PROMPT) {
size_t length =
GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1;
if (length > 1) {
@@ -95,7 +95,7 @@ CefJavaScriptDialogRunnerWin::~CefJavaScriptDialogRunnerWin() {
void CefJavaScriptDialogRunnerWin::Run(
CefBrowserHostImpl* browser,
content::JavaScriptMessageType message_type,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
@@ -111,11 +111,11 @@ void CefJavaScriptDialogRunnerWin::Run(
hook_installed_ = true;
int dialog_type;
if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT)
if (message_type == content::JAVASCRIPT_DIALOG_TYPE_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;
else // JAVASCRIPT_MESSAGE_TYPE_PROMPT
else // JAVASCRIPT_DIALOG_TYPE_PROMPT
dialog_type = IDD_PROMPT;
base::FilePath file_path;

View File

@@ -17,7 +17,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
// CefJavaScriptDialogRunner methods:
void Run(
CefBrowserHostImpl* browser,
content::JavaScriptMessageType message_type,
content::JavaScriptDialogType message_type,
const base::string16& display_url,
const base::string16& message_text,
const base::string16& default_prompt_text,
@@ -28,7 +28,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
HWND dialog_win_;
HWND parent_win_;
content::JavaScriptMessageType message_type_;
content::JavaScriptDialogType message_type_;
base::string16 message_text_;
base::string16 default_prompt_text_;
DialogClosedCallback callback_;

View File

@@ -14,6 +14,7 @@
#include "base/strings/string_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/win/wrapped_window_proc.h"
#include "skia/ext/platform_canvas.h"
#include "skia/ext/skia_utils_win.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/l10n/l10n_util.h"

View File

@@ -8,6 +8,7 @@
#include <X11/extensions/XInput2.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "ui/base/x/x11_util.h"

View File

@@ -7,7 +7,10 @@
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_X11_H_
#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"

View File

@@ -49,7 +49,6 @@ void CefCookieStoreProxy::SetCookieWithDetailsAsync(
bool secure,
bool http_only,
net::CookieSameSite same_site,
bool enforce_strict_secure,
net::CookiePriority priority,
const SetCookiesCallback& callback) {
net::CookieStore* cookie_store = GetCookieStore();
@@ -57,8 +56,7 @@ void CefCookieStoreProxy::SetCookieWithDetailsAsync(
cookie_store->SetCookieWithDetailsAsync(url, name, value, domain, path,
creation_time, expiration_time,
last_access_time, secure, http_only,
same_site, enforce_strict_secure,
priority, callback);
same_site, priority, callback);
}
}

View File

@@ -39,7 +39,6 @@ class CefCookieStoreProxy : public net::CookieStore {
bool secure,
bool http_only,
net::CookieSameSite same_site,
bool enforce_strict_secure,
net::CookiePriority priority,
const SetCookiesCallback& callback) override;
void GetCookiesWithOptionsAsync(

View File

@@ -11,7 +11,7 @@
#include "base/memory/ptr_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"
namespace scheme {

View File

@@ -252,15 +252,6 @@ bool CefNetworkDelegate::AreExperimentalCookieFeaturesEnabled() {
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(
net::URLRequest* request,
std::unique_ptr<net::SourceStream> upstream) {
@@ -468,7 +459,3 @@ bool CefNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
bool CefNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const {
return AreExperimentalCookieFeaturesEnabled();
}
bool CefNetworkDelegate::OnAreStrictSecureCookiesEnabled() const {
return AreStrictSecureCookiesEnabled();
}

View File

@@ -22,7 +22,6 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
// Match the logic from ChromeNetworkDelegate and
// RenderFrameMessageFilter::OnSetCookie.
static bool AreExperimentalCookieFeaturesEnabled();
static bool AreStrictSecureCookiesEnabled();
void set_force_google_safesearch(
BooleanPrefMember* force_google_safesearch) {
@@ -46,7 +45,6 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
bool OnCanAccessFile(const net::URLRequest& request,
const base::FilePath& path) const override;
bool OnAreExperimentalCookieFeaturesEnabled() const override;
bool OnAreStrictSecureCookiesEnabled() const override;
// Weak, owned by our owner (CefURLRequestContextGetterImpl).
BooleanPrefMember* force_google_safesearch_;

View File

@@ -116,16 +116,18 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
std::unique_ptr<net::ProxyConfigService> proxy_config_service,
content::URLRequestInterceptorScopedVector request_interceptors)
: settings_(settings),
net_log_(g_browser_process->net_log()),
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)) {
io_state_(base::MakeUnique<IOState>()) {
// Must first be created on the UI thread.
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 =
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
@@ -141,7 +143,8 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
force_google_safesearch_.MoveToThread(io_thread_proxy);
#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
auth_server_whitelist_.Init(
@@ -159,11 +162,8 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
CefURLRequestContextGetterImpl::~CefURLRequestContextGetterImpl() {
CEF_REQUIRE_IOT();
// Delete the ProxyService object here so that any pending requests will be
// canceled before the associated URLRequestContext is destroyed in this
// object's destructor.
storage_->set_proxy_service(NULL);
// This destructor may not be called during shutdown. Perform any required
// shutdown in ShutdownOnIOThread() instead.
}
// static
@@ -187,12 +187,32 @@ void CefURLRequestContextGetterImpl::ShutdownOnUIThread() {
force_google_safesearch_.Destroy();
auth_server_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() {
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 =
base::CommandLine::ForCurrentProcess();
@@ -200,11 +220,11 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
if (settings_.cache_path.length > 0)
cache_path = base::FilePath(CefString(&settings_.cache_path));
url_request_context_.reset(new CefURLRequestContextImpl());
url_request_context_->set_net_log(net_log_);
io_state_->url_request_context_.reset(new CefURLRequestContextImpl());
io_state_->url_request_context_->set_net_log(io_state_->net_log_);
storage_.reset(
new net::URLRequestContextStorage(url_request_context_.get()));
io_state_->storage_.reset(new net::URLRequestContextStorage(
io_state_->url_request_context_.get()));
SetCookieStoragePath(cache_path,
settings_.persist_session_cookies ? true : false);
@@ -212,49 +232,51 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
std::unique_ptr<CefNetworkDelegate> network_delegate(
new CefNetworkDelegate());
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 =
settings_.accept_language_list.length > 0 ?
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)));
storage_->set_host_resolver(
net::HostResolver::CreateDefaultResolver(net_log_));
storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
io_state_->storage_->set_host_resolver(
net::HostResolver::CreateDefaultResolver(io_state_->net_log_));
io_state_->storage_->set_cert_verifier(net::CertVerifier::CreateDefault());
std::unique_ptr<net::TransportSecurityState> transport_security_state(
new net::TransportSecurityState);
transport_security_state->set_enforce_net_security_expiration(
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(
net::ct::CreateLogVerifiersForKnownLogs());
std::unique_ptr<net::MultiLogCTVerifier> ct_verifier(
new net::MultiLogCTVerifier());
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(
new net::CTPolicyEnforcer);
ct_policy_enforcer->set_enforce_net_security_expiration(
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 =
ProxyServiceFactory::CreateProxyService(
net_log_,
url_request_context_.get(),
url_request_context_->network_delegate(),
std::move(proxy_config_service_),
io_state_->net_log_,
io_state_->url_request_context_.get(),
io_state_->url_request_context_->network_delegate(),
std::move(io_state_->proxy_config_service_),
*command_line,
quick_check_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;
supported_schemes.push_back("basic");
@@ -262,18 +284,18 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
supported_schemes.push_back("ntlm");
supported_schemes.push_back("negotiate");
http_auth_preferences_.reset(
io_state_->http_auth_preferences_.reset(
new net::HttpAuthPreferences(supported_schemes
#if defined(OS_POSIX) && !defined(OS_ANDROID)
, gsapi_library_name_
, io_state_->gsapi_library_name_
#endif
));
storage_->set_http_auth_handler_factory(
io_state_->storage_->set_http_auth_handler_factory(
net::HttpAuthHandlerRegistryFactory::Create(
http_auth_preferences_.get(),
url_request_context_->host_resolver()));
storage_->set_http_server_properties(base::WrapUnique(
io_state_->http_auth_preferences_.get(),
io_state_->url_request_context_->host_resolver()));
io_state_->storage_->set_http_server_properties(base::WrapUnique(
new net::HttpServerPropertiesImpl));
base::FilePath http_cache_path;
@@ -294,74 +316,77 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
net::HttpNetworkSession::Params network_session_params;
network_session_params.host_resolver =
url_request_context_->host_resolver();
io_state_->url_request_context_->host_resolver();
network_session_params.cert_verifier =
url_request_context_->cert_verifier();
io_state_->url_request_context_->cert_verifier();
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 =
url_request_context_->cert_transparency_verifier();
io_state_->url_request_context_->cert_transparency_verifier();
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 =
url_request_context_->proxy_service();
io_state_->url_request_context_->proxy_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 =
url_request_context_->http_auth_handler_factory();
io_state_->url_request_context_->http_auth_handler_factory();
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 =
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)));
storage_->set_http_transaction_factory(base::WrapUnique(
new net::HttpCache(storage_->http_network_session(),
io_state_->storage_->set_http_transaction_factory(base::WrapUnique(
new net::HttpCache(io_state_->storage_->http_network_session(),
std::move(main_backend),
true /* set_up_quic_server_info */)));
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
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.
scheme::InstallInternalProtectedHandlers(
job_factory.get(),
url_request_manager_.get(),
&protocol_handlers_,
io_state_->url_request_manager_.get(),
&io_state_->protocol_handlers_,
network_session_params.host_resolver);
protocol_handlers_.clear();
io_state_->protocol_handlers_.clear();
// 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.
std::unique_ptr<net::URLRequestJobFactory> top_job_factory =
std::move(job_factory);
for (auto i = request_interceptors_.rbegin();
i != request_interceptors_.rend(); ++i) {
for (auto i = io_state_->request_interceptors_.rbegin();
i != io_state_->request_interceptors_.rend(); ++i) {
top_job_factory.reset(new net::URLRequestInterceptingJobFactory(
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)
// Only do this for the first (global) request context.
static bool request_context_for_nss_set = false;
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;
}
#endif
}
return url_request_context_.get();
return io_state_->url_request_context_.get();
}
scoped_refptr<base::SingleThreadTaskRunner>
@@ -370,7 +395,7 @@ scoped_refptr<base::SingleThreadTaskRunner>
}
net::HostResolver* CefURLRequestContextGetterImpl::GetHostResolver() const {
return url_request_context_->host_resolver();
return io_state_->url_request_context_->host_resolver();
}
void CefURLRequestContextGetterImpl::SetCookieStoragePath(
@@ -378,9 +403,9 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
bool persist_session_cookies) {
CEF_REQUIRE_IOT();
if (url_request_context_->cookie_store() &&
((cookie_store_path_.empty() && path.empty()) ||
cookie_store_path_ == path)) {
if (io_state_->url_request_context_->cookie_store() &&
((io_state_->cookie_store_path_.empty() && path.empty()) ||
io_state_->cookie_store_path_ == path)) {
// The path has not changed so don't do anything.
return;
}
@@ -412,23 +437,23 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
new net::CookieMonster(persistent_store.get(), NULL));
if (persistent_store.get() && persist_session_cookies)
cookie_monster->SetPersistSessionCookies(true);
cookie_store_path_ = path;
io_state_->cookie_store_path_ = path;
// Restore the previously supported schemes.
CefCookieManagerImpl::SetCookieMonsterSchemes(cookie_monster.get(),
cookie_supported_schemes_);
CefCookieManagerImpl::SetCookieMonsterSchemes(
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(
const std::vector<std::string>& schemes) {
CEF_REQUIRE_IOT();
cookie_supported_schemes_ = schemes;
io_state_->cookie_supported_schemes_ = schemes;
CefCookieManagerImpl::SetCookieMonsterSchemes(
static_cast<net::CookieMonster*>(GetExistingCookieStore()),
cookie_supported_schemes_);
io_state_->cookie_supported_schemes_);
}
void CefURLRequestContextGetterImpl::AddHandler(
@@ -438,34 +463,36 @@ void CefURLRequestContextGetterImpl::AddHandler(
base::Bind(&CefURLRequestContextGetterImpl::AddHandler, this, handler));
return;
}
handler_list_.push_back(handler);
io_state_->handler_list_.push_back(handler);
}
net::CookieStore*
CefURLRequestContextGetterImpl::GetExistingCookieStore() const {
CEF_REQUIRE_IOT();
if (url_request_context_ && url_request_context_->cookie_store())
return url_request_context_->cookie_store();
if (io_state_->url_request_context_ &&
io_state_->url_request_context_->cookie_store()) {
return io_state_->url_request_context_->cookie_store();
}
LOG(ERROR) << "Cookie store does not exist";
return nullptr;
}
void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
if (proxy_config_service_.get())
if (io_state_->proxy_config_service_.get())
return;
proxy_config_service_ =
io_state_->proxy_config_service_ =
net::ProxyService::CreateSystemProxyConfigService(
io_task_runner_, file_task_runner_);
io_state_->io_task_runner_, io_state_->file_task_runner_);
}
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {
http_auth_preferences_->set_server_whitelist(
io_state_->http_auth_preferences_->set_server_whitelist(
auth_server_whitelist_.GetValue());
}
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
http_auth_preferences_->set_delegate_whitelist(
io_state_->http_auth_preferences_->set_delegate_whitelist(
auth_negotiate_delegate_whitelist_.GetValue());
}

View File

@@ -81,7 +81,7 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
net::CookieStore* GetExistingCookieStore() const;
CefURLRequestManager* request_manager() const {
return url_request_manager_.get();
return io_state_->url_request_manager_.get();
}
private:
@@ -89,9 +89,16 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
void UpdateServerWhitelist();
void UpdateDelegateWhitelist();
void ShutdownOnIOThread();
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> file_task_runner_;
@@ -112,6 +119,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
std::vector<std::string> cookie_supported_schemes_;
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
};
std::unique_ptr<IOState> io_state_;
BooleanPrefMember quick_check_enabled_;
BooleanPrefMember pac_https_url_stripping_enabled_;

View File

@@ -21,9 +21,26 @@ CefURLRequestContextGetterProxy::~CefURLRequestContextGetterProxy() {
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*
CefURLRequestContextGetterProxy::GetURLRequestContext() {
CEF_REQUIRE_IOT();
if (shutting_down_)
return nullptr;
if (!context_proxy_) {
context_proxy_.reset(
new CefURLRequestContextProxy(static_cast<CefURLRequestContextImpl*>(

View File

@@ -24,6 +24,9 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
scoped_refptr<CefURLRequestContextGetterImpl> parent);
~CefURLRequestContextGetterProxy() override;
// Called when the StoragePartitionProxy is destroyed.
void ShutdownOnUIThread();
// net::URLRequestContextGetter implementation.
net::URLRequestContext* GetURLRequestContext() override;
scoped_refptr<base::SingleThreadTaskRunner>
@@ -35,6 +38,8 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
CefRefPtr<CefRequestContextHandler> handler() const { return handler_; }
private:
void ShutdownOnIOThread();
CefRefPtr<CefRequestContextHandler> handler_;
// 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_;
bool shutting_down_ = false;
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterProxy);
};

View File

@@ -171,7 +171,8 @@ std::unique_ptr<CefJavaScriptDialogRunner>
return native_delegate_->CreateJavaScriptDialogRunner();
}
std::unique_ptr<CefMenuRunner> CefBrowserPlatformDelegateOsr::CreateMenuRunner() {
std::unique_ptr<CefMenuRunner>
CefBrowserPlatformDelegateOsr::CreateMenuRunner() {
return native_delegate_->CreateMenuRunner();
}
@@ -302,6 +303,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
return;
const gfx::Point client_pt(event.x, event.y);
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
gfx::Point transformed_pt;
content::RenderWidgetHostImpl* target_rwh =
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
@@ -309,15 +312,32 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
client_pt, &transformed_pt);
if (target_rwh != current_rwh_for_drag_.get()) {
if (current_rwh_for_drag_)
current_rwh_for_drag_->DragTargetDragLeave();
if (current_rwh_for_drag_) {
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_);
}
if (!drag_data_)
return;
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
blink::WebDragOperationsMask ops =
static_cast<blink::WebDragOperationsMask>(allowed_ops);
int modifiers = TranslateModifiers(event.modifiers);
@@ -332,7 +352,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
}
if (current_rwh_for_drag_) {
current_rwh_for_drag_->DragTargetDragLeave();
current_rwh_for_drag_->DragTargetDragLeave(gfx::Point(), gfx::Point());
current_rwh_for_drag_.reset();
}
@@ -349,6 +369,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
return;
gfx::Point client_pt(event.x, event.y);
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
gfx::Point transformed_pt;
content::RenderWidgetHostImpl* target_rwh =
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
@@ -356,8 +378,26 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
client_pt, &transformed_pt);
if (target_rwh != current_rwh_for_drag_.get()) {
if (current_rwh_for_drag_)
current_rwh_for_drag_->DragTargetDragLeave();
if (current_rwh_for_drag_) {
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_);
}
@@ -369,7 +409,6 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
static_cast<CefDragDataImpl*>(drag_data_.get());
base::AutoLock lock_scope(data_impl->lock());
content::DropData* drop_data = data_impl->drop_data();
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
int modifiers = TranslateModifiers(event.modifiers);
target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt,
@@ -430,11 +469,36 @@ void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
if (!web_contents)
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);
web_contents->DragSourceEndedAt(x, y, screen_pt.x(), screen_pt.y(), drag_op,
drag_start_rwh_.get());
// |client_loc| and |screen_loc| are in the root coordinate space, for
// 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() {

View File

@@ -26,6 +26,7 @@
#include "content/browser/frame_host/render_widget_host_view_guest.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_view_frame_subscriber.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/resize_lock.h"
#include "content/common/input_messages.h"
@@ -33,8 +34,8 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/context_factory.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 "media/base/video_frame.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/image/image_skia_operations.h"
@@ -451,7 +452,8 @@ class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient {
CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
bool transparent,
content::RenderWidgetHost* widget,
CefRenderWidgetHostViewOSR* parent_host_view)
CefRenderWidgetHostViewOSR* parent_host_view,
bool is_guest_view_hack)
: transparent_(transparent),
scale_factor_(kDefaultScaleFactor),
frame_rate_threshold_ms_(0),
@@ -483,20 +485,20 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
}
#if !defined(OS_MACOSX)
content::ImageTransportFactory* factory =
content::ImageTransportFactory::GetInstance();
ui::ContextFactoryPrivate* context_factory_private =
factory->GetContextFactoryPrivate();
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));
#endif
PlatformCreateCompositorWidget();
PlatformCreateCompositorWidget(is_guest_view_hack);
#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(
new ui::Compositor(context_factory_private->AllocateFrameSinkId(),
content::GetContextFactory(), context_factory_private,
@@ -593,7 +595,7 @@ bool CefRenderWidgetHostViewOSR::HasFocus() const {
}
bool CefRenderWidgetHostViewOSR::IsSurfaceAvailableForCopy() const {
return GetDelegatedFrameHost()->CanCopyToBitmap();
return GetDelegatedFrameHost()->CanCopyFromCompositingSurface();
}
void CefRenderWidgetHostViewOSR::Show() {
@@ -697,16 +699,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
// The compositor will draw directly to the SoftwareOutputDevice which
// then calls OnPaint.
#if defined(OS_MACOSX)
// We would normally call BrowserCompositorMac::SwapCompositorFrame,
// however it contains compositor resize logic that we don't want.
// We would normally call BrowserCompositorMac::SwapCompositorFrame on
// macOS, however it contains compositor resize logic that we don't want.
// Consequently we instead call the SwapDelegatedFrame method directly.
browser_compositor_->GetDelegatedFrameHost()->SwapDelegatedFrame(
output_surface_id, std::move(frame));
#else
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id,
std::move(frame));
#endif
} else {
if (!copy_frame_generator_.get()) {
copy_frame_generator_.reset(
@@ -721,16 +718,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame(
gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect));
damage_rect.Intersect(gfx::Rect(frame_size));
#if defined(OS_MACOSX)
// We would normally call BrowserCompositorMac::SwapCompositorFrame,
// however it contains compositor resize logic that we don't want.
// We would normally call BrowserCompositorMac::SwapCompositorFrame on
// macOS, however it contains compositor resize logic that we don't want.
// Consequently we instead call the SwapDelegatedFrame method directly.
browser_compositor_->GetDelegatedFrameHost()->SwapDelegatedFrame(
output_surface_id, std::move(frame));
#else
delegated_frame_host_->SwapDelegatedFrame(output_surface_id,
GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id,
std::move(frame));
#endif
// Request a copy of the last compositor frame which will eventually call
// OnPaint asynchronously.
@@ -892,7 +884,7 @@ gfx::Size CefRenderWidgetHostViewOSR::GetPhysicalBackingSize() const {
return gfx::ConvertSizeToPixel(scale_factor_, GetRequestedRendererSize());
}
void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface(
void CefRenderWidgetHostViewOSR::CopyFromSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
const content::ReadbackRequestCallback& callback,
@@ -901,18 +893,14 @@ void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface(
src_subrect, dst_size, callback, color_type);
}
void CefRenderWidgetHostViewOSR::CopyFromCompositingSurfaceToVideoFrame(
void CefRenderWidgetHostViewOSR::CopyFromSurfaceToVideoFrame(
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) {
GetDelegatedFrameHost()->CopyFromCompositingSurfaceToVideoFrame(
src_subrect, target, callback);
}
bool CefRenderWidgetHostViewOSR::CanCopyToVideoFrame() const {
return GetDelegatedFrameHost()->CanCopyToVideoFrame();
}
void CefRenderWidgetHostViewOSR::BeginFrameSubscription(
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) {
GetDelegatedFrameHost()->BeginFrameSubscription(std::move(subscriber));
@@ -950,14 +938,6 @@ content::BrowserAccessibilityManager*
return NULL;
}
void CefRenderWidgetHostViewOSR::LockCompositingSurface() {
NOTIMPLEMENTED();
}
void CefRenderWidgetHostViewOSR::UnlockCompositingSurface() {
NOTIMPLEMENTED();
}
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
void CefRenderWidgetHostViewOSR::ShowDisambiguationPopup(
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>
CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice(
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()));
}

View File

@@ -91,7 +91,8 @@ class CefRenderWidgetHostViewOSR
public:
CefRenderWidgetHostViewOSR(const bool transparent,
content::RenderWidgetHost* widget,
CefRenderWidgetHostViewOSR* parent_host_view);
CefRenderWidgetHostViewOSR* parent_host_view,
bool is_guest_view_hack);
~CefRenderWidgetHostViewOSR() override;
// RenderWidgetHostView implementation.
@@ -142,16 +143,15 @@ class CefRenderWidgetHostViewOSR
gfx::Size GetRequestedRendererSize() const override;
gfx::Size GetPhysicalBackingSize() const override;
void CopyFromCompositingSurface(
void CopyFromSurface(
const gfx::Rect& src_subrect,
const gfx::Size& dst_size,
const content::ReadbackRequestCallback& callback,
const SkColorType color_type) override;
void CopyFromCompositingSurfaceToVideoFrame(
void CopyFromSurfaceToVideoFrame(
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;
bool CanCopyToVideoFrame() const override;
void BeginFrameSubscription(
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber)
override;
@@ -162,8 +162,6 @@ class CefRenderWidgetHostViewOSR
CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate* delegate,
bool for_root_frame) override;
void LockCompositingSurface() override;
void UnlockCompositingSurface() override;
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
@@ -175,6 +173,15 @@ class CefRenderWidgetHostViewOSR
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.
std::unique_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
ui::Compositor* compositor) override;
@@ -280,10 +287,12 @@ class CefRenderWidgetHostViewOSR
void RequestImeCompositionUpdate(bool start_monitoring);
cc::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack);
#if defined(OS_MACOSX)
friend class MacHelper;
#endif
void PlatformCreateCompositorWidget();
void PlatformCreateCompositorWidget(bool is_guest_view_hack);
void PlatformResizeCompositorWidget(const gfx::Size& size);
void PlatformDestroyCompositorWidget();

View File

@@ -7,8 +7,8 @@
#include <X11/cursorfont.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 "third_party/WebKit/public/platform/WebCursorInfo.h"
@@ -166,13 +166,15 @@ XCursorCache* cursor_cache = nullptr;
} // namespace
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
bool is_guest_view_hack) {
// Create a hidden 1x1 window. It will delete itself on close.
window_ = new CefWindowX11(NULL, None, gfx::Rect(0, 0, 1, 1));
compositor_widget_ = window_->xwindow();
}
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) {
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(
const gfx::Size&) {
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {

View File

@@ -128,7 +128,8 @@ content::DelegatedFrameHost* CefRenderWidgetHostViewOSR::GetDelegatedFrameHost()
return browser_compositor_->GetDelegatedFrameHost();
}
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
bool is_guest_view_hack) {
// Create a borderless non-visible 1x1 window.
window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1)
styleMask:NSBorderlessWindowMask
@@ -144,7 +145,8 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
mac_helper_ = new MacHelper(this);
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&) {

View File

@@ -143,13 +143,15 @@ bool IsSystemCursorID(LPCWSTR cursor_id) {
} // namespace
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() {
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
bool is_guest_view_hack) {
DCHECK(!window_);
window_.reset(new CefCompositorHostWin());
compositor_widget_ = window_->hwnd();
}
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size& size) {
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(
const gfx::Size& size) {
DCHECK(window_);
SetWindowPos(window_->hwnd(), NULL, 0, 0, size.width(), size.height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE);

View File

@@ -9,7 +9,7 @@
#include "libcef/browser/osr/render_widget_host_view_osr.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/gfx/skia_util.h"

View File

@@ -99,8 +99,10 @@ content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget(
embedder_render_widget_host->GetView());
}
const bool is_guest_view_hack = !!embedder_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.
@@ -110,7 +112,8 @@ content::RenderWidgetHostViewBase*
CefRenderWidgetHostViewOSR* view = GetView();
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) {

View File

@@ -159,8 +159,7 @@ void CefPermissionContext::DecidePermission(
}
ContentSetting content_setting =
profile_->GetHostContentSettingsMap()->
GetContentSettingAndMaybeUpdateLastUsage(
profile_->GetHostContentSettingsMap()->GetContentSetting(
requesting_origin,
embedding_origin,
permission_util::PermissionTypeToContentSetting(permission),

View File

@@ -294,21 +294,6 @@ PermissionStatus CefPermissionManager::GetPermissionStatus(
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(
PermissionType permission,
const GURL& requesting_origin,

View File

@@ -55,9 +55,6 @@ class CefPermissionManager : public KeyedService,
content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
void RegisterPermissionUsage(content::PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) override;
int SubscribePermissionStatusChange(
content::PermissionType permission,
const GURL& requesting_origin,

View File

@@ -24,6 +24,7 @@
#include "chrome/grit/locale_settings.h"
#include "components/content_settings/core/browser/cookie_settings.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/pref_filter.h"
#include "components/prefs/pref_registry_simple.h"
@@ -175,6 +176,7 @@ std::unique_ptr<PrefService> CreatePrefService(
update_client::RegisterPrefs(registry.get());
content_settings::CookieSettings::RegisterProfilePrefs(registry.get());
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());
GoogleURLTracker::RegisterProfilePrefs(registry.get());
// Print preferences.
registry->RegisterBooleanPref(prefs::kPrintingEnabled, true);

View File

@@ -280,7 +280,7 @@ void SetBool(CommandLinePrefStore* prefs,
const std::string& key,
bool value) {
prefs->SetValue(key,
base::WrapUnique(new base::FundamentalValue(value)),
base::WrapUnique(new base::Value(value)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
}

View File

@@ -9,6 +9,7 @@
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/feature_list.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
@@ -23,6 +24,7 @@
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/printer_query.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
@@ -163,24 +165,40 @@ void CefPrintViewManagerBase::OnDidPrintPage(
#if defined(OS_WIN)
print_job_->AppendPrintedPage(params.page_number);
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(
reinterpret_cast<const unsigned char*>(shared_buf->memory()),
params.data_size);
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(
bytes, params.page_size, params.content_area,
print_text_with_gdi);
bytes, params.page_size, params.content_area, print_text_with_gdi);
}
}
#else
// 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);
ShouldQuitFromInnerMessageLoop();

View File

@@ -90,7 +90,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::GetGlobalContext() {
CefRequestContextImpl::Config config;
config.is_global = true;
return new CefRequestContextImpl(config);
return CefRequestContextImpl::GetOrCreateRequestContext(config);
}
// static
@@ -107,7 +107,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
config.settings = settings;
config.handler = handler;
config.unique_id = g_next_id.GetNext();
return new CefRequestContextImpl(config);
return CefRequestContextImpl::GetOrCreateRequestContext(config);
}
// static
@@ -127,7 +127,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
config.other = static_cast<CefRequestContextImpl*>(other.get());
config.handler = handler;
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);
if (browser_context_impl_) {
// May result in |browser_context_impl_| being deleted if it's not the
// global context and no other CefRequestContextImpl are referencing it.
browser_context_impl_->RemoveRequestContext();
// May result in |browser_context_impl_| being deleted if no other
// CefRequestContextImpl are referencing it.
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
CefRefPtr<CefRequestContextImpl>
CefRequestContextImpl::GetOrCreateForRequestContext(
@@ -155,22 +168,9 @@ CefRequestContextImpl::GetOrCreateForRequestContext(
}
// Use the global context.
CefRequestContextImpl::Config config;
Config config;
config.is_global = true;
return new CefRequestContextImpl(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;
return CefRequestContextImpl::GetOrCreateRequestContext(config);
}
CefBrowserContext* CefRequestContextImpl::GetBrowserContext() {
@@ -191,7 +191,7 @@ void CefRequestContextImpl::GetRequestContextImpl(
const RequestContextCallback& callback) {
if (!task_runner.get())
task_runner = base::MessageLoop::current()->task_runner();
if (request_context_impl_) {
if (request_context_getter_impl_) {
// The browser context already exists.
DCHECK(browser_context());
GetRequestContextImplOnIOThread(task_runner, callback, browser_context());
@@ -257,9 +257,10 @@ bool CefRequestContextImpl::IsSharingWith(CefRefPtr<CefRequestContext> other) {
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.
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.
@@ -479,12 +480,13 @@ cef_errorcode_t CefRequestContextImpl::ResolveHostCached(
return ERR_FAILED;
}
if (!request_context_impl_)
if (!request_context_getter_impl_)
return 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) {
net::HostResolver::RequestInfo request_info(
net::HostPortPair::FromURL(GURL(origin.ToString())));
@@ -501,38 +503,34 @@ cef_errorcode_t CefRequestContextImpl::ResolveHostCached(
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(
const CefRequestContextImpl::Config& config)
: config_(config) {
}
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();
DCHECK(!browser_context_impl_);
DCHECK(!request_context_impl_);
DCHECK(!request_context_getter_impl_);
if (other_browser_context) {
// Share storage with |other_browser_context|.
if (config_.other) {
// Share storage with |config_.other|.
browser_context_impl_ = CefBrowserContextImpl::GetForContext(
other_browser_context);
config_.other->GetBrowserContext());
}
if (!browser_context_impl_) {
@@ -556,7 +554,7 @@ void CefRequestContextImpl::Initialize(
}
// 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_|.
config_.settings = browser_context_impl_->GetSettings();
@@ -565,21 +563,27 @@ void CefRequestContextImpl::Initialize(
// Use a proxy that will execute handler callbacks where appropriate and
// otherwise forward all requests to |browser_context_impl_|.
browser_context_proxy_.reset(
new CefBrowserContextProxy(config_.handler, browser_context_impl_));
new CefBrowserContextProxy(this, config_.handler,
browser_context_impl_));
browser_context_proxy_->Initialize();
DCHECK(!config_.is_global);
} else {
config_.is_global = (browser_context_impl_ ==
CefContentBrowserClient::Get()->browser_context());
}
request_context_impl_ = browser_context_impl_->request_context().get();
DCHECK(request_context_impl_);
request_context_getter_impl_ =
browser_context_impl_->request_context_getter().get();
DCHECK(request_context_getter_impl_);
if (config_.handler.get()) {
// Keep the handler alive until the associated request context is
// 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())
Initialize();
DCHECK(browser_context());
DCHECK(request_context_impl_);
DCHECK(request_context_getter_impl_);
}
void CefRequestContextImpl::GetBrowserContextOnUIThread(
@@ -623,18 +627,18 @@ void CefRequestContextImpl::GetRequestContextImplOnIOThread(
return;
}
DCHECK(request_context_impl_);
DCHECK(request_context_getter_impl_);
// Make sure the request context exists.
request_context_impl_->GetURLRequestContext();
request_context_getter_impl_->GetURLRequestContext();
if (task_runner->BelongsToCurrentThread()) {
// Execute the callback immediately.
callback.Run(request_context_impl_);
callback.Run(request_context_getter_impl_);
} else {
// Execute the callback on the target thread.
task_runner->PostTask(FROM_HERE,
base::Bind(callback, make_scoped_refptr(request_context_impl_)));
base::Bind(callback, make_scoped_refptr(request_context_getter_impl_)));
}
}

View File

@@ -19,16 +19,16 @@ class CefRequestContextImpl : public CefRequestContext {
public:
~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|.
// Will return the global context if |request_context| is NULL.
static CefRefPtr<CefRequestContextImpl> GetOrCreateForRequestContext(
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.
CefBrowserContext* GetBrowserContext();
@@ -108,10 +108,12 @@ class CefRequestContextImpl : public CefRequestContext {
int unique_id = -1;
};
static CefRefPtr<CefRequestContextImpl> GetOrCreateRequestContext(
const Config& config);
explicit CefRequestContextImpl(const Config& config);
void Initialize();
void Initialize(CefBrowserContext* other_browser_context);
// Make sure the browser context exists. Only called on the UI thread.
void EnsureBrowserContext();
@@ -155,7 +157,7 @@ class CefRequestContextImpl : public CefRequestContext {
Config config_;
// Owned by the CefBrowserContext.
CefURLRequestContextGetterImpl* request_context_impl_ = nullptr;
CefURLRequestContextGetterImpl* request_context_getter_impl_ = nullptr;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefRequestContextImpl);
DISALLOW_COPY_AND_ASSIGN(CefRequestContextImpl);

View File

@@ -46,17 +46,6 @@ 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)
@@ -73,6 +62,14 @@ void CefResourceContext::SetUserData(const void* key, Data* 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) {
if (parent_ && ShouldProxyUserData(key))
parent_->RemoveUserData(key);

View File

@@ -35,6 +35,7 @@ class CefResourceContext : public content::ResourceContext {
// SupportsUserData implementation.
Data* GetUserData(const void* key) const 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;
// ResourceContext implementation.

View File

@@ -53,6 +53,8 @@ void SendExecuteMimeTypeHandlerEvent(
web_contents = content::WebContents::FromRenderFrameHost(
content::RenderFrameHost::FromID(render_process_id, render_frame_id));
}
if (!web_contents)
return;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents);

View File

@@ -11,6 +11,10 @@ CefStoragePartitionProxy::CefStoragePartitionProxy(
url_request_context_(url_request_context) {
}
CefStoragePartitionProxy::~CefStoragePartitionProxy() {
url_request_context_->ShutdownOnUIThread();
}
base::FilePath CefStoragePartitionProxy::GetPath() {
return parent_->GetPath();
}
@@ -91,6 +95,11 @@ CefStoragePartitionProxy::GetBroadcastChannelProvider() {
return parent_->GetBroadcastChannelProvider();
}
content::BluetoothAllowedDevicesMap*
CefStoragePartitionProxy::GetBluetoothAllowedDevicesMap() {
return parent_->GetBluetoothAllowedDevicesMap();
}
void CefStoragePartitionProxy::ClearDataForOrigin(
uint32_t remove_mask,
uint32_t quota_storage_remove_mask,
@@ -129,6 +138,10 @@ void CefStoragePartitionProxy::Flush() {
parent_->Flush();
}
void CefStoragePartitionProxy::ClearBluetoothAllowedDevicesMapForTesting() {
parent_->ClearBluetoothAllowedDevicesMapForTesting();
}
void CefStoragePartitionProxy::Bind(
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request) {
parent_->Bind(std::move(request));

View File

@@ -18,6 +18,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
CefStoragePartitionProxy(
content::StoragePartition* parent,
CefURLRequestContextGetterProxy* url_request_context);
~CefStoragePartitionProxy() override;
// StoragePartition methods:
base::FilePath GetPath() override;
@@ -39,6 +40,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
content::BackgroundSyncContext* GetBackgroundSyncContext() override;
content::PaymentAppContextImpl* GetPaymentAppContext() override;
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
content::BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override;
void ClearDataForOrigin(uint32_t remove_mask,
uint32_t quota_storage_remove_mask,
const GURL& storage_origin,
@@ -59,6 +61,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
const base::Time end,
const base::Closure& callback) override;
void Flush() override;
void ClearBluetoothAllowedDevicesMapForTesting() override;
void Bind(
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request)
override;

View File

@@ -41,14 +41,15 @@ CEF_BUTTON_VIEW_T class CefButtonView : public CEF_VIEW_VIEW_D {
}
// views::CustomButton methods:
void StateChanged() override;
void StateChanged(views::CustomButton::ButtonState old_state) override;
// views::ButtonListener methods:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
};
CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::StateChanged() {
ParentClass::StateChanged();
CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::StateChanged(
views::CustomButton::ButtonState old_state) {
ParentClass::StateChanged(old_state);
if (ParentClass::cef_delegate())
ParentClass::cef_delegate()->OnButtonStateChanged(GetCefButton());
}

View File

@@ -265,8 +265,9 @@ bool CefZipReaderImpl::GetFileInfo() {
time.tm_hour = file_info.tmu_date.tm_hour;
time.tm_mday = file_info.tmu_date.tm_mday;
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);
DCHECK_NE(filemodified_, (time_t)-1);
return true;
}

View File

@@ -50,8 +50,9 @@ CefCrashReportUploadThread::CefCrashReportUploadThread(
CrashReportDatabase* database,
const std::string& url,
bool rate_limit,
bool upload_gzip,
int max_uploads)
: CrashReportUploadThread(database, url, rate_limit),
: CrashReportUploadThread(database, url, rate_limit, upload_gzip),
max_uploads_(max_uploads) {
}

View File

@@ -12,6 +12,7 @@ class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread {
CefCrashReportUploadThread(crashpad::CrashReportDatabase* database,
const std::string& url,
bool rate_limit,
bool upload_gzip,
int max_uploads);
~CefCrashReportUploadThread();

View File

@@ -76,6 +76,10 @@ class CefContentClient : public content::ContentClient,
// A scheme that can be sent CORS requests. This value should be true in
// most cases where |is_standard| is true.
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;

View File

@@ -7,7 +7,6 @@
#include "libcef/browser/stream_impl.h"
#include "libcef/common/drag_data_impl.h"
#include "base/files/file_path.h"
#include "net/base/filename_util.h"
#define CHECK_READONLY_RETURN_VOID() \
if (read_only_) { \
@@ -44,18 +43,21 @@ bool CefDragDataImpl::IsReadOnly() {
bool CefDragDataImpl::IsLink() {
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() {
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());
}
bool CefDragDataImpl::IsFile() {
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() {
@@ -90,20 +92,12 @@ CefString CefDragDataImpl::GetFragmentBaseURL() {
CefString CefDragDataImpl::GetFileName() {
base::AutoLock lock_scope(lock_);
if (data_.file_description_filename.empty())
if (data_.file_contents_content_disposition.empty())
return CefString();
base::FilePath file_name(CefString(data_.file_description_filename));
// Images without ALT text will only have a file extension so we need to
// synthesize one from the provided extension and URL.
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();
base::Optional<base::FilePath> filename =
data_.GetSafeFilenameForImageFileContents();
return filename ? CefString(filename->value()) : CefString();
}
size_t CefDragDataImpl::GetFileContents(CefRefPtr<CefStreamWriter> writer) {
@@ -173,7 +167,9 @@ void CefDragDataImpl::ResetFileContents() {
base::AutoLock lock_scope(lock_);
CHECK_READONLY_RETURN_VOID();
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,

View File

@@ -4,7 +4,7 @@
// This file defines extension APIs implemented in CEF.
// 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
// libcef/browser/extensions/chrome_api_registration.cc.

View File

@@ -4,7 +4,7 @@
// This file defines permissions for extension APIs implemented by CEF.
// 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
// libcef/browser/extensions/chrome_api_registration.cc.

View File

@@ -25,7 +25,8 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) {
false, /* is_local */
false, /* is_display_isolated */
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);
if (internal_schemes[i].is_cors_enabled)
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]);
}
}

View File

@@ -16,7 +16,6 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "components/navigation_interception/navigation_params.h"
#include "content/public/browser/browser_thread.h"
@@ -139,9 +138,9 @@ std::string GetURLRequestReferrer(const GURL& referrer_url) {
blink::WebString FilePathStringToWebString(
const base::FilePath::StringType& str) {
#if defined(OS_POSIX)
return base::WideToUTF16(base::SysNativeMBToWide(str));
return blink::WebString::fromUTF8(str);
#elif defined(OS_WIN)
return base::WideToUTF16(str);
return blink::WebString::fromUTF16(str);
#endif
}
@@ -179,8 +178,8 @@ void GetHeaderMap(const blink::WebURLRequest& request,
void visitHeader(const blink::WebString& name,
const blink::WebString& value) override {
const base::string16& nameStr = name;
const base::string16& valueStr = value;
const base::string16& nameStr = name.utf16();
const base::string16& valueStr = value.utf16();
if (base::LowerCaseEqualsASCII(nameStr, kReferrerLowerCase))
*referrer_ = GURL(valueStr);
else
@@ -216,8 +215,8 @@ void SetHeaderMap(const CefRequest::HeaderMap& map,
blink::WebURLRequest& request) {
CefRequest::HeaderMap::const_iterator it = map.begin();
for (; it != map.end(); ++it) {
request.setHTTPHeaderField(base::string16(it->first),
base::string16(it->second));
request.setHTTPHeaderField(blink::WebString::fromUTF16(it->first),
blink::WebString::fromUTF16(it->second));
}
}
@@ -620,7 +619,7 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
blink::WebURLRequest& request) {
request.setURL(params.url);
if (!params.method.empty())
request.setHTTPMethod(base::ASCIIToUTF16(params.method));
request.setHTTPMethod(blink::WebString::fromASCII(params.method));
if (params.referrer.is_valid()) {
const blink::WebString& referrer =
@@ -645,18 +644,18 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params,
}
if (params.upload_data.get()) {
const base::string16& method = request.httpMethod();
const base::string16& method = request.httpMethod().utf16();
if (method == base::ASCIIToUTF16("GET") ||
method == base::ASCIIToUTF16("HEAD")) {
request.setHTTPMethod(base::ASCIIToUTF16("POST"));
request.setHTTPMethod(blink::WebString::fromASCII("POST"));
}
// The comparison performed by httpHeaderField() is case insensitive.
if (request.httpHeaderField(base::ASCIIToUTF16(
if (request.httpHeaderField(blink::WebString::fromASCII(
net::HttpRequestHeaders::kContentType)).length()== 0) {
request.setHTTPHeaderField(
base::ASCIIToUTF16(net::HttpRequestHeaders::kContentType),
base::ASCIIToUTF16(kApplicationFormURLEncoded));
blink::WebString::fromASCII(net::HttpRequestHeaders::kContentType),
blink::WebString::fromASCII(kApplicationFormURLEncoded));
}
blink::WebHTTPBody body;
@@ -1314,7 +1313,7 @@ void CefPostDataElementImpl::Set(const blink::WebHTTPBody::Element& element) {
SetToBytes(element.data.size(),
static_cast<const void*>(element.data.data()));
} else if (element.type == blink::WebHTTPBody::Element::TypeFile) {
SetToFile(base::string16(element.filePath));
SetToFile(element.filePath.utf16());
} else {
NOTREACHED();
}
@@ -1329,7 +1328,8 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const {
static_cast<char*>(data_.bytes.bytes), data_.bytes.size);
} else if (type_ == PDE_TYPE_FILE) {
element.type = blink::WebHTTPBody::Element::TypeFile;
element.filePath.assign(base::string16(CefString(&data_.filename)));
element.filePath.assign(
blink::WebString::fromUTF16(CefString(&data_.filename)));
} else {
NOTREACHED();
}

View File

@@ -193,9 +193,9 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) {
blink::WebString str;
status_code_ = response.httpStatusCode();
str = response.httpStatusText();
status_text_ = CefString(str);
status_text_ = str.utf16();
str = response.mimeType();
mime_type_ = CefString(str);
mime_type_ = str.utf16();
class HeaderVisitor : public blink::WebHTTPHeaderVisitor {
public:
@@ -203,8 +203,7 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) {
void visitHeader(const blink::WebString& name,
const blink::WebString& value) override {
map_->insert(std::make_pair(base::string16(name),
base::string16(value)));
map_->insert(std::make_pair(name.utf16(), value.utf16()));
}
private:

View File

@@ -33,7 +33,8 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(
bool is_local,
bool is_display_isolated,
bool is_secure,
bool is_cors_enabled) {
bool is_cors_enabled,
bool is_csp_bypassing) {
const std::string& scheme = base::ToLowerASCII(scheme_name.ToString());
if (scheme::IsInternalHandledScheme(scheme) ||
registered_schemes_.find(scheme) != registered_schemes_.end()) {
@@ -52,10 +53,12 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(
schemes_.secure_schemes.push_back(scheme);
if (is_cors_enabled)
schemes_.cors_enabled_schemes.push_back(scheme);
if (is_csp_bypassing)
schemes_.csp_bypassing_schemes.push_back(scheme);
CefContentClient::SchemeInfo scheme_info = {
scheme, is_standard, is_local, is_display_isolated, is_secure,
is_cors_enabled
is_cors_enabled, is_csp_bypassing
};
CefContentClient::Get()->AddCustomScheme(scheme_info);
@@ -68,4 +71,5 @@ void CefSchemeRegistrarImpl::GetSchemes(
AppendArray(schemes_.local_schemes, &schemes->local_schemes);
AppendArray(schemes_.secure_schemes, &schemes->secure_schemes);
AppendArray(schemes_.cors_enabled_schemes, &schemes->cors_enabled_schemes);
AppendArray(schemes_.csp_bypassing_schemes, &schemes->csp_bypassing_schemes);
}

View File

@@ -23,14 +23,12 @@ class CefSchemeRegistrarImpl : public CefSchemeRegistrar {
bool is_local,
bool is_display_isolated,
bool is_secure,
bool is_cors_enabled) override;
bool is_cors_enabled,
bool is_csp_bypassing) override;
void GetSchemes(content::ContentClient::Schemes* schemes);
private:
// Verify that the object is being accessed from the correct thread.
bool VerifyContext();
content::ContentClient::Schemes schemes_;
std::set<std::string> registered_schemes_;

View File

@@ -297,17 +297,17 @@ bool CefValueImpl::SetNull() {
}
bool CefValueImpl::SetBool(bool value) {
SetValue(new base::FundamentalValue(value));
SetValue(new base::Value(value));
return true;
}
bool CefValueImpl::SetInt(int value) {
SetValue(new base::FundamentalValue(value));
SetValue(new base::Value(value));
return true;
}
bool CefValueImpl::SetDouble(double value) {
SetValue(new base::FundamentalValue(value));
SetValue(new base::Value(value));
return true;
}
@@ -425,7 +425,7 @@ CefRefPtr<CefBinaryValue> CefBinaryValue::Create(const void* data,
return NULL;
return new CefBinaryValueImpl(static_cast<char*>(const_cast<void*>(data)),
data_size, true);
data_size);
}
// static
@@ -453,12 +453,9 @@ CefBinaryValueImpl::CefBinaryValueImpl(base::BinaryValue* value,
}
CefBinaryValueImpl::CefBinaryValueImpl(char* data,
size_t data_size,
bool copy)
size_t data_size)
: CefValueBase<CefBinaryValue, base::BinaryValue>(
copy ? base::BinaryValue::CreateWithCopiedBuffer(data,
data_size).release() :
new base::BinaryValue(std::unique_ptr<char[]>(data), data_size),
new base::BinaryValue(std::vector<char>(data, data + data_size)),
NULL, kOwnerWillDelete, true, NULL) {
}
@@ -898,19 +895,19 @@ bool CefDictionaryValueImpl::SetNull(const CefString& key) {
bool CefDictionaryValueImpl::SetBool(const CefString& key, bool value) {
CEF_VALUE_VERIFY_RETURN(true, false);
SetInternal(key, new base::FundamentalValue(value));
SetInternal(key, new base::Value(value));
return true;
}
bool CefDictionaryValueImpl::SetInt(const CefString& key, int value) {
CEF_VALUE_VERIFY_RETURN(true, false);
SetInternal(key, new base::FundamentalValue(value));
SetInternal(key, new base::Value(value));
return true;
}
bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) {
CEF_VALUE_VERIFY_RETURN(true, false);
SetInternal(key, new base::FundamentalValue(value));
SetInternal(key, new base::Value(value));
return true;
}
@@ -1301,19 +1298,19 @@ bool CefListValueImpl::SetNull(size_t index) {
bool CefListValueImpl::SetBool(size_t index, bool value) {
CEF_VALUE_VERIFY_RETURN(true, false);
SetInternal(index, new base::FundamentalValue(value));
SetInternal(index, new base::Value(value));
return true;
}
bool CefListValueImpl::SetInt(size_t index, int value) {
CEF_VALUE_VERIFY_RETURN(true, false);
SetInternal(index, new base::FundamentalValue(value));
SetInternal(index, new base::Value(value));
return true;
}
bool CefListValueImpl::SetDouble(size_t index, double value) {
CEF_VALUE_VERIFY_RETURN(true, false);
SetInternal(index, new base::FundamentalValue(value));
SetInternal(index, new base::Value(value));
return true;
}

View File

@@ -143,11 +143,9 @@ class CefBinaryValueImpl
CefBinaryValueImpl(base::BinaryValue* value,
bool will_delete);
// If |copy| is false this object will take ownership of the specified |data|
// buffer instead of copying it.
// The data will always be copied.
CefBinaryValueImpl(char* data,
size_t data_size,
bool copy);
size_t data_size);
// Return a copy of the value.
base::BinaryValue* CopyValue();

View File

@@ -187,7 +187,7 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetFrame(const CefString& name) {
blink::WebView* web_view = render_view()->GetWebView();
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).
WebFrame* frame = web_view->findFrameByName(frame_name,
web_view->mainFrame());
@@ -325,7 +325,7 @@ CefRefPtr<CefFrameImpl> CefBrowserImpl::GetWebFrameImpl(
int64_t parent_id = frame->parent() == NULL ?
webkit_glue::kInvalidFrameId :
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.
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) {
web_frame->executeScript(
WebScriptSource(base::UTF8ToUTF16(code),
WebScriptSource(blink::WebString::fromUTF8(code),
GURL(script_url),
script_start_line));
success = true;
@@ -596,7 +596,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
success = true;
} else if (web_frame->isWebLocalFrame() &&
web_frame->toWebLocalFrame()->executeCommand(
base::UTF8ToUTF16(command))) {
blink::WebString::fromUTF8(command))) {
success = true;
}
}

View File

@@ -151,8 +151,9 @@ void AppendParams(const std::vector<base::string16>& additional_names,
}
for (size_t i = 0; i < additional_names.size(); ++i) {
names[existing_size + i] = additional_names[i];
values[existing_size + i] = additional_values[i];
names[existing_size + i] = blink::WebString::fromUTF16(additional_names[i]);
values[existing_size + i] =
blink::WebString::fromUTF16(additional_values[i]);
}
existing_names->swap(names);
@@ -828,9 +829,8 @@ void CefContentRendererClient::BrowserCreated(
render_view_routing_id,
render_frame_routing_id,
&params));
DCHECK_GT(params.browser_id, 0);
if (params.browser_id == 0) {
// The request failed for some reason.
// The popup may have been canceled during creation.
return;
}

View File

@@ -77,14 +77,14 @@ CefString CefDOMDocumentImpl::GetTitle() {
const WebDocument& document = frame_->document();
const WebString& title = document.title();
if (!title.isNull())
str = title;
str = title.utf16();
return str;
}
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetElementById(const CefString& id) {
const WebDocument& document = frame_->document();
return GetOrCreateNode(document.getElementById(base::string16(id)));
return GetOrCreateNode(document.getElementById(WebString::fromUTF16(id)));
}
CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetFocusedNode() {
@@ -140,7 +140,7 @@ CefString CefDOMDocumentImpl::GetSelectionAsMarkup() {
const WebString& markup = local_frame->selectionAsMarkup();
if (!markup.isNull())
str = markup;
str = markup.utf16();
return str;
}
@@ -156,7 +156,7 @@ CefString CefDOMDocumentImpl::GetSelectionAsText() {
const WebString& text = local_frame->selectionAsText();
if (!text.isNull())
str = text;
str = text.utf16();
return str;
}
@@ -182,7 +182,7 @@ CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL) {
return str;
const WebDocument& document = frame_->document();
const WebURL& url = document.completeURL(base::string16(partialURL));
const WebURL& url = document.completeURL(WebString::fromUTF16(partialURL));
if (!url.isNull()) {
GURL gurl = url;
str = gurl.spec();

View File

@@ -121,7 +121,8 @@ CefString CefDOMNodeImpl::GetFormControlElementType() {
const WebFormControlElement& formElement =
node_.toConst<WebFormControlElement>();
const base::string16& form_control_type = formElement.formControlType();
const base::string16& form_control_type =
formElement.formControlType().utf16();
str = form_control_type;
}
}
@@ -147,7 +148,7 @@ CefString CefDOMNodeImpl::GetName() {
const WebString& name = webkit_glue::GetNodeName(node_);
if (!name.isNull())
str = name;
str = name.utf16();
return str;
}
@@ -165,15 +166,16 @@ CefString CefDOMNodeImpl::GetValue() {
node_.toConst<WebFormControlElement>();
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")) {
const WebInputElement& input_element =
formElement.toConst<WebInputElement>();
value = input_element.value();
value = input_element.value().utf16();
} else if (form_control_type == base::ASCIIToUTF16("select-one")) {
const WebSelectElement& select_element =
formElement.toConst<WebSelectElement>();
value = select_element.value();
value = select_element.value().utf16();
}
base::TrimWhitespace(value, base::TRIM_LEADING, &value);
@@ -184,7 +186,7 @@ CefString CefDOMNodeImpl::GetValue() {
if (str.empty()) {
const WebString& value = node_.nodeValue();
if (!value.isNull())
str = value;
str = value.utf16();
}
return str;
@@ -197,7 +199,7 @@ bool CefDOMNodeImpl::SetValue(const CefString& value) {
if (node_.isElementNode())
return false;
return webkit_glue::SetNodeValue(node_, base::string16(value));
return webkit_glue::SetNodeValue(node_, WebString::fromUTF16(value));
}
CefString CefDOMNodeImpl::GetAsMarkup() {
@@ -207,7 +209,7 @@ CefString CefDOMNodeImpl::GetAsMarkup() {
const WebString& markup = webkit_glue::CreateNodeMarkup(node_);
if (!markup.isNull())
str = markup;
str = markup.utf16();
return str;
}
@@ -274,7 +276,7 @@ CefString CefDOMNodeImpl::GetElementTagName() {
const WebElement& element = node_.toConst<blink::WebElement>();
const WebString& tagname = element.tagName();
if (!tagname.isNull())
str = tagname;
str = tagname.utf16();
return str;
}
@@ -302,7 +304,7 @@ bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) {
}
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) {
@@ -316,9 +318,9 @@ CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) {
}
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())
str = attr;
str = attr.utf16();
return str;
}
@@ -338,8 +340,8 @@ void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap) {
return;
for (unsigned int i = 0; i < len; ++i) {
base::string16 name = element.attributeLocalName(i);
base::string16 value = element.attributeValue(i);
base::string16 name = element.attributeLocalName(i).utf16();
base::string16 value = element.attributeValue(i).utf16();
attrMap.insert(std::make_pair(name, value));
}
}
@@ -355,8 +357,8 @@ bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName,
}
WebElement element = node_.to<blink::WebElement>();
element.setAttribute(base::string16(attrName),
base::string16(value));
element.setAttribute(WebString::fromUTF16(attrName),
WebString::fromUTF16(value));
return true;
}
@@ -373,7 +375,7 @@ CefString CefDOMNodeImpl::GetElementInnerText() {
WebElement element = node_.to<blink::WebElement>();
const WebString& text = element.textContent();
if (!text.isNull())
str = text;
str = text.utf16();
return str;
}

Some files were not shown because too many files have changed in this diff Show More