Compare commits

...

29 Commits
6778 ... 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
77 changed files with 1142 additions and 709 deletions

View File

@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': '939b32ee5ba05c396eef3fd992822fcca9a2e262',
'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

@@ -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}")
@@ -215,7 +220,7 @@ endif()
if(OS_MACOSX)
# Platform-specific compiler/linker flags.
# See also Xcode target properties in macros.cmake.
# See also Xcode target properties in cef_macros.cmake.
set(CEF_LIBTYPE SHARED)
list(APPEND CEF_COMPILER_FLAGS
-fno-strict-aliasing # Avoid assumptions regarding non-aliasing of objects of different types
@@ -259,6 +264,15 @@ if(OS_MACOSX)
-Wl,-dead_strip # Strip dead code
)
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-Wno-undefined-var-template COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
if(COMPILER_SUPPORTS_NO_UNDEFINED_VAR_TEMPLATE)
list(APPEND CEF_CXX_COMPILER_FLAGS
-Wno-undefined-var-template # Don't warn about potentially uninstantiated static members
)
endif()
# Standard libraries.
set(CEF_STANDARD_LIBS
-lpthread
@@ -305,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)
@@ -350,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
@@ -454,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

@@ -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

@@ -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

@@ -2395,6 +2395,13 @@ typedef struct _cef_pdf_print_settings_t {
int page_width;
int page_height;
///
// The percentage to scale the PDF by before printing (e.g. 50 is 50%).
// If this value is less than or equal to zero the default value of 100
// will be used.
///
int scale_factor;
///
// Margins in millimeters. Only used if |margin_type| is set to
// PDF_PRINT_MARGIN_CUSTOM.

View File

@@ -937,6 +937,8 @@ struct CefPdfPrintSettingsTraits {
target->page_width = src->page_width;
target->page_height = src->page_height;
target->scale_factor = src->scale_factor;
target->margin_top = src->margin_top;
target->margin_right = src->margin_right;
target->margin_bottom = src->margin_bottom;

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());
@@ -190,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();
}
@@ -214,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.
@@ -60,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;
@@ -78,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

@@ -47,6 +47,7 @@
#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"
@@ -351,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(
@@ -382,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(),
@@ -780,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;
@@ -2243,10 +2257,13 @@ bool CefBrowserHostImpl::CanDragEnter(
void CefBrowserHostImpl::GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
CefBrowserInfoManager::GetInstance()->GetCustomWebContentsView(
web_contents, target_url, view, delegate_view);
target_url, opener_render_process_id, opener_render_frame_id, view,
delegate_view);
}
void CefBrowserHostImpl::WebContentsCreated(
@@ -2261,8 +2278,8 @@ void CefBrowserHostImpl::WebContentsCreated(
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
CefBrowserInfoManager::GetInstance()->WebContentsCreated(
source_contents, target_url, new_contents, settings, client,
platform_delegate);
target_url, opener_render_process_id, opener_render_frame_id, settings,
client, platform_delegate);
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
@@ -2271,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(
@@ -2352,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) {
@@ -2369,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,
@@ -2503,7 +2534,12 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
void CefBrowserHostImpl::DidFinishNavigation(
content::NavigationHandle* navigation_handle) {
CHECK(navigation_handle->GetRenderFrameHost());
// This method may be called with a nullptr RenderFrameHost (RFH) when a
// provisional load is started. It should be called again with a non-nullptr
// RFH once the provisional load is committed or if the provisional load
// fails.
if (!navigation_handle->GetRenderFrameHost())
return;
const net::Error error_code = navigation_handle->GetNetErrorCode();
if (error_code == net::OK) {

View File

@@ -405,6 +405,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
void GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) override;
void WebContentsCreated(content::WebContents* source_contents,
@@ -635,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

@@ -247,15 +247,14 @@ bool CefBrowserInfoManager::CanCreateWindow(
}
void CefBrowserInfoManager::GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
content::RenderFrameHost* host =
web_contents->GetRenderViewHost()->GetMainFrame();
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW,
host->GetProcess()->GetID(), host->GetRoutingID(),
opener_render_process_id, opener_render_frame_id,
target_url);
DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get());
@@ -271,22 +270,16 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
}
void CefBrowserInfoManager::WebContentsCreated(
content::WebContents* source_contents,
const GURL& target_url,
content::WebContents* new_contents,
int opener_render_process_id,
int opener_render_frame_id,
CefBrowserSettings& settings,
CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate) {
DCHECK(source_contents);
DCHECK(new_contents);
content::RenderFrameHost* host =
source_contents->GetRenderViewHost()->GetMainFrame();
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
PopPendingPopup(
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW,
host->GetProcess()->GetID(), host->GetRoutingID(),
target_url);
opener_render_process_id, opener_render_frame_id, target_url);
DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get());
@@ -416,34 +409,55 @@ 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.
PendingNewBrowserInfoList::iterator it =
pending_new_browser_info_list_.begin();
while (it != pending_new_browser_info_list_.end()) {
PendingNewBrowserInfo* info = *it;
if (info->render_process_id == render_process_id)
it = pending_new_browser_info_list_.erase(it);
else
++it;
{
base::AutoLock lock_scope(browser_info_lock_);
PendingNewBrowserInfoList::iterator it =
pending_new_browser_info_list_.begin();
while (it != pending_new_browser_info_list_.end()) {
PendingNewBrowserInfo* info = *it;
if (info->render_process_id == render_process_id)
it = pending_new_browser_info_list_.erase(it);
else
++it;
}
}
// 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);
host->FilterURL(false, &pending_popup->target_url);
GetInstance()->PushPendingPopup(std::move(pending_popup));
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

@@ -75,17 +75,18 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Called from CefBrowserHostImpl::GetCustomWebContentsView. See comments on
// PendingPopup for more information.
void GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view);
// Called from CefBrowserHostImpl::WebContentsCreated. See comments on
// PendingPopup for more information.
void WebContentsCreated(
content::WebContents* source_contents,
const GURL& target_url,
content::WebContents* new_contents,
int opener_render_process_id,
int opener_render_frame_id,
CefBrowserSettings& settings,
CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate);

View File

@@ -45,9 +45,9 @@
#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 "libcef/common/crash_reporting_win.h"
#include "ui/base/cursor/cursor_loader_win.h"
#endif
#endif // defined(USE_AURA)
@@ -134,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());
@@ -169,10 +171,6 @@ int CefBrowserMainParts::PreCreateThreads() {
}
void CefBrowserMainParts::PreMainMessageLoopRun() {
#if defined(OS_WIN)
crash_reporting_win::BlockUntilHandlerStarted();
#endif
if (extensions::ExtensionsEnabled()) {
// Initialize extension global objects before creating the global
// BrowserContext.
@@ -192,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();
}
@@ -212,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

@@ -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();
}
@@ -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;
@@ -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

@@ -60,7 +60,8 @@ class CefForceShutdown {
}
} g_force_shutdown;
#if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
#if defined(OS_WIN)
#if defined(ARCH_CPU_X86_64)
// VS2013 only checks the existence of FMA3 instructions, not the enabled-ness
// of them at the OS level (this is fixed in VS2015). We force off usage of
// FMA3 instructions in the CRT to avoid using that path and hitting illegal
@@ -72,7 +73,18 @@ void DisableFMA3() {
disabled = true;
_set_FMA3_enable(0);
}
#endif
#endif // defined(ARCH_CPU_X86_64)
// Signal chrome_elf to initialize crash reporting, rather than doing it in
// DllMain. See https://crbug.com/656800 for details.
void InitCrashReporter() {
static bool initialized = false;
if (initialized)
return;
initialized = true;
SignalInitializeCrashReporting();
}
#endif // defined(OS_WIN)
#if defined(OS_MACOSX) || defined(OS_WIN)
@@ -126,9 +138,12 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) {
int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application,
void* windows_sandbox_info) {
#if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
#if defined(OS_WIN)
#if defined(ARCH_CPU_X86_64)
DisableFMA3();
#endif
InitCrashReporter();
#endif
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
#if defined(OS_WIN)
@@ -182,9 +197,12 @@ bool CefInitialize(const CefMainArgs& args,
const CefSettings& settings,
CefRefPtr<CefApp> application,
void* windows_sandbox_info) {
#if defined(OS_WIN) && defined(ARCH_CPU_X86_64)
#if defined(OS_WIN)
#if defined(ARCH_CPU_X86_64)
DisableFMA3();
#endif
InitCrashReporter();
#endif
// Return true if the global context already exists.
if (g_context)

View File

@@ -211,7 +211,7 @@ void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
if (agent_host != agent_host_) {
agent_host_ = agent_host;
agent_host_->AttachClient(this);
if (inspect_element_at_.IsEmpty()) {
if (!inspect_element_at_.IsEmpty()) {
agent_host_->InspectElement(
this, inspect_element_at_.x, inspect_element_at_.y);
}

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,29 +89,38 @@ 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;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
// 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_;
#if defined(OS_POSIX) && !defined(OS_ANDROID)
std::string gsapi_library_name_;
std::string gsapi_library_name_;
#endif
std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
std::unique_ptr<net::URLRequestContextStorage> storage_;
std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_;
std::unique_ptr<CefURLRequestContextImpl> url_request_context_;
std::unique_ptr<CefURLRequestManager> url_request_manager_;
content::ProtocolHandlerMap protocol_handlers_;
content::URLRequestInterceptorScopedVector request_interceptors_;
std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
std::unique_ptr<net::URLRequestContextStorage> storage_;
std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_;
std::unique_ptr<CefURLRequestContextImpl> url_request_context_;
std::unique_ptr<CefURLRequestManager> url_request_manager_;
content::ProtocolHandlerMap protocol_handlers_;
content::URLRequestInterceptorScopedVector request_interceptors_;
base::FilePath cookie_store_path_;
std::vector<std::string> cookie_supported_schemes_;
base::FilePath cookie_store_path_;
std::vector<std::string> cookie_supported_schemes_;
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
std::vector<CefRefPtr<CefRequestContextHandler> > handler_list_;
};
std::unique_ptr<IOState> io_state_;
BooleanPrefMember quick_check_enabled_;
BooleanPrefMember 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

@@ -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

@@ -47,7 +47,7 @@ void FillInDictionaryFromPdfPrintSettings(
print_settings.SetInteger(kSettingCopies, 1);
print_settings.SetBoolean(kSettingCollate, false);
print_settings.SetString(kSettingDeviceName, "");
print_settings.SetInteger(kSettingScaleFactor, 100);
print_settings.SetBoolean(kSettingRasterizePdf, false);
print_settings.SetBoolean(kSettingGenerateDraftData, false);
print_settings.SetBoolean(kSettingPreviewModifiable, false);
@@ -59,6 +59,8 @@ void FillInDictionaryFromPdfPrintSettings(
!!pdf_settings.backgrounds_enabled);
print_settings.SetBoolean(kSettingHeaderFooterEnabled,
!!pdf_settings.header_footer_enabled);
print_settings.SetInteger(kSettingScaleFactor,
pdf_settings.scale_factor > 0 ? pdf_settings.scale_factor : 100);
if (pdf_settings.header_footer_enabled) {
print_settings.SetString(kSettingHeaderFooterTitle,

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)

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();
}

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;

View File

@@ -6,8 +6,6 @@
#include "libcef/common/crash_reporting_win.h"
#include "libcef/common/crash_reporting.h"
#include "base/debug/crash_logging.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"
@@ -119,17 +117,4 @@ bool InitializeCrashReportingForModule() {
return false;
}
void BlockUntilHandlerStarted() {
if (!crash_reporting::Enabled())
return;
HMODULE chrome_elf = GetModuleHandle(chrome::kChromeElfDllName);
if (chrome_elf) {
auto block_until_handler_started = reinterpret_cast<void (*)()>(
GetProcAddress(chrome_elf, "BlockUntilHandlerStartedImpl"));
if (block_until_handler_started)
block_until_handler_started();
}
}
} // namespace crash_reporting_win

View File

@@ -8,8 +8,4 @@ namespace crash_reporting_win {
// state from chrome_elf via exported functions.
bool InitializeCrashReportingForModule();
// Called from libcef early in main process startup to ensure that the crash
// handler process is started before other sub-processes are created.
void BlockUntilHandlerStarted();
} // namespace crash_reporting_win

View File

@@ -829,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

@@ -28,10 +28,7 @@ void CEF_CALLBACK auth_callback_cont(struct _cef_auth_callback_t* self,
DCHECK(username);
if (!username)
return;
// Verify param: password; type: string_byref_const
DCHECK(password);
if (!password)
return;
// Unverified params: password
// Execute
CefAuthCallbackCppToC::Get(self)->Continue(

View File

@@ -27,10 +27,7 @@ void CefAuthCallbackCToCpp::Continue(const CefString& username,
DCHECK(!username.empty());
if (username.empty())
return;
// Verify param: password; type: string_byref_const
DCHECK(!password.empty());
if (password.empty())
return;
// Unverified params: password
// Execute
_struct->cont(_struct,

View File

@@ -58,7 +58,8 @@ template<> cef_translator_test_scoped_client_t* CefCToCppScoped<CefTranslatorTes
return reinterpret_cast<cef_translator_test_scoped_client_t*>(
CefTranslatorTestScopedClientChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedClientChild>(
reinterpret_cast<CefTranslatorTestScopedClientChild*>(c))));
reinterpret_cast<CefTranslatorTestScopedClientChild*>(CEF_RAW_PTR_GET(
c)))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;

View File

@@ -117,7 +117,8 @@ template<> cef_translator_test_scoped_library_child_t* CefCToCppScoped<CefTransl
return reinterpret_cast<cef_translator_test_scoped_library_child_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(c))));
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(
CEF_RAW_PTR_GET(c)))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;

View File

@@ -94,13 +94,15 @@ template<> cef_translator_test_scoped_library_t* CefCToCppScoped<CefTranslatorTe
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(c))));
reinterpret_cast<CefTranslatorTestScopedLibraryChild*>(CEF_RAW_PTR_GET(
c)))));
}
if (type == WT_TRANSLATOR_TEST_SCOPED_LIBRARY_CHILD_CHILD) {
return reinterpret_cast<cef_translator_test_scoped_library_t*>(
CefTranslatorTestScopedLibraryChildChildCToCpp::UnwrapRaw(
CefRawPtr<CefTranslatorTestScopedLibraryChildChild>(
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(c))));
reinterpret_cast<CefTranslatorTestScopedLibraryChildChild*>(
CEF_RAW_PTR_GET(c)))));
}
NOTREACHED() << "Unexpected class type: " << type;
return NULL;

21
patch/patches/DEPS.patch Normal file
View File

@@ -0,0 +1,21 @@
diff --git a/DEPS b/DEPS
index 849d1f7..c5297af 100644
--- DEPS
+++ DEPS
@@ -1166,12 +1166,12 @@ recursedeps = [
'src/buildtools',
'src/third_party/android_tools',
[
- 'DEPS.chromium',
- 'src/third_party/angle'
+ 'src/third_party/angle',
+ 'DEPS.chromium'
],
[
- 'DEPS',
- 'src/third_party/swiftshader'
+ 'src/third_party/swiftshader',
+ 'DEPS'
]
]

View File

@@ -63,7 +63,7 @@ index 4b43013..169ca47 100644
content::BrowserContext* GetBrowserContextRedirectedInIncognito(
content::BrowserContext* context);
diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h
index 6554312..701cb0f 100644
index 385f9c3..3d126bd 100644
--- chrome/browser/profiles/profile_manager.h
+++ chrome/browser/profiles/profile_manager.h
@@ -89,7 +89,7 @@ class ProfileManager : public base::NonThreadSafe,

View File

@@ -1,5 +1,5 @@
diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc
index 50a66bb..4daaadf 100644
index aab05cd..d1532b6 100644
--- content/browser/compositor/gpu_process_transport_factory.cc
+++ content/browser/compositor/gpu_process_transport_factory.cc
@@ -220,6 +220,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() {

View File

@@ -31,7 +31,7 @@ index d2ce8b9..e4fc7c6 100644
cflags = [ "/wd4201" ]
}
diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc
index 4750471..a341ac0 100644
index a53beea..703f779 100644
--- chrome/common/crash_keys.cc
+++ chrome/common/crash_keys.cc
@@ -4,6 +4,8 @@
@@ -52,7 +52,7 @@ index 4750471..a341ac0 100644
// The following keys may be chunked by the underlying crash logging system,
// but ultimately constitute a single key-value pair.
//
@@ -252,10 +254,16 @@ size_t RegisterChromeCrashKeys() {
@@ -251,10 +253,16 @@ size_t RegisterChromeCrashKeys() {
// This dynamic set of keys is used for sets of key value pairs when gathering
// a collection of data, like command line switches or extension IDs.
@@ -71,7 +71,7 @@ index 4750471..a341ac0 100644
// Register the extension IDs.
{
@@ -289,7 +297,7 @@ size_t RegisterChromeCrashKeys() {
@@ -288,7 +296,7 @@ size_t RegisterChromeCrashKeys() {
return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength);
}
@@ -80,7 +80,7 @@ index 4750471..a341ac0 100644
static const char* const kIgnoreSwitches[] = {
switches::kEnableLogging,
switches::kFlagSwitchesBegin,
@@ -345,7 +353,7 @@ static bool IsBoringSwitch(const std::string& flag) {
@@ -344,7 +352,7 @@ static bool IsBoringSwitch(const std::string& flag) {
}
void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
@@ -203,7 +203,7 @@ index c658fa9..8c4a145 100644
g_crash_helper_enabled = true;
return true;
diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc
index 3c31d76..26a2602 100644
index 722ce16..711f2f2 100644
--- components/crash/content/app/breakpad_linux.cc
+++ components/crash/content/app/breakpad_linux.cc
@@ -29,6 +29,7 @@
@@ -222,7 +222,7 @@ index 3c31d76..26a2602 100644
#endif
bool g_is_crash_reporter_enabled = false;
@@ -685,7 +687,7 @@ bool CrashDone(const MinidumpDescriptor& minidump,
@@ -688,7 +690,7 @@ bool CrashDone(const MinidumpDescriptor& minidump,
info.process_type_length = 7;
info.distro = base::g_linux_distro;
info.distro_length = my_strlen(base::g_linux_distro);
@@ -231,7 +231,7 @@ index 3c31d76..26a2602 100644
info.process_start_time = g_process_start_time;
info.oom_size = base::g_oom_size;
info.pid = g_pid;
@@ -1341,7 +1343,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
@@ -1359,7 +1361,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
header_content_encoding,
header_content_type,
post_file,
@@ -240,7 +240,7 @@ index 3c31d76..26a2602 100644
"--timeout=10", // Set a timeout so we don't hang forever.
"--tries=1", // Don't retry if the upload fails.
"-O", // Output reply to the file descriptor path.
@@ -1680,10 +1682,19 @@ void HandleCrashDump(const BreakpadInfo& info) {
@@ -1698,10 +1700,19 @@ void HandleCrashDump(const BreakpadInfo& info) {
GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version);
writer.AddBoundary();
@@ -262,7 +262,7 @@ index 3c31d76..26a2602 100644
if (info.pid > 0) {
char pid_value_buf[kUint64StringSize];
uint64_t pid_value_len = my_uint64_len(info.pid);
@@ -1977,6 +1988,17 @@ void InitCrashReporter(const std::string& process_type) {
@@ -1999,6 +2010,17 @@ void InitCrashReporter(const std::string& process_type) {
PostEnableBreakpadInitialization();
}
@@ -281,7 +281,7 @@ index 3c31d76..26a2602 100644
void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) {
SanitizationInfo sanitization_info;
diff --git components/crash/content/app/breakpad_linux.h components/crash/content/app/breakpad_linux.h
index 3ef4e8a..d0a4b12 100644
index 0160f62..b732498 100644
--- components/crash/content/app/breakpad_linux.h
+++ components/crash/content/app/breakpad_linux.h
@@ -16,6 +16,9 @@ namespace breakpad {
@@ -292,10 +292,10 @@ index 3ef4e8a..d0a4b12 100644
+void SetCrashServerURL(const std::string& url);
+
#if defined(OS_ANDROID)
struct SanitizationInfo {
bool should_sanitize_dumps = false;
extern void InitCrashKeysForTesting();
diff --git components/crash/content/app/crash_reporter_client.cc components/crash/content/app/crash_reporter_client.cc
index fd88348..cbb9533 100644
index eac090b..c6ca2d3 100644
--- components/crash/content/app/crash_reporter_client.cc
+++ components/crash/content/app/crash_reporter_client.cc
@@ -88,11 +88,12 @@ int CrashReporterClient::GetResultCodeRespawnFailed() {
@@ -320,7 +320,7 @@ index fd88348..cbb9533 100644
#if defined(OS_WIN)
bool CrashReporterClient::GetCrashDumpLocation(base::string16* crash_dir) {
@@ -141,6 +143,32 @@ bool CrashReporterClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
@@ -149,6 +151,32 @@ bool CrashReporterClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
}
#endif
@@ -353,7 +353,7 @@ index fd88348..cbb9533 100644
#if defined(OS_ANDROID)
int CrashReporterClient::GetAndroidMinidumpDescriptor() {
return 0;
@@ -165,9 +193,4 @@ bool CrashReporterClient::ShouldEnableBreakpadMicrodumps() {
@@ -173,9 +201,4 @@ bool CrashReporterClient::ShouldEnableBreakpadMicrodumps() {
}
#endif
@@ -364,7 +364,7 @@ index fd88348..cbb9533 100644
-
} // namespace crash_reporter
diff --git components/crash/content/app/crash_reporter_client.h components/crash/content/app/crash_reporter_client.h
index 513727c..aef4590 100644
index ccc3048..663e880 100644
--- components/crash/content/app/crash_reporter_client.h
+++ components/crash/content/app/crash_reporter_client.h
@@ -8,6 +8,7 @@
@@ -398,7 +398,7 @@ index 513727c..aef4590 100644
// The location where minidump files should be written. Returns true if
// |crash_dir| was set. Windows has to use base::string16 because this code
@@ -176,6 +179,23 @@ class CrashReporterClient {
@@ -181,6 +184,23 @@ class CrashReporterClient {
// Returns true if breakpad should run in the given process type.
virtual bool EnableBreakpadForProcess(const std::string& process_type);
@@ -423,7 +423,7 @@ index 513727c..aef4590 100644
} // namespace crash_reporter
diff --git components/crash/content/app/crashpad.cc components/crash/content/app/crashpad.cc
index a0eabba..94039c4 100644
index 76f6734..f6f8000 100644
--- components/crash/content/app/crashpad.cc
+++ components/crash/content/app/crashpad.cc
@@ -142,7 +142,8 @@ void InitializeCrashpadImpl(bool initial_client,
@@ -538,7 +538,7 @@ index 7df66ea..4ee709a 100644
bool result = crashpad_client.StartHandler(handler_path,
database_path,
diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc
index 3ad5f8d..77a0fe6 100644
index 89f3d2b..9ce7c35 100644
--- components/crash/content/app/crashpad_win.cc
+++ components/crash/content/app/crashpad_win.cc
@@ -41,15 +41,15 @@ void GetPlatformCrashpadAnnotations(
@@ -598,9 +598,9 @@ index 3ad5f8d..77a0fe6 100644
+ crash_reporter_client->GetCrashOptionalArguments(&arguments);
+
if (!g_crashpad_client.Get().StartHandler(
exe_file, database_path, metrics_path, url, process_annotations,
arguments, false, true)) {
g_crashpad_client.Get().StartHandler(
exe_file, database_path, metrics_path, url, process_annotations,
arguments, false, false);
diff --git content/browser/frame_host/debug_urls.cc content/browser/frame_host/debug_urls.cc
index c693078..e58465b 100644
--- content/browser/frame_host/debug_urls.cc

View File

@@ -55,7 +55,7 @@ index 982fbe8..e757be46 100644
+ "studio path")
}
diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py
index 43a7e09..2af18e9 100644
index ec60564..6e88441 100644
--- build/toolchain/win/setup_toolchain.py
+++ build/toolchain/win/setup_toolchain.py
@@ -127,15 +127,17 @@ def _LoadToolchainEnv(cpu, sdk_dir):

View File

@@ -1,8 +1,8 @@
diff --git content/browser/frame_host/navigation_handle_impl.cc content/browser/frame_host/navigation_handle_impl.cc
index 2e525bb..646b81b 100644
index 4ebe13f1..11ded80 100644
--- content/browser/frame_host/navigation_handle_impl.cc
+++ content/browser/frame_host/navigation_handle_impl.cc
@@ -256,12 +256,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() {
@@ -257,12 +257,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() {
}
RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() {
@@ -16,7 +16,7 @@ index 2e525bb..646b81b 100644
}
diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc
index ff676db..63f862d 100644
index e3c2371..c2ce9bc 100644
--- content/browser/frame_host/render_frame_host_impl.cc
+++ content/browser/frame_host/render_frame_host_impl.cc
@@ -1133,6 +1133,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError(

View File

@@ -38,10 +38,10 @@ index f8b651f..ec39f8d 100644
content::WebPluginInfo* plugin) override;
diff --git chrome/browser/plugins/plugin_info_message_filter.cc chrome/browser/plugins/plugin_info_message_filter.cc
index 75a6fda..84cfc9f 100644
index 6847272..13c6f5c 100644
--- chrome/browser/plugins/plugin_info_message_filter.cc
+++ chrome/browser/plugins/plugin_info_message_filter.cc
@@ -483,8 +483,8 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
@@ -457,8 +457,8 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin(
for (; i < matching_plugins.size(); ++i) {
if (!filter ||
filter->IsPluginAvailable(render_process_id_, render_frame_id,
@@ -210,10 +210,10 @@ index 3e92d37..ecd8493 100644
const std::string& mime_type,
bool allow_wildcard,
diff --git content/common/frame_messages.h content/common/frame_messages.h
index 774d9cb..c74223f 100644
index 0442702..d0475ce 100644
--- content/common/frame_messages.h
+++ content/common/frame_messages.h
@@ -1244,8 +1244,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
@@ -1246,8 +1246,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback,
// Used to get the list of plugins. |main_frame_origin| is used to handle
// exceptions for plugin content settings.
@@ -224,7 +224,7 @@ index 774d9cb..c74223f 100644
url::Origin /* main_frame_origin */,
std::vector<content::WebPluginInfo> /* plugins */)
@@ -1253,9 +1254,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins,
@@ -1255,9 +1256,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins,
// type. If there is no matching plugin, |found| is false.
// |actual_mime_type| is the actual mime type supported by the
// found plugin.
@@ -285,10 +285,10 @@ index 3b610b1..7c439e0 100644
WebPluginInfo* plugin) = 0;
diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc
index 4af9b67..d73ac0b 100644
index 1af5e8e..3edcdce 100644
--- content/renderer/render_frame_impl.cc
+++ content/renderer/render_frame_impl.cc
@@ -2752,7 +2752,8 @@ blink::WebPlugin* RenderFrameImpl::createPlugin(
@@ -2757,7 +2757,8 @@ blink::WebPlugin* RenderFrameImpl::createPlugin(
std::string mime_type;
bool found = false;
Send(new FrameHostMsg_GetPluginInfo(
@@ -298,7 +298,7 @@ index 4af9b67..d73ac0b 100644
params.mimeType.utf8(), &found, &info, &mime_type));
if (!found)
return NULL;
@@ -5246,9 +5247,8 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
@@ -5264,9 +5265,8 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
(pending_navigation_params_ &&
!pending_navigation_params_->request_params.redirects.empty());
@@ -310,7 +310,7 @@ index 4af9b67..d73ac0b 100644
// The handlenavigation API is deprecated and will be removed once
// crbug.com/325351 is resolved.
if (GetContentClient()->renderer()->HandleNavigation(
@@ -5257,7 +5257,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
@@ -5275,7 +5275,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
is_redirect)) {
return blink::WebNavigationPolicyIgnore;
}
@@ -319,7 +319,7 @@ index 4af9b67..d73ac0b 100644
Referrer referrer(
RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest));
diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc
index ed2baee..19f294b 100644
index f30b509..a6009f9 100644
--- content/renderer/renderer_blink_platform_impl.cc
+++ content/renderer/renderer_blink_platform_impl.cc
@@ -712,6 +712,7 @@ blink::WebMIDIAccessor* RendererBlinkPlatformImpl::createMIDIAccessor(

View File

@@ -15,10 +15,10 @@ index 2b04a24..85653cf 100644
}
}
diff --git Source/core/frame/LocalFrame.cpp Source/core/frame/LocalFrame.cpp
index 6fa75cf..20cba50 100644
index 949107e..8a6f58d 100644
--- Source/core/frame/LocalFrame.cpp
+++ Source/core/frame/LocalFrame.cpp
@@ -898,6 +898,7 @@ PluginData* LocalFrame::pluginData() const {
@@ -900,6 +900,7 @@ PluginData* LocalFrame::pluginData() const {
if (!loader().allowPlugins(NotAboutToInstantiatePlugin))
return nullptr;
return page()->pluginData(
@@ -27,10 +27,10 @@ index 6fa75cf..20cba50 100644
}
diff --git Source/core/page/Page.cpp Source/core/page/Page.cpp
index cb46ff7..7c63196 100644
index b18bc71..ad01dcf 100644
--- Source/core/page/Page.cpp
+++ Source/core/page/Page.cpp
@@ -226,16 +226,26 @@ void Page::refreshPlugins() {
@@ -231,16 +231,26 @@ void Page::refreshPlugins() {
for (const Page* page : allPages()) {
// Clear out the page's plugin data.
@@ -65,7 +65,7 @@ index cb46ff7..7c63196 100644
void Page::setValidationMessageClient(ValidationMessageClient* client) {
diff --git Source/core/page/Page.h Source/core/page/Page.h
index 9c429bd..667207e 100644
index 8fda288..615389b 100644
--- Source/core/page/Page.h
+++ Source/core/page/Page.h
@@ -130,7 +130,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
@@ -78,7 +78,7 @@ index 9c429bd..667207e 100644
EditorClient& editorClient() const { return *m_editorClient; }
SpellCheckerClient& spellCheckerClient() const {
@@ -285,7 +286,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
@@ -286,7 +287,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized<Page>,
// longer needed.
Member<Frame> m_mainFrame;

View File

@@ -1,5 +1,5 @@
diff --git public/common/common_param_traits_macros.h public/common/common_param_traits_macros.h
index a7d48d0..15df86a 100644
index 95651f7..97359bc 100644
--- public/common/common_param_traits_macros.h
+++ public/common/common_param_traits_macros.h
@@ -203,6 +203,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
@@ -11,7 +11,7 @@ index a7d48d0..15df86a 100644
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
diff --git public/common/web_preferences.cc public/common/web_preferences.cc
index d44ff10..eba4758 100644
index e67991b..220cc96 100644
--- public/common/web_preferences.cc
+++ public/common/web_preferences.cc
@@ -173,6 +173,7 @@ WebPreferences::WebPreferences()
@@ -23,7 +23,7 @@ index d44ff10..eba4758 100644
inert_visual_viewport(false),
record_whole_document(false),
diff --git public/common/web_preferences.h public/common/web_preferences.h
index ba18988..42a0296 100644
index 07985ab..1a76702 100644
--- public/common/web_preferences.h
+++ public/common/web_preferences.h
@@ -187,6 +187,7 @@ struct CONTENT_EXPORT WebPreferences {
@@ -35,10 +35,10 @@ index ba18988..42a0296 100644
bool inert_visual_viewport;
bool record_whole_document;
diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc
index 85a9fa9..3df9583 100644
index c59e978..2ebba64 100644
--- renderer/render_view_impl.cc
+++ renderer/render_view_impl.cc
@@ -1401,6 +1401,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal(
@@ -1405,6 +1405,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal(
blink::WebView* web_view,
CompositorDependencies* compositor_deps) {
ApplyWebPreferences(prefs, web_view);

View File

@@ -1,5 +1,5 @@
diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm
index b67a5f3..edf32a4 100644
index b7f8bad..22ece7c 100644
--- render_widget_host_view_mac.mm
+++ render_widget_host_view_mac.mm
@@ -463,9 +463,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,

View File

@@ -1,8 +1,8 @@
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
index 204d1ae..0768d71 100644
index e2fe27b..fbdf066 100644
--- content/browser/renderer_host/render_widget_host_view_aura.cc
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -757,8 +757,10 @@ void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) {
@@ -762,8 +762,10 @@ void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) {
RenderWidgetHostViewBase::SetBackgroundColor(color);
bool opaque = GetBackgroundOpaque();
host_->SetBackgroundOpaque(opaque);

View File

@@ -78,7 +78,7 @@ index e3a15e6..5fae563 100644
}
diff --git ui/gfx/render_text.h ui/gfx/render_text.h
index bcb7314..4063073 100644
index fc02e24..aa26d9a 100644
--- ui/gfx/render_text.h
+++ ui/gfx/render_text.h
@@ -313,6 +313,10 @@ class GFX_EXPORT RenderText {
@@ -114,7 +114,7 @@ index 4a7cfd9..750a6ca 100644
if (style_ == STYLE_BUTTON && PlatformStyle::kDefaultLabelButtonHasBoldFont) {
// Some text appears wider when rendered normally than when rendered bold.
diff --git ui/views/controls/label.cc ui/views/controls/label.cc
index 2d16942..dc60700 100644
index 0532230..53d7e90 100644
--- ui/views/controls/label.cc
+++ ui/views/controls/label.cc
@@ -28,6 +28,7 @@

View File

@@ -71,7 +71,7 @@ index 657ad20..fcd514a 100644
void FlushInput();
diff --git content/browser/renderer_host/render_widget_host_view_event_handler.cc content/browser/renderer_host/render_widget_host_view_event_handler.cc
index 628aa29..f2098f9 100644
index f19b0c3..df2727e 100644
--- content/browser/renderer_host/render_widget_host_view_event_handler.cc
+++ content/browser/renderer_host/render_widget_host_view_event_handler.cc
@@ -28,6 +28,10 @@
@@ -325,7 +325,7 @@ index 544f086..0e81c59 100644
base::WeakPtrFactory<DesktopWindowTreeHostX11> weak_factory_;
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
index 38ade37..e66b0cd 100644
index 5ff65fd..8ae0c51 100644
--- ui/views/widget/widget.cc
+++ ui/views/widget/widget.cc
@@ -131,6 +131,7 @@ Widget::InitParams::InitParams(Type type)
@@ -336,7 +336,7 @@ index 38ade37..e66b0cd 100644
native_widget(nullptr),
desktop_window_tree_host(nullptr),
layer_type(ui::LAYER_TEXTURED),
@@ -306,7 +307,7 @@ void Widget::Init(const InitParams& in_params) {
@@ -305,7 +306,7 @@ void Widget::Init(const InitParams& in_params) {
params.name = params.delegate->GetContentsView()->GetClassName();
params.child |= (params.type == InitParams::TYPE_CONTROL);
@@ -345,7 +345,7 @@ index 38ade37..e66b0cd 100644
if (params.opacity == views::Widget::InitParams::INFER_OPACITY &&
params.type != views::Widget::InitParams::TYPE_WINDOW &&
@@ -370,7 +371,12 @@ void Widget::Init(const InitParams& in_params) {
@@ -369,7 +370,12 @@ void Widget::Init(const InitParams& in_params) {
}
} else if (params.delegate) {
SetContentsView(params.delegate->GetContentsView());
@@ -360,7 +360,7 @@ index 38ade37..e66b0cd 100644
// This must come after SetContentsView() or it might not be able to find
// the correct NativeTheme (on Linux). See http://crbug.com/384492
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
index 2a239c4..3d02b48 100644
index a7affa6..3e665f3 100644
--- ui/views/widget/widget.h
+++ ui/views/widget/widget.h
@@ -253,6 +253,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
@@ -372,7 +372,7 @@ index 2a239c4..3d02b48 100644
// the NativeWidget may specify a default size. If the parent is specified,
// |bounds| is in the parent's coordinate system. If the parent is not
diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc
index 810b9cb..fc339da 100644
index ac76453..1f10dd4 100644
--- ui/views/win/hwnd_message_handler.cc
+++ ui/views/win/hwnd_message_handler.cc
@@ -2539,8 +2539,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,

View File

@@ -1,8 +1,8 @@
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
index 8800f75..edbd8eb 100644
index e3076d2..42927cf 100644
--- content/browser/web_contents/web_contents_impl.cc
+++ content/browser/web_contents/web_contents_impl.cc
@@ -1571,6 +1571,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -1576,6 +1576,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
std::string unique_name;
frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name);
@@ -15,7 +15,7 @@ index 8800f75..edbd8eb 100644
WebContentsViewDelegate* delegate =
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
@@ -1581,6 +1587,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -1586,6 +1592,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
view_.reset(CreateWebContentsView(this, delegate,
&render_view_host_delegate_view_));
}
@@ -23,12 +23,15 @@ index 8800f75..edbd8eb 100644
if (browser_plugin_guest_ && !GuestMode::IsCrossProcessFrameGuest(this)) {
view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(),
@@ -2093,6 +2100,12 @@ void WebContentsImpl::CreateNewWindow(
@@ -2100,6 +2107,15 @@ void WebContentsImpl::CreateNewWindow(
create_params.renderer_initiated_creation =
main_frame_route_id != MSG_ROUTING_NONE;
+ if (delegate_) {
+ delegate_->GetCustomWebContentsView(this, params.target_url,
+ delegate_->GetCustomWebContentsView(this,
+ params.target_url,
+ render_process_id,
+ params.opener_render_frame_id,
+ &create_params.view,
+ &create_params.delegate_view);
+ }
@@ -36,7 +39,7 @@ index 8800f75..edbd8eb 100644
WebContentsImpl* new_contents = NULL;
if (!is_guest) {
create_params.context = view_->GetNativeView();
@@ -2122,7 +2135,7 @@ void WebContentsImpl::CreateNewWindow(
@@ -2129,7 +2145,7 @@ void WebContentsImpl::CreateNewWindow(
// TODO(brettw): It seems bogus that we have to call this function on the
// newly created object and give it one of its own member variables.
new_view->CreateViewForWidget(
@@ -45,7 +48,7 @@ index 8800f75..edbd8eb 100644
}
// Save the created window associated with the route so we can show it
// later.
@@ -4985,7 +4998,7 @@ NavigationEntry*
@@ -4985,7 +5001,7 @@ NavigationEntry*
void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(
RenderViewHost* render_view_host) {
RenderWidgetHostViewBase* rwh_view =
@@ -70,7 +73,7 @@ index fa0afb5..d677b31 100644
WebContents::CreateParams::CreateParams(const CreateParams& other) = default;
diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h
index 5a509ef..981a0a5 100644
index f968ca2..ee6f060 100644
--- content/public/browser/web_contents.h
+++ content/public/browser/web_contents.h
@@ -60,9 +60,11 @@ class PageState;
@@ -97,7 +100,7 @@ index 5a509ef..981a0a5 100644
// Creates a new WebContents.
diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h
index 6f966c7..71f2f2e 100644
index 6f966c7..391b9a0 100644
--- content/public/browser/web_contents_delegate.h
+++ content/public/browser/web_contents_delegate.h
@@ -42,11 +42,13 @@ class ColorChooser;
@@ -114,13 +117,15 @@ index 6f966c7..71f2f2e 100644
struct ColorSuggestion;
struct ContextMenuParams;
struct DropData;
@@ -329,6 +331,12 @@ class CONTENT_EXPORT WebContentsDelegate {
@@ -329,6 +331,14 @@ class CONTENT_EXPORT WebContentsDelegate {
const std::string& partition_id,
SessionStorageNamespace* session_storage_namespace);
+ virtual void GetCustomWebContentsView(
+ WebContents* web_contents,
+ const GURL& target_url,
+ int opener_render_process_id,
+ int opener_render_frame_id,
+ content::WebContentsView** view,
+ content::RenderViewHostDelegateView** delegate_view) {}
+

View File

@@ -1,5 +1,5 @@
diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp
index a5721cf..d89dcff 100644
index 48385f8..a11804b 100644
--- Source/web/ChromeClientImpl.cpp
+++ Source/web/ChromeClientImpl.cpp
@@ -898,7 +898,7 @@ bool ChromeClientImpl::hasOpenedPopup() const {
@@ -12,7 +12,7 @@ index a5721cf..d89dcff 100644
DCHECK(RuntimeEnabledFeatures::pagePopupEnabled());
diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp
index 8a38208..90784a8 100644
index 5b5fef6..ef4f665 100644
--- Source/web/WebViewImpl.cpp
+++ Source/web/WebViewImpl.cpp
@@ -357,6 +357,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client,
@@ -39,10 +39,10 @@ index 8a38208..90784a8 100644
void WebViewImpl::setBackgroundColorOverride(WebColor color) {
diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h
index f94b695..4828185 100644
index 354e52e..c2058f3 100644
--- Source/web/WebViewImpl.h
+++ Source/web/WebViewImpl.h
@@ -369,7 +369,8 @@ class WEB_EXPORT WebViewImpl final
@@ -370,7 +370,8 @@ class WEB_EXPORT WebViewImpl final
// Returns true if popup menus should be rendered by the browser, false if
// they should be rendered by WebKit (which is the default).
@@ -52,7 +52,7 @@ index f94b695..4828185 100644
bool shouldAutoResize() const { return m_shouldAutoResize; }
@@ -652,6 +653,8 @@ class WEB_EXPORT WebViewImpl final
@@ -653,6 +654,8 @@ class WEB_EXPORT WebViewImpl final
float m_fakePageScaleAnimationPageScaleFactor;
bool m_fakePageScaleAnimationUseAnchor;

View File

@@ -1,8 +1,8 @@
diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd
index c10c883..a03df69 100644
index 81b3556..e235465 100644
--- chrome/app/generated_resources.grd
+++ chrome/app/generated_resources.grd
@@ -6771,7 +6771,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
@@ -6779,7 +6779,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
</message>
</if>
<message name="IDS_PLUGIN_BLOCKED_BY_POLICY" desc="The placeholder text for a plugin blocked by enterprise policy.">

View File

@@ -1382,12 +1382,11 @@ gint BrowserWindowOsrGtk::KeyEvent(GtkWidget* widget,
if (event->type == GDK_KEY_PRESS) {
key_event.type = KEYEVENT_RAWKEYDOWN;
host->SendKeyEvent(key_event);
} else {
// Need to send both KEYUP and CHAR events.
key_event.type = KEYEVENT_KEYUP;
host->SendKeyEvent(key_event);
key_event.type = KEYEVENT_CHAR;
host->SendKeyEvent(key_event);
} else {
key_event.type = KEYEVENT_KEYUP;
host->SendKeyEvent(key_event);
}
return TRUE;

View File

@@ -188,12 +188,19 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
name:NSWindowDidChangeBackingPropertiesNotification
object:nil];
if (text_input_context_osr_mac_) {
[GetInputClientFromContext(text_input_context_osr_mac_) release];
[text_input_context_osr_mac_ release];
}
[super dealloc];
}
- (void)detach {
renderer_ = NULL;
browser_window_ = NULL;
if (text_input_context_osr_mac_)
[GetInputClientFromContext(text_input_context_osr_mac_) detach];
}
- (CefRefPtr<CefBrowser>)getBrowser {
@@ -526,10 +533,11 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
- (NSTextInputContext*)inputContext {
if (!text_input_context_osr_mac_) {
CefTextInputClientOSRMac* text_input_client =
[[CefTextInputClientOSRMac alloc] initWithBrowser:[self getBrowser]];
[[[CefTextInputClientOSRMac alloc]
initWithBrowser:[self getBrowser]] retain];
text_input_context_osr_mac_ = [[NSTextInputContext alloc] initWithClient:
text_input_client];
text_input_context_osr_mac_ = [[[NSTextInputContext alloc] initWithClient:
text_input_client] retain];
}
return text_input_context_osr_mac_;

View File

@@ -197,6 +197,10 @@
// Deletes itself.
- (void)cleanup:(id)window {
root_window_->WindowDestroyed();
// Don't want any more delegate callbacks after we destroy ourselves.
[window setDelegate:nil];
[self release];
}

View File

@@ -66,6 +66,7 @@
@property(nonatomic) BOOL handlingKeyDown;
- (id)initWithBrowser:(CefRefPtr<CefBrowser>)browser;
- (void)detach;
- (void)HandleKeyEventBeforeTextInputClient:(NSEvent*)keyEvent;
- (void)HandleKeyEventAfterTextInputClient:(CefKeyEvent)keyEvent;
- (void)ChangeCompositionRange:(CefRange)range

View File

@@ -69,6 +69,10 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
return self;
}
- (void)detach {
browser_ = NULL;
}
- (NSArray*)validAttributesForMarkedText {
if (!validAttributesForMarkedText_) {
validAttributesForMarkedText_ = [[NSArray alloc] initWithObjects:

View File

@@ -19,7 +19,7 @@ namespace {
// Returns the top menu bar with the specified |tag|.
NSMenuItem* GetMenuBarMenuWithTag(NSInteger tag) {
NSMenu* main_menu = NSApp.mainMenu;
NSMenu* main_menu = [[NSApplication sharedApplication] mainMenu];
NSInteger found_index = [main_menu indexOfItemWithTag:tag];
if (found_index >= 0)
return [main_menu itemAtIndex:found_index];

View File

@@ -2237,229 +2237,6 @@ TEST(NavigationTest, CrossOriginCtrlLeftClickCancel) {
}
namespace {
const char kPopupNavPageUrl[] = "http://tests-popup.com/page.html";
const char kPopupNavPopupUrl[] = "http://tests-popup.com/popup.html";
const char kPopupNavPopupUrl2[] = "http://tests-popup2.com/popup.html";
const char kPopupNavPopupName[] = "my_popup";
// Browser side.
class PopupNavTestHandler : public TestHandler {
public:
enum Mode {
ALLOW,
DENY,
NAVIGATE_AFTER_CREATION,
};
PopupNavTestHandler(Mode mode)
: mode_(mode) {}
void RunTest() override {
// Add the resources that we will navigate to/from.
std::string page = "<html><script>function doPopup() { window.open('" +
std::string(kPopupNavPopupUrl) + "', '" +
std::string(kPopupNavPopupName) +
"'); }</script>Page</html>";
AddResource(kPopupNavPageUrl, page, "text/html");
AddResource(kPopupNavPopupUrl, "<html>Popup</html>", "text/html");
if (mode_ == NAVIGATE_AFTER_CREATION)
AddResource(kPopupNavPopupUrl2, "<html>Popup2</html>", "text/html");
// Create the browser.
CreateBrowser(kPopupNavPageUrl);
// Time out the test after a reasonable period of time.
SetTestTimeout();
}
bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
const CefString& target_frame_name,
cef_window_open_disposition_t target_disposition,
bool user_gesture,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access) override {
EXPECT_FALSE(got_on_before_popup_);
got_on_before_popup_.yes();
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
EXPECT_EQ(GetBrowserId(), browser->GetIdentifier());
EXPECT_STREQ(kPopupNavPageUrl, frame->GetURL().ToString().c_str());
EXPECT_STREQ(kPopupNavPopupUrl, target_url.ToString().c_str());
EXPECT_STREQ(kPopupNavPopupName, target_frame_name.ToString().c_str());
EXPECT_EQ(WOD_NEW_FOREGROUND_TAB, target_disposition);
EXPECT_FALSE(user_gesture);
EXPECT_FALSE(*no_javascript_access);
return (mode_ == DENY); // Return true to cancel the popup.
}
void OnAfterCreated(CefRefPtr<CefBrowser> browser) override {
TestHandler::OnAfterCreated(browser);
if (mode_ == NAVIGATE_AFTER_CREATION && browser->IsPopup()) {
// Navigate to the 2nd popup URL instead of the 1st popup URL.
browser->GetMainFrame()->LoadURL(kPopupNavPopupUrl2);
}
}
void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
const std::string& url = frame->GetURL();
if (url == kPopupNavPageUrl) {
EXPECT_FALSE(got_load_start_);
got_load_start_.yes();
} else if (url == kPopupNavPopupUrl) {
EXPECT_FALSE(got_popup_load_start_);
got_popup_load_start_.yes();
} else if (url == kPopupNavPopupUrl2) {
EXPECT_FALSE(got_popup_load_start2_);
got_popup_load_start2_.yes();
}
}
void OnLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
ErrorCode errorCode,
const CefString& errorText,
const CefString& failedUrl) override {
if (failedUrl == kPopupNavPageUrl) {
EXPECT_FALSE(got_load_error_);
got_load_error_.yes();
} else if (failedUrl == kPopupNavPopupUrl) {
EXPECT_FALSE(got_popup_load_error_);
got_popup_load_error_.yes();
} else if (failedUrl == kPopupNavPopupUrl2) {
EXPECT_FALSE(got_popup_load_error2_);
got_popup_load_error2_.yes();
}
}
void OnLoadEnd(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int httpStatusCode) override {
const std::string& url = frame->GetURL();
if (url == kPopupNavPageUrl) {
EXPECT_FALSE(got_load_end_);
got_load_end_.yes();
frame->ExecuteJavaScript("doPopup()", kPopupNavPageUrl, 0);
if (mode_ == DENY) {
// Wait a bit to make sure the popup window isn't created.
CefPostDelayedTask(TID_UI,
base::Bind(&PopupNavTestHandler::DestroyTest, this), 200);
}
} else if (url == kPopupNavPopupUrl) {
EXPECT_FALSE(got_popup_load_end_);
got_popup_load_end_.yes();
if (mode_ != NAVIGATE_AFTER_CREATION) {
if (mode_ != DENY) {
CloseBrowser(browser, false);
DestroyTest();
} else {
EXPECT_FALSE(true); // Not reached.
}
}
} else if (url == kPopupNavPopupUrl2) {
EXPECT_FALSE(got_popup_load_end2_);
got_popup_load_end2_.yes();
if (mode_ == NAVIGATE_AFTER_CREATION) {
CloseBrowser(browser, false);
DestroyTest();
} else {
EXPECT_FALSE(true); // Not reached.
}
} else {
EXPECT_FALSE(true); // Not reached.
}
}
private:
void DestroyTest() override {
EXPECT_TRUE(got_load_start_);
EXPECT_FALSE(got_load_error_);
EXPECT_TRUE(got_load_end_);
EXPECT_TRUE(got_on_before_popup_);
if (mode_ == ALLOW) {
EXPECT_TRUE(got_popup_load_start_);
EXPECT_FALSE(got_popup_load_error_);
EXPECT_TRUE(got_popup_load_end_);
EXPECT_FALSE(got_popup_load_start2_);
EXPECT_FALSE(got_popup_load_error2_);
EXPECT_FALSE(got_popup_load_end2_);
} else if (mode_ == DENY) {
EXPECT_FALSE(got_popup_load_start_);
EXPECT_FALSE(got_popup_load_error_);
EXPECT_FALSE(got_popup_load_end_);
EXPECT_FALSE(got_popup_load_start2_);
EXPECT_FALSE(got_popup_load_error2_);
EXPECT_FALSE(got_popup_load_end2_);
} else if (mode_ == NAVIGATE_AFTER_CREATION) {
EXPECT_FALSE(got_popup_load_start_);
EXPECT_TRUE(got_popup_load_error_);
EXPECT_FALSE(got_popup_load_end_);
EXPECT_TRUE(got_popup_load_start2_);
EXPECT_FALSE(got_popup_load_error2_);
EXPECT_TRUE(got_popup_load_end2_);
}
TestHandler::DestroyTest();
}
const Mode mode_;
TrackCallback got_on_before_popup_;
TrackCallback got_load_start_;
TrackCallback got_load_error_;
TrackCallback got_load_end_;
TrackCallback got_popup_load_start_;
TrackCallback got_popup_load_error_;
TrackCallback got_popup_load_end_;
TrackCallback got_popup_load_start2_;
TrackCallback got_popup_load_error2_;
TrackCallback got_popup_load_end2_;
IMPLEMENT_REFCOUNTING(PopupNavTestHandler);
};
} // namespace
// Test allowing popups.
TEST(NavigationTest, PopupAllow) {
CefRefPtr<PopupNavTestHandler> handler =
new PopupNavTestHandler(PopupNavTestHandler::ALLOW);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test denying popups.
TEST(NavigationTest, PopupDeny) {
CefRefPtr<PopupNavTestHandler> handler =
new PopupNavTestHandler(PopupNavTestHandler::DENY);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
// Test navigation to a different origin after popup creation to verify that
// internal objects are tracked correctly (see issue #1392).
TEST(NavigationTest, PopupNavigateAfterCreation) {
CefRefPtr<PopupNavTestHandler> handler =
new PopupNavTestHandler(PopupNavTestHandler::NAVIGATE_AFTER_CREATION);
handler->ExecuteTest();
ReleaseAndWaitForDestructor(handler);
}
namespace {
const char kSimultPopupMainUrl[] = "http://www.tests-sp.com/main.html";

View File

@@ -125,50 +125,17 @@ TEST(RequestContextTest, CreateContextSharedGlobal) {
EXPECT_TRUE(context1->IsSame(context1));
EXPECT_TRUE(context1->IsSharingWith(context1));
// Returns the same global context.
CefRefPtr<CefRequestContext> context2 =
CefRequestContext::CreateContext(context1, NULL);
EXPECT_TRUE(context2.get());
EXPECT_FALSE(context2->IsGlobal());
EXPECT_TRUE(context2->IsGlobal());
EXPECT_TRUE(context2->IsSame(context2));
EXPECT_FALSE(context2->IsSame(context1));
EXPECT_FALSE(context1->IsSame(context2));
EXPECT_TRUE(context2->IsSame(context1));
EXPECT_TRUE(context1->IsSame(context2));
EXPECT_TRUE(context2->IsSharingWith(context2));
EXPECT_TRUE(context2->IsSharingWith(context1));
EXPECT_TRUE(context1->IsSharingWith(context2));
CefRefPtr<CefRequestContext> context3 =
CefRequestContext::CreateContext(context2, NULL);
EXPECT_TRUE(context3.get());
EXPECT_FALSE(context3->IsGlobal());
EXPECT_TRUE(context3->IsSame(context3));
EXPECT_FALSE(context3->IsSame(context2));
EXPECT_FALSE(context3->IsSame(context1));
EXPECT_FALSE(context1->IsSame(context3));
EXPECT_FALSE(context2->IsSame(context3));
EXPECT_TRUE(context3->IsSharingWith(context3));
EXPECT_TRUE(context3->IsSharingWith(context2));
EXPECT_TRUE(context3->IsSharingWith(context1));
EXPECT_TRUE(context1->IsSharingWith(context3));
EXPECT_TRUE(context2->IsSharingWith(context3));
CefRefPtr<CefRequestContext> context4 =
CefRequestContext::CreateContext(context1, NULL);
EXPECT_TRUE(context4.get());
EXPECT_FALSE(context4->IsGlobal());
EXPECT_TRUE(context4->IsSame(context4));
EXPECT_FALSE(context4->IsSame(context3));
EXPECT_FALSE(context4->IsSame(context2));
EXPECT_FALSE(context4->IsSame(context1));
EXPECT_FALSE(context1->IsSame(context4));
EXPECT_FALSE(context2->IsSame(context4));
EXPECT_FALSE(context3->IsSame(context4));
EXPECT_TRUE(context4->IsSharingWith(context4));
EXPECT_TRUE(context4->IsSharingWith(context3));
EXPECT_TRUE(context4->IsSharingWith(context2));
EXPECT_TRUE(context4->IsSharingWith(context1));
EXPECT_TRUE(context1->IsSharingWith(context4));
EXPECT_TRUE(context2->IsSharingWith(context4));
EXPECT_TRUE(context3->IsSharingWith(context4));
}
TEST(RequestContextTest, CreateContextSharedOnDisk) {
@@ -649,6 +616,336 @@ TEST(RequestContextTest, NoReferrerLinkDifferentOrigin) {
}
namespace {
const char kPopupNavPageUrl[] = "http://tests-popup.com/page.html";
const char kPopupNavPopupUrl[] = "http://tests-popup.com/popup.html";
const char kPopupNavPopupUrl2[] = "http://tests-popup2.com/popup.html";
const char kPopupNavPopupName[] = "my_popup";
// Browser side.
class PopupNavTestHandler : public TestHandler {
public:
enum Mode {
ALLOW_CLOSE_POPUP_FIRST,
ALLOW_CLOSE_POPUP_LAST,
DENY,
NAVIGATE_AFTER_CREATION,
DESTROY_PARENT_BEFORE_CREATION,
DESTROY_PARENT_BEFORE_CREATION_FORCE,
DESTROY_PARENT_DURING_CREATION,
DESTROY_PARENT_DURING_CREATION_FORCE,
DESTROY_PARENT_AFTER_CREATION,
DESTROY_PARENT_AFTER_CREATION_FORCE,
};
enum RCMode {
RC_MODE_NONE,
RC_MODE_IMPL,
RC_MODE_PROXY,
};
PopupNavTestHandler(Mode mode, RCMode rc_mode)
: mode_(mode),
rc_mode_(rc_mode) {}
void RunTest() override {
// Add the resources that we will navigate to/from.
std::string page = "<html><script>function doPopup() { window.open('" +
std::string(kPopupNavPopupUrl) + "', '" +
std::string(kPopupNavPopupName) +
"'); }</script>Page</html>";
AddResource(kPopupNavPageUrl, page, "text/html");
AddResource(kPopupNavPopupUrl, "<html>Popup</html>", "text/html");
if (mode_ == NAVIGATE_AFTER_CREATION)
AddResource(kPopupNavPopupUrl2, "<html>Popup2</html>", "text/html");
CefRefPtr<CefRequestContext> request_context;
CefRefPtr<CefRequestContextHandler> rc_handler;
if (rc_mode_ == RC_MODE_PROXY) {
class Handler : public CefRequestContextHandler {
public:
Handler() {}
private:
IMPLEMENT_REFCOUNTING(Handler);
};
rc_handler = new Handler();
}
if (rc_mode_ != RC_MODE_NONE) {
CefRequestContextSettings settings;
request_context = CefRequestContext::CreateContext(settings, rc_handler);
}
// Create the browser.
CreateBrowser(kPopupNavPageUrl, request_context);
// Time out the test after a reasonable period of time.
SetTestTimeout();
}
bool OnBeforePopup(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& target_url,
const CefString& target_frame_name,
cef_window_open_disposition_t target_disposition,
bool user_gesture,
const CefPopupFeatures& popupFeatures,
CefWindowInfo& windowInfo,
CefRefPtr<CefClient>& client,
CefBrowserSettings& settings,
bool* no_javascript_access) override {
EXPECT_FALSE(got_on_before_popup_);
got_on_before_popup_.yes();
EXPECT_TRUE(CefCurrentlyOn(TID_IO));
EXPECT_EQ(GetBrowserId(), browser->GetIdentifier());
EXPECT_STREQ(kPopupNavPageUrl, frame->GetURL().ToString().c_str());
EXPECT_STREQ(kPopupNavPopupUrl, target_url.ToString().c_str());
EXPECT_STREQ(kPopupNavPopupName, target_frame_name.ToString().c_str());
EXPECT_EQ(WOD_NEW_FOREGROUND_TAB, target_disposition);
EXPECT_FALSE(user_gesture);
EXPECT_FALSE(*no_javascript_access);
if (mode_ == DESTROY_PARENT_DURING_CREATION ||
mode_ == DESTROY_PARENT_DURING_CREATION_FORCE) {
// Destroy the main (parent) browser while popup creation is pending.
CloseBrowser(browser, mode_ == DESTROY_PARENT_DURING_CREATION_FORCE);
}
return (mode_ == DENY); // Return true to cancel the popup.
}
void OnAfterCreated(CefRefPtr<CefBrowser> browser) override {
TestHandler::OnAfterCreated(browser);
if (browser->IsPopup() &&
(mode_ == DESTROY_PARENT_AFTER_CREATION ||
mode_ == DESTROY_PARENT_AFTER_CREATION_FORCE)) {
// Destroy the main (parent) browser immediately after the popup is
// created.
CloseBrowser(GetBrowser(), mode_ == DESTROY_PARENT_AFTER_CREATION_FORCE);
}
if (mode_ == NAVIGATE_AFTER_CREATION && browser->IsPopup()) {
// Navigate to the 2nd popup URL instead of the 1st popup URL.
browser->GetMainFrame()->LoadURL(kPopupNavPopupUrl2);
}
}
void OnLoadStart(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
TransitionType transition_type) override {
const std::string& url = frame->GetURL();
if (url == kPopupNavPageUrl) {
EXPECT_FALSE(got_load_start_);
got_load_start_.yes();
} else if (url == kPopupNavPopupUrl) {
EXPECT_FALSE(got_popup_load_start_);
got_popup_load_start_.yes();
} else if (url == kPopupNavPopupUrl2) {
EXPECT_FALSE(got_popup_load_start2_);
got_popup_load_start2_.yes();
}
}
void OnLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
ErrorCode errorCode,
const CefString& errorText,
const CefString& failedUrl) override {
if (failedUrl == kPopupNavPageUrl) {
EXPECT_FALSE(got_load_error_);
got_load_error_.yes();
} else if (failedUrl == kPopupNavPopupUrl) {
EXPECT_FALSE(got_popup_load_error_);
got_popup_load_error_.yes();
} else if (failedUrl == kPopupNavPopupUrl2) {
EXPECT_FALSE(got_popup_load_error2_);
got_popup_load_error2_.yes();
}
}
void OnLoadEnd(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int httpStatusCode) override {
const std::string& url = frame->GetURL();
if (url == kPopupNavPageUrl) {
EXPECT_FALSE(got_load_end_);
got_load_end_.yes();
frame->ExecuteJavaScript("doPopup()", kPopupNavPageUrl, 0);
if (mode_ == DESTROY_PARENT_BEFORE_CREATION ||
mode_ == DESTROY_PARENT_BEFORE_CREATION_FORCE) {
// Destroy the main (parent) browser immediately before the popup is
// created.
CloseBrowser(browser, mode_ == DESTROY_PARENT_BEFORE_CREATION_FORCE);
}
if (mode_ == DENY) {
// Wait a bit to make sure the popup window isn't created.
CefPostDelayedTask(TID_UI,
base::Bind(&PopupNavTestHandler::DestroyTest, this), 200);
}
} else if (url == kPopupNavPopupUrl) {
EXPECT_FALSE(got_popup_load_end_);
got_popup_load_end_.yes();
if (mode_ == ALLOW_CLOSE_POPUP_FIRST) {
// Close the popup browser first.
CloseBrowser(browser, false);
} else if (mode_ == ALLOW_CLOSE_POPUP_LAST) {
// Close the main browser first.
CloseBrowser(GetBrowser(), false);
} else if (mode_ != NAVIGATE_AFTER_CREATION) {
EXPECT_FALSE(true); // Not reached.
}
} else if (url == kPopupNavPopupUrl2) {
EXPECT_FALSE(got_popup_load_end2_);
got_popup_load_end2_.yes();
if (mode_ == NAVIGATE_AFTER_CREATION) {
// Close the popup browser first.
CloseBrowser(browser, false);
} else {
EXPECT_FALSE(true); // Not reached.
}
} else {
EXPECT_FALSE(true); // Not reached.
}
}
void OnBeforeClose(CefRefPtr<CefBrowser> browser) override {
TestHandler::OnBeforeClose(browser);
bool destroy_test = false;
if (mode_ == ALLOW_CLOSE_POPUP_FIRST || mode_ == NAVIGATE_AFTER_CREATION) {
// Destroy the test after the popup browser closes.
if (browser->IsPopup())
destroy_test = true;
} else if (mode_ == ALLOW_CLOSE_POPUP_LAST ||
mode_ == DESTROY_PARENT_BEFORE_CREATION ||
mode_ == DESTROY_PARENT_BEFORE_CREATION_FORCE ||
mode_ == DESTROY_PARENT_DURING_CREATION ||
mode_ == DESTROY_PARENT_DURING_CREATION_FORCE ||
mode_ == DESTROY_PARENT_AFTER_CREATION ||
mode_ == DESTROY_PARENT_AFTER_CREATION_FORCE) {
// Destroy the test after the main browser closes.
if (!browser->IsPopup())
destroy_test = true;
}
if (destroy_test) {
CefPostTask(TID_UI, base::Bind(&PopupNavTestHandler::DestroyTest, this));
}
}
private:
void DestroyTest() override {
EXPECT_TRUE(got_load_start_);
EXPECT_FALSE(got_load_error_);
EXPECT_TRUE(got_load_end_);
// OnBeforePopup may come before or after browser destruction with the
// DESTROY_PARENT_BEFORE_CREATION* tests.
if (mode_ != DESTROY_PARENT_BEFORE_CREATION &&
mode_ != DESTROY_PARENT_BEFORE_CREATION_FORCE) {
EXPECT_TRUE(got_on_before_popup_);
}
if (mode_ == ALLOW_CLOSE_POPUP_FIRST || mode_ == ALLOW_CLOSE_POPUP_LAST) {
EXPECT_TRUE(got_popup_load_start_);
EXPECT_FALSE(got_popup_load_error_);
EXPECT_TRUE(got_popup_load_end_);
EXPECT_FALSE(got_popup_load_start2_);
EXPECT_FALSE(got_popup_load_error2_);
EXPECT_FALSE(got_popup_load_end2_);
} else if (mode_ == DENY ||
mode_ == DESTROY_PARENT_BEFORE_CREATION ||
mode_ == DESTROY_PARENT_BEFORE_CREATION_FORCE ||
mode_ == DESTROY_PARENT_DURING_CREATION ||
mode_ == DESTROY_PARENT_DURING_CREATION_FORCE ||
mode_ == DESTROY_PARENT_AFTER_CREATION ||
mode_ == DESTROY_PARENT_AFTER_CREATION_FORCE) {
EXPECT_FALSE(got_popup_load_start_);
EXPECT_FALSE(got_popup_load_error_);
EXPECT_FALSE(got_popup_load_end_);
EXPECT_FALSE(got_popup_load_start2_);
EXPECT_FALSE(got_popup_load_error2_);
EXPECT_FALSE(got_popup_load_end2_);
} else if (mode_ == NAVIGATE_AFTER_CREATION) {
EXPECT_FALSE(got_popup_load_start_);
EXPECT_TRUE(got_popup_load_error_);
EXPECT_FALSE(got_popup_load_end_);
EXPECT_TRUE(got_popup_load_start2_);
EXPECT_FALSE(got_popup_load_error2_);
EXPECT_TRUE(got_popup_load_end2_);
}
// Will trigger destruction of all remaining browsers.
TestHandler::DestroyTest();
}
const Mode mode_;
const RCMode rc_mode_;
TrackCallback got_on_before_popup_;
TrackCallback got_load_start_;
TrackCallback got_load_error_;
TrackCallback got_load_end_;
TrackCallback got_popup_load_start_;
TrackCallback got_popup_load_error_;
TrackCallback got_popup_load_end_;
TrackCallback got_popup_load_start2_;
TrackCallback got_popup_load_error2_;
TrackCallback got_popup_load_end2_;
IMPLEMENT_REFCOUNTING(PopupNavTestHandler);
};
} // namespace
#define POPUP_TEST(name, test_mode, rc_mode)\
TEST(RequestContextTest, Popup##name) {\
CefRefPtr<PopupNavTestHandler> handler =\
new PopupNavTestHandler(PopupNavTestHandler::test_mode,\
PopupNavTestHandler::rc_mode);\
handler->ExecuteTest();\
ReleaseAndWaitForDestructor(handler);\
}
#define POPUP_TEST_GROUP(name, test_mode)\
POPUP_TEST(name##RCNone, test_mode, RC_MODE_NONE);\
POPUP_TEST(name##RCImpl, test_mode, RC_MODE_IMPL);\
POPUP_TEST(name##RCProxy, test_mode, RC_MODE_PROXY);
// Test allowing popups and closing the popup browser first.
POPUP_TEST_GROUP(AllowClosePopupFirst, ALLOW_CLOSE_POPUP_FIRST);
// Test allowing popups and closing the main browser first to verify that
// internal objects are tracked correctly (see issue #2162).
POPUP_TEST_GROUP(AllowClosePopupLast, ALLOW_CLOSE_POPUP_LAST);
// Test denying popups.
POPUP_TEST_GROUP(Deny, DENY);
// Test navigation to a different origin after popup creation to verify that
// internal objects are tracked correctly (see issue #1392).
POPUP_TEST_GROUP(NavigateAfterCreation, NAVIGATE_AFTER_CREATION);
// Test destroying the parent browser during or immediately after popup creation
// to verify that internal objects are tracked correctly (see issue #2041).
POPUP_TEST_GROUP(DestroyParentBeforeCreation, DESTROY_PARENT_BEFORE_CREATION);
POPUP_TEST_GROUP(DestroyParentBeforeCreationForce,
DESTROY_PARENT_BEFORE_CREATION_FORCE);
POPUP_TEST_GROUP(DestroyParentDuringCreation, DESTROY_PARENT_DURING_CREATION);
POPUP_TEST_GROUP(DestroyParentDuringCreationForce,
DESTROY_PARENT_DURING_CREATION_FORCE);
POPUP_TEST_GROUP(DestroyParentAfterCreation, DESTROY_PARENT_AFTER_CREATION);
POPUP_TEST_GROUP(DestroyParentAfterCreationForce,
DESTROY_PARENT_AFTER_CREATION_FORCE);
namespace {
const char kResolveOrigin[] = "http://www.google.com";

View File

@@ -1616,7 +1616,7 @@ class ResponseFilterTestHandler : public TestHandler {
DCHECK(!got_load_end_);
got_load_end_.yes();
EXPECT_EQ(200, httpStatusCode);
EXPECT_TRUE(httpStatusCode == 0 || httpStatusCode == 200);
GetOutputContent(frame);
}

View File

@@ -222,38 +222,33 @@ void TestHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
browser_count_++;
if (!browser->IsPopup()) {
// Keep non-popup browsers.
const int browser_id = browser->GetIdentifier();
EXPECT_EQ(browser_map_.find(browser_id), browser_map_.end());
if (browser_map_.empty()) {
first_browser_id_ = browser_id;
first_browser_ = browser;
}
browser_map_.insert(std::make_pair(browser_id, browser));
const int browser_id = browser->GetIdentifier();
EXPECT_EQ(browser_map_.find(browser_id), browser_map_.end());
if (browser_map_.empty()) {
first_browser_id_ = browser_id;
first_browser_ = browser;
}
browser_map_.insert(std::make_pair(browser_id, browser));
}
void TestHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
EXPECT_UI_THREAD();
if (!browser->IsPopup()) {
// Free the browser pointer so that the browser can be destroyed.
const int browser_id = browser->GetIdentifier();
BrowserMap::iterator it = browser_map_.find(browser_id);
EXPECT_NE(it, browser_map_.end());
browser_map_.erase(it);
// Free the browser pointer so that the browser can be destroyed.
const int browser_id = browser->GetIdentifier();
BrowserMap::iterator it = browser_map_.find(browser_id);
EXPECT_NE(it, browser_map_.end());
browser_map_.erase(it);
if (browser_id == first_browser_id_) {
first_browser_id_ = 0;
first_browser_ = NULL;
}
if (browser_id == first_browser_id_) {
first_browser_id_ = 0;
first_browser_ = NULL;
}
if (browser_map_.empty() &&
signal_completion_when_all_browsers_close_) {
// Signal that the test is now complete.
TestComplete();
}
if (browser_map_.empty() &&
signal_completion_when_all_browsers_close_) {
// Signal that the test is now complete.
TestComplete();
}
browser_count_--;
@@ -352,7 +347,7 @@ void TestHandler::DestroyTest() {
// iterating.
BrowserMap browser_map = browser_map_;
// Tell all non-popup browsers to close.
// Tell all browsers to close.
BrowserMap::const_iterator it = browser_map.begin();
for (; it != browser_map.end(); ++it)
CloseBrowser(it->second, false);

View File

@@ -140,19 +140,59 @@ class CrashHTTPRequestHandler(BaseHTTPRequestHandler):
self.send_header('Content-type', 'text/html')
self.end_headers()
def _parse_post_data(self):
def _parse_post_data(self, data):
""" Returns a cgi.FieldStorage object for this request or None if this is
not a POST request. """
if self.command != 'POST':
return None
return cgi.FieldStorage(
fp = self.rfile,
fp = cStringIO.StringIO(data),
headers = self.headers,
environ = {
'REQUEST_METHOD': 'POST',
'CONTENT_TYPE': self.headers['Content-Type'],
})
def _get_chunk_size(self):
# Read to the next "\r\n".
size_str = self.rfile.read(2)
while size_str[-2:] != b"\r\n":
size_str += self.rfile.read(1)
# Remove the trailing "\r\n".
size_str = size_str[:-2]
assert len(size_str) <= 4
return int(size_str, 16)
def _get_chunk_data(self, chunk_size):
data = self.rfile.read(chunk_size)
assert len(data) == chunk_size
# Skip the trailing "\r\n".
self.rfile.read(2)
return data
def _unchunk_request(self, compressed):
""" Read a chunked request body. Optionally decompress the result. """
if compressed:
d = zlib.decompressobj(16+zlib.MAX_WBITS)
# Chunked format is: <size>\r\n<bytes>\r\n<size>\r\n<bytes>\r\n0\r\n
unchunked = b""
while True:
chunk_size = self._get_chunk_size()
print 'Chunk size 0x%x' % chunk_size
if (chunk_size == 0):
break
chunk_data = self._get_chunk_data(chunk_size)
if compressed:
unchunked += d.decompress(chunk_data)
else:
unchunked += chunk_data
if compressed:
unchunked += d.flush()
return unchunked
def _create_new_dump_id(self):
""" Breakpad requires a 16 digit hexadecimal dump ID. """
return str(uuid.uuid4().get_hex().upper()[0:16])
@@ -179,13 +219,48 @@ class CrashHTTPRequestHandler(BaseHTTPRequestHandler):
dmp_stream = None
metadata = {}
# Breakpad on Linux sends gzipped request contents.
if 'Content-Encoding' in self.headers and self.headers['Content-Encoding'] == 'gzip':
print_msg('Decompressing gzipped request')
self.rfile = cStringIO.StringIO(zlib.decompress(self.rfile.read(), 16+zlib.MAX_WBITS))
# Request body may be chunked and/or gzip compressed. For example:
#
# 3029 branch on Windows:
# User-Agent: Crashpad/0.8.0
# Host: localhost:8080
# Connection: Keep-Alive
# Transfer-Encoding: chunked
# Content-Type: multipart/form-data; boundary=---MultipartBoundary-vp5j9HdSRYK8DvX2DhtpqEbMNjSN1wnL---
# Content-Encoding: gzip
#
# 2987 branch on Windows:
# User-Agent: Crashpad/0.8.0
# Host: localhost:8080
# Connection: Keep-Alive
# Content-Type: multipart/form-data; boundary=---MultipartBoundary-qFhorGA40vDJ1fgmc2mjorL0fRfKOqup---
# Content-Length: 609894
#
# 2883 branch on Linux:
# User-Agent: Wget/1.15 (linux-gnu)
# Host: localhost:8080
# Accept: */*
# Connection: Keep-Alive
# Content-Type: multipart/form-data; boundary=--------------------------83572861f14cc736
# Content-Length: 32237
# Content-Encoding: gzip
print self.headers
chunked = 'Transfer-Encoding' in self.headers and self.headers['Transfer-Encoding'] == 'chunked'
compressed = 'Content-Encoding' in self.headers and self.headers['Content-Encoding'] == 'gzip'
if chunked:
request_body = self._unchunk_request(compressed)
else:
content_length = int(self.headers['Content-Length']) if 'Content-Length' in self.headers else 0
if content_length > 0:
request_body = self.rfile.read(content_length)
else:
request_body = self.rfile.read()
if compressed:
request_body = zlib.decompress(request_body, 16+zlib.MAX_WBITS)
# Parse the multi-part request.
form_data = self._parse_post_data()
form_data = self._parse_post_data(request_body)
for key in form_data.keys():
if key == minidump_key and form_data[minidump_key].file:
dmp_stream = form_data[minidump_key].file

View File

@@ -550,7 +550,7 @@ def make_ctocpp_unwrap_derived(header, cls, base_scoped):
' }\n'
impl[1] += ' if (type == '+get_wrapper_type_enum(clsname)+') {\n'+\
' return reinterpret_cast<'+get_capi_name(cls.get_name(), True)+'*>('+\
clsname+'CToCpp::UnwrapRaw(CefRawPtr<'+clsname+'>(reinterpret_cast<'+clsname+'*>(c))));\n'+\
clsname+'CToCpp::UnwrapRaw(CefRawPtr<'+clsname+'>(reinterpret_cast<'+clsname+'*>(CEF_RAW_PTR_GET(c)))));\n'+\
' }\n'
else:
impl = ''