diff --git a/BUILD.gn b/BUILD.gn index 78deca587..e571d4add 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -140,9 +140,6 @@ assert(!enable_print_preview) # Enable support for Widevine CDM. assert(enable_widevine) -# Disable support for plugin installation. -assert(!enable_plugin_installation) - if (is_clang) { # Don't use the chrome style plugin. assert(!clang_use_chrome_plugins) @@ -595,6 +592,9 @@ static_library("libcef_static") { # we include Blink headers. "//third_party/WebKit/public/platform", "//third_party/WebKit/public/web", + + # Crashpad code uses paths relative to this directory. + "//third_party/crashpad/crashpad", ] public_deps = [ @@ -753,8 +753,8 @@ static_library("libcef_static") { ] deps += [ + "//build/config/freetype", "//build/linux:fontconfig", - "//build/linux:freetype2", ] } diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 8934b103a..40e779243 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,5 +7,5 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': '939b32ee5ba05c396eef3fd992822fcca9a2e262', + 'chromium_checkout': 'a106f0abbf69dad349d4aaf4bcc4f5d376dd2377', } diff --git a/include/internal/cef_linux.h b/include/internal/cef_linux.h index d9813a5b3..d4586768a 100644 --- a/include/internal/cef_linux.h +++ b/include/internal/cef_linux.h @@ -81,7 +81,6 @@ struct CefWindowInfoTraits { target->height = src->height; target->parent_window = src->parent_window; target->windowless_rendering_enabled = src->windowless_rendering_enabled; - target->transparent_painting_enabled = src->transparent_painting_enabled; target->window = src->window; } }; @@ -114,15 +113,14 @@ class CefWindowInfo : public CefStructBase { // monitor info and to act as the parent window for dialogs, context menus, // etc. If |parent| is not provided then the main screen monitor will be used // and some functionality that requires a parent window may not function - // correctly. If |transparent| is true a transparent background color will be - // used (RGBA=0x00000000). If |transparent| is false the background will be - // white and opaque. In order to create windowless browsers the + // correctly. In order to create windowless browsers the // CefSettings.windowless_rendering_enabled value must be set to true. + // Transparent painting is enabled by default but can be disabled by setting + // CefBrowserSettings.background_color to an opaque value. /// - void SetAsWindowless(CefWindowHandle parent, bool transparent) { + void SetAsWindowless(CefWindowHandle parent) { windowless_rendering_enabled = true; parent_window = parent; - transparent_painting_enabled = transparent; } }; diff --git a/include/internal/cef_mac.h b/include/internal/cef_mac.h index 420f16ada..2448c9efd 100644 --- a/include/internal/cef_mac.h +++ b/include/internal/cef_mac.h @@ -87,7 +87,6 @@ struct CefWindowInfoTraits { target->hidden = src->hidden; target->parent_view = src->parent_view; target->windowless_rendering_enabled = src->windowless_rendering_enabled; - target->transparent_painting_enabled = src->transparent_painting_enabled; target->view = src->view; } }; @@ -121,15 +120,14 @@ class CefWindowInfo : public CefStructBase { // monitor info and to act as the parent view for dialogs, context menus, // etc. If |parent| is not provided then the main screen monitor will be used // and some functionality that requires a parent view may not function - // correctly. If |transparent| is true a transparent background color will be - // used (RGBA=0x00000000). If |transparent| is false the background will be - // white and opaque. In order to create windowless browsers the + // correctly. In order to create windowless browsers the // CefSettings.windowless_rendering_enabled value must be set to true. + // Transparent painting is enabled by default but can be disabled by setting + // CefBrowserSettings.background_color to an opaque value. /// - void SetAsWindowless(CefWindowHandle parent, bool transparent) { + void SetAsWindowless(CefWindowHandle parent) { windowless_rendering_enabled = true; parent_view = parent; - transparent_painting_enabled = transparent; } }; diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index 63b89b9c5..375b7576f 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -401,10 +401,14 @@ typedef struct _cef_settings_t { int enable_net_security_expiration; /// - // Opaque background color used for accelerated content. By default the - // background color will be white. Only the RGB compontents of the specified - // value will be used. The alpha component must greater than 0 to enable use - // of the background color but will be otherwise ignored. + // Background color used for the browser before a document is loaded and when + // no document color is specified. The alpha component must be either fully + // opaque (0xFF) or fully transparent (0x00). If the alpha component is fully + // opaque then the RGB components will be used as the background color. If the + // alpha component is fully transparent for a windowed browser then the + // default value of opaque white be used. If the alpha component is fully + // transparent for a windowless (off-screen) browser then transparent painting + // will be enabled. /// cef_color_t background_color; @@ -652,11 +656,14 @@ typedef struct _cef_browser_settings_t { cef_state_t webgl; /// - // Opaque background color used for the browser before a document is loaded - // and when no document color is specified. By default the background color - // will be the same as CefSettings.background_color. Only the RGB compontents - // of the specified value will be used. The alpha component must greater than - // 0 to enable use of the background color but will be otherwise ignored. + // Background color used for the browser before a document is loaded and when + // no document color is specified. The alpha component must be either fully + // opaque (0xFF) or fully transparent (0x00). If the alpha component is fully + // opaque then the RGB components will be used as the background color. If the + // alpha component is fully transparent for a windowed browser then the + // CefSettings.background_color value will be used. If the alpha component is + // fully transparent for a windowless (off-screen) browser then transparent + // painting will be enabled. /// cef_color_t background_color; diff --git a/include/internal/cef_types_linux.h b/include/internal/cef_types_linux.h index 865a9613a..4a31f087e 100644 --- a/include/internal/cef_types_linux.h +++ b/include/internal/cef_types_linux.h @@ -92,17 +92,11 @@ typedef struct _cef_window_info_t { // monitor will be used and some functionality that requires a parent window // may not function correctly. In order to create windowless browsers the // CefSettings.windowless_rendering_enabled value must be set to true. + // Transparent painting is enabled by default but can be disabled by setting + // CefBrowserSettings.background_color to an opaque value. /// int windowless_rendering_enabled; - /// - // Set to true (1) to enable transparent painting in combination with - // windowless rendering. When this value is true a transparent background - // color will be used (RGBA=0x00000000). When this value is false the - // background will be white and opaque. - /// - int transparent_painting_enabled; - /// // Pointer for the new browser window. Only used with windowed rendering. /// diff --git a/include/internal/cef_types_mac.h b/include/internal/cef_types_mac.h index 8947e258d..459507fe3 100644 --- a/include/internal/cef_types_mac.h +++ b/include/internal/cef_types_mac.h @@ -102,17 +102,11 @@ typedef struct _cef_window_info_t { // monitor will be used and some functionality that requires a parent view // may not function correctly. In order to create windowless browsers the // CefSettings.windowless_rendering_enabled value must be set to true. + // Transparent painting is enabled by default but can be disabled by setting + // CefBrowserSettings.background_color to an opaque value. /// int windowless_rendering_enabled; - /// - // Set to true (1) to enable transparent painting in combination with - // windowless rendering. When this value is true a transparent background - // color will be used (RGBA=0x00000000). When this value is false the - // background will be white and opaque. - /// - int transparent_painting_enabled; - /// // NSView pointer for the new browser view. Only used with windowed rendering. /// diff --git a/include/internal/cef_types_win.h b/include/internal/cef_types_win.h index 0c23a7e7c..58c638bba 100644 --- a/include/internal/cef_types_win.h +++ b/include/internal/cef_types_win.h @@ -82,17 +82,11 @@ typedef struct _cef_window_info_t { // monitor will be used and some functionality that requires a parent window // may not function correctly. In order to create windowless browsers the // CefSettings.windowless_rendering_enabled value must be set to true. + // Transparent painting is enabled by default but can be disabled by setting + // CefBrowserSettings.background_color to an opaque value. /// int windowless_rendering_enabled; - /// - // Set to true (1) to enable transparent painting in combination with - // windowless rendering. When this value is true a transparent background - // color will be used (RGBA=0x00000000). When this value is false the - // background will be white and opaque. - /// - int transparent_painting_enabled; - /// // Handle for the new browser window. Only used with windowed rendering. /// diff --git a/include/internal/cef_win.h b/include/internal/cef_win.h index 9c20c4818..f4028778b 100644 --- a/include/internal/cef_win.h +++ b/include/internal/cef_win.h @@ -88,7 +88,6 @@ struct CefWindowInfoTraits { target->height = src->height; target->parent_window = src->parent_window; target->menu = src->menu; - target->transparent_painting_enabled = src->transparent_painting_enabled; target->windowless_rendering_enabled = src->windowless_rendering_enabled; target->window = src->window; } @@ -140,15 +139,14 @@ class CefWindowInfo : public CefStructBase { // monitor info and to act as the parent window for dialogs, context menus, // etc. If |parent| is not provided then the main screen monitor will be used // and some functionality that requires a parent window may not function - // correctly. If |transparent| is true a transparent background color will be - // used (RGBA=0x00000000). If |transparent| is false the background will be - // white and opaque. In order to create windowless browsers the + // correctly. In order to create windowless browsers the // CefSettings.windowless_rendering_enabled value must be set to true. + // Transparent painting is enabled by default but can be disabled by setting + // CefBrowserSettings.background_color to an opaque value. /// - void SetAsWindowless(CefWindowHandle parent, bool transparent) { + void SetAsWindowless(CefWindowHandle parent) { windowless_rendering_enabled = TRUE; parent_window = parent; - transparent_painting_enabled = transparent; } }; diff --git a/libcef/browser/browser_context.cc b/libcef/browser/browser_context.cc index ba84693f2..30ab6e824 100644 --- a/libcef/browser/browser_context.cc +++ b/libcef/browser/browser_context.cc @@ -28,6 +28,15 @@ CefBrowserContext::~CefBrowserContext() { void CefBrowserContext::Initialize() { content::BrowserContext::Initialize(this, GetPath()); + resource_context_.reset( + new CefResourceContext(IsOffTheRecord(), GetHandler())); + + // This must be called before creating any services to avoid hitting + // DependencyManager::AssertContextWasntDestroyed when creating/destroying + // multiple browser contexts (due to pointer address reuse). + BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( + this); + const bool extensions_enabled = extensions::ExtensionsEnabled(); if (extensions_enabled) { // Create the custom ExtensionSystem first because other KeyedServices @@ -41,22 +50,18 @@ void CefBrowserContext::Initialize() { } else { extension_system_->InitForRegularProfile(true); } + resource_context_->set_extensions_info_map(extension_system_->info_map()); } +} - resource_context_.reset(new CefResourceContext( - IsOffTheRecord(), - extensions_enabled ? extension_system_->info_map() : NULL, - GetHandler())); - - BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( - this); - +void CefBrowserContext::PostInitialize() { // Spell checking support and possibly other subsystems retrieve the // PrefService associated with a BrowserContext via UserPrefs::Get(). PrefService* pref_service = GetPrefs(); DCHECK(pref_service); user_prefs::UserPrefs::Set(this, pref_service); + const bool extensions_enabled = extensions::ExtensionsEnabled(); if (extensions_enabled && !is_proxy_) extension_system_->Init(); } diff --git a/libcef/browser/browser_context.h b/libcef/browser/browser_context.h index 9b2308321..87d3ca3bb 100644 --- a/libcef/browser/browser_context.h +++ b/libcef/browser/browser_context.h @@ -187,6 +187,9 @@ class CefBrowserContext : public ChromeProfileStub { protected: ~CefBrowserContext() override; + // Must be called after all services have been initialized. + void PostInitialize(); + // Must be called before the child object destructor has completed. void Shutdown(); diff --git a/libcef/browser/browser_context_impl.cc b/libcef/browser/browser_context_impl.cc index 1d9b05bc8..04095b6c2 100644 --- a/libcef/browser/browser_context_impl.cc +++ b/libcef/browser/browser_context_impl.cc @@ -85,6 +85,8 @@ class ImplManager { CefBrowserContextImpl* GetImplForContext( const content::BrowserContext* context) { CEF_REQUIRE_UIT(); + if (!context) + return NULL; const CefBrowserContext* cef_context = static_cast(context); @@ -141,7 +143,14 @@ class ImplManager { DISALLOW_COPY_AND_ASSIGN(ImplManager); }; -base::LazyInstance g_manager = LAZY_INSTANCE_INITIALIZER; +#if DCHECK_IS_ON() +// Because of DCHECK()s in the object destructor. +base::LazyInstance::DestructorAtExit g_manager = + LAZY_INSTANCE_INITIALIZER; +#else +base::LazyInstance::Leaky g_manager = + LAZY_INSTANCE_INITIALIZER; +#endif } // namespace @@ -259,9 +268,16 @@ void CefBrowserContextImpl::Initialize() { CefString(&CefContext::Get()->settings().accept_language_list); } - // Initialize preferences. + // Initialize a temporary PrefService object that may be referenced during + // BrowserContextServices initialization. pref_service_ = browser_prefs::CreatePrefService( - this, cache_path_, !!settings_.persist_user_preferences); + this, base::FilePath(), false, true); + + CefBrowserContext::Initialize(); + + // Initialize the real PrefService object. + pref_service_ = browser_prefs::CreatePrefService( + this, cache_path_, !!settings_.persist_user_preferences, false); // Initialize visited links management. base::FilePath visited_link_path; @@ -275,13 +291,13 @@ void CefBrowserContextImpl::Initialize() { visitedlink_listener_->CreateListenerForContext(this); visitedlink_master_->Init(); - CefBrowserContext::Initialize(); - // Initialize proxy configuration tracker. pref_proxy_config_tracker_.reset( ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( GetPrefs())); + CefBrowserContext::PostInitialize(); + // Create the CefURLRequestContextGetterImpl via an indirect call to // CreateRequestContext. Triggers a call to CefURLRequestContextGetterImpl:: // GetURLRequestContext() on the IO thread which creates the diff --git a/libcef/browser/browser_context_proxy.cc b/libcef/browser/browser_context_proxy.cc index 589d69ef4..bc085144c 100644 --- a/libcef/browser/browser_context_proxy.cc +++ b/libcef/browser/browser_context_proxy.cc @@ -82,6 +82,8 @@ void CefBrowserContextProxy::Initialize() { // This object's CefResourceContext needs to proxy some UserData requests to // the parent object's CefResourceContext. resource_context()->set_parent(parent_->resource_context()); + + CefBrowserContext::PostInitialize(); } base::SupportsUserData::Data* @@ -182,6 +184,11 @@ net::URLRequestContextGetter* return nullptr; } +void CefBrowserContextProxy::RegisterInProcessServices( + StaticServiceMap* services) { + parent_->RegisterInProcessServices(services); +} + PrefService* CefBrowserContextProxy::GetPrefs() { return parent_->GetPrefs(); } diff --git a/libcef/browser/browser_context_proxy.h b/libcef/browser/browser_context_proxy.h index 11b76a26e..05d9f1519 100644 --- a/libcef/browser/browser_context_proxy.h +++ b/libcef/browser/browser_context_proxy.h @@ -54,6 +54,7 @@ class CefBrowserContextProxy : public CefBrowserContext { content::ProtocolHandlerMap* protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors) override; + void RegisterInProcessServices(StaticServiceMap* services) override; // Profile methods. PrefService* GetPrefs() override; diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 64d43b599..bbae0f3ec 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -50,6 +50,7 @@ #include "content/public/browser/download_manager.h" #include "content/public/browser/download_url_parameters.h" #include "content/public/browser/host_zoom_map.h" +#include "content/public/browser/keyboard_event_processing_result.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" @@ -70,6 +71,8 @@ #include "components/spellcheck/browser/spellcheck_platform.h" #endif +using content::KeyboardEventProcessingResult; + namespace { // Associates a CefBrowserHostImpl instance with a WebContents. This object will @@ -782,8 +785,8 @@ void CefBrowserHostImpl::Find(int identifier, const CefString& searchText, blink::WebFindOptions options; options.forward = forward; - options.matchCase = matchCase; - options.findNext = findNext; + options.match_case = matchCase; + options.find_next = findNext; web_contents()->Find(identifier, searchText, options); } else { CEF_POST_TASK(CEF_UIT, @@ -1038,8 +1041,8 @@ void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) { return; content::NativeWebKeyboardEvent web_event( - blink::WebInputEvent::Undefined, - blink::WebInputEvent::NoModifiers, + blink::WebInputEvent::kUndefined, + blink::WebInputEvent::kNoModifiers, ui::EventTimeStampToSeconds(ui::EventTimeForNow())); platform_delegate_->TranslateKeyEvent(web_event, event); platform_delegate_->SendKeyEvent(web_event); @@ -1724,6 +1727,12 @@ void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) { } } +SkColor CefBrowserHostImpl::GetBackgroundColor() const { + // Don't use |platform_delegate_| because it's not thread-safe. + return CefContext::Get()->GetBackgroundColor(&settings_, + is_windowless_ ? STATE_ENABLED : STATE_DISABLED); +} + int CefBrowserHostImpl::browser_id() const { return browser_info_->browser_id(); } @@ -1785,8 +1794,8 @@ bool CefBrowserHostImpl::IsFullscreenForTabOrPending( blink::WebDisplayMode CefBrowserHostImpl::GetDisplayMode( const content::WebContents* web_contents) const { - return is_fullscreen_ ? blink::WebDisplayModeFullscreen : - blink::WebDisplayModeBrowser; + return is_fullscreen_ ? blink::kWebDisplayModeFullscreen : + blink::kWebDisplayModeBrowser; } void CefBrowserHostImpl::FindReply( @@ -2170,29 +2179,29 @@ content::WebContents* CefBrowserHostImpl::GetActionableWebContents() { return web_contents(); } -bool CefBrowserHostImpl::PreHandleKeyboardEvent( +KeyboardEventProcessingResult CefBrowserHostImpl::PreHandleKeyboardEvent( content::WebContents* source, - const content::NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) { - if (!platform_delegate_) - return false; - - if (client_.get()) { + const content::NativeWebKeyboardEvent& event) { + if (platform_delegate_ && client_.get()) { CefRefPtr handler = client_->GetKeyboardHandler(); if (handler.get()) { CefKeyEvent cef_event; - if (!browser_util::GetCefKeyEvent(event, cef_event)) - return false; - - cef_event.focus_on_editable_field = focus_on_editable_field_; + if (browser_util::GetCefKeyEvent(event, cef_event)) { + cef_event.focus_on_editable_field = focus_on_editable_field_; - CefEventHandle event_handle = platform_delegate_->GetEventHandle(event); - return handler->OnPreKeyEvent(this, cef_event, event_handle, - is_keyboard_shortcut); + CefEventHandle event_handle = platform_delegate_->GetEventHandle(event); + bool is_keyboard_shortcut = false; + bool result = handler->OnPreKeyEvent(this, cef_event, event_handle, + &is_keyboard_shortcut); + if (result) + return KeyboardEventProcessingResult::HANDLED; + else if (is_keyboard_shortcut) + return KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT; + } } } - return false; + return KeyboardEventProcessingResult::NOT_HANDLED; } void CefBrowserHostImpl::HandleKeyboardEvent( @@ -2527,7 +2536,7 @@ void CefBrowserHostImpl::DidFinishNavigation( // Don't call OnLoadStart for same page navigations (fragments, // history state). - if (!navigation_handle->IsSamePage()) + if (!navigation_handle->IsSameDocument()) OnLoadStart(frame, navigation_handle->GetPageTransition()); if (is_main_frame) diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index a0db20505..6f4328eb0 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -339,6 +339,7 @@ class CefBrowserHostImpl : public CefBrowserHost, // Thread safe accessors. const CefBrowserSettings& settings() const { return settings_; } + SkColor GetBackgroundColor() const; CefRefPtr client() const { return client_; } scoped_refptr browser_info() const { return browser_info_; } int browser_id() const; @@ -391,10 +392,9 @@ class CefBrowserHostImpl : public CefBrowserHost, bool reverse) override; bool HandleContextMenu( const content::ContextMenuParams& params) override; - bool PreHandleKeyboardEvent( + content::KeyboardEventProcessingResult PreHandleKeyboardEvent( content::WebContents* source, - const content::NativeWebKeyboardEvent& event, - bool* is_keyboard_shortcut) override; + const content::NativeWebKeyboardEvent& event) override; void HandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event) override; diff --git a/libcef/browser/browser_platform_delegate.cc b/libcef/browser/browser_platform_delegate.cc index 1890243ca..43ca183a1 100644 --- a/libcef/browser/browser_platform_delegate.cc +++ b/libcef/browser/browser_platform_delegate.cc @@ -207,28 +207,28 @@ int CefBrowserPlatformDelegate::TranslateModifiers(uint32 cef_modifiers) { int webkit_modifiers = 0; // Set modifiers based on key state. if (cef_modifiers & EVENTFLAG_SHIFT_DOWN) - webkit_modifiers |= blink::WebInputEvent::ShiftKey; + webkit_modifiers |= blink::WebInputEvent::kShiftKey; if (cef_modifiers & EVENTFLAG_CONTROL_DOWN) - webkit_modifiers |= blink::WebInputEvent::ControlKey; + webkit_modifiers |= blink::WebInputEvent::kControlKey; if (cef_modifiers & EVENTFLAG_ALT_DOWN) - webkit_modifiers |= blink::WebInputEvent::AltKey; + webkit_modifiers |= blink::WebInputEvent::kAltKey; if (cef_modifiers & EVENTFLAG_COMMAND_DOWN) - webkit_modifiers |= blink::WebInputEvent::MetaKey; + webkit_modifiers |= blink::WebInputEvent::kMetaKey; if (cef_modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) - webkit_modifiers |= blink::WebInputEvent::LeftButtonDown; + webkit_modifiers |= blink::WebInputEvent::kLeftButtonDown; if (cef_modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) - webkit_modifiers |= blink::WebInputEvent::MiddleButtonDown; + webkit_modifiers |= blink::WebInputEvent::kMiddleButtonDown; if (cef_modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON) - webkit_modifiers |= blink::WebInputEvent::RightButtonDown; + webkit_modifiers |= blink::WebInputEvent::kRightButtonDown; if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON) - webkit_modifiers |= blink::WebInputEvent::CapsLockOn; + webkit_modifiers |= blink::WebInputEvent::kCapsLockOn; if (cef_modifiers & EVENTFLAG_NUM_LOCK_ON) - webkit_modifiers |= blink::WebInputEvent::NumLockOn; + webkit_modifiers |= blink::WebInputEvent::kNumLockOn; if (cef_modifiers & EVENTFLAG_IS_LEFT) - webkit_modifiers |= blink::WebInputEvent::IsLeft; + webkit_modifiers |= blink::WebInputEvent::kIsLeft; if (cef_modifiers & EVENTFLAG_IS_RIGHT) - webkit_modifiers |= blink::WebInputEvent::IsRight; + webkit_modifiers |= blink::WebInputEvent::kIsRight; if (cef_modifiers & EVENTFLAG_IS_KEY_PAD) - webkit_modifiers |= blink::WebInputEvent::IsKeyPad; + webkit_modifiers |= blink::WebInputEvent::kIsKeyPad; return webkit_modifiers; } diff --git a/libcef/browser/browser_platform_delegate.h b/libcef/browser/browser_platform_delegate.h index 29b3719ca..4b4cb79ba 100644 --- a/libcef/browser/browser_platform_delegate.h +++ b/libcef/browser/browser_platform_delegate.h @@ -134,6 +134,13 @@ class CefBrowserPlatformDelegate { CefBrowserHostImpl* new_browser, bool is_devtools); + // Returns the background color for the browser. The alpha component will be + // either SK_AlphaTRANSPARENT or SK_AlphaOPAQUE (e.g. fully transparent or + // fully opaque). SK_AlphaOPAQUE will always be returned for windowed + // browsers. SK_ColorTRANSPARENT may be returned for windowless browsers to + // enable transparency. + virtual SkColor GetBackgroundColor() const = 0; + // Notify the window that it was resized. virtual void WasResized() = 0; diff --git a/libcef/browser/browser_platform_delegate_create.cc b/libcef/browser/browser_platform_delegate_create.cc index 68ce205f8..c7fb11e07 100644 --- a/libcef/browser/browser_platform_delegate_create.cc +++ b/libcef/browser/browser_platform_delegate_create.cc @@ -6,6 +6,8 @@ #include +#include "libcef/browser/context.h" + #include "base/memory/ptr_util.h" #include "build/build_config.h" @@ -29,28 +31,31 @@ namespace { std::unique_ptr CreateNativeDelegate( - const CefWindowInfo& window_info) { + const CefWindowInfo& window_info, + SkColor background_color) { #if defined(OS_WIN) - return base::WrapUnique(new CefBrowserPlatformDelegateNativeWin(window_info)); + return base::MakeUnique( + window_info, background_color); #elif defined(OS_MACOSX) - return base::WrapUnique(new CefBrowserPlatformDelegateNativeMac(window_info)); + return base::MakeUnique( + window_info, background_color); #elif defined(OS_LINUX) - return base::WrapUnique( - new CefBrowserPlatformDelegateNativeLinux(window_info)); + return base::MakeUnique( + window_info, background_color); #endif } std::unique_ptr CreateOSRDelegate( std::unique_ptr native_delegate) { #if defined(OS_WIN) - return base::WrapUnique( - new CefBrowserPlatformDelegateOsrWin(std::move(native_delegate))); + return base::MakeUnique( + std::move(native_delegate)); #elif defined(OS_MACOSX) - return base::WrapUnique( - new CefBrowserPlatformDelegateOsrMac(std::move(native_delegate))); + return base::MakeUnique( + std::move(native_delegate)); #elif defined(OS_LINUX) - return base::WrapUnique( - new CefBrowserPlatformDelegateOsrLinux(std::move(native_delegate))); + return base::MakeUnique( + std::move(native_delegate)); #endif } @@ -59,24 +64,30 @@ std::unique_ptr CreateOSRDelegate( // static std::unique_ptr CefBrowserPlatformDelegate::Create( CefBrowserHostImpl::CreateParams& create_params) { + const bool is_windowless = + create_params.window_info && + create_params.window_info->windowless_rendering_enabled && + create_params.client && + create_params.client->GetRenderHandler().get(); + const SkColor background_color = CefContext::Get()->GetBackgroundColor( + &create_params.settings, is_windowless ? STATE_ENABLED : STATE_DISABLED); + if (create_params.window_info) { std::unique_ptr native_delegate = - CreateNativeDelegate(*create_params.window_info.get()); - if (create_params.window_info->windowless_rendering_enabled && - create_params.client && - create_params.client->GetRenderHandler().get()) { + CreateNativeDelegate(*create_params.window_info.get(), + background_color); + if (is_windowless) return CreateOSRDelegate(std::move(native_delegate)); - } return std::move(native_delegate); } #if defined(USE_AURA) else { // CefWindowInfo is not used in this case. std::unique_ptr native_delegate = - CreateNativeDelegate(CefWindowInfo()); - return base::WrapUnique(new CefBrowserPlatformDelegateViews( + CreateNativeDelegate(CefWindowInfo(), background_color); + return base::MakeUnique( std::move(native_delegate), - static_cast(create_params.browser_view.get()))); + static_cast(create_params.browser_view.get())); } #endif // defined(USE_AURA) diff --git a/libcef/browser/browser_util.cc b/libcef/browser/browser_util.cc index 92c02f908..0575fea66 100644 --- a/libcef/browser/browser_util.cc +++ b/libcef/browser/browser_util.cc @@ -10,17 +10,17 @@ namespace browser_util { bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event, CefKeyEvent& cef_event) { - switch (event.type()) { - case blink::WebKeyboardEvent::RawKeyDown: + switch (event.GetType()) { + case blink::WebKeyboardEvent::kRawKeyDown: cef_event.type = KEYEVENT_RAWKEYDOWN; break; - case blink::WebKeyboardEvent::KeyDown: + case blink::WebKeyboardEvent::kKeyDown: cef_event.type = KEYEVENT_KEYDOWN; break; - case blink::WebKeyboardEvent::KeyUp: + case blink::WebKeyboardEvent::kKeyUp: cef_event.type = KEYEVENT_KEYUP; break; - case blink::WebKeyboardEvent::Char: + case blink::WebKeyboardEvent::kChar: cef_event.type = KEYEVENT_CHAR; break; default: @@ -28,22 +28,22 @@ bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event, } cef_event.modifiers = 0; - if (event.modifiers() & blink::WebKeyboardEvent::ShiftKey) + if (event.GetModifiers() & blink::WebKeyboardEvent::kShiftKey) cef_event.modifiers |= EVENTFLAG_SHIFT_DOWN; - if (event.modifiers() & blink::WebKeyboardEvent::ControlKey) + if (event.GetModifiers() & blink::WebKeyboardEvent::kControlKey) cef_event.modifiers |= EVENTFLAG_CONTROL_DOWN; - if (event.modifiers() & blink::WebKeyboardEvent::AltKey) + if (event.GetModifiers() & blink::WebKeyboardEvent::kAltKey) cef_event.modifiers |= EVENTFLAG_ALT_DOWN; - if (event.modifiers() & blink::WebKeyboardEvent::MetaKey) + if (event.GetModifiers() & blink::WebKeyboardEvent::kMetaKey) cef_event.modifiers |= EVENTFLAG_COMMAND_DOWN; - if (event.modifiers() & blink::WebKeyboardEvent::IsKeyPad) + if (event.GetModifiers() & blink::WebKeyboardEvent::kIsKeyPad) cef_event.modifiers |= EVENTFLAG_IS_KEY_PAD; - cef_event.windows_key_code = event.windowsKeyCode; - cef_event.native_key_code = event.nativeKeyCode; - cef_event.is_system_key = event.isSystemKey; + cef_event.windows_key_code = event.windows_key_code; + cef_event.native_key_code = event.native_key_code; + cef_event.is_system_key = event.is_system_key; cef_event.character = event.text[0]; - cef_event.unmodified_character = event.unmodifiedText[0]; + cef_event.unmodified_character = event.unmodified_text[0]; return true; } diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index c17112828..00a440837 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -277,8 +277,8 @@ safe_browsing::ClientSideDetectionService* return NULL; } -subresource_filter::RulesetService* - ChromeBrowserProcessStub::subresource_filter_ruleset_service() { +subresource_filter::ContentRulesetService* + ChromeBrowserProcessStub::subresource_filter_ruleset_service() { NOTREACHED(); return NULL; } diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index 0a3f75c94..bc767d8e8 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -84,7 +84,7 @@ class ChromeBrowserProcessStub : public BrowserProcess, safe_browsing::SafeBrowsingService* safe_browsing_service() override; safe_browsing::ClientSideDetectionService* safe_browsing_detection_service() override; - subresource_filter::RulesetService* + subresource_filter::ContentRulesetService* subresource_filter_ruleset_service() override; #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) diff --git a/libcef/browser/context.cc b/libcef/browser/context.cc index 72b74a436..fd813dbed 100644 --- a/libcef/browser/context.cc +++ b/libcef/browser/context.cc @@ -22,12 +22,12 @@ #include "base/debug/debugger.h" #include "base/files/file_util.h" #include "base/synchronization/waitable_event.h" -#include "content/public/app/content_main.h" -#include "content/public/app/content_main_runner.h" +#include "content/app/content_service_manager_main_delegate.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_switches.h" +#include "services/service_manager/embedder/main.h" #include "ui/base/ui_base_switches.h" #if defined(OS_WIN) @@ -116,11 +116,28 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) { argv_as_utf8[argv.size()] = nullptr; argv.clear(); return crashpad::HandlerMain(static_cast(storage.size()), - argv_as_utf8.get()); + argv_as_utf8.get(), nullptr); } #endif // defined(OS_MACOSX) || defined(OS_WIN) +bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) { + // Windowed browser colors must be fully opaque. + if (!is_windowless && CefColorGetA(cef_in) != SK_AlphaOPAQUE) + return false; + + // Windowless browser colors may be fully transparent. + if (is_windowless && CefColorGetA(cef_in) == SK_AlphaTRANSPARENT) { + *sk_out = SK_ColorTRANSPARENT; + return true; + } + + // Ignore the alpha component. + *sk_out = SkColorSetRGB(CefColorGetR(cef_in), CefColorGetG(cef_in), + CefColorGetB(cef_in)); + return true; +} + } // namespace int CefExecuteProcess(const CefMainArgs& args, @@ -326,12 +343,12 @@ bool CefContext::Initialize(const CefMainArgs& args, #endif main_delegate_.reset(new CefMainDelegate(application)); - main_runner_.reset(content::ContentMainRunner::Create()); browser_info_manager_.reset(new CefBrowserInfoManager); int exit_code; // Initialize the content runner. + content::ContentMainParams params(main_delegate_.get()); #if defined(OS_WIN) sandbox::SandboxInterfaceInfo sandbox_info = {0}; if (windows_sandbox_info == NULL) { @@ -340,20 +357,20 @@ bool CefContext::Initialize(const CefMainArgs& args, settings_.no_sandbox = true; } - content::ContentMainParams params(main_delegate_.get()); params.instance = args.instance; params.sandbox_info = static_cast(windows_sandbox_info); - - exit_code = main_runner_->Initialize(params); #else - content::ContentMainParams params(main_delegate_.get()); params.argc = args.argc; params.argv = const_cast(args.argv); - - exit_code = main_runner_->Initialize(params); #endif + sm_main_delegate_.reset( + new content::ContentServiceManagerMainDelegate(params)); + sm_main_params_.reset( + new service_manager::MainParams(sm_main_delegate_.get())); + + exit_code = service_manager::MainInitialize(*sm_main_params_); DCHECK_LT(exit_code, 0); if (exit_code >= 0) return false; @@ -363,7 +380,7 @@ bool CefContext::Initialize(const CefMainArgs& args, // Run the process. Results in a call to CefMainDelegate::RunProcess() which // will create the browser runner and message loop without blocking. - exit_code = main_runner_->Run(); + exit_code = service_manager::MainRun(*sm_main_params_); initialized_ = true; @@ -413,6 +430,23 @@ bool CefContext::OnInitThread() { return (base::PlatformThread::CurrentId() == init_thread_id_); } +SkColor CefContext::GetBackgroundColor( + const CefBrowserSettings* browser_settings, + cef_state_t windowless_state) const { + bool is_windowless = windowless_state == STATE_ENABLED ? true : + (windowless_state == STATE_DISABLED ? false : + !!settings_.windowless_rendering_enabled); + + // Default to opaque white if no acceptable color values are found. + SkColor sk_color = SK_ColorWHITE; + + if (!browser_settings || + !GetColor(browser_settings->background_color, is_windowless, &sk_color)) { + GetColor(settings_.background_color, is_windowless, &sk_color); + } + return sk_color; +} + CefTraceSubscriber* CefContext::GetTraceSubscriber() { CEF_REQUIRE_UIT(); if (shutting_down_) @@ -488,9 +522,10 @@ void CefContext::FinalizeShutdown() { main_delegate_->ShutdownBrowser(); // Shut down the content runner. - main_runner_->Shutdown(); + service_manager::MainShutdown(*sm_main_params_); browser_info_manager_.reset(NULL); - main_runner_.reset(NULL); + sm_main_params_.reset(NULL); + sm_main_delegate_.reset(NULL); main_delegate_.reset(NULL); } diff --git a/libcef/browser/context.h b/libcef/browser/context.h index 4ee767bac..c49b738c9 100644 --- a/libcef/browser/context.h +++ b/libcef/browser/context.h @@ -13,13 +13,18 @@ #include "include/cef_app.h" #include "base/threading/platform_thread.h" +#include "third_party/skia/include/core/SkColor.h" namespace base { class WaitableEvent; } namespace content { -class ContentMainRunner; +class ContentServiceManagerMainDelegate; +} + +namespace service_manager { +struct MainParams; } class CefBrowserHostImpl; @@ -55,6 +60,17 @@ class CefContext { const CefSettings& settings() const { return settings_; } + // Returns the background color for the browser. If |browser_settings| is + // nullptr or does not specify a color then the global settings will be used. + // The alpha component will be either SK_AlphaTRANSPARENT or SK_AlphaOPAQUE + // (e.g. fully transparent or fully opaque). If |is_windowless| is + // STATE_DISABLED then SK_AlphaTRANSPARENT will always be returned. If + // |is_windowless| is STATE_ENABLED then SK_ColorTRANSPARENT may be returned + // to enable transparency for windowless browsers. See additional comments on + // CefSettings.background_color and CefBrowserSettings.background_color. + SkColor GetBackgroundColor(const CefBrowserSettings* browser_settings, + cef_state_t windowless_state) const; + CefTraceSubscriber* GetTraceSubscriber(); // Populate the request context settings based on CefSettings and command- @@ -81,7 +97,8 @@ class CefContext { CefSettings settings_; std::unique_ptr main_delegate_; - std::unique_ptr main_runner_; + std::unique_ptr sm_main_delegate_; + std::unique_ptr sm_main_params_; std::unique_ptr trace_subscriber_; std::unique_ptr browser_info_manager_; }; diff --git a/libcef/browser/context_menu_params_impl.cc b/libcef/browser/context_menu_params_impl.cc index 1ab4c1858..f1ad329c0 100644 --- a/libcef/browser/context_menu_params_impl.cc +++ b/libcef/browser/context_menu_params_impl.cc @@ -35,7 +35,7 @@ CefContextMenuParamsImpl::TypeFlags CefContextMenuParamsImpl::GetTypeFlags() { type_flags |= CM_TYPEFLAG_FRAME; if (!params.link_url.is_empty()) type_flags |= CM_TYPEFLAG_LINK; - if (params.media_type != blink::WebContextMenuData::MediaTypeNone) + if (params.media_type != blink::WebContextMenuData::kMediaTypeNone) type_flags |= CM_TYPEFLAG_MEDIA; if (!params.selection_text.empty()) type_flags |= CM_TYPEFLAG_SELECTION; diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index 7fc49b501..3cecf13fb 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -82,7 +82,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer, return num_bytes; base::Value* id = new base::Value(stream_id_); - base::StringValue* chunkValue = new base::StringValue(chunk); + base::Value* chunkValue = new base::Value(chunk); content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, @@ -116,9 +116,10 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show( const CefBrowserSettings& settings, const CefPoint& inspect_element_at) { CefBrowserSettings new_settings = settings; - if (CefColorGetA(new_settings.background_color) == 0) { - // Use white as the default background color for DevTools instead of the - // CefSettings.background_color value. + if (!windowInfo.windowless_rendering_enabled && + CefColorGetA(new_settings.background_color) != SK_AlphaOPAQUE) { + // Use white as the default background color for windowed DevTools instead + // of the CefSettings.background_color value. new_settings.background_color = SK_ColorWHITE; } diff --git a/libcef/browser/download_manager_delegate.cc b/libcef/browser/download_manager_delegate.cc index f04c85df1..3031c9348 100644 --- a/libcef/browser/download_manager_delegate.cc +++ b/libcef/browser/download_manager_delegate.cc @@ -150,7 +150,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { callback.Run(suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, - suggested_path); + suggested_path, + content::DOWNLOAD_INTERRUPT_REASON_NONE); } } @@ -168,7 +169,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { callback.Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, - path); + path, content::DOWNLOAD_INTERRUPT_REASON_NONE); } base::WeakPtr manager_; @@ -360,7 +361,8 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget( callback.Run(item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, - item->GetForcedFilePath()); + item->GetForcedFilePath(), + content::DOWNLOAD_INTERRUPT_REASON_NONE); return true; } diff --git a/libcef/browser/extensions/extension_system.cc b/libcef/browser/extensions/extension_system.cc index cd4f7a677..b0240ec9d 100644 --- a/libcef/browser/extensions/extension_system.cc +++ b/libcef/browser/extensions/extension_system.cc @@ -34,6 +34,7 @@ #include "extensions/browser/notification_types.h" #include "extensions/browser/null_app_sorting.h" #include "extensions/browser/quota_service.h" +#include "extensions/browser/renderer_startup_helper.h" #include "extensions/browser/runtime_data.h" #include "extensions/browser/service_worker_manager.h" #include "extensions/browser/value_store/value_store_factory.h" @@ -82,6 +83,9 @@ CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context) : browser_context_(browser_context), initialized_(false), registry_(ExtensionRegistry::Get(browser_context)), + renderer_helper_( + extensions::RendererStartupHelperFactory::GetForBrowserContext( + browser_context)), weak_ptr_factory_(this) { } @@ -391,24 +395,8 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) { weak_ptr_factory_.GetWeakPtr(), make_scoped_refptr(extension))); - // Tell renderers about the new extension, unless it's a theme (renderers - // don't need to know about themes). - if (!extension->is_theme()) { - for (content::RenderProcessHost::iterator i( - content::RenderProcessHost::AllHostsIterator()); - !i.IsAtEnd(); i.Advance()) { - content::RenderProcessHost* host = i.GetCurrentValue(); - if (host->GetBrowserContext() == browser_context_) { - // We don't need to include tab permisisons here, since the extension - // was just loaded. - std::vector loaded_extensions( - 1, ExtensionMsg_Loaded_Params(extension, - false /* no tab permissions */)); - host->Send( - new ExtensionMsg_Loaded(loaded_extensions)); - } - } - } + // Tell renderers about the loaded extension. + renderer_helper_->OnExtensionLoaded(*extension); // Tell subsystems that use the EXTENSION_LOADED notification about the new // extension. @@ -485,13 +473,8 @@ void CefExtensionSystem::NotifyExtensionUnloaded( content::Source(browser_context_), content::Details(&details)); - for (content::RenderProcessHost::iterator i( - content::RenderProcessHost::AllHostsIterator()); - !i.IsAtEnd(); i.Advance()) { - content::RenderProcessHost* host = i.GetCurrentValue(); - if (host->GetBrowserContext() == browser_context_) - host->Send(new ExtensionMsg_Unloaded(extension->id())); - } + // Tell renderers about the unloaded extension. + renderer_helper_->OnExtensionUnloaded(*extension); UnregisterExtensionWithRequestContexts(extension->id(), reason); } diff --git a/libcef/browser/extensions/extension_system.h b/libcef/browser/extensions/extension_system.h index 156e812f2..949faca98 100644 --- a/libcef/browser/extensions/extension_system.h +++ b/libcef/browser/extensions/extension_system.h @@ -138,6 +138,10 @@ class CefExtensionSystem : public ExtensionSystem { // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. ExtensionRegistry* registry_; + // The associated RendererStartupHelper. Guaranteed to outlive the + // ExtensionSystem, and thus us. + extensions::RendererStartupHelper* renderer_helper_; + // Must be the last member. base::WeakPtrFactory weak_ptr_factory_; diff --git a/libcef/browser/extensions/mime_handler_view_guest_delegate.cc b/libcef/browser/extensions/mime_handler_view_guest_delegate.cc index 0a5cde31e..da3a1c829 100644 --- a/libcef/browser/extensions/mime_handler_view_guest_delegate.cc +++ b/libcef/browser/extensions/mime_handler_view_guest_delegate.cc @@ -44,7 +44,8 @@ void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams( CefRefPtr owner_browser = GetOwnerBrowser(guest_); if (owner_browser->IsWindowless()) { - CefWebContentsViewOSR* view_osr = new CefWebContentsViewOSR(false); + CefWebContentsViewOSR* view_osr = + new CefWebContentsViewOSR(owner_browser->GetBackgroundColor()); params->view = view_osr; params->delegate_view = view_osr; } diff --git a/libcef/browser/native/browser_platform_delegate_native.cc b/libcef/browser/native/browser_platform_delegate_native.cc index b90903a95..887e0203a 100644 --- a/libcef/browser/native/browser_platform_delegate_native.cc +++ b/libcef/browser/native/browser_platform_delegate_native.cc @@ -10,11 +10,17 @@ #include "content/public/browser/render_widget_host.h" CefBrowserPlatformDelegateNative::CefBrowserPlatformDelegateNative( - const CefWindowInfo& window_info) + const CefWindowInfo& window_info, + SkColor background_color) : window_info_(window_info), + background_color_(background_color), windowless_handler_(nullptr) { } +SkColor CefBrowserPlatformDelegateNative::GetBackgroundColor() const { + return background_color_; +} + void CefBrowserPlatformDelegateNative::WasResized() { content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost(); if (host) diff --git a/libcef/browser/native/browser_platform_delegate_native.h b/libcef/browser/native/browser_platform_delegate_native.h index 8c776c8c3..bd74b3d8a 100644 --- a/libcef/browser/native/browser_platform_delegate_native.h +++ b/libcef/browser/native/browser_platform_delegate_native.h @@ -25,6 +25,7 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate { }; // CefBrowserPlatformDelegate methods: + SkColor GetBackgroundColor() const override; void WasResized() override; void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override; void SendMouseEvent(const blink::WebMouseEvent& event) override; @@ -39,9 +40,11 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate { } protected: - explicit CefBrowserPlatformDelegateNative(const CefWindowInfo& window_info); + CefBrowserPlatformDelegateNative(const CefWindowInfo& window_info, + SkColor background_color); CefWindowInfo window_info_; + const SkColor background_color_; WindowlessHandler* windowless_handler_; // Not owned by this object. }; diff --git a/libcef/browser/native/browser_platform_delegate_native_linux.cc b/libcef/browser/native/browser_platform_delegate_native_linux.cc index 0fd11cb3a..0282199bf 100644 --- a/libcef/browser/native/browser_platform_delegate_native_linux.cc +++ b/libcef/browser/native/browser_platform_delegate_native_linux.cc @@ -43,8 +43,9 @@ long GetSystemUptime() { } // namespace CefBrowserPlatformDelegateNativeLinux::CefBrowserPlatformDelegateNativeLinux( - const CefWindowInfo& window_info) - : CefBrowserPlatformDelegateNative(window_info), + const CefWindowInfo& window_info, + SkColor background_color) + : CefBrowserPlatformDelegateNative(window_info, background_color), host_window_created_(false), window_widget_(nullptr), window_x11_(nullptr) { @@ -82,17 +83,8 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() { // Add a reference that will be released in BrowserDestroyed(). browser_->AddRef(); - SkColor background_color = SK_ColorWHITE; - const CefSettings& settings = CefContext::Get()->settings(); - if (CefColorGetA(settings.background_color) > 0) { - background_color = SkColorSetRGB( - CefColorGetR(settings.background_color), - CefColorGetG(settings.background_color), - CefColorGetB(settings.background_color)); - } - CefWindowDelegateView* delegate_view = - new CefWindowDelegateView(background_color); + new CefWindowDelegateView(GetBackgroundColor()); delegate_view->Init(window_info_.window, browser_->web_contents(), gfx::Rect(gfx::Point(), rect.size())); @@ -253,19 +245,19 @@ void CefBrowserPlatformDelegateNativeLinux::HandleExternalProtocol( void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent( content::NativeWebKeyboardEvent& result, const CefKeyEvent& key_event) const { - result.windowsKeyCode = key_event.windows_key_code; - result.nativeKeyCode = key_event.native_key_code; - result.isSystemKey = key_event.is_system_key ? 1 : 0; + result.windows_key_code = key_event.windows_key_code; + result.native_key_code = key_event.native_key_code; + result.is_system_key = key_event.is_system_key ? 1 : 0; switch (key_event.type) { case KEYEVENT_RAWKEYDOWN: case KEYEVENT_KEYDOWN: - result.setType(blink::WebInputEvent::RawKeyDown); + result.SetType(blink::WebInputEvent::kRawKeyDown); break; case KEYEVENT_KEYUP: - result.setType(blink::WebInputEvent::KeyUp); + result.SetType(blink::WebInputEvent::kKeyUp); break; case KEYEVENT_CHAR: - result.setType(blink::WebInputEvent::Char); + result.SetType(blink::WebInputEvent::kChar); break; default: NOTREACHED(); @@ -273,20 +265,20 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent( // Populate DOM values that will be passed to JavaScript handlers via // KeyboardEvent. - result.domCode = + result.dom_code = static_cast(ui::KeycodeConverter::NativeKeycodeToDomCode( key_event.native_key_code)); int keysym = ui::XKeysymForWindowsKeyCode( static_cast(key_event.windows_key_code), !!(key_event.modifiers & EVENTFLAG_SHIFT_DOWN)); base::char16 ch = ui::GetUnicodeCharacterFromXKeySym(keysym); - result.domKey = static_cast(ui::XKeySymToDomKey(keysym, ch)); + result.dom_key = static_cast(ui::XKeySymToDomKey(keysym, ch)); result.text[0] = key_event.character; - result.unmodifiedText[0] = key_event.unmodified_character; + result.unmodified_text[0] = key_event.unmodified_character; - result.setModifiers( - result.modifiers() | TranslateModifiers(key_event.modifiers)); + result.SetModifiers( + result.GetModifiers() | TranslateModifiers(key_event.modifiers)); } void CefBrowserPlatformDelegateNativeLinux::TranslateClickEvent( @@ -298,25 +290,25 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateClickEvent( switch (type) { case MBT_LEFT: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Left; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kLeft; break; case MBT_MIDDLE: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Middle; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kMiddle; break; case MBT_RIGHT: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Right; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kRight; break; default: NOTREACHED(); } - result.clickCount = clickCount; + result.click_count = clickCount; } void CefBrowserPlatformDelegateNativeLinux::TranslateMoveEvent( @@ -326,21 +318,21 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMoveEvent( TranslateMouseEvent(result, mouse_event); if (!mouseLeave) { - result.setType(blink::WebInputEvent::MouseMove); + result.SetType(blink::WebInputEvent::kMouseMove); if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Left; + result.button = blink::WebMouseEvent::Button::kLeft; else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Middle; + result.button = blink::WebMouseEvent::Button::kMiddle; else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Right; + result.button = blink::WebMouseEvent::Button::kRight; else - result.button = blink::WebMouseEvent::Button::NoButton; + result.button = blink::WebMouseEvent::Button::kNoButton; } else { - result.setType(blink::WebInputEvent::MouseLeave); - result.button = blink::WebMouseEvent::Button::NoButton; + result.SetType(blink::WebInputEvent::kMouseLeave); + result.button = blink::WebMouseEvent::Button::kNoButton; } - result.clickCount = 0; + result.click_count = 0; } void CefBrowserPlatformDelegateNativeLinux::TranslateWheelEvent( @@ -350,28 +342,28 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateWheelEvent( result = blink::WebMouseWheelEvent(); TranslateMouseEvent(result, mouse_event); - result.setType(blink::WebInputEvent::MouseWheel); + result.SetType(blink::WebInputEvent::kMouseWheel); static const double scrollbarPixelsPerGtkTick = 40.0; - result.deltaX = deltaX; - result.deltaY = deltaY; - result.wheelTicksX = result.deltaX / scrollbarPixelsPerGtkTick; - result.wheelTicksY = result.deltaY / scrollbarPixelsPerGtkTick; - result.hasPreciseScrollingDeltas = true; + result.delta_x = deltaX; + result.delta_y = deltaY; + result.wheel_ticks_x = deltaX / scrollbarPixelsPerGtkTick; + result.wheel_ticks_y = deltaY / scrollbarPixelsPerGtkTick; + result.has_precise_scrolling_deltas = true; // Unless the phase and momentumPhase are passed in as parameters to this // function, there is no way to know them - result.phase = blink::WebMouseWheelEvent::PhaseNone; - result.momentumPhase = blink::WebMouseWheelEvent::PhaseNone; + result.phase = blink::WebMouseWheelEvent::kPhaseNone; + result.momentum_phase = blink::WebMouseWheelEvent::kPhaseNone; if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Left; + result.button = blink::WebMouseEvent::Button::kLeft; else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Middle; + result.button = blink::WebMouseEvent::Button::kMiddle; else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Right; + result.button = blink::WebMouseEvent::Button::kRight; else - result.button = blink::WebMouseEvent::Button::NoButton; + result.button = blink::WebMouseEvent::Button::kNoButton; } CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle( @@ -390,20 +382,17 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent( blink::WebMouseEvent& result, const CefMouseEvent& mouse_event) const { // position - result.x = mouse_event.x; - result.y = mouse_event.y; - result.windowX = result.x; - result.windowY = result.y; + result.SetPositionInWidget(mouse_event.x, mouse_event.y); - const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(result.x, result.y)); - result.globalX = screen_pt.x(); - result.globalY = screen_pt.y(); + const gfx::Point& screen_pt = + GetScreenPoint(gfx::Point(mouse_event.x, mouse_event.y)); + result.SetPositionInScreen(screen_pt.x(), screen_pt.y()); // modifiers - result.setModifiers( - result.modifiers() | TranslateModifiers(mouse_event.modifiers)); + result.SetModifiers( + result.GetModifiers() | TranslateModifiers(mouse_event.modifiers)); // timestamp - result.setTimeStampSeconds(GetSystemUptime()); + result.SetTimeStampSeconds(GetSystemUptime()); } diff --git a/libcef/browser/native/browser_platform_delegate_native_linux.h b/libcef/browser/native/browser_platform_delegate_native_linux.h index 0bbe37791..5b46e4af7 100644 --- a/libcef/browser/native/browser_platform_delegate_native_linux.h +++ b/libcef/browser/native/browser_platform_delegate_native_linux.h @@ -13,8 +13,8 @@ class CefWindowX11; class CefBrowserPlatformDelegateNativeLinux : public CefBrowserPlatformDelegateNative { public: - explicit CefBrowserPlatformDelegateNativeLinux( - const CefWindowInfo& window_info); + CefBrowserPlatformDelegateNativeLinux(const CefWindowInfo& window_info, + SkColor background_color); // CefBrowserPlatformDelegate methods: void BrowserDestroyed(CefBrowserHostImpl* browser) override; diff --git a/libcef/browser/native/browser_platform_delegate_native_mac.h b/libcef/browser/native/browser_platform_delegate_native_mac.h index 94926f32b..5c6be6223 100644 --- a/libcef/browser/native/browser_platform_delegate_native_mac.h +++ b/libcef/browser/native/browser_platform_delegate_native_mac.h @@ -11,8 +11,8 @@ class CefBrowserPlatformDelegateNativeMac : public CefBrowserPlatformDelegateNative { public: - explicit CefBrowserPlatformDelegateNativeMac( - const CefWindowInfo& window_info); + CefBrowserPlatformDelegateNativeMac(const CefWindowInfo& window_info, + SkColor background_color); // CefBrowserPlatformDelegate methods: void BrowserDestroyed(CefBrowserHostImpl* browser) override; @@ -40,7 +40,8 @@ class CefBrowserPlatformDelegateNativeMac : CefEventHandle GetEventHandle( const content::NativeWebKeyboardEvent& event) const override; std::unique_ptr CreateFileDialogRunner() override; - std::unique_ptr CreateJavaScriptDialogRunner() override; + std::unique_ptr CreateJavaScriptDialogRunner() + override; std::unique_ptr CreateMenuRunner() override; private: diff --git a/libcef/browser/native/browser_platform_delegate_native_mac.mm b/libcef/browser/native/browser_platform_delegate_native_mac.mm index 62f5a4de5..d3c0e03d0 100644 --- a/libcef/browser/native/browser_platform_delegate_native_mac.mm +++ b/libcef/browser/native/browser_platform_delegate_native_mac.mm @@ -141,8 +141,9 @@ NSUInteger NativeModifiers(int cef_modifiers) { } // namespace CefBrowserPlatformDelegateNativeMac::CefBrowserPlatformDelegateNativeMac( - const CefWindowInfo& window_info) - : CefBrowserPlatformDelegateNative(window_info), + const CefWindowInfo& window_info, + SkColor background_color) + : CefBrowserPlatformDelegateNative(window_info, background_color), host_window_created_(false) { } @@ -347,9 +348,9 @@ NSUInteger NativeModifiers(int cef_modifiers) { result = content::NativeWebKeyboardEvent(synthetic_event); if (key_event.type == KEYEVENT_CHAR) - result.setType(blink::WebInputEvent::Char); + result.SetType(blink::WebInputEvent::kChar); - result.isSystemKey = key_event.is_system_key; + result.is_system_key = key_event.is_system_key; } void CefBrowserPlatformDelegateNativeMac::TranslateClickEvent( @@ -361,25 +362,25 @@ NSUInteger NativeModifiers(int cef_modifiers) { switch (type) { case MBT_LEFT: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Left; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kLeft; break; case MBT_MIDDLE: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Middle; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kMiddle; break; case MBT_RIGHT: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Right; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kRight; break; default: NOTREACHED(); } - result.clickCount = clickCount; + result.click_count = clickCount; } void CefBrowserPlatformDelegateNativeMac::TranslateMoveEvent( @@ -389,21 +390,21 @@ NSUInteger NativeModifiers(int cef_modifiers) { TranslateMouseEvent(result, mouse_event); if (!mouseLeave) { - result.setType(blink::WebInputEvent::MouseMove); + result.SetType(blink::WebInputEvent::kMouseMove); if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Left; + result.button = blink::WebMouseEvent::Button::kLeft; else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Middle; + result.button = blink::WebMouseEvent::Button::kMiddle; else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Right; + result.button = blink::WebMouseEvent::Button::kRight; else - result.button = blink::WebMouseEvent::Button::NoButton; + result.button = blink::WebMouseEvent::Button::kNoButton; } else { - result.setType(blink::WebInputEvent::MouseLeave); - result.button = blink::WebMouseEvent::Button::NoButton; + result.SetType(blink::WebInputEvent::kMouseLeave); + result.button = blink::WebMouseEvent::Button::kNoButton; } - result.clickCount = 0; + result.click_count = 0; } void CefBrowserPlatformDelegateNativeMac::TranslateWheelEvent( @@ -413,28 +414,28 @@ NSUInteger NativeModifiers(int cef_modifiers) { result = blink::WebMouseWheelEvent(); TranslateMouseEvent(result, mouse_event); - result.setType(blink::WebInputEvent::MouseWheel); + result.SetType(blink::WebInputEvent::kMouseWheel); static const double scrollbarPixelsPerCocoaTick = 40.0; - result.deltaX = deltaX; - result.deltaY = deltaY; - result.wheelTicksX = result.deltaX / scrollbarPixelsPerCocoaTick; - result.wheelTicksY = result.deltaY / scrollbarPixelsPerCocoaTick; - result.hasPreciseScrollingDeltas = true; + result.delta_y = deltaX; + result.delta_y = deltaY; + result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick; + result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick; + result.has_precise_scrolling_deltas = true; // Unless the phase and momentumPhase are passed in as parameters to this // function, there is no way to know them - result.phase = blink::WebMouseWheelEvent::PhaseNone; - result.momentumPhase = blink::WebMouseWheelEvent::PhaseNone; + result.phase = blink::WebMouseWheelEvent::kPhaseNone; + result.momentum_phase = blink::WebMouseWheelEvent::kPhaseNone; if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Left; + result.button = blink::WebMouseEvent::Button::kLeft; else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Middle; + result.button = blink::WebMouseEvent::Button::kMiddle; else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Right; + result.button = blink::WebMouseEvent::Button::kRight; else - result.button = blink::WebMouseEvent::Button::NoButton; + result.button = blink::WebMouseEvent::Button::kNoButton; } CefEventHandle CefBrowserPlatformDelegateNativeMac::GetEventHandle( @@ -461,20 +462,17 @@ NSUInteger NativeModifiers(int cef_modifiers) { blink::WebMouseEvent& result, const CefMouseEvent& mouse_event) const { // position - result.x = mouse_event.x; - result.y = mouse_event.y; - result.windowX = result.x; - result.windowY = result.y; + result.SetPositionInWidget(mouse_event.x, mouse_event.y); - const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(result.x, result.y)); - result.globalX = screen_pt.x(); - result.globalY = screen_pt.y(); + const gfx::Point& screen_pt = + GetScreenPoint(gfx::Point(mouse_event.x, mouse_event.y)); + result.SetPositionInScreen(screen_pt.x(), screen_pt.y()); // modifiers - result.setModifiers( - result.modifiers() | TranslateModifiers(mouse_event.modifiers)); + result.SetModifiers( + result.GetModifiers() | TranslateModifiers(mouse_event.modifiers)); // timestamp - Mac OSX specific - result.setTimeStampSeconds(currentEventTimestamp()); + result.SetTimeStampSeconds(currentEventTimestamp()); } diff --git a/libcef/browser/native/browser_platform_delegate_native_win.cc b/libcef/browser/native/browser_platform_delegate_native_win.cc index e0220296d..93a9e6d73 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.cc +++ b/libcef/browser/native/browser_platform_delegate_native_win.cc @@ -115,8 +115,9 @@ WORD KeyStatesToWord() { } // namespace CefBrowserPlatformDelegateNativeWin::CefBrowserPlatformDelegateNativeWin( - const CefWindowInfo& window_info) - : CefBrowserPlatformDelegateNative(window_info), + const CefWindowInfo& window_info, + SkColor background_color) + : CefBrowserPlatformDelegateNative(window_info, background_color), host_window_created_(false), window_widget_(nullptr) { } @@ -163,15 +164,6 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() { DCHECK(!window_widget_); - SkColor background_color = SK_ColorWHITE; - const CefSettings& settings = CefContext::Get()->settings(); - if (CefColorGetA(settings.background_color) > 0) { - background_color = SkColorSetRGB( - CefColorGetR(settings.background_color), - CefColorGetG(settings.background_color), - CefColorGetB(settings.background_color)); - } - // Adjust for potential display scaling. gfx::Point point = gfx::Point(cr.right, cr.bottom); float scale = display::Screen::GetScreen()-> @@ -180,7 +172,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() { gfx::ScalePoint(gfx::PointF(point), 1.0f / scale)); CefWindowDelegateView* delegate_view = - new CefWindowDelegateView(background_color); + new CefWindowDelegateView(GetBackgroundColor()); delegate_view->Init(window_info_.window, browser_->web_contents(), gfx::Rect(0, 0, point.x(), point.y())); @@ -331,27 +323,27 @@ void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent( if (!msg.hwnd) return; - switch (event.type()) { - case blink::WebInputEvent::RawKeyDown: - msg.message = event.isSystemKey ? WM_SYSKEYDOWN : WM_KEYDOWN; + switch (event.GetType()) { + case blink::WebInputEvent::kRawKeyDown: + msg.message = event.is_system_key ? WM_SYSKEYDOWN : WM_KEYDOWN; break; - case blink::WebInputEvent::KeyUp: - msg.message = event.isSystemKey ? WM_SYSKEYUP : WM_KEYUP; + case blink::WebInputEvent::kKeyUp: + msg.message = event.is_system_key ? WM_SYSKEYUP : WM_KEYUP; break; - case blink::WebInputEvent::Char: - msg.message = event.isSystemKey ? WM_SYSCHAR: WM_CHAR; + case blink::WebInputEvent::kChar: + msg.message = event.is_system_key ? WM_SYSCHAR: WM_CHAR; break; default: NOTREACHED(); return; } - msg.wParam = event.windowsKeyCode; + msg.wParam = event.windows_key_code; - UINT scan_code = ::MapVirtualKeyW(event.windowsKeyCode, MAPVK_VK_TO_VSC); + UINT scan_code = ::MapVirtualKeyW(event.windows_key_code, MAPVK_VK_TO_VSC); msg.lParam = (scan_code << 16) | // key scan code 1; // key repeat count - if (event.modifiers() & content::NativeWebKeyboardEvent::AltKey) + if (event.GetModifiers() & content::NativeWebKeyboardEvent::kAltKey) msg.lParam |= (1 << 29); DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam); @@ -368,19 +360,19 @@ void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol( void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( content::NativeWebKeyboardEvent& result, const CefKeyEvent& key_event) const { - result.windowsKeyCode = key_event.windows_key_code; - result.nativeKeyCode = key_event.native_key_code; - result.isSystemKey = key_event.is_system_key ? 1 : 0; + result.windows_key_code = key_event.windows_key_code; + result.native_key_code = key_event.native_key_code; + result.is_system_key = key_event.is_system_key ? 1 : 0; switch (key_event.type) { case KEYEVENT_RAWKEYDOWN: case KEYEVENT_KEYDOWN: - result.setType(blink::WebInputEvent::RawKeyDown); + result.SetType(blink::WebInputEvent::kRawKeyDown); break; case KEYEVENT_KEYUP: - result.setType(blink::WebInputEvent::KeyUp); + result.SetType(blink::WebInputEvent::kKeyUp); break; case KEYEVENT_CHAR: - result.setType(blink::WebInputEvent::Char); + result.SetType(blink::WebInputEvent::kChar); break; default: NOTREACHED(); @@ -388,27 +380,27 @@ void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( // Populate DOM values that will be passed to JavaScript handlers via // KeyboardEvent. - result.domCode = + result.dom_code = static_cast(ui::KeycodeConverter::NativeKeycodeToDomCode( key_event.native_key_code)); - if (result.type() == blink::WebInputEvent::Char) { - result.domKey = ui::DomKey::FromCharacter(key_event.windows_key_code); + if (result.GetType() == blink::WebInputEvent::kChar) { + result.dom_key = ui::DomKey::FromCharacter(key_event.windows_key_code); } else { // TODO(cef): CefKeyEvent does not currently pass extended key status (see // WM_KEYDOWN docs) which would be necessary to pass EF_IS_EXTENDED_KEY as // the |flags| parameter to DomKeyFromKeyboardCode(). - result.domKey = ui::PlatformKeyMap::DomKeyFromKeyboardCode( + result.dom_key = ui::PlatformKeyMap::DomKeyFromKeyboardCode( ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), 0); } - if (result.type() == blink::WebInputEvent::Char || - result.type() == blink::WebInputEvent::RawKeyDown) { - result.text[0] = result.windowsKeyCode; - result.unmodifiedText[0] = result.windowsKeyCode; + if (result.GetType() == blink::WebInputEvent::kChar || + result.GetType() == blink::WebInputEvent::kRawKeyDown) { + result.text[0] = result.windows_key_code; + result.unmodified_text[0] = result.windows_key_code; } - result.setModifiers( - result.modifiers() | TranslateModifiers(key_event.modifiers)); + result.SetModifiers( + result.GetModifiers() | TranslateModifiers(key_event.modifiers)); } void CefBrowserPlatformDelegateNativeWin::TranslateClickEvent( @@ -420,25 +412,25 @@ void CefBrowserPlatformDelegateNativeWin::TranslateClickEvent( switch (type) { case MBT_LEFT: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Left; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kLeft; break; case MBT_MIDDLE: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Middle; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kMiddle; break; case MBT_RIGHT: - result.setType(mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown); - result.button = blink::WebMouseEvent::Button::Right; + result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp : + blink::WebInputEvent::kMouseDown); + result.button = blink::WebMouseEvent::Button::kRight; break; default: NOTREACHED(); } - result.clickCount = clickCount; + result.click_count = clickCount; } void CefBrowserPlatformDelegateNativeWin::TranslateMoveEvent( @@ -448,21 +440,21 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMoveEvent( TranslateMouseEvent(result, mouse_event); if (!mouseLeave) { - result.setType(blink::WebInputEvent::MouseMove); + result.SetType(blink::WebInputEvent::kMouseMove); if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Left; + result.button = blink::WebMouseEvent::Button::kLeft; else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Middle; + result.button = blink::WebMouseEvent::Button::kMiddle; else if (mouse_event.modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON) - result.button = blink::WebMouseEvent::Button::Right; + result.button = blink::WebMouseEvent::Button::kRight; else - result.button = blink::WebMouseEvent::Button::NoButton; + result.button = blink::WebMouseEvent::Button::kNoButton; } else { - result.setType(blink::WebInputEvent::MouseLeave); - result.button = blink::WebMouseEvent::Button::NoButton; + result.SetType(blink::WebInputEvent::kMouseLeave); + result.button = blink::WebMouseEvent::Button::kNoButton; } - result.clickCount = 0; + result.click_count = 0; } void CefBrowserPlatformDelegateNativeWin::TranslateWheelEvent( @@ -471,8 +463,8 @@ void CefBrowserPlatformDelegateNativeWin::TranslateWheelEvent( int deltaX, int deltaY) const { TranslateMouseEvent(result, mouse_event); - result.setType(blink::WebInputEvent::MouseWheel); - result.button = blink::WebMouseEvent::Button::NoButton; + result.SetType(blink::WebInputEvent::kMouseWheel); + result.button = blink::WebMouseEvent::Button::kNoButton; float wheelDelta; bool horizontalScroll = false; @@ -494,19 +486,19 @@ void CefBrowserPlatformDelegateNativeWin::TranslateWheelEvent( ULONG scrollLines = defaultScrollLinesPerWheelDelta; SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0); if (scrollLines == WHEEL_PAGESCROLL) - result.scrollByPage = true; - if (!result.scrollByPage) + result.scroll_by_page = true; + if (!result.scroll_by_page) scrollDelta *= static_cast(scrollLines) * scrollbarPixelsPerLine; } // Set scroll amount based on above calculations. WebKit expects positive // deltaY to mean "scroll up" and positive deltaX to mean "scroll left". if (horizontalScroll) { - result.deltaX = scrollDelta; - result.wheelTicksX = wheelDelta; + result.delta_x = scrollDelta; + result.wheel_ticks_x = wheelDelta; } else { - result.deltaY = scrollDelta; - result.wheelTicksY = wheelDelta; + result.delta_y = scrollDelta; + result.wheel_ticks_y = wheelDelta; } } @@ -536,21 +528,18 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent( blink::WebMouseEvent& result, const CefMouseEvent& mouse_event) const { // position - result.x = mouse_event.x; - result.y = mouse_event.y; - result.windowX = result.x; - result.windowY = result.y; + result.SetPositionInWidget(mouse_event.x, mouse_event.y); - const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(result.x, result.y)); - result.globalX = screen_pt.x(); - result.globalY = screen_pt.y(); + const gfx::Point& screen_pt = + GetScreenPoint(gfx::Point(mouse_event.x, mouse_event.y)); + result.SetPositionInScreen(screen_pt.x(), screen_pt.y()); // modifiers - result.setModifiers( - result.modifiers() | TranslateModifiers(mouse_event.modifiers)); + result.SetModifiers( + result.GetModifiers() | TranslateModifiers(mouse_event.modifiers)); // timestamp - result.setTimeStampSeconds(GetMessageTime() / 1000.0); + result.SetTimeStampSeconds(GetMessageTime() / 1000.0); } // static diff --git a/libcef/browser/native/browser_platform_delegate_native_win.h b/libcef/browser/native/browser_platform_delegate_native_win.h index 89e1ac196..bb370cd37 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.h +++ b/libcef/browser/native/browser_platform_delegate_native_win.h @@ -13,8 +13,8 @@ class CefBrowserPlatformDelegateNativeWin : public CefBrowserPlatformDelegateNative { public: - explicit CefBrowserPlatformDelegateNativeWin( - const CefWindowInfo& window_info); + CefBrowserPlatformDelegateNativeWin(const CefWindowInfo& window_info, + SkColor background_color); // CefBrowserPlatformDelegate methods: void BrowserDestroyed(CefBrowserHostImpl* browser) override; diff --git a/libcef/browser/native/native_menu_win.cc b/libcef/browser/native/native_menu_win.cc index ad45e450f..92770c189 100644 --- a/libcef/browser/native/native_menu_win.cc +++ b/libcef/browser/native/native_menu_win.cc @@ -289,10 +289,11 @@ class CefNativeMenuWin::MenuHostWindow { // We currently don't support items with both icons and checkboxes. const gfx::ImageSkia skia_icon = icon.AsImageSkia(); DCHECK(type != ui::MenuModel::TYPE_CHECK); - gfx::Canvas canvas(skia_icon.size(), 1.0f, false); - canvas.DrawImageInt(skia_icon, 0, 0); + std::unique_ptr canvas = skia::CreatePlatformCanvas( + skia_icon.width(), skia_icon.height(), false); + canvas->drawBitmap(*skia_icon.bitmap(), 0, 0); DrawToNativeContext( - canvas.sk_canvas(), dc, + canvas.get(), dc, draw_item_struct->rcItem.left + kItemLeftMargin, draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom - draw_item_struct->rcItem.top - skia_icon.height()) / 2, NULL); @@ -308,9 +309,11 @@ class CefNativeMenuWin::MenuHostWindow { state = draw_item_struct->itemState & ODS_SELECTED ? NativeTheme::kHovered : NativeTheme::kNormal; } - gfx::Canvas canvas(gfx::Size(config.check_width, config.check_height), - 1.0f, - false); + + std::unique_ptr canvas = skia::CreatePlatformCanvas( + config.check_width, config.check_height, false); + cc::SkiaPaintCanvas paint_canvas(canvas.get()); + NativeTheme::ExtraParams extra; extra.menu_check.is_radio = false; gfx::Rect bounds(0, 0, config.check_width, config.check_height); @@ -319,13 +322,13 @@ class CefNativeMenuWin::MenuHostWindow { ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi(); native_theme->Paint( - canvas.sk_canvas(), NativeTheme::kMenuCheckBackground, + &paint_canvas, NativeTheme::kMenuCheckBackground, state, bounds, extra); native_theme->Paint( - canvas.sk_canvas(), NativeTheme::kMenuCheck, state, bounds, extra); + &paint_canvas, NativeTheme::kMenuCheck, state, bounds, extra); // Draw checkbox to menu. - DrawToNativeContext(canvas.sk_canvas(), dc, + DrawToNativeContext(canvas.get(), dc, draw_item_struct->rcItem.left + kItemLeftMargin, draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom - draw_item_struct->rcItem.top - config.check_height) / 2, NULL); diff --git a/libcef/browser/net/chrome_scheme_handler.cc b/libcef/browser/net/chrome_scheme_handler.cc index 19481bb6e..c380ae684 100644 --- a/libcef/browser/net/chrome_scheme_handler.cc +++ b/libcef/browser/net/chrome_scheme_handler.cc @@ -295,7 +295,7 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory { ~CefWebUIControllerFactory() override {} private: - friend struct base::DefaultLazyInstanceTraits; + friend struct base::LazyInstanceTraitsBase; // From chrome/browser/chrome_content_browser_client.cc diff --git a/libcef/browser/net/url_request_context_getter_impl.cc b/libcef/browser/net/url_request_context_getter_impl.cc index 6662108cf..b0d734ed7 100644 --- a/libcef/browser/net/url_request_context_getter_impl.cc +++ b/libcef/browser/net/url_request_context_getter_impl.cc @@ -116,16 +116,18 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl( std::unique_ptr 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()) { // 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 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 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> ct_logs( net::ct::CreateLogVerifiersForKnownLogs()); std::unique_ptr 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 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 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 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 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()); + io_state_->request_interceptors_.push_back( + base::MakeUnique()); // Set up interceptors in the reverse order. std::unique_ptr 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 @@ -370,7 +395,7 @@ scoped_refptr } 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& schemes) { CEF_REQUIRE_IOT(); - cookie_supported_schemes_ = schemes; + io_state_->cookie_supported_schemes_ = schemes; CefCookieManagerImpl::SetCookieMonsterSchemes( static_cast(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()); } diff --git a/libcef/browser/net/url_request_context_getter_impl.h b/libcef/browser/net/url_request_context_getter_impl.h index b5aa16207..2612b679a 100644 --- a/libcef/browser/net/url_request_context_getter_impl.h +++ b/libcef/browser/net/url_request_context_getter_impl.h @@ -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; + + // 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 io_task_runner_; - scoped_refptr file_task_runner_; + scoped_refptr io_task_runner_; + scoped_refptr file_task_runner_; #if defined(OS_POSIX) && !defined(OS_ANDROID) - std::string gsapi_library_name_; + std::string gsapi_library_name_; #endif - std::unique_ptr proxy_config_service_; - std::unique_ptr storage_; - std::unique_ptr http_auth_preferences_; - std::unique_ptr url_request_context_; - std::unique_ptr url_request_manager_; - content::ProtocolHandlerMap protocol_handlers_; - content::URLRequestInterceptorScopedVector request_interceptors_; + std::unique_ptr proxy_config_service_; + std::unique_ptr storage_; + std::unique_ptr http_auth_preferences_; + std::unique_ptr url_request_context_; + std::unique_ptr url_request_manager_; + content::ProtocolHandlerMap protocol_handlers_; + content::URLRequestInterceptorScopedVector request_interceptors_; - base::FilePath cookie_store_path_; - std::vector cookie_supported_schemes_; + base::FilePath cookie_store_path_; + std::vector cookie_supported_schemes_; - std::vector > handler_list_; + std::vector > handler_list_; + }; + std::unique_ptr io_state_; BooleanPrefMember quick_check_enabled_; BooleanPrefMember pac_https_url_stripping_enabled_; diff --git a/libcef/browser/net/url_request_context_getter_proxy.cc b/libcef/browser/net/url_request_context_getter_proxy.cc index ddc61ec1b..e814eeb5e 100644 --- a/libcef/browser/net/url_request_context_getter_proxy.cc +++ b/libcef/browser/net/url_request_context_getter_proxy.cc @@ -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( diff --git a/libcef/browser/net/url_request_context_getter_proxy.h b/libcef/browser/net/url_request_context_getter_proxy.h index 25b66cdb0..ed693d9d2 100644 --- a/libcef/browser/net/url_request_context_getter_proxy.h +++ b/libcef/browser/net/url_request_context_getter_proxy.h @@ -24,6 +24,9 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter { scoped_refptr parent); ~CefURLRequestContextGetterProxy() override; + // Called when the StoragePartitionProxy is destroyed. + void ShutdownOnUIThread(); + // net::URLRequestContextGetter implementation. net::URLRequestContext* GetURLRequestContext() override; scoped_refptr @@ -35,6 +38,8 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter { CefRefPtr handler() const { return handler_; } private: + void ShutdownOnIOThread(); + CefRefPtr handler_; // The CefURLRequestContextImpl owned by |parent_| is passed as a raw pointer @@ -44,6 +49,8 @@ class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter { std::unique_ptr context_proxy_; + bool shutting_down_ = false; + DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterProxy); }; diff --git a/libcef/browser/origin_whitelist_impl.cc b/libcef/browser/origin_whitelist_impl.cc index 8da8b67e9..b6bd2ac57 100644 --- a/libcef/browser/origin_whitelist_impl.cc +++ b/libcef/browser/origin_whitelist_impl.cc @@ -150,7 +150,7 @@ class CefOriginWhitelistManager { DISALLOW_COPY_AND_ASSIGN(CefOriginWhitelistManager); }; -base::LazyInstance g_manager = +base::LazyInstance::Leaky g_manager = LAZY_INSTANCE_INITIALIZER; CefOriginWhitelistManager* CefOriginWhitelistManager::GetInstance() { diff --git a/libcef/browser/osr/browser_platform_delegate_osr.cc b/libcef/browser/osr/browser_platform_delegate_osr.cc index 148ef49ca..efe9514a2 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.cc +++ b/libcef/browser/osr/browser_platform_delegate_osr.cc @@ -28,8 +28,7 @@ void CefBrowserPlatformDelegateOsr::CreateViewForWebContents( DCHECK(!view_osr_); // Use the OSR view instead of the default platform view. - view_osr_ = new CefWebContentsViewOSR( - !!native_delegate_->window_info().transparent_painting_enabled); + view_osr_ = new CefWebContentsViewOSR(GetBackgroundColor()); *view = view_osr_; *delegate_view = view_osr_; } @@ -68,6 +67,10 @@ void CefBrowserPlatformDelegateOsr::BrowserDestroyed( view_osr_ = nullptr; } +SkColor CefBrowserPlatformDelegateOsr::GetBackgroundColor() const { + return native_delegate_->GetBackgroundColor(); +} + void CefBrowserPlatformDelegateOsr::WasResized() { CefRenderWidgetHostViewOSR* view = GetOSRHostView(); if (view) diff --git a/libcef/browser/osr/browser_platform_delegate_osr.h b/libcef/browser/osr/browser_platform_delegate_osr.h index f14b425f6..98c795837 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.h +++ b/libcef/browser/osr/browser_platform_delegate_osr.h @@ -27,6 +27,7 @@ class CefBrowserPlatformDelegateOsr : void WebContentsCreated(content::WebContents* web_contents) override; void BrowserCreated(CefBrowserHostImpl* browser) override; void BrowserDestroyed(CefBrowserHostImpl* browser) override; + SkColor GetBackgroundColor() const override; void WasResized() override; void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override; void SendMouseEvent(const blink::WebMouseEvent& event) override; diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index a72af6a3c..e78ba16b4 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -28,7 +28,6 @@ #include "content/browser/renderer_host/render_widget_host_delegate.h" #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h" #include "content/browser/renderer_host/render_widget_host_impl.h" -#include "content/browser/renderer_host/resize_lock.h" #include "content/common/input_messages.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_thread.h" @@ -63,73 +62,6 @@ static content::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) { return screenInfo; } -#if !defined(OS_MACOSX) - -// When accelerated compositing is enabled and a widget resize is pending, -// we delay further resizes of the UI. The following constant is the maximum -// length of time that we should delay further UI resizes while waiting for a -// resized frame from a renderer. -const int kResizeLockTimeoutMs = 67; - -// Used to prevent further resizes while a resize is pending. -class CefResizeLock : public content::ResizeLock { - public: - CefResizeLock(CefRenderWidgetHostViewOSR* host, - const gfx::Size new_size, - bool defer_compositor_lock, - double timeout) - : ResizeLock(new_size, defer_compositor_lock), - host_(host), - cancelled_(false), - weak_ptr_factory_(this) { - DCHECK(host_); - host_->HoldResize(); - - CEF_POST_DELAYED_TASK( - CEF_UIT, - base::Bind(&CefResizeLock::CancelLock, - weak_ptr_factory_.GetWeakPtr()), - timeout); - } - - ~CefResizeLock() override { - CancelLock(); - } - - bool GrabDeferredLock() override { - return ResizeLock::GrabDeferredLock(); - } - - void UnlockCompositor() override { - ResizeLock::UnlockCompositor(); - compositor_lock_ = NULL; - } - - protected: - void LockCompositor() override { - ResizeLock::LockCompositor(); - compositor_lock_ = host_->GetCompositor()->GetCompositorLock(); - } - - void CancelLock() { - if (cancelled_) - return; - cancelled_ = true; - UnlockCompositor(); - host_->ReleaseResize(); - } - - private: - CefRenderWidgetHostViewOSR* host_; - scoped_refptr compositor_lock_; - bool cancelled_; - base::WeakPtrFactory weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(CefResizeLock); -}; - -#endif // !defined(OS_MACOSX) - } // namespace // Used for managing copy requests when GPU compositing is enabled. Based on @@ -450,11 +382,11 @@ class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient { CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( - bool transparent, + SkColor background_color, content::RenderWidgetHost* widget, CefRenderWidgetHostViewOSR* parent_host_view, bool is_guest_view_hack) - : transparent_(transparent), + : background_color_(background_color), scale_factor_(kDefaultScaleFactor), frame_rate_threshold_ms_(0), #if !defined(OS_MACOSX) @@ -493,6 +425,10 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( PlatformCreateCompositorWidget(is_guest_view_hack); + bool opaque = SkColorGetA(background_color_) == SK_AlphaOPAQUE; + GetRootLayer()->SetFillsBoundsOpaquely(opaque); + GetRootLayer()->SetColor(background_color_); + #if !defined(OS_MACOSX) // On macOS the ui::Compositor is created/owned by the platform view. content::ImageTransportFactory* factory = @@ -655,14 +591,20 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetViewBounds() const { } void CefRenderWidgetHostViewOSR::SetBackgroundColor(SkColor color) { - if (transparent_) - color = SkColorSetARGB(SK_AlphaTRANSPARENT, 0, 0, 0); - - content::RenderWidgetHostViewBase::SetBackgroundColor(color); + // The renderer will feed its color back to us with the first CompositorFrame. + // We short-cut here to show a sensible color before that happens. + UpdateBackgroundColorFromRenderer(color); + + DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE || + SkColorGetA(color) == SK_AlphaTRANSPARENT); + if (render_widget_host_) { + render_widget_host_->SetBackgroundOpaque( + SkColorGetA(color) == SK_AlphaOPAQUE); + } +} - const bool opaque = !transparent_ && GetBackgroundOpaque(); - if (render_widget_host_) - render_widget_host_->SetBackgroundOpaque(opaque); +SkColor CefRenderWidgetHostViewOSR::background_color() const { + return background_color_; } bool CefRenderWidgetHostViewOSR::LockMouse() { @@ -672,8 +614,18 @@ bool CefRenderWidgetHostViewOSR::LockMouse() { void CefRenderWidgetHostViewOSR::UnlockMouse() { } -void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( - uint32_t output_surface_id, +void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink( + cc::mojom::MojoCompositorFrameSinkClient* + renderer_compositor_frame_sink) { + renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; + if (GetDelegatedFrameHost()) { + GetDelegatedFrameHost()->DidCreateNewRendererCompositorFrameSink( + renderer_compositor_frame_sink_); + } +} + +void CefRenderWidgetHostViewOSR::SubmitCompositorFrame( + const cc::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame"); @@ -699,11 +651,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( // The compositor will draw directly to the SoftwareOutputDevice which // then calls OnPaint. - // We would normally call BrowserCompositorMac::SwapCompositorFrame on + // We would normally call BrowserCompositorMac::SubmitCompositorFrame on // macOS, however it contains compositor resize logic that we don't want. // Consequently we instead call the SwapDelegatedFrame method directly. - GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id, - std::move(frame)); + GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id, + std::move(frame)); } else { if (!copy_frame_generator_.get()) { copy_frame_generator_.reset( @@ -718,11 +670,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect)); damage_rect.Intersect(gfx::Rect(frame_size)); - // We would normally call BrowserCompositorMac::SwapCompositorFrame on + // We would normally call BrowserCompositorMac::SubmitCompositorFrame on // macOS, however it contains compositor resize logic that we don't want. // Consequently we instead call the SwapDelegatedFrame method directly. - GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id, - std::move(frame)); + GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id, + std::move(frame)); // Request a copy of the last compositor frame which will eventually call // OnPaint asynchronously. @@ -793,7 +745,7 @@ void CefRenderWidgetHostViewOSR::UpdateCursor( if (!handler.get()) return; - content::WebCursor::CursorInfo cursor_info; + content::CursorInfo cursor_info; cursor.GetCursorInfo(&cursor_info); const cef_cursor_type_t cursor_type = @@ -1067,7 +1019,7 @@ CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice( DCHECK(!copy_frame_generator_); DCHECK(!software_output_device_); software_output_device_ = new CefSoftwareOutputDeviceOSR( - compositor, transparent_, + compositor, background_color() == SK_ColorTRANSPARENT, base::Bind(&CefRenderWidgetHostViewOSR::OnPaint, weak_ptr_factory_.GetWeakPtr())); return base::WrapUnique(software_output_device_); @@ -1104,33 +1056,15 @@ bool CefRenderWidgetHostViewOSR::DelegatedFrameCanCreateResizeLock() const { return !render_widget_host_->auto_resize_enabled(); } -std::unique_ptr -CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock( - bool defer_compositor_lock) { - const gfx::Size& desired_size = GetRootLayer()->bounds().size(); - return std::unique_ptr(new CefResizeLock( - this, - desired_size, - defer_compositor_lock, - kResizeLockTimeoutMs)); -} - -void CefRenderWidgetHostViewOSR::DelegatedFrameHostResizeLockWasReleased() { - return render_widget_host_->WasResized(); -} +std::unique_ptr +CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock() { + HoldResize(); -void -CefRenderWidgetHostViewOSR::DelegatedFrameHostSendReclaimCompositorResources( - int output_surface_id, - bool is_swap_ack, - const cc::ReturnedResourceArray& resources) { - render_widget_host_->Send(new ViewMsg_ReclaimCompositorResources( - render_widget_host_->GetRoutingID(), output_surface_id, is_swap_ack, - resources)); + const gfx::Size& desired_size = GetRootLayer()->bounds().size(); + return base::MakeUnique(this, desired_size); } -void CefRenderWidgetHostViewOSR::SetBeginFrameSource( - cc::BeginFrameSource* source) { +void CefRenderWidgetHostViewOSR::OnBeginFrame(const cc::BeginFrameArgs& args) { // TODO(cef): Maybe we can use this method in combination with // OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer. // See https://codereview.chromium.org/1841083007. @@ -1140,10 +1074,20 @@ bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const { return render_widget_host_->auto_resize_enabled(); } +std::unique_ptr +CefRenderWidgetHostViewOSR::GetCompositorLock( + ui::CompositorLockClient* client) { + return GetCompositor()->GetCompositorLock(client); +} + +void CefRenderWidgetHostViewOSR::CompositorResizeLockEnded() { + ReleaseResize(); +} + #endif // !defined(OS_MACOSX) bool CefRenderWidgetHostViewOSR::InstallTransparency() { - if (transparent_) { + if (background_color() == SK_ColorTRANSPARENT) { SetBackgroundColor(SkColor()); #if defined(OS_MACOSX) browser_compositor_->SetHasTransparentBackground(true); @@ -1244,16 +1188,20 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent( const blink::WebMouseEvent& event) { TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendMouseEvent"); if (!IsPopupWidget()) { - if (browser_impl_.get() && event.type() == blink::WebMouseEvent::MouseDown) + if (browser_impl_.get() && + event.GetType() == blink::WebMouseEvent::kMouseDown) { browser_impl_->CancelContextMenu(); + } if (popup_host_view_ && - popup_host_view_->popup_position_.Contains(event.x, event.y)) { + popup_host_view_->popup_position_.Contains( + event.PositionInWidget().x, event.PositionInWidget().y)) { blink::WebMouseEvent popup_event(event); - popup_event.x -= popup_host_view_->popup_position_.x(); - popup_event.y -= popup_host_view_->popup_position_.y(); - popup_event.windowX = popup_event.x; - popup_event.windowY = popup_event.y; + popup_event.SetPositionInWidget( + event.PositionInWidget().x - popup_host_view_->popup_position_.x(), + event.PositionInWidget().y - popup_host_view_->popup_position_.y()); + popup_event.SetPositionInScreen(popup_event.PositionInWidget().x, + popup_event.PositionInWidget().y); popup_host_view_->SendMouseEvent(popup_event); return; @@ -1272,12 +1220,15 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent( browser_impl_->CancelContextMenu(); if (popup_host_view_) { - if (popup_host_view_->popup_position_.Contains(event.x, event.y)) { + if (popup_host_view_->popup_position_.Contains( + event.PositionInWidget().x, event.PositionInWidget().y)) { blink::WebMouseWheelEvent popup_event(event); - popup_event.x -= popup_host_view_->popup_position_.x(); - popup_event.y -= popup_host_view_->popup_position_.y(); - popup_event.windowX = popup_event.x; - popup_event.windowY = popup_event.y; + popup_event.SetPositionInWidget( + event.PositionInWidget().x - popup_host_view_->popup_position_.x(), + event.PositionInWidget().y - popup_host_view_->popup_position_.y()); + popup_event.SetPositionInScreen(popup_event.PositionInWidget().x, + popup_event.PositionInWidget().y); + popup_host_view_->SendMouseWheelEvent(popup_event); return; } else { @@ -1601,9 +1552,7 @@ void CefRenderWidgetHostViewOSR::RequestImeCompositionUpdate( bool start_monitoring) { if (!render_widget_host_) return; - render_widget_host_->Send( - new InputMsg_RequestCompositionUpdate(render_widget_host_->GetRoutingID(), - false, start_monitoring)); + render_widget_host_->RequestCompositionUpdates(false, start_monitoring); } void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged( @@ -1644,3 +1593,13 @@ cc::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId( render_widget_host_->GetRoutingID())); } +void CefRenderWidgetHostViewOSR::UpdateBackgroundColorFromRenderer( + SkColor color) { + if (color == background_color()) + return; + background_color_ = color; + + bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE; + GetRootLayer()->SetFillsBoundsOpaquely(opaque); + GetRootLayer()->SetColor(color); +} diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index d902b8436..c598ec939 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -16,6 +16,7 @@ #include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "cc/scheduler/begin_frame_source.h" +#include "content/browser/renderer_host/compositor_resize_lock.h" #include "content/browser/renderer_host/delegated_frame_host.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "ui/compositor/compositor.h" @@ -85,11 +86,12 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, public ui::CompositorDelegate #if !defined(OS_MACOSX) - , public content::DelegatedFrameHostClient + , public content::DelegatedFrameHostClient, + public content::CompositorResizeLockClient #endif { public: - CefRenderWidgetHostViewOSR(const bool transparent, + CefRenderWidgetHostViewOSR(SkColor background_color, content::RenderWidgetHost* widget, CefRenderWidgetHostViewOSR* parent_host_view, bool is_guest_view_hack); @@ -111,6 +113,7 @@ class CefRenderWidgetHostViewOSR bool IsShowing() override; gfx::Rect GetViewBounds() const override; void SetBackgroundColor(SkColor color) override; + SkColor background_color() const override; bool LockMouse() override; void UnlockMouse() override; @@ -125,7 +128,10 @@ class CefRenderWidgetHostViewOSR #endif // defined(OS_MACOSX) // RenderWidgetHostViewBase implementation. - void OnSwapCompositorFrame(uint32_t output_surface_id, + void DidCreateNewRendererCompositorFrameSink( + cc::mojom::MojoCompositorFrameSinkClient* + renderer_compositor_frame_sink) override; + void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) override; void ClearCompositorFrame() override; void InitAsPopup(content::RenderWidgetHostView* parent_host_view, @@ -192,16 +198,16 @@ class CefRenderWidgetHostViewOSR bool DelegatedFrameHostIsVisible() const override; SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override; - bool DelegatedFrameCanCreateResizeLock() const override; - std::unique_ptr DelegatedFrameHostCreateResizeLock( - bool defer_compositor_lock) override; - void DelegatedFrameHostResizeLockWasReleased() override; - void DelegatedFrameHostSendReclaimCompositorResources( - int output_surface_id, - bool is_swap_ack, - const cc::ReturnedResourceArray& resources) override; - void SetBeginFrameSource(cc::BeginFrameSource* source) override; + bool DelegatedFrameCanCreateResizeLock() const override; + std::unique_ptr + DelegatedFrameHostCreateResizeLock() override; + void OnBeginFrame(const cc::BeginFrameArgs& args) override; bool IsAutoResizeEnabled() const override; + + // CompositorResizeLockClient implementation. + std::unique_ptr GetCompositorLock( + ui::CompositorLockClient* client) override; + void CompositorResizeLockEnded() override; #endif // !defined(OS_MACOSX) bool InstallTransparency(); @@ -225,7 +231,7 @@ class CefRenderWidgetHostViewOSR void* bitmap_pixels); bool IsPopupWidget() const { - return popup_type_ != blink::WebPopupTypeNone; + return popup_type_ != blink::kWebPopupTypeNone; } void ImeSetComposition( @@ -289,6 +295,10 @@ class CefRenderWidgetHostViewOSR cc::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack); + // Applies background color without notifying the RenderWidget about + // opaqueness changes. + void UpdateBackgroundColorFromRenderer(SkColor color); + #if defined(OS_MACOSX) friend class MacHelper; #endif @@ -300,7 +310,8 @@ class CefRenderWidgetHostViewOSR ui::PlatformCursor GetPlatformCursor(blink::WebCursorInfo::Type type); #endif - const bool transparent_; + // The background color of the web content. + SkColor background_color_; float scale_factor_; int frame_rate_threshold_ms_; @@ -363,6 +374,9 @@ class CefRenderWidgetHostViewOSR gfx::Vector2dF last_scroll_offset_; bool is_scroll_offset_changed_pending_; + cc::mojom::MojoCompositorFrameSinkClient* renderer_compositor_frame_sink_ = + nullptr; + base::WeakPtrFactory weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(CefRenderWidgetHostViewOSR); diff --git a/libcef/browser/osr/render_widget_host_view_osr_linux.cc b/libcef/browser/osr/render_widget_host_view_osr_linux.cc index 80acf7d05..528395952 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_linux.cc +++ b/libcef/browser/osr/render_widget_host_view_osr_linux.cc @@ -23,92 +23,92 @@ using blink::WebCursorInfo; int ToCursorID(WebCursorInfo::Type type) { switch (type) { - case WebCursorInfo::TypePointer: + case WebCursorInfo::kTypePointer: return XC_left_ptr; - case WebCursorInfo::TypeCross: + case WebCursorInfo::kTypeCross: return XC_crosshair; - case WebCursorInfo::TypeHand: + case WebCursorInfo::kTypeHand: return XC_hand2; - case WebCursorInfo::TypeIBeam: + case WebCursorInfo::kTypeIBeam: return XC_xterm; - case WebCursorInfo::TypeWait: + case WebCursorInfo::kTypeWait: return XC_watch; - case WebCursorInfo::TypeHelp: + case WebCursorInfo::kTypeHelp: return XC_question_arrow; - case WebCursorInfo::TypeEastResize: + case WebCursorInfo::kTypeEastResize: return XC_right_side; - case WebCursorInfo::TypeNorthResize: + case WebCursorInfo::kTypeNorthResize: return XC_top_side; - case WebCursorInfo::TypeNorthEastResize: + case WebCursorInfo::kTypeNorthEastResize: return XC_top_right_corner; - case WebCursorInfo::TypeNorthWestResize: + case WebCursorInfo::kTypeNorthWestResize: return XC_top_left_corner; - case WebCursorInfo::TypeSouthResize: + case WebCursorInfo::kTypeSouthResize: return XC_bottom_side; - case WebCursorInfo::TypeSouthEastResize: + case WebCursorInfo::kTypeSouthEastResize: return XC_bottom_right_corner; - case WebCursorInfo::TypeSouthWestResize: + case WebCursorInfo::kTypeSouthWestResize: return XC_bottom_left_corner; - case WebCursorInfo::TypeWestResize: + case WebCursorInfo::kTypeWestResize: return XC_left_side; - case WebCursorInfo::TypeNorthSouthResize: + case WebCursorInfo::kTypeNorthSouthResize: return XC_sb_v_double_arrow; - case WebCursorInfo::TypeEastWestResize: + case WebCursorInfo::kTypeEastWestResize: return XC_sb_h_double_arrow; - case WebCursorInfo::TypeNorthEastSouthWestResize: + case WebCursorInfo::kTypeNorthEastSouthWestResize: return XC_left_ptr; - case WebCursorInfo::TypeNorthWestSouthEastResize: + case WebCursorInfo::kTypeNorthWestSouthEastResize: return XC_left_ptr; - case WebCursorInfo::TypeColumnResize: + case WebCursorInfo::kTypeColumnResize: return XC_sb_h_double_arrow; - case WebCursorInfo::TypeRowResize: + case WebCursorInfo::kTypeRowResize: return XC_sb_v_double_arrow; - case WebCursorInfo::TypeMiddlePanning: + case WebCursorInfo::kTypeMiddlePanning: return XC_fleur; - case WebCursorInfo::TypeEastPanning: + case WebCursorInfo::kTypeEastPanning: return XC_sb_right_arrow; - case WebCursorInfo::TypeNorthPanning: + case WebCursorInfo::kTypeNorthPanning: return XC_sb_up_arrow; - case WebCursorInfo::TypeNorthEastPanning: + case WebCursorInfo::kTypeNorthEastPanning: return XC_top_right_corner; - case WebCursorInfo::TypeNorthWestPanning: + case WebCursorInfo::kTypeNorthWestPanning: return XC_top_left_corner; - case WebCursorInfo::TypeSouthPanning: + case WebCursorInfo::kTypeSouthPanning: return XC_sb_down_arrow; - case WebCursorInfo::TypeSouthEastPanning: + case WebCursorInfo::kTypeSouthEastPanning: return XC_bottom_right_corner; - case WebCursorInfo::TypeSouthWestPanning: + case WebCursorInfo::kTypeSouthWestPanning: return XC_bottom_left_corner; - case WebCursorInfo::TypeWestPanning: + case WebCursorInfo::kTypeWestPanning: return XC_sb_left_arrow; - case WebCursorInfo::TypeMove: + case WebCursorInfo::kTypeMove: return XC_fleur; - case WebCursorInfo::TypeVerticalText: + case WebCursorInfo::kTypeVerticalText: return XC_left_ptr; - case WebCursorInfo::TypeCell: + case WebCursorInfo::kTypeCell: return XC_left_ptr; - case WebCursorInfo::TypeContextMenu: + case WebCursorInfo::kTypeContextMenu: return XC_left_ptr; - case WebCursorInfo::TypeAlias: + case WebCursorInfo::kTypeAlias: return XC_left_ptr; - case WebCursorInfo::TypeProgress: + case WebCursorInfo::kTypeProgress: return XC_left_ptr; - case WebCursorInfo::TypeNoDrop: + case WebCursorInfo::kTypeNoDrop: return XC_left_ptr; - case WebCursorInfo::TypeCopy: + case WebCursorInfo::kTypeCopy: return XC_left_ptr; - case WebCursorInfo::TypeNotAllowed: + case WebCursorInfo::kTypeNotAllowed: return XC_left_ptr; - case WebCursorInfo::TypeZoomIn: + case WebCursorInfo::kTypeZoomIn: return XC_left_ptr; - case WebCursorInfo::TypeZoomOut: + case WebCursorInfo::kTypeZoomOut: return XC_left_ptr; - case WebCursorInfo::TypeGrab: + case WebCursorInfo::kTypeGrab: return XC_left_ptr; - case WebCursorInfo::TypeGrabbing: + case WebCursorInfo::kTypeGrabbing: return XC_left_ptr; - case WebCursorInfo::TypeCustom: - case WebCursorInfo::TypeNone: + case WebCursorInfo::kTypeCustom: + case WebCursorInfo::kTypeNone: break; } NOTREACHED(); @@ -185,7 +185,7 @@ void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() { ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor( blink::WebCursorInfo::Type type) { - if (type == WebCursorInfo::TypeNone) { + if (type == WebCursorInfo::kTypeNone) { if (!invisible_cursor_) { invisible_cursor_.reset( new ui::XScopedCursor(ui::CreateInvisibleCursor(), diff --git a/libcef/browser/osr/render_widget_host_view_osr_mac.mm b/libcef/browser/osr/render_widget_host_view_osr_mac.mm index 85a773852..ad5122461 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_mac.mm +++ b/libcef/browser/osr/render_widget_host_view_osr_mac.mm @@ -17,8 +17,6 @@ #include "base/strings/utf_string_conversions.h" #include "content/common/view_messages.h" #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" -#include "ui/events/latency_info.h" - class MacHelper : public content::BrowserCompositorMacClient, @@ -49,15 +47,6 @@ SkColor BrowserCompositorMacGetGutterColor(SkColor color) const override { return color; } - void BrowserCompositorMacSendReclaimCompositorResources( - int output_surface_id, - bool is_swap_ack, - const cc::ReturnedResourceArray& resources) override { - view_->render_widget_host()->Send(new ViewMsg_ReclaimCompositorResources( - view_->render_widget_host()->GetRoutingID(), output_surface_id, - is_swap_ack, resources)); - } - void BrowserCompositorMacSendBeginFrame( const cc::BeginFrameArgs& args) override { view_->render_widget_host()->Send( diff --git a/libcef/browser/osr/render_widget_host_view_osr_win.cc b/libcef/browser/osr/render_widget_host_view_osr_win.cc index f2b5c77e2..991a8d62f 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_win.cc +++ b/libcef/browser/osr/render_widget_host_view_osr_win.cc @@ -46,91 +46,91 @@ using blink::WebCursorInfo; LPCWSTR ToCursorID(WebCursorInfo::Type type) { switch (type) { - case WebCursorInfo::TypePointer: + case WebCursorInfo::kTypePointer: return IDC_ARROW; - case WebCursorInfo::TypeCross: + case WebCursorInfo::kTypeCross: return IDC_CROSS; - case WebCursorInfo::TypeHand: + case WebCursorInfo::kTypeHand: return IDC_HAND; - case WebCursorInfo::TypeIBeam: + case WebCursorInfo::kTypeIBeam: return IDC_IBEAM; - case WebCursorInfo::TypeWait: + case WebCursorInfo::kTypeWait: return IDC_WAIT; - case WebCursorInfo::TypeHelp: + case WebCursorInfo::kTypeHelp: return IDC_HELP; - case WebCursorInfo::TypeEastResize: + case WebCursorInfo::kTypeEastResize: return IDC_SIZEWE; - case WebCursorInfo::TypeNorthResize: + case WebCursorInfo::kTypeNorthResize: return IDC_SIZENS; - case WebCursorInfo::TypeNorthEastResize: + case WebCursorInfo::kTypeNorthEastResize: return IDC_SIZENESW; - case WebCursorInfo::TypeNorthWestResize: + case WebCursorInfo::kTypeNorthWestResize: return IDC_SIZENWSE; - case WebCursorInfo::TypeSouthResize: + case WebCursorInfo::kTypeSouthResize: return IDC_SIZENS; - case WebCursorInfo::TypeSouthEastResize: + case WebCursorInfo::kTypeSouthEastResize: return IDC_SIZENWSE; - case WebCursorInfo::TypeSouthWestResize: + case WebCursorInfo::kTypeSouthWestResize: return IDC_SIZENESW; - case WebCursorInfo::TypeWestResize: + case WebCursorInfo::kTypeWestResize: return IDC_SIZEWE; - case WebCursorInfo::TypeNorthSouthResize: + case WebCursorInfo::kTypeNorthSouthResize: return IDC_SIZENS; - case WebCursorInfo::TypeEastWestResize: + case WebCursorInfo::kTypeEastWestResize: return IDC_SIZEWE; - case WebCursorInfo::TypeNorthEastSouthWestResize: + case WebCursorInfo::kTypeNorthEastSouthWestResize: return IDC_SIZENESW; - case WebCursorInfo::TypeNorthWestSouthEastResize: + case WebCursorInfo::kTypeNorthWestSouthEastResize: return IDC_SIZENWSE; - case WebCursorInfo::TypeColumnResize: + case WebCursorInfo::kTypeColumnResize: return MAKEINTRESOURCE(IDC_COLRESIZE); - case WebCursorInfo::TypeRowResize: + case WebCursorInfo::kTypeRowResize: return MAKEINTRESOURCE(IDC_ROWRESIZE); - case WebCursorInfo::TypeMiddlePanning: + case WebCursorInfo::kTypeMiddlePanning: return MAKEINTRESOURCE(IDC_PAN_MIDDLE); - case WebCursorInfo::TypeEastPanning: + case WebCursorInfo::kTypeEastPanning: return MAKEINTRESOURCE(IDC_PAN_EAST); - case WebCursorInfo::TypeNorthPanning: + case WebCursorInfo::kTypeNorthPanning: return MAKEINTRESOURCE(IDC_PAN_NORTH); - case WebCursorInfo::TypeNorthEastPanning: + case WebCursorInfo::kTypeNorthEastPanning: return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST); - case WebCursorInfo::TypeNorthWestPanning: + case WebCursorInfo::kTypeNorthWestPanning: return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST); - case WebCursorInfo::TypeSouthPanning: + case WebCursorInfo::kTypeSouthPanning: return MAKEINTRESOURCE(IDC_PAN_SOUTH); - case WebCursorInfo::TypeSouthEastPanning: + case WebCursorInfo::kTypeSouthEastPanning: return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST); - case WebCursorInfo::TypeSouthWestPanning: + case WebCursorInfo::kTypeSouthWestPanning: return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST); - case WebCursorInfo::TypeWestPanning: + case WebCursorInfo::kTypeWestPanning: return MAKEINTRESOURCE(IDC_PAN_WEST); - case WebCursorInfo::TypeMove: + case WebCursorInfo::kTypeMove: return IDC_SIZEALL; - case WebCursorInfo::TypeVerticalText: + case WebCursorInfo::kTypeVerticalText: return MAKEINTRESOURCE(IDC_VERTICALTEXT); - case WebCursorInfo::TypeCell: + case WebCursorInfo::kTypeCell: return MAKEINTRESOURCE(IDC_CELL); - case WebCursorInfo::TypeContextMenu: + case WebCursorInfo::kTypeContextMenu: return IDC_ARROW; - case WebCursorInfo::TypeAlias: + case WebCursorInfo::kTypeAlias: return MAKEINTRESOURCE(IDC_ALIAS); - case WebCursorInfo::TypeProgress: + case WebCursorInfo::kTypeProgress: return IDC_APPSTARTING; - case WebCursorInfo::TypeNoDrop: + case WebCursorInfo::kTypeNoDrop: return IDC_NO; - case WebCursorInfo::TypeCopy: + case WebCursorInfo::kTypeCopy: return MAKEINTRESOURCE(IDC_COPYCUR); - case WebCursorInfo::TypeNone: + case WebCursorInfo::kTypeNone: return MAKEINTRESOURCE(IDC_CURSOR_NONE); - case WebCursorInfo::TypeNotAllowed: + case WebCursorInfo::kTypeNotAllowed: return IDC_NO; - case WebCursorInfo::TypeZoomIn: + case WebCursorInfo::kTypeZoomIn: return MAKEINTRESOURCE(IDC_ZOOMIN); - case WebCursorInfo::TypeZoomOut: + case WebCursorInfo::kTypeZoomOut: return MAKEINTRESOURCE(IDC_ZOOMOUT); - case WebCursorInfo::TypeGrab: + case WebCursorInfo::kTypeGrab: return MAKEINTRESOURCE(IDC_HAND_GRAB); - case WebCursorInfo::TypeGrabbing: + case WebCursorInfo::kTypeGrabbing: return MAKEINTRESOURCE(IDC_HAND_GRABBING); } NOTREACHED(); diff --git a/libcef/browser/osr/web_contents_view_osr.cc b/libcef/browser/osr/web_contents_view_osr.cc index 69ca980b7..7fcd310ea 100644 --- a/libcef/browser/osr/web_contents_view_osr.cc +++ b/libcef/browser/osr/web_contents_view_osr.cc @@ -14,10 +14,9 @@ #include "content/browser/frame_host/render_widget_host_view_guest.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/render_widget_host.h" -#include "content/public/browser/user_metrics.h" -CefWebContentsViewOSR::CefWebContentsViewOSR(bool transparent) - : transparent_(transparent), +CefWebContentsViewOSR::CefWebContentsViewOSR(SkColor background_color) + : background_color_(background_color), web_contents_(NULL) { } @@ -100,9 +99,8 @@ content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget( } const bool is_guest_view_hack = !!embedder_render_widget_host; - return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, - embedder_host_view, - is_guest_view_hack); + return new CefRenderWidgetHostViewOSR(background_color_, render_widget_host, + embedder_host_view, is_guest_view_hack); } // Called for popup and fullscreen widgets. @@ -112,8 +110,8 @@ content::RenderWidgetHostViewBase* CefRenderWidgetHostViewOSR* view = GetView(); CHECK(view); - return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, view, - false); + return new CefRenderWidgetHostViewOSR(background_color_, render_widget_host, + view, false); } void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) { diff --git a/libcef/browser/osr/web_contents_view_osr.h b/libcef/browser/osr/web_contents_view_osr.h index cd7637fd3..37967b5ff 100644 --- a/libcef/browser/osr/web_contents_view_osr.h +++ b/libcef/browser/osr/web_contents_view_osr.h @@ -8,6 +8,7 @@ #include "content/browser/renderer_host/render_view_host_delegate_view.h" #include "content/browser/web_contents/web_contents_view.h" +#include "third_party/skia/include/core/SkColor.h" namespace content { class BrowserPluginGuest; @@ -22,7 +23,7 @@ class CefRenderWidgetHostViewOSR; class CefWebContentsViewOSR : public content::WebContentsView, public content::RenderViewHostDelegateView { public: - explicit CefWebContentsViewOSR(bool transparent); + explicit CefWebContentsViewOSR(SkColor background_color); ~CefWebContentsViewOSR() override; void WebContentsCreated(content::WebContents* web_contents); @@ -74,7 +75,7 @@ class CefWebContentsViewOSR : public content::WebContentsView, CefRenderWidgetHostViewOSR* GetView() const; CefBrowserHostImpl* GetBrowser() const; - const bool transparent_; + const SkColor background_color_; content::WebContents* web_contents_; diff --git a/libcef/browser/plugins/plugin_info_message_filter.cc b/libcef/browser/plugins/plugin_info_message_filter.cc index a9bcce041..d7f4ffd07 100644 --- a/libcef/browser/plugins/plugin_info_message_filter.cc +++ b/libcef/browser/plugins/plugin_info_message_filter.cc @@ -63,7 +63,7 @@ class ShutdownNotifierFactory static ShutdownNotifierFactory* GetInstance(); private: - friend struct base::DefaultLazyInstanceTraits; + friend struct base::LazyInstanceTraitsBase; ShutdownNotifierFactory() : BrowserContextKeyedServiceShutdownNotifierFactory( @@ -370,19 +370,6 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus( DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); DCHECK(plugin_setting != CONTENT_SETTING_ASK); -#if BUILDFLAG(ENABLE_PLUGIN_INSTALLATION) - // Check if the plugin is outdated. - if (plugin_status == PluginMetadata::SECURITY_STATUS_OUT_OF_DATE && - !allow_outdated_plugins_.GetValue()) { - if (allow_outdated_plugins_.IsManaged()) { - *status = CefViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed; - } else { - *status = CefViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked; - } - return; - } -#endif - // Check if the plugin is crashing too much. if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) && !always_authorize_plugins_.GetValue() && diff --git a/libcef/browser/prefs/browser_prefs.cc b/libcef/browser/prefs/browser_prefs.cc index 1c58cf990..36742634e 100644 --- a/libcef/browser/prefs/browser_prefs.cc +++ b/libcef/browser/prefs/browser_prefs.cc @@ -97,7 +97,8 @@ const char kUserPrefsFileName[] = "UserPrefs.json"; std::unique_ptr CreatePrefService( Profile* profile, const base::FilePath& cache_path, - bool persist_user_preferences) { + bool persist_user_preferences, + bool is_pre_initialization) { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -114,7 +115,8 @@ std::unique_ptr CreatePrefService( factory.set_command_line_prefs(command_line_pref_store); // True if preferences will be stored on disk. - const bool store_on_disk = !cache_path.empty() && persist_user_preferences; + const bool store_on_disk = !cache_path.empty() && persist_user_preferences && + !is_pre_initialization; scoped_refptr sequenced_task_runner; if (store_on_disk) { @@ -141,23 +143,27 @@ std::unique_ptr CreatePrefService( } #if BUILDFLAG(ENABLE_SUPERVISED_USERS) - // Used to store supervised user preferences. - SupervisedUserSettingsService* supervised_user_settings = - SupervisedUserSettingsServiceFactory::GetForProfile(profile); + // Don't access factories during pre-initialization. + if (!is_pre_initialization) { + // Used to store supervised user preferences. + SupervisedUserSettingsService* supervised_user_settings = + SupervisedUserSettingsServiceFactory::GetForProfile(profile); + + if (store_on_disk) { + supervised_user_settings->Init( + cache_path, sequenced_task_runner.get(), true); + } else { + scoped_refptr testing_pref_store = + new TestingPrefStore(); + testing_pref_store->SetInitializationCompleted(); + supervised_user_settings->Init(testing_pref_store); + } - if (store_on_disk) { - supervised_user_settings->Init( - cache_path, sequenced_task_runner.get(), true); - } else { - scoped_refptr testing_pref_store = new TestingPrefStore(); - testing_pref_store->SetInitializationCompleted(); - supervised_user_settings->Init(testing_pref_store); + scoped_refptr supervised_user_prefs = make_scoped_refptr( + new SupervisedUserPrefStore(supervised_user_settings)); + DCHECK(supervised_user_prefs->IsInitializationComplete()); + factory.set_supervised_user_prefs(supervised_user_prefs); } - - scoped_refptr supervised_user_prefs = make_scoped_refptr( - new SupervisedUserPrefStore(supervised_user_settings)); - DCHECK(supervised_user_prefs->IsInitializationComplete()); - factory.set_supervised_user_prefs(supervised_user_prefs); #endif // BUILDFLAG(ENABLE_SUPERVISED_USERS) // Registry that will be populated with all known preferences. Preferences @@ -182,7 +188,7 @@ std::unique_ptr CreatePrefService( // Spell checking preferences. // Based on SpellcheckServiceFactory::RegisterProfilePrefs. registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries, - new base::ListValue); + base::MakeUnique()); std::string spellcheck_lang = command_line->GetSwitchValueASCII(switches::kOverrideSpellCheckLang); if (!spellcheck_lang.empty()) { diff --git a/libcef/browser/prefs/browser_prefs.h b/libcef/browser/prefs/browser_prefs.h index b23c0efcb..a08f60ae4 100644 --- a/libcef/browser/prefs/browser_prefs.h +++ b/libcef/browser/prefs/browser_prefs.h @@ -19,11 +19,14 @@ namespace browser_prefs { // Name for the user prefs JSON file. extern const char kUserPrefsFileName[]; -// Create the PrefService used to manage pref registration and storage. +// Create the PrefService used to manage pref registration and storage. If +// |is_pre_initialization| is true a non-persistent PrefService will be created +// for temporary usage during BrowserContextServices initialization. std::unique_ptr CreatePrefService( Profile* profile, const base::FilePath& cache_path, - bool persist_user_preferences); + bool persist_user_preferences, + bool is_pre_initialization); } // namespace browser_prefs diff --git a/libcef/browser/prefs/renderer_prefs.cc b/libcef/browser/prefs/renderer_prefs.cc index 169f4b355..2a1da1771 100644 --- a/libcef/browser/prefs/renderer_prefs.cc +++ b/libcef/browser/prefs/renderer_prefs.cc @@ -272,7 +272,7 @@ void SetString(CommandLinePrefStore* prefs, const std::string& value) { prefs->SetValue( key, - base::WrapUnique(new base::StringValue(value)), + base::WrapUnique(new base::Value(value)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } @@ -284,28 +284,6 @@ void SetBool(CommandLinePrefStore* prefs, WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } -SkColor GetBaseBackgroundColor(CefRefPtr browser) { - if (browser.get()) { - const CefBrowserSettings& browser_settings = browser->settings(); - if (CefColorGetA(browser_settings.background_color) > 0) { - return SkColorSetRGB( - CefColorGetR(browser_settings.background_color), - CefColorGetG(browser_settings.background_color), - CefColorGetB(browser_settings.background_color)); - } - } - - const CefSettings& settings = CefContext::Get()->settings(); - if (CefColorGetA(settings.background_color) > 0) { - return SkColorSetRGB( - CefColorGetR(settings.background_color), - CefColorGetG(settings.background_color), - CefColorGetB(settings.background_color)); - } - - return SK_ColorWHITE; -} - } // namespace void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs) { @@ -368,7 +346,7 @@ void PopulateWebPreferences(content::RenderViewHost* rvh, SetDefaultPrefs(web); // Set preferences based on the context's PrefService. - if (browser.get()) { + if (browser) { CefBrowserContext* profile = static_cast( browser->web_contents()->GetBrowserContext()); @@ -379,11 +357,18 @@ void PopulateWebPreferences(content::RenderViewHost* rvh, SetExtensionPrefs(rvh, web); // Set preferences based on CefBrowserSettings. - if (browser.get()) + if (browser) SetCefPrefs(browser->settings(), web); // Set the background color for the WebView. - web.base_background_color = GetBaseBackgroundColor(browser); + if (browser) { + web.base_background_color = browser->GetBackgroundColor(); + } else { + // We don't know for sure that the browser will be windowless but assume + // that the global windowless state is likely to be accurate. + web.base_background_color = + CefContext::Get()->GetBackgroundColor(nullptr, STATE_DEFAULT); + } } } // namespace renderer_prefs diff --git a/libcef/browser/printing/print_view_manager.cc b/libcef/browser/printing/print_view_manager.cc index ecf0a1deb..c26229939 100644 --- a/libcef/browser/printing/print_view_manager.cc +++ b/libcef/browser/printing/print_view_manager.cc @@ -50,6 +50,8 @@ void FillInDictionaryFromPdfPrintSettings( print_settings.SetBoolean(kSettingRasterizePdf, false); print_settings.SetBoolean(kSettingGenerateDraftData, false); print_settings.SetBoolean(kSettingPreviewModifiable, false); + print_settings.SetInteger(kSettingDpiHorizontal, 0); + print_settings.SetInteger(kSettingDpiVertical, 0); // User defined settings. print_settings.SetBoolean(kSettingLandscape, !!pdf_settings.landscape); diff --git a/libcef/browser/printing/printing_message_filter.cc b/libcef/browser/printing/printing_message_filter.cc index d6166cd42..d315b41e5 100644 --- a/libcef/browser/printing/printing_message_filter.cc +++ b/libcef/browser/printing/printing_message_filter.cc @@ -48,7 +48,7 @@ class ShutdownNotifierFactory static ShutdownNotifierFactory* GetInstance(); private: - friend struct base::DefaultLazyInstanceTraits; + friend struct base::LazyInstanceTraitsBase; ShutdownNotifierFactory() : BrowserContextKeyedServiceShutdownNotifierFactory( diff --git a/libcef/browser/resource_context.cc b/libcef/browser/resource_context.cc index b30a90e4a..328a37035 100644 --- a/libcef/browser/resource_context.cc +++ b/libcef/browser/resource_context.cc @@ -37,26 +37,13 @@ bool ShouldProxyUserData(const void* key) { CefResourceContext::CefResourceContext( bool is_off_the_record, - extensions::InfoMap* extension_info_map, CefRefPtr handler) : parent_(nullptr), is_off_the_record_(is_off_the_record), - extension_info_map_(extension_info_map), handler_(handler) { } 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) @@ -117,6 +104,12 @@ std::unique_ptr #endif } +void CefResourceContext::set_extensions_info_map( + extensions::InfoMap* extensions_info_map) { + DCHECK(!extension_info_map_); + extension_info_map_ = extensions_info_map; +} + void CefResourceContext::set_url_request_context_getter( CefURLRequestContextGetter* getter) { DCHECK(!getter_.get()); diff --git a/libcef/browser/resource_context.h b/libcef/browser/resource_context.h index 15feaabc2..a4c0ea8cd 100644 --- a/libcef/browser/resource_context.h +++ b/libcef/browser/resource_context.h @@ -28,7 +28,6 @@ enum class CefViewHostMsg_GetPluginInfo_Status; class CefResourceContext : public content::ResourceContext { public: CefResourceContext(bool is_off_the_record, - extensions::InfoMap* extension_info_map, CefRefPtr handler); ~CefResourceContext() override; @@ -44,6 +43,7 @@ class CefResourceContext : public content::ResourceContext { std::unique_ptr CreateClientCertStore(); + void set_extensions_info_map(extensions::InfoMap* extensions_info_map); void set_url_request_context_getter(CefURLRequestContextGetter* getter); void set_parent(CefResourceContext* parent); diff --git a/libcef/browser/storage_partition_proxy.cc b/libcef/browser/storage_partition_proxy.cc index 8e151c699..6cbcbb007 100644 --- a/libcef/browser/storage_partition_proxy.cc +++ b/libcef/browser/storage_partition_proxy.cc @@ -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(); } @@ -76,6 +80,11 @@ CefStoragePartitionProxy::GetPlatformNotificationContext() { return parent_->GetPlatformNotificationContext(); } +content::BackgroundFetchContext* +CefStoragePartitionProxy::GetBackgroundFetchContext() { + return parent_->GetBackgroundFetchContext(); +} + content::BackgroundSyncContext* CefStoragePartitionProxy::GetBackgroundSyncContext() { return parent_->GetBackgroundSyncContext(); @@ -130,6 +139,14 @@ void CefStoragePartitionProxy::ClearData( cookie_matcher, begin, end, callback); } +void CefStoragePartitionProxy::ClearHttpAndMediaCaches( + const base::Time begin, + const base::Time end, + const base::Callback& url_matcher, + const base::Closure& callback) { + parent_->ClearHttpAndMediaCaches(begin, end, url_matcher, callback); +} + void CefStoragePartitionProxy::Flush() { parent_->Flush(); } diff --git a/libcef/browser/storage_partition_proxy.h b/libcef/browser/storage_partition_proxy.h index b863e54f4..bf030afb9 100644 --- a/libcef/browser/storage_partition_proxy.h +++ b/libcef/browser/storage_partition_proxy.h @@ -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; @@ -36,6 +37,7 @@ class CefStoragePartitionProxy : public content::StoragePartition { content::ZoomLevelDelegate* GetZoomLevelDelegate() override; content::PlatformNotificationContext* GetPlatformNotificationContext() override; + content::BackgroundFetchContext* GetBackgroundFetchContext() override; content::BackgroundSyncContext* GetBackgroundSyncContext() override; content::PaymentAppContextImpl* GetPaymentAppContext() override; content::BroadcastChannelProvider* GetBroadcastChannelProvider() override; @@ -59,6 +61,11 @@ class CefStoragePartitionProxy : public content::StoragePartition { const base::Time begin, const base::Time end, const base::Closure& callback) override; + void ClearHttpAndMediaCaches( + const base::Time begin, + const base::Time end, + const base::Callback& url_matcher, + const base::Closure& callback) override; void Flush() override; void ClearBluetoothAllowedDevicesMapForTesting() override; void Bind( diff --git a/libcef/browser/views/browser_platform_delegate_views.cc b/libcef/browser/views/browser_platform_delegate_views.cc index d4e1a32b1..b9aa12a86 100644 --- a/libcef/browser/views/browser_platform_delegate_views.cc +++ b/libcef/browser/views/browser_platform_delegate_views.cc @@ -166,6 +166,10 @@ void CefBrowserPlatformDelegateViews::PopupBrowserCreated( } } +SkColor CefBrowserPlatformDelegateViews::GetBackgroundColor() const { + return native_delegate_->GetBackgroundColor(); +} + void CefBrowserPlatformDelegateViews::WasResized() { content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost(); if (host) diff --git a/libcef/browser/views/browser_platform_delegate_views.h b/libcef/browser/views/browser_platform_delegate_views.h index ca263576b..b42f8a1b7 100644 --- a/libcef/browser/views/browser_platform_delegate_views.h +++ b/libcef/browser/views/browser_platform_delegate_views.h @@ -42,6 +42,7 @@ class CefBrowserPlatformDelegateViews : void PopupBrowserCreated( CefBrowserHostImpl* new_browser, bool is_devtools) override; + SkColor GetBackgroundColor() const override; void WasResized() override; void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override; void SendMouseEvent(const blink::WebMouseEvent& event) override; diff --git a/libcef/browser/views/browser_view_impl.cc b/libcef/browser/views/browser_view_impl.cc index 3b5f6ea0d..3de872ff2 100644 --- a/libcef/browser/views/browser_view_impl.cc +++ b/libcef/browser/views/browser_view_impl.cc @@ -181,22 +181,8 @@ void CefBrowserViewImpl::SetPendingBrowserCreateParams( } void CefBrowserViewImpl::SetDefaults(const CefBrowserSettings& settings) { - SkColor background_color = SK_ColorWHITE; - if (CefColorGetA(settings.background_color) > 0) { - background_color = SkColorSetRGB( - CefColorGetR(settings.background_color), - CefColorGetG(settings.background_color), - CefColorGetB(settings.background_color)); - } else { - const CefSettings& global_settings = CefContext::Get()->settings(); - if (CefColorGetA(global_settings.background_color) > 0) { - background_color = SkColorSetRGB( - CefColorGetR(global_settings.background_color), - CefColorGetG(global_settings.background_color), - CefColorGetB(global_settings.background_color)); - } - } - SetBackgroundColor(background_color); + SetBackgroundColor( + CefContext::Get()->GetBackgroundColor(&settings, STATE_DISABLED)); } CefBrowserViewView* CefBrowserViewImpl::CreateRootView() { @@ -213,7 +199,8 @@ bool CefBrowserViewImpl::HandleAccelerator( // Previous calls to TranslateMessage can generate Char events as well as // RawKeyDown events, even if the latter triggered an accelerator. In these // cases, we discard the Char events. - if (event.type() == blink::WebInputEvent::Char && ignore_next_char_event_) { + if (event.GetType() == blink::WebInputEvent::kChar && + ignore_next_char_event_) { ignore_next_char_event_ = false; return true; } @@ -222,7 +209,7 @@ bool CefBrowserViewImpl::HandleAccelerator( // always generate a Char event. ignore_next_char_event_ = false; - if (event.type() == blink::WebInputEvent::RawKeyDown) { + if (event.GetType() == blink::WebInputEvent::kRawKeyDown) { ui::Accelerator accelerator = ui::GetAcceleratorFromNativeWebKeyboardEvent(event); diff --git a/libcef/browser/views/label_button_impl.h b/libcef/browser/views/label_button_impl.h index 8ade1650f..45ac76ccf 100644 --- a/libcef/browser/views/label_button_impl.h +++ b/libcef/browser/views/label_button_impl.h @@ -111,7 +111,7 @@ CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetEnabledTextColors( CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetFontList( const CefString& font_list) { CEF_REQUIRE_VALID_RETURN_VOID(); - ParentClass::root_view()->SetFontListDeprecated(gfx::FontList(font_list)); + ParentClass::root_view()->SetFontList(gfx::FontList(font_list)); } CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetHorizontalAlignment( diff --git a/libcef/common/cef_messages.cc b/libcef/common/cef_messages.cc index 1e1ccf627..cb9e5e2b1 100644 --- a/libcef/common/cef_messages.cc +++ b/libcef/common/cef_messages.cc @@ -91,7 +91,7 @@ bool ParamTraits >::Read( return false; if (!has_object) return true; - ScopedVector elements; + net::UploadData::ElementsVector elements; if (!ReadParam(m, iter, &elements)) return false; int64_t identifier; diff --git a/libcef/common/net/upload_data.cc b/libcef/common/net/upload_data.cc index a4351480e..db815fec7 100644 --- a/libcef/common/net/upload_data.cc +++ b/libcef/common/net/upload_data.cc @@ -5,6 +5,7 @@ #include "cef/libcef/common/net/upload_data.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" namespace net { @@ -17,7 +18,7 @@ UploadData::UploadData() void UploadData::AppendBytes(const char* bytes, int bytes_len) { DCHECK(!is_chunked_); if (bytes_len > 0) { - elements_.push_back(new UploadElement()); + elements_.push_back(base::MakeUnique()); elements_.back()->SetToBytes(bytes, bytes_len); } } @@ -26,7 +27,7 @@ void UploadData::AppendFileRange(const base::FilePath& file_path, uint64_t offset, uint64_t length, const base::Time& expected_modification_time) { DCHECK(!is_chunked_); - elements_.push_back(new UploadElement()); + elements_.push_back(base::MakeUnique()); elements_.back()->SetToFilePathRange(file_path, offset, length, expected_modification_time); } diff --git a/libcef/common/net/upload_data.h b/libcef/common/net/upload_data.h index c0e022881..c8a9ff05d 100644 --- a/libcef/common/net/upload_data.h +++ b/libcef/common/net/upload_data.h @@ -7,10 +7,12 @@ #include +#include +#include + #include "libcef/common/net/upload_element.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_vector.h" #include "base/supports_user_data.h" #include "net/base/net_export.h" @@ -49,15 +51,17 @@ class UploadData void set_last_chunk_appended(bool set) { last_chunk_appended_ = set; } bool last_chunk_appended() const { return last_chunk_appended_; } - const ScopedVector& elements() const { + using ElementsVector = std::vector>; + + const ElementsVector& elements() const { return elements_; } - ScopedVector* elements_mutable() { + ElementsVector* elements_mutable() { return &elements_; } - void swap_elements(ScopedVector* elements) { + void swap_elements(ElementsVector* elements) { elements_.swap(*elements); } @@ -72,7 +76,7 @@ class UploadData ~UploadData() override; - ScopedVector elements_; + ElementsVector elements_; int64_t identifier_; bool is_chunked_; bool last_chunk_appended_; diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 5381ab6de..485210fee 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -99,20 +99,20 @@ net::URLRequest::ReferrerPolicy GetURLRequestReferrerPolicy( net::URLRequest::ReferrerPolicy net_referrer_policy = net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE; switch (static_cast(policy)) { - case blink::WebReferrerPolicyAlways: - case blink::WebReferrerPolicyNever: - case blink::WebReferrerPolicyOrigin: + case blink::kWebReferrerPolicyAlways: + case blink::kWebReferrerPolicyNever: + case blink::kWebReferrerPolicyOrigin: net_referrer_policy = net::URLRequest::NEVER_CLEAR_REFERRER; break; - case blink::WebReferrerPolicyNoReferrerWhenDowngrade: + case blink::kWebReferrerPolicyNoReferrerWhenDowngrade: net_referrer_policy = net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE; break; - case blink::WebReferrerPolicyOriginWhenCrossOrigin: + case blink::kWebReferrerPolicyOriginWhenCrossOrigin: net_referrer_policy = net::URLRequest::ORIGIN_ONLY_ON_TRANSITION_CROSS_ORIGIN; break; - case blink::WebReferrerPolicyDefault: + case blink::kWebReferrerPolicyDefault: default: net_referrer_policy = command_line->HasSwitch(switches::kReducedReferrerGranularity) @@ -138,9 +138,9 @@ std::string GetURLRequestReferrer(const GURL& referrer_url) { blink::WebString FilePathStringToWebString( const base::FilePath::StringType& str) { #if defined(OS_POSIX) - return blink::WebString::fromUTF8(str); + return blink::WebString::FromUTF8(str); #elif defined(OS_WIN) - return blink::WebString::fromUTF16(str); + return blink::WebString::FromUTF16(str); #endif } @@ -176,10 +176,10 @@ void GetHeaderMap(const blink::WebURLRequest& request, referrer_(referrer) { } - void visitHeader(const blink::WebString& name, + void VisitHeader(const blink::WebString& name, const blink::WebString& value) override { - const base::string16& nameStr = name.utf16(); - const base::string16& valueStr = value.utf16(); + const base::string16& nameStr = name.Utf16(); + const base::string16& valueStr = value.Utf16(); if (base::LowerCaseEqualsASCII(nameStr, kReferrerLowerCase)) *referrer_ = GURL(valueStr); else @@ -192,7 +192,7 @@ void GetHeaderMap(const blink::WebURLRequest& request, }; HeaderVisitor visitor(&map, &referrer); - request.visitHTTPHeaderFields(&visitor); + request.VisitHTTPHeaderFields(&visitor); } // Read |source| into |map|. @@ -215,8 +215,8 @@ void SetHeaderMap(const CefRequest::HeaderMap& map, blink::WebURLRequest& request) { CefRequest::HeaderMap::const_iterator it = map.begin(); for (; it != map.end(); ++it) { - request.setHTTPHeaderField(blink::WebString::fromUTF16(it->first), - blink::WebString::fromUTF16(it->second)); + request.SetHTTPHeaderField(blink::WebString::FromUTF16(it->first), + blink::WebString::FromUTF16(it->second)); } } @@ -494,8 +494,8 @@ void CefRequestImpl::Get(net::URLRequest* request, bool changed_only) const { if (ShouldSet(kChangedPostData, changed_only)) { if (postdata_.get()) { - request->set_upload(base::WrapUnique( - static_cast(postdata_.get())->Get())); + request->set_upload( + static_cast(postdata_.get())->Get()); } else if (request->get_upload()) { request->set_upload(std::unique_ptr()); } @@ -530,33 +530,33 @@ void CefRequestImpl::Set( } void CefRequestImpl::Set(const blink::WebURLRequest& request) { - DCHECK(!request.isNull()); + DCHECK(!request.IsNull()); base::AutoLock lock_scope(lock_); CHECK_READONLY_RETURN_VOID(); Reset(); - url_ = request.url(); - method_ = request.httpMethod().utf8(); + url_ = request.Url(); + method_ = request.HttpMethod().Utf8(); ::GetHeaderMap(request, headermap_, referrer_url_); referrer_policy_ = - static_cast(request.getReferrerPolicy()); + static_cast(request.GetReferrerPolicy()); - const blink::WebHTTPBody& body = request.httpBody(); - if (!body.isNull()) { + const blink::WebHTTPBody& body = request.HttpBody(); + if (!body.IsNull()) { postdata_ = new CefPostDataImpl(); static_cast(postdata_.get())->Set(body); } - first_party_for_cookies_ = request.firstPartyForCookies(); + first_party_for_cookies_ = request.FirstPartyForCookies(); - if (request.getCachePolicy() == blink::WebCachePolicy::BypassingCache) + if (request.GetCachePolicy() == blink::WebCachePolicy::kBypassingCache) flags_ |= UR_FLAG_SKIP_CACHE; - if (request.allowStoredCredentials()) + if (request.AllowStoredCredentials()) flags_ |= UR_FLAG_ALLOW_CACHED_CREDENTIALS; - if (request.reportUploadProgress()) + if (request.ReportUploadProgress()) flags_ |= UR_FLAG_REPORT_UPLOAD_PROGRESS; } @@ -564,18 +564,18 @@ void CefRequestImpl::Get(blink::WebURLRequest& request, int64& upload_data_size) const { base::AutoLock lock_scope(lock_); - request.setRequestContext(blink::WebURLRequest::RequestContextInternal); - request.setURL(url_); - request.setHTTPMethod(blink::WebString::fromUTF8(method_)); + request.SetRequestContext(blink::WebURLRequest::kRequestContextInternal); + request.SetURL(url_); + request.SetHTTPMethod(blink::WebString::FromUTF8(method_)); if (!referrer_url_.is_empty()) { const blink::WebString& referrer = - blink::WebSecurityPolicy::generateReferrerHeader( + blink::WebSecurityPolicy::GenerateReferrerHeader( static_cast(referrer_policy_), url_, - blink::WebString::fromUTF8(referrer_url_.spec())); - if (!referrer.isEmpty()) { - request.setHTTPReferrer( + blink::WebString::FromUTF8(referrer_url_.spec())); + if (!referrer.IsEmpty()) { + request.SetHTTPReferrer( referrer, static_cast(referrer_policy_)); } @@ -583,9 +583,9 @@ void CefRequestImpl::Get(blink::WebURLRequest& request, if (postdata_.get()) { blink::WebHTTPBody body; - body.initialize(); + body.Initialize(); static_cast(postdata_.get())->Get(body); - request.setHTTPBody(body); + request.SetHTTPBody(body); if (flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS) { // Attempt to determine the upload data size. @@ -602,33 +602,33 @@ void CefRequestImpl::Get(blink::WebURLRequest& request, ::SetHeaderMap(headermap_, request); if (!first_party_for_cookies_.is_empty()) - request.setFirstPartyForCookies(first_party_for_cookies_); + request.SetFirstPartyForCookies(first_party_for_cookies_); - request.setCachePolicy((flags_ & UR_FLAG_SKIP_CACHE) ? - blink::WebCachePolicy::BypassingCache : - blink::WebCachePolicy::UseProtocolCachePolicy); + request.SetCachePolicy((flags_ & UR_FLAG_SKIP_CACHE) ? + blink::WebCachePolicy::kBypassingCache : + blink::WebCachePolicy::kUseProtocolCachePolicy); - SETBOOLFLAG(request, flags_, setAllowStoredCredentials, + SETBOOLFLAG(request, flags_, SetAllowStoredCredentials, UR_FLAG_ALLOW_CACHED_CREDENTIALS); - SETBOOLFLAG(request, flags_, setReportUploadProgress, + SETBOOLFLAG(request, flags_, SetReportUploadProgress, UR_FLAG_REPORT_UPLOAD_PROGRESS); } // static void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params, blink::WebURLRequest& request) { - request.setURL(params.url); + request.SetURL(params.url); if (!params.method.empty()) - request.setHTTPMethod(blink::WebString::fromASCII(params.method)); + request.SetHTTPMethod(blink::WebString::FromASCII(params.method)); if (params.referrer.is_valid()) { const blink::WebString& referrer = - blink::WebSecurityPolicy::generateReferrerHeader( + blink::WebSecurityPolicy::GenerateReferrerHeader( static_cast(params.referrer_policy), params.url, - blink::WebString::fromUTF8(params.referrer.spec())); - if (!referrer.isEmpty()) { - request.setHTTPReferrer( + blink::WebString::FromUTF8(params.referrer.spec())); + if (!referrer.IsEmpty()) { + request.SetHTTPReferrer( referrer, static_cast(params.referrer_policy)); } @@ -638,59 +638,54 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params, for (net::HttpUtil::HeadersIterator i(params.headers.begin(), params.headers.end(), "\n"); i.GetNext(); ) { - request.addHTTPHeaderField(blink::WebString::fromUTF8(i.name()), - blink::WebString::fromUTF8(i.values())); + request.AddHTTPHeaderField(blink::WebString::FromUTF8(i.name()), + blink::WebString::FromUTF8(i.values())); } } if (params.upload_data.get()) { - const base::string16& method = request.httpMethod().utf16(); + const base::string16& method = request.HttpMethod().Utf16(); if (method == base::ASCIIToUTF16("GET") || method == base::ASCIIToUTF16("HEAD")) { - request.setHTTPMethod(blink::WebString::fromASCII("POST")); + request.SetHTTPMethod(blink::WebString::FromASCII("POST")); } // The comparison performed by httpHeaderField() is case insensitive. - if (request.httpHeaderField(blink::WebString::fromASCII( + if (request.HttpHeaderField(blink::WebString::FromASCII( net::HttpRequestHeaders::kContentType)).length()== 0) { - request.setHTTPHeaderField( - blink::WebString::fromASCII(net::HttpRequestHeaders::kContentType), - blink::WebString::fromASCII(kApplicationFormURLEncoded)); + request.SetHTTPHeaderField( + blink::WebString::FromASCII(net::HttpRequestHeaders::kContentType), + blink::WebString::FromASCII(kApplicationFormURLEncoded)); } blink::WebHTTPBody body; - body.initialize(); - - const ScopedVector& elements = - params.upload_data->elements(); - ScopedVector::const_iterator it = - elements.begin(); - for (; it != elements.end(); ++it) { - const net::UploadElement& element = **it; - if (element.type() == net::UploadElement::TYPE_BYTES) { + body.Initialize(); + + for (const auto& element : params.upload_data->elements()) { + if (element->type() == net::UploadElement::TYPE_BYTES) { blink::WebData data; - data.assign(element.bytes(), element.bytes_length()); - body.appendData(data); - } else if (element.type() == net::UploadElement::TYPE_FILE) { - body.appendFile(FilePathStringToWebString(element.file_path().value())); + data.Assign(element->bytes(), element->bytes_length()); + body.AppendData(data); + } else if (element->type() == net::UploadElement::TYPE_FILE) { + body.AppendFile(FilePathStringToWebString(element->file_path().value())); } else { NOTREACHED(); } } - request.setHTTPBody(body); + request.SetHTTPBody(body); } if (params.first_party_for_cookies.is_valid()) - request.setFirstPartyForCookies(params.first_party_for_cookies); + request.SetFirstPartyForCookies(params.first_party_for_cookies); - request.setCachePolicy((params.load_flags & UR_FLAG_SKIP_CACHE) ? - blink::WebCachePolicy::BypassingCache : - blink::WebCachePolicy::UseProtocolCachePolicy); + request.SetCachePolicy((params.load_flags & UR_FLAG_SKIP_CACHE) ? + blink::WebCachePolicy::kBypassingCache : + blink::WebCachePolicy::kUseProtocolCachePolicy); - SETBOOLFLAG(request, params.load_flags, setAllowStoredCredentials, + SETBOOLFLAG(request, params.load_flags, SetAllowStoredCredentials, UR_FLAG_ALLOW_CACHED_CREDENTIALS); - SETBOOLFLAG(request, params.load_flags, setReportUploadProgress, + SETBOOLFLAG(request, params.load_flags, SetReportUploadProgress, UR_FLAG_REPORT_UPLOAD_PROGRESS); } @@ -984,11 +979,9 @@ void CefPostDataImpl::Set(const net::UploadData& data) { CefRefPtr postelem; - const ScopedVector& elements = data.elements(); - ScopedVector::const_iterator it = elements.begin(); - for (; it != elements.end(); ++it) { + for (const auto& element : data.elements()) { postelem = CefPostDataElement::Create(); - static_cast(postelem.get())->Set(**it); + static_cast(postelem.get())->Set(*element); AddElement(postelem); } } @@ -1018,27 +1011,28 @@ void CefPostDataImpl::Set(const net::UploadDataStream& data_stream) { void CefPostDataImpl::Get(net::UploadData& data) const { base::AutoLock lock_scope(lock_); - ScopedVector data_elements; - ElementVector::const_iterator it = elements_.begin(); - for (; it != elements_.end(); ++it) { - net::UploadElement* element = new net::UploadElement(); - static_cast(it->get())->Get(*element); - data_elements.push_back(element); + net::UploadData::ElementsVector data_elements; + for (const auto& element : elements_) { + std::unique_ptr data_element = + base::MakeUnique(); + static_cast(element.get())->Get( + *data_element.get()); + data_elements.push_back(std::move(data_element)); } data.swap_elements(&data_elements); } -net::UploadDataStream* CefPostDataImpl::Get() const { +std::unique_ptr CefPostDataImpl::Get() const { base::AutoLock lock_scope(lock_); UploadElementReaders element_readers; - ElementVector::const_iterator it = elements_.begin(); - for (; it != elements_.end(); ++it) { - element_readers.push_back(base::WrapUnique( - static_cast(it->get())->Get())); + for (const auto& element : elements_) { + element_readers.push_back( + static_cast(element.get())->Get()); } - return new net::ElementsUploadDataStream(std::move(element_readers), 0); + return base::MakeUnique( + std::move(element_readers), 0); } void CefPostDataImpl::Set(const blink::WebHTTPBody& data) { @@ -1049,9 +1043,9 @@ void CefPostDataImpl::Set(const blink::WebHTTPBody& data) { CefRefPtr postelem; blink::WebHTTPBody::Element element; - size_t size = data.elementCount(); + size_t size = data.ElementCount(); for (size_t i = 0; i < size; ++i) { - if (data.elementAt(i, element)) { + if (data.ElementAt(i, element)) { postelem = CefPostDataElement::Create(); static_cast(postelem.get())->Set(element); AddElement(postelem); @@ -1066,10 +1060,10 @@ void CefPostDataImpl::Get(blink::WebHTTPBody& data) const { ElementVector::const_iterator it = elements_.begin(); for (; it != elements_.end(); ++it) { static_cast(it->get())->Get(element); - if (element.type == blink::WebHTTPBody::Element::TypeData) { - data.appendData(element.data); - } else if (element.type == blink::WebHTTPBody::Element::TypeFile) { - data.appendFile(element.filePath); + if (element.type == blink::WebHTTPBody::Element::kTypeData) { + data.AppendData(element.data); + } else if (element.type == blink::WebHTTPBody::Element::kTypeFile) { + data.AppendFile(element.file_path); } else { NOTREACHED(); } @@ -1284,22 +1278,22 @@ void CefPostDataElementImpl::Get(net::UploadElement& element) const { } } -net::UploadElementReader* CefPostDataElementImpl::Get() const { +std::unique_ptr CefPostDataElementImpl::Get() const { base::AutoLock lock_scope(lock_); if (type_ == PDE_TYPE_BYTES) { net::UploadElement* element = new net::UploadElement(); element->SetToBytes(static_cast(data_.bytes.bytes), data_.bytes.size); - return new BytesElementReader(base::WrapUnique(element)); + return base::MakeUnique(base::WrapUnique(element)); } else if (type_ == PDE_TYPE_FILE) { net::UploadElement* element = new net::UploadElement(); base::FilePath path = base::FilePath(CefString(&data_.filename)); element->SetToFilePath(path); - return new FileElementReader(base::WrapUnique(element)); + return base::MakeUnique(base::WrapUnique(element)); } else { NOTREACHED(); - return NULL; + return nullptr; } } @@ -1309,11 +1303,11 @@ void CefPostDataElementImpl::Set(const blink::WebHTTPBody::Element& element) { CHECK_READONLY_RETURN_VOID(); } - if (element.type == blink::WebHTTPBody::Element::TypeData) { + if (element.type == blink::WebHTTPBody::Element::kTypeData) { SetToBytes(element.data.size(), - static_cast(element.data.data())); - } else if (element.type == blink::WebHTTPBody::Element::TypeFile) { - SetToFile(element.filePath.utf16()); + static_cast(element.data.Data())); + } else if (element.type == blink::WebHTTPBody::Element::kTypeFile) { + SetToFile(element.file_path.Utf16()); } else { NOTREACHED(); } @@ -1323,13 +1317,13 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const { base::AutoLock lock_scope(lock_); if (type_ == PDE_TYPE_BYTES) { - element.type = blink::WebHTTPBody::Element::TypeData; - element.data.assign( + element.type = blink::WebHTTPBody::Element::kTypeData; + element.data.Assign( static_cast(data_.bytes.bytes), data_.bytes.size); } else if (type_ == PDE_TYPE_FILE) { - element.type = blink::WebHTTPBody::Element::TypeFile; - element.filePath.assign( - blink::WebString::fromUTF16(CefString(&data_.filename))); + element.type = blink::WebHTTPBody::Element::kTypeFile; + element.file_path.Assign( + blink::WebString::FromUTF16(CefString(&data_.filename))); } else { NOTREACHED(); } diff --git a/libcef/common/request_impl.h b/libcef/common/request_impl.h index 2c3f3a079..134c6877d 100644 --- a/libcef/common/request_impl.h +++ b/libcef/common/request_impl.h @@ -8,6 +8,8 @@ #include +#include + #include "include/cef_request.h" #include "base/synchronization/lock.h" @@ -166,7 +168,7 @@ class CefPostDataImpl : public CefPostData { void Set(const net::UploadData& data); void Set(const net::UploadDataStream& data_stream); void Get(net::UploadData& data) const; - net::UploadDataStream* Get() const; + std::unique_ptr Get() const; void Set(const blink::WebHTTPBody& data); void Get(blink::WebHTTPBody& data) const; @@ -217,7 +219,7 @@ class CefPostDataElementImpl : public CefPostDataElement { void Set(const net::UploadElement& element); void Set(const net::UploadElementReader& element_reader); void Get(net::UploadElement& element) const; - net::UploadElementReader* Get() const; + std::unique_ptr Get() const; void Set(const blink::WebHTTPBody::Element& element); void Get(blink::WebHTTPBody::Element& element) const; diff --git a/libcef/common/response_impl.cc b/libcef/common/response_impl.cc index adf6dc1e3..b4c27754c 100644 --- a/libcef/common/response_impl.cc +++ b/libcef/common/response_impl.cc @@ -185,25 +185,25 @@ void CefResponseImpl::SetResponseHeaders( } void CefResponseImpl::Set(const blink::WebURLResponse& response) { - DCHECK(!response.isNull()); + DCHECK(!response.IsNull()); base::AutoLock lock_scope(lock_); CHECK_READONLY_RETURN_VOID(); blink::WebString str; - status_code_ = response.httpStatusCode(); - str = response.httpStatusText(); - status_text_ = str.utf16(); - str = response.mimeType(); - mime_type_ = str.utf16(); + status_code_ = response.HttpStatusCode(); + str = response.HttpStatusText(); + status_text_ = str.Utf16(); + str = response.MimeType(); + mime_type_ = str.Utf16(); class HeaderVisitor : public blink::WebHTTPHeaderVisitor { public: explicit HeaderVisitor(HeaderMap* map) : map_(map) {} - void visitHeader(const blink::WebString& name, + void VisitHeader(const blink::WebString& name, const blink::WebString& value) override { - map_->insert(std::make_pair(name.utf16(), value.utf16())); + map_->insert(std::make_pair(name.Utf16(), value.Utf16())); } private: @@ -211,7 +211,7 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) { }; HeaderVisitor visitor(&header_map_); - response.visitHTTPHeaderFields(&visitor); + response.VisitHTTPHeaderFields(&visitor); } void CefResponseImpl::Set(const net::URLRequest* request) { diff --git a/libcef/common/value_base.cc b/libcef/common/value_base.cc index 5ca561488..c24664249 100644 --- a/libcef/common/value_base.cc +++ b/libcef/common/value_base.cc @@ -199,3 +199,40 @@ void CefValueController::TakeFrom(CefValueController* other) { } } } + +void CefValueController::Swap(void* old_value, void* new_value) { + DCHECK(old_value && new_value && old_value != new_value); + + // Controller should already be locked. + DCHECK(locked()); + + if (owner_value_ == old_value) + owner_value_ = new_value; + + if (!reference_map_.empty()) { + ReferenceMap::iterator it = reference_map_.find(old_value); + if (it != reference_map_.end()) { + // References should only be added once. + DCHECK(reference_map_.find(new_value) == reference_map_.end()); + reference_map_.insert(std::make_pair(new_value, it->second)); + reference_map_.erase(it); + } + } + + if (!dependency_map_.empty()) { + DependencyMap::iterator it = dependency_map_.find(old_value); + if (it != dependency_map_.end()) { + dependency_map_.insert(std::make_pair(new_value, it->second)); + dependency_map_.erase(it); + } + + it = dependency_map_.begin(); + for (; it != dependency_map_.end(); ++it) { + DependencySet::iterator dit = it->second.find(old_value); + if (dit != it->second.end()) { + it->second.insert(new_value); + it->second.erase(dit); + } + } + } +} diff --git a/libcef/common/value_base.h b/libcef/common/value_base.h index a26db5676..4a53894a5 100644 --- a/libcef/common/value_base.h +++ b/libcef/common/value_base.h @@ -109,6 +109,11 @@ class CefValueController // |other|. The |other| controller must already be locked. void TakeFrom(CefValueController* other); + // Replace all instances of |old_value| with |new_value|. Used in cases where + // move semantics may move the contents of an object without retaining the + // object pointer itself. + void Swap(void* old_value, void* new_value); + protected: friend class base::RefCountedThreadSafe; diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index 0d2341087..2c40512dc 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -13,7 +13,7 @@ // static CefRefPtr CefValue::Create() { - return new CefValueImpl(base::Value::CreateNullValue().release()); + return new CefValueImpl(new base::Value()); } // static @@ -25,9 +25,8 @@ CefRefPtr CefValueImpl::GetOrCreateRefOrCopy( DCHECK(value); if (value->IsType(base::Value::Type::BINARY)) { - base::BinaryValue* binary_value = static_cast(value); return new CefValueImpl(CefBinaryValueImpl::GetOrCreateRef( - binary_value, parent_value, controller)); + value, parent_value, controller)); } if (value->IsType(base::Value::Type::DICTIONARY)) { @@ -73,42 +72,48 @@ void CefValueImpl::SetValue(base::Value* value) { SetValueInternal(value); } -base::Value* CefValueImpl::CopyOrTransferValue( - void* new_parent_value, - bool new_read_only, +base::Value* CefValueImpl::CopyOrDetachValue( CefValueController* new_controller) { base::AutoLock lock_scope(lock_); if (binary_value_) { - base::BinaryValue* value = - static_cast(binary_value_.get())-> - CopyOrDetachValue(new_controller); - binary_value_ = CefBinaryValueImpl::GetOrCreateRef( - value, new_parent_value, new_controller); - return value; + return static_cast(binary_value_.get())-> + CopyOrDetachValue(new_controller); } if (dictionary_value_) { - base::DictionaryValue* value = - static_cast(dictionary_value_.get())-> - CopyOrDetachValue(new_controller); - dictionary_value_ = CefDictionaryValueImpl::GetOrCreateRef( - value, new_parent_value, new_read_only, new_controller); - return value; + return static_cast(dictionary_value_.get())-> + CopyOrDetachValue(new_controller); } if (list_value_) { - base::ListValue* value = - static_cast(list_value_.get())-> - CopyOrDetachValue(new_controller); - list_value_ = CefListValueImpl::GetOrCreateRef( - value, new_parent_value, new_read_only, new_controller); - return value; + return static_cast(list_value_.get())-> + CopyOrDetachValue(new_controller); } return value_->DeepCopy(); } +void CefValueImpl::SwapValue( + base::Value* new_value, + void* new_parent_value, + CefValueController* new_controller) { + base::AutoLock lock_scope(lock_); + + if (binary_value_) { + binary_value_ = CefBinaryValueImpl::GetOrCreateRef( + new_value, new_parent_value, new_controller); + } else if (dictionary_value_) { + dictionary_value_ = CefDictionaryValueImpl::GetOrCreateRef( + static_cast(new_value), new_parent_value, + false, new_controller); + } else if (list_value_) { + list_value_ = CefListValueImpl::GetOrCreateRef( + static_cast(new_value), new_parent_value, + false, new_controller); + } +} + bool CefValueImpl::IsValid() { base::AutoLock lock_scope(lock_); @@ -292,7 +297,7 @@ CefRefPtr CefValueImpl::GetList() { } bool CefValueImpl::SetNull() { - SetValue(base::Value::CreateNullValue().release()); + SetValue(new base::Value()); return true; } @@ -312,7 +317,7 @@ bool CefValueImpl::SetDouble(double value) { } bool CefValueImpl::SetString(const CefString& value) { - SetValue(new base::StringValue(value.ToString())); + SetValue(new base::Value(value.ToString())); return true; } @@ -348,8 +353,7 @@ void CefValueImpl::SetValueInternal(base::Value* value) { if (value) { switch (value->GetType()) { case base::Value::Type::BINARY: - binary_value_ = new CefBinaryValueImpl( - static_cast(value), true); + binary_value_ = new CefBinaryValueImpl(value, true); return; case base::Value::Type::DICTIONARY: dictionary_value_ = new CefDictionaryValueImpl( @@ -430,7 +434,7 @@ CefRefPtr CefBinaryValue::Create(const void* data, // static CefRefPtr CefBinaryValueImpl::GetOrCreateRef( - base::BinaryValue* value, + base::Value* value, void* parent_value, CefValueController* controller) { DCHECK(value); @@ -445,28 +449,28 @@ CefRefPtr CefBinaryValueImpl::GetOrCreateRef( CefBinaryValueImpl::kReference, controller); } -CefBinaryValueImpl::CefBinaryValueImpl(base::BinaryValue* value, +CefBinaryValueImpl::CefBinaryValueImpl(base::Value* value, bool will_delete) - : CefValueBase( + : CefValueBase( value, NULL, will_delete ? kOwnerWillDelete : kOwnerNoDelete, true, NULL) { } CefBinaryValueImpl::CefBinaryValueImpl(char* data, size_t data_size) - : CefValueBase( - new base::BinaryValue(std::vector(data, data + data_size)), + : CefValueBase( + new base::Value(std::vector(data, data + data_size)), NULL, kOwnerWillDelete, true, NULL) { } -base::BinaryValue* CefBinaryValueImpl::CopyValue() { +base::Value* CefBinaryValueImpl::CopyValue() { CEF_VALUE_VERIFY_RETURN(false, NULL); return const_value().DeepCopy(); } -base::BinaryValue* CefBinaryValueImpl::CopyOrDetachValue( +base::Value* CefBinaryValueImpl::CopyOrDetachValue( CefValueController* new_controller) { - base::BinaryValue* new_value; + base::Value* new_value; if (!will_delete()) { // Copy the value. @@ -480,21 +484,21 @@ base::BinaryValue* CefBinaryValueImpl::CopyOrDetachValue( return new_value; } -bool CefBinaryValueImpl::IsSameValue(const base::BinaryValue* that) { +bool CefBinaryValueImpl::IsSameValue(const base::Value* that) { CEF_VALUE_VERIFY_RETURN(false, false); return (&const_value() == that); } -bool CefBinaryValueImpl::IsEqualValue(const base::BinaryValue* that) { +bool CefBinaryValueImpl::IsEqualValue(const base::Value* that) { CEF_VALUE_VERIFY_RETURN(false, false); return const_value().Equals(that); } -base::BinaryValue* CefBinaryValueImpl::GetValueUnsafe() { +base::Value* CefBinaryValueImpl::GetValueUnsafe() { if (!VerifyAttached()) return NULL; controller()->AssertLockAcquired(); - return const_cast(&const_value()); + return const_cast(&const_value()); } bool CefBinaryValueImpl::IsValid() { @@ -559,11 +563,11 @@ size_t CefBinaryValueImpl::GetData(void* buffer, return size; } -CefBinaryValueImpl::CefBinaryValueImpl(base::BinaryValue* value, +CefBinaryValueImpl::CefBinaryValueImpl(base::Value* value, void* parent_value, ValueMode value_mode, CefValueController* controller) - : CefValueBase( + : CefValueBase( value, parent_value, value_mode, true, controller) { } @@ -823,8 +827,7 @@ CefRefPtr CefDictionaryValueImpl::GetBinary( if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value) && out_value->IsType(base::Value::Type::BINARY)) { - base::BinaryValue* binary_value = - static_cast(const_cast(out_value)); + base::Value* binary_value = const_cast(out_value); return CefBinaryValueImpl::GetOrCreateRef(binary_value, const_cast(&const_value()), controller()); } @@ -881,15 +884,15 @@ bool CefDictionaryValueImpl::SetValue(const CefString& key, CefValueImpl* impl = static_cast(value.get()); DCHECK(impl); - base::Value* new_value = - impl->CopyOrTransferValue(mutable_value(), false, controller()); - SetInternal(key, new_value); + base::Value* new_value = impl->CopyOrDetachValue(controller()); + base::Value* actual_value = SetInternal(key, new_value); + impl->SwapValue(actual_value, mutable_value(), controller()); return true; } bool CefDictionaryValueImpl::SetNull(const CefString& key) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(key, base::Value::CreateNullValue().release()); + SetInternal(key, new base::Value()); return true; } @@ -914,7 +917,7 @@ bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) { bool CefDictionaryValueImpl::SetString(const CefString& key, const CefString& value) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(key, new base::StringValue(value.ToString())); + SetInternal(key, new base::Value(value.ToString())); return true; } @@ -971,11 +974,12 @@ bool CefDictionaryValueImpl::RemoveInternal(const CefString& key) { return true; } -void CefDictionaryValueImpl::SetInternal(const CefString& key, - base::Value* value) { +base::Value* CefDictionaryValueImpl::SetInternal(const CefString& key, + base::Value* value) { DCHECK(value); RemoveInternal(key); mutable_value()->SetWithoutPathExpansion(base::StringPiece(key), value); + return value; } CefDictionaryValueImpl::CefDictionaryValueImpl( @@ -1107,7 +1111,7 @@ bool CefListValueImpl::SetSize(size_t size) { RemoveInternal(i); } else if (size > 0) { // Expand the list size. - mutable_value()->Set(size-1, base::Value::CreateNullValue()); + mutable_value()->Set(size-1, base::MakeUnique()); } return true; } @@ -1230,8 +1234,7 @@ CefRefPtr CefListValueImpl::GetBinary(size_t index) { if (const_value().Get(index, &out_value) && out_value->IsType(base::Value::Type::BINARY)) { - base::BinaryValue* binary_value = - static_cast(const_cast(out_value)); + base::Value* binary_value = const_cast(out_value); return CefBinaryValueImpl::GetOrCreateRef(binary_value, const_cast(&const_value()), controller()); } @@ -1284,15 +1287,15 @@ bool CefListValueImpl::SetValue(size_t index, CefRefPtr value) { CefValueImpl* impl = static_cast(value.get()); DCHECK(impl); - base::Value* new_value = - impl->CopyOrTransferValue(mutable_value(), false, controller()); - SetInternal(index, new_value); + base::Value* new_value = impl->CopyOrDetachValue(controller()); + base::Value* actual_value = SetInternal(index, new_value); + impl->SwapValue(actual_value, mutable_value(), controller()); return true; } bool CefListValueImpl::SetNull(size_t index) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(index, base::Value::CreateNullValue().release()); + SetInternal(index, new base::Value()); return true; } @@ -1316,7 +1319,7 @@ bool CefListValueImpl::SetDouble(size_t index, double value) { bool CefListValueImpl::SetString(size_t index, const CefString& value) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(index, new base::StringValue(value.ToString())); + SetInternal(index, new base::Value(value.ToString())); return true; } @@ -1353,28 +1356,52 @@ bool CefListValueImpl::SetList(size_t index, CefRefPtr value) { } bool CefListValueImpl::RemoveInternal(size_t index) { + // base::Value now uses move semantics which means that Remove() will return + // a new base::Value object with the moved contents of the base::Value that + // exists in the implementation std::vector. Consequently we use Get() to + // retrieve the actual base::Value pointer as it exists in the std::vector. + const base::Value* actual_value = nullptr; + if (!const_value().Get(index, &actual_value)) + return false; + DCHECK(actual_value); + std::unique_ptr out_value; if (!mutable_value()->Remove(index, &out_value)) return false; // Remove the value. - controller()->Remove(out_value.get(), true); + controller()->Remove(const_cast(actual_value), true); // Only list and dictionary types may have dependencies. if (out_value->IsType(base::Value::Type::LIST) || out_value->IsType(base::Value::Type::DICTIONARY)) { - controller()->RemoveDependencies(out_value.get()); + controller()->RemoveDependencies(const_cast(actual_value)); } return true; } -void CefListValueImpl::SetInternal(size_t index, base::Value* value) { +base::Value* CefListValueImpl::SetInternal(size_t index, base::Value* value) { DCHECK(value); + if (RemoveInternal(index)) mutable_value()->Insert(index, base::WrapUnique(value)); else - mutable_value()->Set(index, value); + mutable_value()->Set(index, base::WrapUnique(value)); + + // base::Value now uses move semantics which means that Insert()/Set() will + // move the contents of the passed-in base::Value instead of keeping the same + // object. Consequently we use Get() to retrieve the actual base::Value + // pointer as it exists in the std::vector. + const base::Value* actual_value = nullptr; + const_value().Get(index, &actual_value); + DCHECK(actual_value); + + // |value| will have been deleted at this point. Update the controller to + // reference |actual_value| instead. + controller()->Swap(value, const_cast(actual_value)); + + return const_cast(actual_value); } CefListValueImpl::CefListValueImpl( diff --git a/libcef/common/values_impl.h b/libcef/common/values_impl.h index 48b68fcc8..6de24a715 100644 --- a/libcef/common/values_impl.h +++ b/libcef/common/values_impl.h @@ -44,10 +44,12 @@ class CefValueImpl : public CefValue { // Copy a simple value or transfer ownership of a complex value. If ownership // of the value is tranferred then this object's internal reference to the - // value will be updated and remain valid. - base::Value* CopyOrTransferValue(void* new_parent_value, - bool new_read_only, - CefValueController* new_controller); + // value will be updated and remain valid. base::Value now uses move semantics + // so we need to perform the copy and swap in two steps. + base::Value* CopyOrDetachValue(CefValueController* new_controller); + void SwapValue(base::Value* new_value, + void* new_parent_value, + CefValueController* new_controller); // Returns a reference to the underlying data. Access must be protected by // calling AcquireLock/ReleaseLock. @@ -126,11 +128,11 @@ class CefValueImpl : public CefValue { // CefBinaryValue implementation class CefBinaryValueImpl - : public CefValueBase { + : public CefValueBase { public: // Get or create a reference value. static CefRefPtr GetOrCreateRef( - base::BinaryValue* value, + base::Value* value, void* parent_value, CefValueController* controller); @@ -140,7 +142,7 @@ class CefBinaryValueImpl // longer valid. Use GetOrCreateRef instead of this constructor if |value| is // owned by some other object and you do not plan to explicitly call // Detach(NULL). - CefBinaryValueImpl(base::BinaryValue* value, + CefBinaryValueImpl(base::Value* value, bool will_delete); // The data will always be copied. @@ -148,18 +150,18 @@ class CefBinaryValueImpl size_t data_size); // Return a copy of the value. - base::BinaryValue* CopyValue(); + base::Value* CopyValue(); // If this value is a reference then return a copy. Otherwise, detach and // transfer ownership of the value. - base::BinaryValue* CopyOrDetachValue(CefValueController* new_controller); + base::Value* CopyOrDetachValue(CefValueController* new_controller); - bool IsSameValue(const base::BinaryValue* that); - bool IsEqualValue(const base::BinaryValue* that); + bool IsSameValue(const base::Value* that); + bool IsEqualValue(const base::Value* that); // Returns the underlying value. Access must be protected by calling // lock/unlock on the controller. - base::BinaryValue* GetValueUnsafe(); + base::Value* GetValueUnsafe(); // CefBinaryValue methods. bool IsValid() override; @@ -175,7 +177,7 @@ class CefBinaryValueImpl private: // See the CefValueBase constructor for usage. Binary values are always // read-only. - CefBinaryValueImpl(base::BinaryValue* value, + CefBinaryValueImpl(base::Value* value, void* parent_value, ValueMode value_mode, CefValueController* controller); @@ -265,7 +267,7 @@ class CefDictionaryValueImpl CefValueController* controller); bool RemoveInternal(const CefString& key); - void SetInternal(const CefString& key, base::Value* value); + base::Value* SetInternal(const CefString& key, base::Value* value); DISALLOW_COPY_AND_ASSIGN(CefDictionaryValueImpl); }; @@ -346,7 +348,7 @@ class CefListValueImpl CefValueController* controller); bool RemoveInternal(size_t index); - void SetInternal(size_t index, base::Value* value); + base::Value* SetInternal(size_t index, base::Value* value); DISALLOW_COPY_AND_ASSIGN(CefListValueImpl); }; diff --git a/libcef/common/widevine_loader.h b/libcef/common/widevine_loader.h index 01a55370e..b7711fcb0 100644 --- a/libcef/common/widevine_loader.h +++ b/libcef/common/widevine_loader.h @@ -47,7 +47,7 @@ class CefWidevineLoader { #endif private: - friend struct base::DefaultLazyInstanceTraits; + friend struct base::LazyInstanceTraitsBase; // Members are only accessed before context initialization or on the UI // thread. diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index 2764e6653..ecc8fe088 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -46,7 +46,6 @@ using blink::WebString; using blink::WebURL; using blink::WebView; - // CefBrowserImpl static methods. // ----------------------------------------------------------------------------- @@ -99,9 +98,9 @@ bool CefBrowserImpl::IsLoading() { CEF_REQUIRE_RT_RETURN(false); if (render_view()->GetWebView()) { - blink::WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); + blink::WebFrame* main_frame = render_view()->GetWebView()->MainFrame(); if (main_frame) - return main_frame->toWebLocalFrame()->isLoading(); + return main_frame->ToWebLocalFrame()->IsLoading(); } return false; } @@ -109,26 +108,26 @@ bool CefBrowserImpl::IsLoading() { void CefBrowserImpl::Reload() { CEF_REQUIRE_RT_RETURN_VOID(); - if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { - render_view()->GetWebView()->mainFrame()->reload( - blink::WebFrameLoadType::Reload); + if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) { + render_view()->GetWebView()->MainFrame()->Reload( + blink::WebFrameLoadType::kReload); } } void CefBrowserImpl::ReloadIgnoreCache() { CEF_REQUIRE_RT_RETURN_VOID(); - if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { - render_view()->GetWebView()->mainFrame()->reload( - blink::WebFrameLoadType::ReloadBypassingCache); + if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) { + render_view()->GetWebView()->MainFrame()->Reload( + blink::WebFrameLoadType::kReloadBypassingCache); } } void CefBrowserImpl::StopLoad() { CEF_REQUIRE_RT_RETURN_VOID(); - if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) - render_view()->GetWebView()->mainFrame()->stopLoading(); + if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) + render_view()->GetWebView()->MainFrame()->StopLoading(); } int CefBrowserImpl::GetIdentifier() { @@ -153,16 +152,16 @@ bool CefBrowserImpl::IsPopup() { bool CefBrowserImpl::HasDocument() { CEF_REQUIRE_RT_RETURN(false); - if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) - return !render_view()->GetWebView()->mainFrame()->document().isNull(); + if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) + return !render_view()->GetWebView()->MainFrame()->GetDocument().IsNull(); return false; } CefRefPtr CefBrowserImpl::GetMainFrame() { CEF_REQUIRE_RT_RETURN(nullptr); - if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) - return GetWebFrameImpl(render_view()->GetWebView()->mainFrame()).get(); + if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) + return GetWebFrameImpl(render_view()->GetWebView()->MainFrame()).get(); return nullptr; } @@ -170,8 +169,8 @@ CefRefPtr CefBrowserImpl::GetFocusedFrame() { CEF_REQUIRE_RT_RETURN(nullptr); if (render_view()->GetWebView() && - render_view()->GetWebView()->focusedFrame()) { - return GetWebFrameImpl(render_view()->GetWebView()->focusedFrame()).get(); + render_view()->GetWebView()->FocusedFrame()) { + return GetWebFrameImpl(render_view()->GetWebView()->FocusedFrame()).get(); } return nullptr; } @@ -187,14 +186,20 @@ CefRefPtr CefBrowserImpl::GetFrame(const CefString& name) { blink::WebView* web_view = render_view()->GetWebView(); if (web_view) { - const blink::WebString& frame_name = blink::WebString::fromUTF16(name); + const blink::WebString& frame_name = blink::WebString::FromUTF16(name); // Search by assigned frame name (Frame::name). - WebFrame* frame = web_view->findFrameByName(frame_name, - web_view->mainFrame()); + WebFrame* frame = web_view->FindFrameByName(frame_name, + web_view->MainFrame()); if (!frame) { // Search by unique frame name (Frame::uniqueName). - frame = webkit_glue::FindFrameByUniqueName(frame_name, - web_view->mainFrame()); + const std::string& searchname = name; + for (WebFrame* cur_frame = web_view->MainFrame(); cur_frame; + cur_frame = cur_frame->TraverseNext()) { + if (webkit_glue::GetUniqueName(cur_frame) == searchname) { + frame = cur_frame; + break; + } + } } if (frame) return GetWebFrameImpl(frame).get(); @@ -209,8 +214,8 @@ size_t CefBrowserImpl::GetFrameCount() { int count = 0; if (render_view()->GetWebView()) { - for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame; - frame = frame->traverseNext()) { + for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame; + frame = frame->TraverseNext()) { count++; } } @@ -225,8 +230,8 @@ void CefBrowserImpl::GetFrameIdentifiers(std::vector& identifiers) { identifiers.clear(); if (render_view()->GetWebView()) { - for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame; - frame = frame->traverseNext()) { + for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame; + frame = frame->TraverseNext()) { identifiers.push_back(webkit_glue::GetIdentifier(frame)); } } @@ -239,9 +244,9 @@ void CefBrowserImpl::GetFrameNames(std::vector& names) { names.clear(); if (render_view()->GetWebView()) { - for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame; - frame = frame->traverseNext()) { - names.push_back(CefString(frame->uniqueName().utf8())); + for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame; + frame = frame->TraverseNext()) { + names.push_back(webkit_glue::GetUniqueName(frame)); } } } @@ -287,7 +292,7 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) { blink::WebURLRequest request; CefRequestImpl::Get(params, request); - web_frame->loadRequest(request); + web_frame->LoadRequest(request); } bool CefBrowserImpl::SendProcessMessage(CefProcessId target_process, @@ -322,10 +327,11 @@ CefRefPtr CefBrowserImpl::GetWebFrameImpl( CefRefPtr framePtr(new CefFrameImpl(this, frame)); frames_.insert(std::make_pair(frame_id, framePtr)); - int64_t parent_id = frame->parent() == NULL ? + const int64_t parent_id = frame->Parent() == NULL ? webkit_glue::kInvalidFrameId : - webkit_glue::GetIdentifier(frame->parent()); - base::string16 name = frame->uniqueName().utf16(); + webkit_glue::GetIdentifier(frame->Parent()); + const base::string16& name = + base::UTF8ToUTF16(webkit_glue::GetUniqueName(frame)); // Notify the browser that the frame has been identified. Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name)); @@ -335,8 +341,8 @@ CefRefPtr CefBrowserImpl::GetWebFrameImpl( CefRefPtr CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) { if (frame_id == webkit_glue::kInvalidFrameId) { - if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) - return GetWebFrameImpl(render_view()->GetWebView()->mainFrame()); + if (render_view()->GetWebView() && render_view()->GetWebView()->MainFrame()) + return GetWebFrameImpl(render_view()->GetWebView()->MainFrame()); return nullptr; } @@ -347,8 +353,8 @@ CefRefPtr CefBrowserImpl::GetWebFrameImpl(int64_t frame_id) { if (render_view()->GetWebView()) { // Check if the frame exists but we don't know about it yet. - for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame; - frame = frame->traverseNext()) { + for (WebFrame* frame = render_view()->GetWebView()->MainFrame(); frame; + frame = frame->TraverseNext()) { if (webkit_glue::GetIdentifier(frame) == frame_id) return GetWebFrameImpl(frame); } @@ -416,12 +422,12 @@ void CefBrowserImpl::DidFailLoad( } void CefBrowserImpl::DidFinishLoad(blink::WebLocalFrame* frame) { - blink::WebDataSource* ds = frame->dataSource(); + blink::WebDataSource* ds = frame->DataSource(); Send(new CefHostMsg_DidFinishLoad(routing_id(), webkit_glue::GetIdentifier(frame), - ds->getRequest().url(), - !frame->parent(), - ds->response().httpStatusCode())); + ds->GetRequest().Url(), + !frame->Parent(), + ds->GetResponse().HttpStatusCode())); OnLoadEnd(frame); } @@ -468,12 +474,12 @@ void CefBrowserImpl::FocusedNodeChanged(const blink::WebNode& node) { CefRefPtr handler = app->GetRenderProcessHandler(); if (handler.get()) { - if (node.isNull()) { + if (node.IsNull()) { handler->OnFocusedNodeChanged(this, GetFocusedFrame(), NULL); } else { - const blink::WebDocument& document = node.document(); - if (!document.isNull()) { - blink::WebFrame* frame = document.frame(); + const blink::WebDocument& document = node.GetDocument(); + if (!document.IsNull()) { + blink::WebFrame* frame = document.GetFrame(); CefRefPtr documentImpl = new CefDOMDocumentImpl(this, frame); handler->OnFocusedNodeChanged(this, @@ -489,7 +495,7 @@ void CefBrowserImpl::FocusedNodeChanged(const blink::WebNode& node) { // Based on ExtensionHelper::DraggableRegionsChanged. void CefBrowserImpl::DraggableRegionsChanged(blink::WebFrame* frame) { blink::WebVector webregions = - frame->document().draggableRegions(); + frame->GetDocument().DraggableRegions(); std::vector regions; for (size_t i = 0; i < webregions.size(); ++i) { Cef_DraggableRegion_Params region; @@ -561,8 +567,8 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { DCHECK_GE(script_start_line, 0); if (is_javascript) { - web_frame->executeScript( - WebScriptSource(blink::WebString::fromUTF8(code), + web_frame->ExecuteScript( + WebScriptSource(blink::WebString::FromUTF8(code), GURL(script_url), script_start_line)); success = true; @@ -586,17 +592,17 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { DCHECK(!command.empty()); if (base::LowerCaseEqualsASCII(command, "getsource")) { - if (web_frame->isWebLocalFrame()) { - response = blink::WebFrameContentDumper::dumpAsMarkup( - web_frame->toWebLocalFrame()).utf8(); + if (web_frame->IsWebLocalFrame()) { + response = blink::WebFrameContentDumper::DumpAsMarkup( + web_frame->ToWebLocalFrame()).Utf8(); success = true; } } else if (base::LowerCaseEqualsASCII(command, "gettext")) { response = webkit_glue::DumpDocumentText(web_frame); success = true; - } else if (web_frame->isWebLocalFrame() && - web_frame->toWebLocalFrame()->executeCommand( - blink::WebString::fromUTF8(command))) { + } else if (web_frame->IsWebLocalFrame() && + web_frame->ToWebLocalFrame()->ExecuteCommand( + blink::WebString::FromUTF8(command))) { success = true; } } @@ -614,7 +620,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { params.arguments.GetString(0, &string); params.arguments.GetString(1, &url); - web_frame->loadHTMLString(string, GURL(url)); + web_frame->LoadHTMLString(string, GURL(url)); } } } else { @@ -697,7 +703,8 @@ void CefBrowserImpl::OnLoadEnd(blink::WebLocalFrame* frame) { CefRefPtr load_handler = handler->GetLoadHandler(); if (load_handler.get()) { CefRefPtr cef_frame = GetWebFrameImpl(frame); - int httpStatusCode = frame->dataSource()->response().httpStatusCode(); + int httpStatusCode = + frame->DataSource()->GetResponse().HttpStatusCode(); load_handler->OnLoadEnd(this, cef_frame.get(), httpStatusCode); } } @@ -719,8 +726,8 @@ void CefBrowserImpl::OnLoadError(blink::WebLocalFrame* frame, CefRefPtr cef_frame = GetWebFrameImpl(frame); const cef_errorcode_t errorCode = static_cast(error.reason); - const std::string& errorText = error.localizedDescription.utf8(); - const GURL& failedUrl = error.unreachableURL; + const std::string& errorText = error.localized_description.Utf8(); + const GURL& failedUrl = error.unreachable_url; load_handler->OnLoadError(this, cef_frame.get(), errorCode, errorText, failedUrl.spec()); } diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index 9570e76e1..a46137973 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -103,10 +103,10 @@ namespace { // Stub implementation of blink::WebPrerenderingSupport. class CefPrerenderingSupport : public blink::WebPrerenderingSupport { private: - void add(const blink::WebPrerender& prerender) override {} - void cancel(const blink::WebPrerender& prerender) override {} - void abandon(const blink::WebPrerender& prerender) override {} - void prefetchFinished() override {} + void Add(const blink::WebPrerender& prerender) override {} + void Cancel(const blink::WebPrerender& prerender) override {} + void Abandon(const blink::WebPrerender& prerender) override {} + void PrefetchFinished() override {} }; // Stub implementation of blink::WebPrerendererClient. @@ -116,7 +116,7 @@ class CefPrerendererClient : public content::RenderViewObserver, explicit CefPrerendererClient(content::RenderView* render_view) : content::RenderViewObserver(render_view) { DCHECK(render_view); - render_view->GetWebView()->setPrerendererClient(this); + render_view->GetWebView()->SetPrerendererClient(this); } private: @@ -128,8 +128,8 @@ class CefPrerendererClient : public content::RenderViewObserver, } // WebPrerendererClient methods: - void willAddPrerender(blink::WebPrerender* prerender) override {} - bool isPrefetchOnly() override { return false; } + void WillAddPrerender(blink::WebPrerender* prerender) override {} + bool IsPrefetchOnly() override { return false; } }; void AppendParams(const std::vector& additional_names, @@ -151,13 +151,13 @@ void AppendParams(const std::vector& additional_names, } for (size_t i = 0; i < additional_names.size(); ++i) { - names[existing_size + i] = blink::WebString::fromUTF16(additional_names[i]); + names[existing_size + i] = blink::WebString::FromUTF16(additional_names[i]); values[existing_size + i] = - blink::WebString::fromUTF16(additional_values[i]); + blink::WebString::FromUTF16(additional_values[i]); } - existing_names->swap(names); - existing_values->swap(values); + existing_names->Swap(names); + existing_values->Swap(values); } } // namespace @@ -219,7 +219,7 @@ CefRefPtr CefContentRendererClient::GetBrowserForMainFrame( for (; it != browsers_.end(); ++it) { content::RenderView* render_view = it->second->render_view(); if (render_view && render_view->GetWebView() && - render_view->GetWebView()->mainFrame() == frame) { + render_view->GetWebView()->MainFrame() == frame) { return it->second; } } @@ -269,7 +269,7 @@ void CefContentRendererClient::WebKitInitialized() { CefV8IsolateCreated(); // TODO(cef): Enable these once the implementation supports it. - blink::WebRuntimeFeatures::enableNotifications(false); + blink::WebRuntimeFeatures::EnableNotifications(false); const CefContentClient::SchemeInfoList* schemes = CefContentClient::Get()->GetCustomSchemes(); @@ -280,15 +280,15 @@ void CefContentRendererClient::WebKitInitialized() { for (; it != schemes->end(); ++it) { const CefContentClient::SchemeInfo& info = *it; const blink::WebString& scheme = - blink::WebString::fromUTF8(info.scheme_name); + blink::WebString::FromUTF8(info.scheme_name); if (info.is_local) - webkit_glue::registerURLSchemeAsLocal(scheme); + webkit_glue::RegisterURLSchemeAsLocal(scheme); if (info.is_display_isolated) - blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(scheme); + blink::WebSecurityPolicy::RegisterURLSchemeAsDisplayIsolated(scheme); if (info.is_secure) - webkit_glue::registerURLSchemeAsSecure(scheme); + webkit_glue::RegisterURLSchemeAsSecure(scheme); if (info.is_cors_enabled) - webkit_glue::registerURLSchemeAsCORSEnabled(scheme); + webkit_glue::RegisterURLSchemeAsCORSEnabled(scheme); } } @@ -298,10 +298,10 @@ void CefContentRendererClient::WebKitInitialized() { const Cef_CrossOriginWhiteListEntry_Params& entry = cross_origin_whitelist_entries_[i]; GURL gurl = GURL(entry.source_origin); - blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( + blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry( gurl, - blink::WebString::fromUTF8(entry.target_protocol), - blink::WebString::fromUTF8(entry.target_domain), + blink::WebString::FromUTF8(entry.target_protocol), + blink::WebString::FromUTF8(entry.target_domain), entry.allow_target_subdomains); } cross_origin_whitelist_entries_.clear(); @@ -411,7 +411,7 @@ void CefContentRendererClient::RenderThreadStarted() { base::MessageLoop::current()->AddDestructionObserver(this); } - blink::WebPrerenderingSupport::initialize(new CefPrerenderingSupport()); + blink::WebPrerenderingSupport::Initialize(new CefPrerenderingSupport()); // Retrieve the new render thread information synchronously. CefProcessHostMsg_GetNewRenderThreadInfo_Params params; @@ -475,6 +475,11 @@ void CefContentRendererClient::RenderFrameCreated( if (extensions::ExtensionsEnabled()) extensions_renderer_client_->RenderFrameCreated(render_frame); + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + if (!command_line->HasSwitch(switches::kDisableSpellChecking)) + new SpellCheckProvider(render_frame, spellcheck_.get()); + BrowserCreated(render_frame->GetRenderView(), render_frame); } @@ -487,8 +492,16 @@ void CefContentRendererClient::RenderViewCreated( const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (!command_line->HasSwitch(switches::kDisableSpellChecking)) - new SpellCheckProvider(render_view, spellcheck_.get()); + if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { + // This is a workaround keeping the behavior that, the Blink side spellcheck + // enabled state is initialized on RenderView creation. + // TODO(xiaochengh): Design better way to sync between Chrome-side and + // Blink-side spellcheck enabled states. See crbug.com/710097. + if (SpellCheckProvider* provider = + SpellCheckProvider::Get(render_view->GetMainRenderFrame())) { + provider->EnableSpellcheck(spellcheck_->IsSpellcheckEnabled()); + } + } BrowserCreated(render_view, render_view->GetMainRenderFrame()); } @@ -498,7 +511,7 @@ bool CefContentRendererClient::OverrideCreatePlugin( blink::WebLocalFrame* frame, const blink::WebPluginParams& params, blink::WebPlugin** plugin) { - std::string orig_mime_type = params.mimeType.utf8(); + std::string orig_mime_type = params.mime_type.Utf8(); if (extensions::ExtensionsEnabled() && !extensions_renderer_client_->OverrideCreatePlugin(render_frame, params)) { @@ -509,7 +522,7 @@ bool CefContentRendererClient::OverrideCreatePlugin( CefViewHostMsg_GetPluginInfo_Output output; render_frame->Send(new CefViewHostMsg_GetPluginInfo( render_frame->GetRoutingID(), url, render_frame->IsMainFrame(), - frame->top()->getSecurityOrigin(), orig_mime_type, &output)); + frame->Top()->GetSecurityOrigin(), orig_mime_type, &output)); *plugin = CreatePlugin(render_frame, frame, params, output); return true; @@ -530,7 +543,7 @@ bool CefContentRendererClient::HandleNavigation( application->GetRenderProcessHandler(); if (handler.get()) { CefRefPtr browserPtr = - CefBrowserImpl::GetBrowserForMainFrame(frame->top()); + CefBrowserImpl::GetBrowserForMainFrame(frame->Top()); if (browserPtr.get()) { CefRefPtr framePtr = browserPtr->GetWebFrameImpl(frame); CefRefPtr requestPtr(CefRequest::Create()); @@ -541,22 +554,22 @@ bool CefContentRendererClient::HandleNavigation( cef_navigation_type_t navigation_type = NAVIGATION_OTHER; switch (type) { - case blink::WebNavigationTypeLinkClicked: + case blink::kWebNavigationTypeLinkClicked: navigation_type = NAVIGATION_LINK_CLICKED; break; - case blink::WebNavigationTypeFormSubmitted: + case blink::kWebNavigationTypeFormSubmitted: navigation_type = NAVIGATION_FORM_SUBMITTED; break; - case blink::WebNavigationTypeBackForward: + case blink::kWebNavigationTypeBackForward: navigation_type = NAVIGATION_BACK_FORWARD; break; - case blink::WebNavigationTypeReload: + case blink::kWebNavigationTypeReload: navigation_type = NAVIGATION_RELOAD; break; - case blink::WebNavigationTypeFormResubmitted: + case blink::kWebNavigationTypeFormResubmitted: navigation_type = NAVIGATION_FORM_RESUBMITTED; break; - case blink::WebNavigationTypeOther: + case blink::kWebNavigationTypeOther: navigation_type = NAVIGATION_OTHER; break; } @@ -579,7 +592,7 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame, bool is_initial_navigation, bool is_server_redirect, bool* send_referrer) { - DCHECK(!frame->parent()); + DCHECK(!frame->Parent()); // For now, we skip the rest for POST submissions. This is because // http://crbug.com/101395 is more likely to cause compatibility issues @@ -646,6 +659,12 @@ void CefContentRendererClient::RunScriptsAtDocumentEnd( extensions_renderer_client_->RunScriptsAtDocumentEnd(render_frame); } +void CefContentRendererClient::RunScriptsAtDocumentIdle( + content::RenderFrame* render_frame) { + if (extensions::ExtensionsEnabled()) + extensions_renderer_client_->RunScriptsAtDocumentIdle(render_frame); +} + void CefContentRendererClient::WillDestroyCurrentMessageLoop() { base::AutoLock lock_scope(single_process_cleanup_lock_); single_process_cleanup_complete_ = true; @@ -663,7 +682,7 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin( const std::string& identifier = output.group_identifier; CefViewHostMsg_GetPluginInfo_Status status = output.status; GURL url(original_params.url); - std::string orig_mime_type = original_params.mimeType.utf8(); + std::string orig_mime_type = original_params.mime_type.Utf8(); CefPluginPlaceholder* placeholder = NULL; // If the browser plugin is to be enabled, this should be handled by the @@ -680,16 +699,16 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin( if (info.mime_types[i].mime_type == actual_mime_type) { AppendParams(info.mime_types[i].additional_param_names, info.mime_types[i].additional_param_values, - ¶ms.attributeNames, ¶ms.attributeValues); + ¶ms.attribute_names, ¶ms.attribute_values); break; } } - if (params.mimeType.isNull() && (actual_mime_type.size() > 0)) { + if (params.mime_type.IsNull() && (actual_mime_type.size() > 0)) { // Webkit might say that mime type is null while we already know the // actual mime type via CefViewHostMsg_GetPluginInfo. In that case // we should use what we know since WebpluginDelegateProxy does some // specific initializations based on this information. - params.mimeType = blink::WebString::fromUTF8(actual_mime_type.c_str()); + params.mime_type = blink::WebString::FromUTF8(actual_mime_type); } auto create_blocked_plugin = [&render_frame, &frame, ¶ms, &info, @@ -717,7 +736,7 @@ blink::WebPlugin* CefContentRendererClient::CreatePlugin( PowerSaverInfo power_saver_info = PowerSaverInfo::Get(render_frame, power_saver_setting_on, params, - info, frame->document().url()); + info, frame->GetDocument().Url()); if (power_saver_info.blocked_for_background_tab || is_prerendering || !power_saver_info.poster_attribute.empty()) { placeholder = CefPluginPlaceholder::CreateBlockedPlugin( @@ -848,7 +867,7 @@ void CefContentRendererClient::BrowserCreated( // WebKit layer, or if it would be exposed as an WebView instance method; the // current implementation uses a static variable, and WebKit needs to be // patched in order to make it work for each WebView instance - render_view->GetWebView()->setUseExternalPopupMenusThisInstance( + render_view->GetWebView()->SetUseExternalPopupMenusThisInstance( !params.is_windowless); #endif diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/content_renderer_client.h index 53e553ddf..6ccf5865d 100644 --- a/libcef/renderer/content_renderer_client.h +++ b/libcef/renderer/content_renderer_client.h @@ -127,6 +127,7 @@ class CefContentRendererClient : public content::ContentRendererClient, override; void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override; void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override; + void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override; // MessageLoop::DestructionObserver implementation. void WillDestroyCurrentMessageLoop() override; diff --git a/libcef/renderer/dom_document_impl.cc b/libcef/renderer/dom_document_impl.cc index 3b8516fcb..f22557aff 100644 --- a/libcef/renderer/dom_document_impl.cc +++ b/libcef/renderer/dom_document_impl.cc @@ -29,8 +29,8 @@ CefDOMDocumentImpl::CefDOMDocumentImpl(CefBrowserImpl* browser, WebFrame* frame) : browser_(browser), frame_(frame) { - const WebDocument& document = frame_->document(); - DCHECK(!document.isNull()); + const WebDocument& document = frame_->GetDocument(); + DCHECK(!document.IsNull()); } CefDOMDocumentImpl::~CefDOMDocumentImpl() { @@ -44,29 +44,29 @@ CefDOMDocumentImpl::Type CefDOMDocumentImpl::GetType() { if (!VerifyContext()) return DOM_DOCUMENT_TYPE_UNKNOWN; - const WebDocument& document = frame_->document(); - if (document.isHTMLDocument()) + const WebDocument& document = frame_->GetDocument(); + if (document.IsHTMLDocument()) return DOM_DOCUMENT_TYPE_HTML; - if (document.isXHTMLDocument()) + if (document.IsXHTMLDocument()) return DOM_DOCUMENT_TYPE_XHTML; - if (document.isPluginDocument()) + if (document.IsPluginDocument()) return DOM_DOCUMENT_TYPE_PLUGIN; return DOM_DOCUMENT_TYPE_UNKNOWN; } CefRefPtr CefDOMDocumentImpl::GetDocument() { - const WebDocument& document = frame_->document(); - return GetOrCreateNode(document.document()); + const WebDocument& document = frame_->GetDocument(); + return GetOrCreateNode(document.GetDocument()); } CefRefPtr CefDOMDocumentImpl::GetBody() { - const WebDocument& document = frame_->document(); - return GetOrCreateNode(document.body()); + const WebDocument& document = frame_->GetDocument(); + return GetOrCreateNode(document.Body()); } CefRefPtr CefDOMDocumentImpl::GetHead() { - WebDocument document = frame_->document(); - return GetOrCreateNode(document.head()); + WebDocument document = frame_->GetDocument(); + return GetOrCreateNode(document.Head()); } CefString CefDOMDocumentImpl::GetTitle() { @@ -74,89 +74,89 @@ CefString CefDOMDocumentImpl::GetTitle() { if (!VerifyContext()) return str; - const WebDocument& document = frame_->document(); - const WebString& title = document.title(); - if (!title.isNull()) - str = title.utf16(); + const WebDocument& document = frame_->GetDocument(); + const WebString& title = document.Title(); + if (!title.IsNull()) + str = title.Utf16(); return str; } CefRefPtr CefDOMDocumentImpl::GetElementById(const CefString& id) { - const WebDocument& document = frame_->document(); - return GetOrCreateNode(document.getElementById(WebString::fromUTF16(id))); + const WebDocument& document = frame_->GetDocument(); + return GetOrCreateNode(document.GetElementById(WebString::FromUTF16(id))); } CefRefPtr CefDOMDocumentImpl::GetFocusedNode() { - const WebDocument& document = frame_->document(); - return GetOrCreateNode(document.focusedElement()); + const WebDocument& document = frame_->GetDocument(); + return GetOrCreateNode(document.FocusedElement()); } bool CefDOMDocumentImpl::HasSelection() { - if (!VerifyContext() || !frame_->isWebLocalFrame()) + if (!VerifyContext() || !frame_->IsWebLocalFrame()) return false; - return frame_->toWebLocalFrame()->hasSelection(); + return frame_->ToWebLocalFrame()->HasSelection(); } int CefDOMDocumentImpl::GetSelectionStartOffset() { - if (!VerifyContext() || !frame_->isWebLocalFrame()) + if (!VerifyContext() || !frame_->IsWebLocalFrame()) return 0; - blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame(); - if (!!local_frame->hasSelection()) + blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame(); + if (!!local_frame->HasSelection()) return 0; - const WebRange& range = local_frame->selectionRange(); - if (range.isNull()) + const WebRange& range = local_frame->SelectionRange(); + if (range.IsNull()) return 0; - return range.startOffset(); + return range.StartOffset(); } int CefDOMDocumentImpl::GetSelectionEndOffset() { - if (!VerifyContext() || !frame_->isWebLocalFrame()) + if (!VerifyContext() || !frame_->IsWebLocalFrame()) return 0; - blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame(); - if (!!local_frame->hasSelection()) + blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame(); + if (!!local_frame->HasSelection()) return 0; - const WebRange& range = local_frame->selectionRange(); - if (range.isNull()) + const WebRange& range = local_frame->SelectionRange(); + if (range.IsNull()) return 0; - return range.endOffset(); + return range.EndOffset(); } CefString CefDOMDocumentImpl::GetSelectionAsMarkup() { CefString str; - if (!VerifyContext() || !frame_->isWebLocalFrame()) + if (!VerifyContext() || !frame_->IsWebLocalFrame()) return str; - blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame(); - if (!!local_frame->hasSelection()) + blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame(); + if (!!local_frame->HasSelection()) return str; - const WebString& markup = local_frame->selectionAsMarkup(); - if (!markup.isNull()) - str = markup.utf16(); + const WebString& markup = local_frame->SelectionAsMarkup(); + if (!markup.IsNull()) + str = markup.Utf16(); return str; } CefString CefDOMDocumentImpl::GetSelectionAsText() { CefString str; - if (!VerifyContext() || !frame_->isWebLocalFrame()) + if (!VerifyContext() || !frame_->IsWebLocalFrame()) return str; - blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame(); - if (!!local_frame->hasSelection()) + blink::WebLocalFrame* local_frame = frame_->ToWebLocalFrame(); + if (!!local_frame->HasSelection()) return str; - const WebString& text = local_frame->selectionAsText(); - if (!text.isNull()) - str = text.utf16(); + const WebString& text = local_frame->SelectionAsText(); + if (!text.IsNull()) + str = text.Utf16(); return str; } @@ -166,9 +166,9 @@ CefString CefDOMDocumentImpl::GetBaseURL() { if (!VerifyContext()) return str; - const WebDocument& document = frame_->document(); - const WebURL& url = document.baseURL(); - if (!url.isNull()) { + const WebDocument& document = frame_->GetDocument(); + const WebURL& url = document.BaseURL(); + if (!url.IsNull()) { GURL gurl = url; str = gurl.spec(); } @@ -181,9 +181,9 @@ CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL) { if (!VerifyContext()) return str; - const WebDocument& document = frame_->document(); - const WebURL& url = document.completeURL(WebString::fromUTF16(partialURL)); - if (!url.isNull()) { + const WebDocument& document = frame_->GetDocument(); + const WebURL& url = document.CompleteURL(WebString::FromUTF16(partialURL)); + if (!url.IsNull()) { GURL gurl = url; str = gurl.spec(); } @@ -197,7 +197,7 @@ CefRefPtr CefDOMDocumentImpl::GetOrCreateNode( return NULL; // Nodes may potentially be null. - if (node.isNull()) + if (node.IsNull()) return NULL; if (!node_map_.empty()) { diff --git a/libcef/renderer/dom_node_impl.cc b/libcef/renderer/dom_node_impl.cc index 6ccba64cc..1376dfd1b 100644 --- a/libcef/renderer/dom_node_impl.cc +++ b/libcef/renderer/dom_node_impl.cc @@ -41,7 +41,7 @@ CefDOMNodeImpl::CefDOMNodeImpl(CefRefPtr document, CefDOMNodeImpl::~CefDOMNodeImpl() { CEF_REQUIRE_RT(); - if (document_.get() && !node_.isNull()) { + if (document_.get() && !node_.IsNull()) { // Remove the node from the document. document_->RemoveNode(node_); } @@ -58,14 +58,14 @@ bool CefDOMNodeImpl::IsText() { if (!VerifyContext()) return false; - return node_.isTextNode(); + return node_.IsTextNode(); } bool CefDOMNodeImpl::IsElement() { if (!VerifyContext()) return false; - return node_.isElementNode(); + return node_.IsElementNode(); } // Logic copied from RenderViewImpl::IsEditableNode. @@ -73,19 +73,19 @@ bool CefDOMNodeImpl::IsEditable() { if (!VerifyContext()) return false; - if (node_.isContentEditable()) + if (node_.IsContentEditable()) return true; - if (node_.isElementNode()) { - const WebElement& element = node_.toConst(); + if (node_.IsElementNode()) { + const WebElement& element = node_.ToConst(); if (webkit_glue::IsTextControlElement(element)) return true; // Also return true if it has an ARIA role of 'textbox'. - for (unsigned i = 0; i < element.attributeCount(); ++i) { - if (base::LowerCaseEqualsASCII(element.attributeLocalName(i).utf8(), + for (unsigned i = 0; i < element.AttributeCount(); ++i) { + if (base::LowerCaseEqualsASCII(element.AttributeLocalName(i).Utf8(), "role")) { - if (base::LowerCaseEqualsASCII(element.attributeValue(i).utf8(), + if (base::LowerCaseEqualsASCII(element.AttributeValue(i).Utf8(), "textbox")) { return true; } @@ -101,9 +101,9 @@ bool CefDOMNodeImpl::IsFormControlElement() { if (!VerifyContext()) return false; - if (node_.isElementNode()) { - const WebElement& element = node_.toConst(); - return element.isFormControlElement(); + if (node_.IsElementNode()) { + const WebElement& element = node_.ToConst(); + return element.IsFormControlElement(); } return false; @@ -114,15 +114,15 @@ CefString CefDOMNodeImpl::GetFormControlElementType() { if (!VerifyContext()) return str; - if (node_.isElementNode()) { - const WebElement& element = node_.toConst(); - if (element.isFormControlElement()) { + if (node_.IsElementNode()) { + const WebElement& element = node_.ToConst(); + if (element.IsFormControlElement()) { // Retrieve the type from the form control element. const WebFormControlElement& formElement = - node_.toConst(); + node_.ToConst(); const base::string16& form_control_type = - formElement.formControlType().utf16(); + formElement.FormControlType().Utf16(); str = form_control_type; } } @@ -138,7 +138,7 @@ bool CefDOMNodeImpl::IsSame(CefRefPtr that) { if (!impl || !impl->VerifyContext()) return false; - return node_.equals(impl->node_); + return node_.Equals(impl->node_); } CefString CefDOMNodeImpl::GetName() { @@ -147,8 +147,8 @@ CefString CefDOMNodeImpl::GetName() { return str; const WebString& name = webkit_glue::GetNodeName(node_); - if (!name.isNull()) - str = name.utf16(); + if (!name.IsNull()) + str = name.Utf16(); return str; } @@ -158,24 +158,24 @@ CefString CefDOMNodeImpl::GetValue() { if (!VerifyContext()) return str; - if (node_.isElementNode()) { - const WebElement& element = node_.toConst(); - if (element.isFormControlElement()) { + if (node_.IsElementNode()) { + const WebElement& element = node_.ToConst(); + if (element.IsFormControlElement()) { // Retrieve the value from the form control element. const WebFormControlElement& formElement = - node_.toConst(); + node_.ToConst(); base::string16 value; const base::string16& form_control_type = - formElement.formControlType().utf16(); + formElement.FormControlType().Utf16(); if (form_control_type == base::ASCIIToUTF16("text")) { const WebInputElement& input_element = - formElement.toConst(); - value = input_element.value().utf16(); + formElement.ToConst(); + value = input_element.Value().Utf16(); } else if (form_control_type == base::ASCIIToUTF16("select-one")) { const WebSelectElement& select_element = - formElement.toConst(); - value = select_element.value().utf16(); + formElement.ToConst(); + value = select_element.Value().Utf16(); } base::TrimWhitespace(value, base::TRIM_LEADING, &value); @@ -184,9 +184,9 @@ CefString CefDOMNodeImpl::GetValue() { } if (str.empty()) { - const WebString& value = node_.nodeValue(); - if (!value.isNull()) - str = value.utf16(); + const WebString& value = node_.NodeValue(); + if (!value.IsNull()) + str = value.Utf16(); } return str; @@ -196,10 +196,10 @@ bool CefDOMNodeImpl::SetValue(const CefString& value) { if (!VerifyContext()) return false; - if (node_.isElementNode()) + if (node_.IsElementNode()) return false; - return webkit_glue::SetNodeValue(node_, WebString::fromUTF16(value)); + return webkit_glue::SetNodeValue(node_, WebString::FromUTF16(value)); } CefString CefDOMNodeImpl::GetAsMarkup() { @@ -208,8 +208,8 @@ CefString CefDOMNodeImpl::GetAsMarkup() { return str; const WebString& markup = webkit_glue::CreateNodeMarkup(node_); - if (!markup.isNull()) - str = markup.utf16(); + if (!markup.IsNull()) + str = markup.Utf16(); return str; } @@ -225,42 +225,42 @@ CefRefPtr CefDOMNodeImpl::GetParent() { if (!VerifyContext()) return NULL; - return document_->GetOrCreateNode(node_.parentNode()); + return document_->GetOrCreateNode(node_.ParentNode()); } CefRefPtr CefDOMNodeImpl::GetPreviousSibling() { if (!VerifyContext()) return NULL; - return document_->GetOrCreateNode(node_.previousSibling()); + return document_->GetOrCreateNode(node_.PreviousSibling()); } CefRefPtr CefDOMNodeImpl::GetNextSibling() { if (!VerifyContext()) return NULL; - return document_->GetOrCreateNode(node_.nextSibling()); + return document_->GetOrCreateNode(node_.NextSibling()); } bool CefDOMNodeImpl::HasChildren() { if (!VerifyContext()) return false; - return !node_.firstChild().isNull(); + return !node_.FirstChild().IsNull(); } CefRefPtr CefDOMNodeImpl::GetFirstChild() { if (!VerifyContext()) return NULL; - return document_->GetOrCreateNode(node_.firstChild()); + return document_->GetOrCreateNode(node_.FirstChild()); } CefRefPtr CefDOMNodeImpl::GetLastChild() { if (!VerifyContext()) return NULL; - return document_->GetOrCreateNode(node_.lastChild()); + return document_->GetOrCreateNode(node_.LastChild()); } CefString CefDOMNodeImpl::GetElementTagName() { @@ -268,15 +268,15 @@ CefString CefDOMNodeImpl::GetElementTagName() { if (!VerifyContext()) return str; - if (!node_.isElementNode()) { + if (!node_.IsElementNode()) { NOTREACHED(); return str; } - const WebElement& element = node_.toConst(); - const WebString& tagname = element.tagName(); - if (!tagname.isNull()) - str = tagname.utf16(); + const WebElement& element = node_.ToConst(); + const WebString& tagname = element.TagName(); + if (!tagname.IsNull()) + str = tagname.Utf16(); return str; } @@ -285,26 +285,26 @@ bool CefDOMNodeImpl::HasElementAttributes() { if (!VerifyContext()) return false; - if (!node_.isElementNode()) { + if (!node_.IsElementNode()) { NOTREACHED(); return false; } - const WebElement& element = node_.toConst(); - return (element.attributeCount() > 0); + const WebElement& element = node_.ToConst(); + return (element.AttributeCount() > 0); } bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) { if (!VerifyContext()) return false; - if (!node_.isElementNode()) { + if (!node_.IsElementNode()) { NOTREACHED(); return false; } - const WebElement& element = node_.toConst(); - return element.hasAttribute(WebString::fromUTF16(attrName)); + const WebElement& element = node_.ToConst(); + return element.HasAttribute(WebString::FromUTF16(attrName)); } CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) { @@ -312,15 +312,15 @@ CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) { if (!VerifyContext()) return str; - if (!node_.isElementNode()) { + if (!node_.IsElementNode()) { NOTREACHED(); return str; } - const WebElement& element = node_.toConst(); - const WebString& attr = element.getAttribute(WebString::fromUTF16(attrName)); - if (!attr.isNull()) - str = attr.utf16(); + const WebElement& element = node_.ToConst(); + const WebString& attr = element.GetAttribute(WebString::FromUTF16(attrName)); + if (!attr.IsNull()) + str = attr.Utf16(); return str; } @@ -329,19 +329,19 @@ void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap) { if (!VerifyContext()) return; - if (!node_.isElementNode()) { + if (!node_.IsElementNode()) { NOTREACHED(); return; } - const WebElement& element = node_.toConst(); - unsigned int len = element.attributeCount(); + const WebElement& element = node_.ToConst(); + unsigned int len = element.AttributeCount(); if (len == 0) return; for (unsigned int i = 0; i < len; ++i) { - base::string16 name = element.attributeLocalName(i).utf16(); - base::string16 value = element.attributeValue(i).utf16(); + base::string16 name = element.AttributeLocalName(i).Utf16(); + base::string16 value = element.AttributeValue(i).Utf16(); attrMap.insert(std::make_pair(name, value)); } } @@ -351,14 +351,14 @@ bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName, if (!VerifyContext()) return false; - if (!node_.isElementNode()) { + if (!node_.IsElementNode()) { NOTREACHED(); return false; } - WebElement element = node_.to(); - element.setAttribute(WebString::fromUTF16(attrName), - WebString::fromUTF16(value)); + WebElement element = node_.To(); + element.SetAttribute(WebString::FromUTF16(attrName), + WebString::FromUTF16(value)); return true; } @@ -367,15 +367,15 @@ CefString CefDOMNodeImpl::GetElementInnerText() { if (!VerifyContext()) return str; - if (!node_.isElementNode()) { + if (!node_.IsElementNode()) { NOTREACHED(); return str; } - WebElement element = node_.to(); - const WebString& text = element.textContent(); - if (!text.isNull()) - str = text.utf16(); + WebElement element = node_.To(); + const WebString& text = element.TextContent(); + if (!text.IsNull()) + str = text.Utf16(); return str; } @@ -385,13 +385,13 @@ CefRect CefDOMNodeImpl::GetElementBounds() { if (!VerifyContext()) return rect; - if (!node_.isElementNode()) { + if (!node_.IsElementNode()) { NOTREACHED(); return rect; } - WebElement element = node_.to(); - blink::WebRect rc = element.boundsInViewport(); + WebElement element = node_.To(); + blink::WebRect rc = element.BoundsInViewport(); rect.Set(rc.x, rc.y, rc.width, rc.height); return rect; @@ -399,7 +399,7 @@ CefRect CefDOMNodeImpl::GetElementBounds() { void CefDOMNodeImpl::Detach() { document_ = NULL; - node_.assign(WebNode()); + node_.Assign(WebNode()); } bool CefDOMNodeImpl::VerifyContext() { @@ -409,7 +409,7 @@ bool CefDOMNodeImpl::VerifyContext() { } if (!document_->VerifyContext()) return false; - if (node_.isNull()) { + if (node_.IsNull()) { NOTREACHED(); return false; } diff --git a/libcef/renderer/extensions/extensions_renderer_client.cc b/libcef/renderer/extensions/extensions_renderer_client.cc index f82e12a26..57e57293b 100644 --- a/libcef/renderer/extensions/extensions_renderer_client.cc +++ b/libcef/renderer/extensions/extensions_renderer_client.cc @@ -53,8 +53,8 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame, const GURL& new_url, bool is_extension_url, bool is_initial_navigation) { - DCHECK(!frame->parent()); - GURL old_url(frame->document().url()); + DCHECK(!frame->Parent()); + GURL old_url(frame->GetDocument().Url()); extensions::RendererExtensionRegistry* extension_registry = extensions::RendererExtensionRegistry::Get(); @@ -62,8 +62,9 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame, // If old_url is still empty and this is an initial navigation, then this is // a window.open operation. We should look at the opener URL. Note that the // opener is a local frame in this case. - if (is_initial_navigation && old_url.is_empty() && frame->opener()) { - blink::WebLocalFrame* opener_frame = frame->opener()->toWebLocalFrame(); + if (is_initial_navigation && old_url.is_empty() && frame->Opener() && + frame->Opener()->IsWebLocalFrame()) { + blink::WebLocalFrame* opener_frame = frame->Opener()->ToWebLocalFrame(); // We usually want to compare against the URL that determines the type of // process. In default Chrome, that's the URL of the opener's top frame and @@ -74,19 +75,19 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame, if (base::CommandLine::ForCurrentProcess()->HasSwitch( ::switches::kSitePerProcess) || extensions::IsIsolateExtensionsEnabled()) - old_url = opener_frame->document().url(); + old_url = opener_frame->GetDocument().Url(); else - old_url = opener_frame->top()->document().url(); + old_url = opener_frame->Top()->GetDocument().Url(); // If we're about to open a normal web page from a same-origin opener stuck // in an extension process (other than the Chrome Web Store), we want to // keep it in process to allow the opener to script it. - blink::WebDocument opener_document = opener_frame->document(); + blink::WebDocument opener_document = opener_frame->GetDocument(); blink::WebSecurityOrigin opener_origin = - opener_document.getSecurityOrigin(); - bool opener_is_extension_url = !opener_origin.isUnique() && + opener_document.GetSecurityOrigin(); + bool opener_is_extension_url = !opener_origin.IsUnique() && extension_registry->GetExtensionOrAppByURL( - opener_document.url()) != nullptr; + opener_document.Url()) != nullptr; const extensions::Extension* opener_top_extension = extension_registry->GetExtensionOrAppByURL(old_url); bool opener_is_web_store = @@ -94,14 +95,14 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame, opener_top_extension->id() == extensions::kWebStoreAppId; if (!is_extension_url && !opener_is_extension_url && !opener_is_web_store && IsStandaloneExtensionProcess() && - opener_origin.canRequest(blink::WebURL(new_url))) + opener_origin.CanRequest(blink::WebURL(new_url))) return false; } // Only consider keeping non-app URLs in an app process if this window // has an opener (in which case it might be an OAuth popup that tries to // script an iframe within the app). - bool should_consider_workaround = !!frame->opener(); + bool should_consider_workaround = !!frame->Opener(); return extensions::CrossesExtensionProcessBoundary( *extension_registry->GetMainThreadExtensionSet(), old_url, new_url, @@ -157,7 +158,7 @@ void CefExtensionsRendererClient::RenderViewCreated( bool CefExtensionsRendererClient::OverrideCreatePlugin( content::RenderFrame* render_frame, const blink::WebPluginParams& params) { - if (params.mimeType.utf8() != content::kBrowserPluginMimeType) + if (params.mime_type.Utf8() != content::kBrowserPluginMimeType) return true; bool guest_view_api_available = false; @@ -174,7 +175,7 @@ bool CefExtensionsRendererClient::WillSendRequest( GURL* new_url) { // Check whether the request should be allowed. If not allowed, we reset the // URL to something invalid to prevent the request and cause an error. - if (url.protocolIs(extensions::kExtensionScheme) && + if (url.ProtocolIs(extensions::kExtensionScheme) && !resource_request_policy_->CanRequestResource(GURL(url), frame, transition_type)) { *new_url = GURL(chrome::kExtensionInvalidRequestURL); @@ -194,6 +195,11 @@ void CefExtensionsRendererClient::RunScriptsAtDocumentEnd( extension_dispatcher_->RunScriptsAtDocumentEnd(render_frame); } +void CefExtensionsRendererClient::RunScriptsAtDocumentIdle( + content::RenderFrame* render_frame) { + extension_dispatcher_->RunScriptsAtDocumentIdle(render_frame); +} + // static bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame, const GURL& url, @@ -232,7 +238,7 @@ bool CefExtensionsRendererClient::ShouldFork(blink::WebLocalFrame* frame, // for subframes, so this check only makes sense for top-level frames. // TODO(alexmos,nasko): Figure out how this check should work when reloading // subframes in --site-per-process mode. - if (!frame->parent() && GURL(frame->document().url()) == url) { + if (!frame->Parent() && GURL(frame->GetDocument().Url()) == url) { if (is_extension_url != IsStandaloneExtensionProcess()) return true; } diff --git a/libcef/renderer/extensions/extensions_renderer_client.h b/libcef/renderer/extensions/extensions_renderer_client.h index 5e150cd7a..2cd157835 100644 --- a/libcef/renderer/extensions/extensions_renderer_client.h +++ b/libcef/renderer/extensions/extensions_renderer_client.h @@ -55,6 +55,7 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient { GURL* new_url); void RunScriptsAtDocumentStart(content::RenderFrame* render_frame); void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame); + void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame); static bool ShouldFork(blink::WebLocalFrame* frame, const GURL& url, diff --git a/libcef/renderer/extensions/print_web_view_helper_delegate.cc b/libcef/renderer/extensions/print_web_view_helper_delegate.cc index f14338702..5b012b79e 100644 --- a/libcef/renderer/extensions/print_web_view_helper_delegate.cc +++ b/libcef/renderer/extensions/print_web_view_helper_delegate.cc @@ -29,13 +29,13 @@ bool CefPrintWebViewHelperDelegate::CancelPrerender( // Return the PDF object element if |frame| is the out of process PDF extension. blink::WebElement CefPrintWebViewHelperDelegate::GetPdfElement( blink::WebLocalFrame* frame) { - GURL url = frame->document().url(); + GURL url = frame->GetDocument().Url(); if (url.SchemeIs(extensions::kExtensionScheme) && url.host() == extension_misc::kPdfExtensionId) { // with id="plugin" is created in // chrome/browser/resources/pdf/pdf.js. - auto plugin_element = frame->document().getElementById("plugin"); - if (!plugin_element.isNull()) { + auto plugin_element = frame->GetDocument().GetElementById("plugin"); + if (!plugin_element.IsNull()) { return plugin_element; } NOTREACHED(); @@ -49,7 +49,7 @@ bool CefPrintWebViewHelperDelegate::IsPrintPreviewEnabled() { bool CefPrintWebViewHelperDelegate::OverridePrint( blink::WebLocalFrame* frame) { - if (!frame->document().isPluginDocument()) + if (!frame->GetDocument().IsPluginDocument()) return false; std::vector mime_handlers = diff --git a/libcef/renderer/frame_impl.cc b/libcef/renderer/frame_impl.cc index b79fda8d2..b935367e3 100644 --- a/libcef/renderer/frame_impl.cc +++ b/libcef/renderer/frame_impl.cc @@ -84,10 +84,10 @@ void CefFrameImpl::ViewSource() { void CefFrameImpl::GetSource(CefRefPtr visitor) { CEF_REQUIRE_RT_RETURN_VOID(); - if (frame_ && frame_->isWebLocalFrame()) { + if (frame_ && frame_->IsWebLocalFrame()) { const CefString& content = - std::string(blink::WebFrameContentDumper::dumpAsMarkup( - frame_->toWebLocalFrame()).utf8()); + std::string(blink::WebFrameContentDumper::DumpAsMarkup( + frame_->ToWebLocalFrame()).Utf8()); visitor->Visit(content); } } @@ -151,7 +151,7 @@ void CefFrameImpl::LoadString(const CefString& string, if (frame_) { GURL gurl = GURL(url.ToString()); - frame_->loadHTMLString(string.ToString(), gurl); + frame_->LoadHTMLString(string.ToString(), gurl); } } @@ -167,8 +167,8 @@ void CefFrameImpl::ExecuteJavaScript(const CefString& jsCode, if (frame_) { GURL gurl = GURL(scriptUrl.ToString()); - frame_->executeScript( - blink::WebScriptSource(WebString::fromUTF16(jsCode.ToString16()), gurl, + frame_->ExecuteScript( + blink::WebScriptSource(WebString::FromUTF16(jsCode.ToString16()), gurl, startLine)); } } @@ -177,15 +177,15 @@ bool CefFrameImpl::IsMain() { CEF_REQUIRE_RT_RETURN(false); if (frame_) - return (frame_->parent() == NULL); + return (frame_->Parent() == NULL); return false; } bool CefFrameImpl::IsFocused() { CEF_REQUIRE_RT_RETURN(false); - if (frame_ && frame_->view()) - return (frame_->view()->focusedFrame() == frame_); + if (frame_ && frame_->View()) + return (frame_->View()->FocusedFrame() == frame_); return false; } @@ -194,7 +194,7 @@ CefString CefFrameImpl::GetName() { CEF_REQUIRE_RT_RETURN(name); if (frame_) - name = frame_->uniqueName().utf16(); + name = webkit_glue::GetUniqueName(frame_); return name; } @@ -208,7 +208,7 @@ CefRefPtr CefFrameImpl::GetParent() { CEF_REQUIRE_RT_RETURN(NULL); if (frame_) { - blink::WebFrame* parent = frame_->parent(); + blink::WebFrame* parent = frame_->Parent(); if (parent) return browser_->GetWebFrameImpl(parent).get(); } @@ -221,7 +221,7 @@ CefString CefFrameImpl::GetURL() { CEF_REQUIRE_RT_RETURN(url); if (frame_) { - GURL gurl = frame_->document().url(); + GURL gurl = frame_->GetDocument().Url(); url = gurl.spec(); } return url; @@ -237,9 +237,9 @@ CefRefPtr CefFrameImpl::GetV8Context() { CEF_REQUIRE_RT_RETURN(NULL); if (frame_) { - v8::Isolate* isolate = blink::mainThreadIsolate(); + v8::Isolate* isolate = blink::MainThreadIsolate(); v8::HandleScope handle_scope(isolate); - return new CefV8ContextImpl(isolate, frame_->mainWorldScriptContext()); + return new CefV8ContextImpl(isolate, frame_->MainWorldScriptContext()); } else { return NULL; } @@ -254,8 +254,8 @@ void CefFrameImpl::VisitDOM(CefRefPtr visitor) { // Create a CefDOMDocumentImpl object that is valid only for the scope of this // method. CefRefPtr documentImpl; - const blink::WebDocument& document = frame_->document(); - if (!document.isNull()) + const blink::WebDocument& document = frame_->GetDocument(); + if (!document.IsNull()) documentImpl = new CefDOMDocumentImpl(browser_, frame_); visitor->Visit(documentImpl.get()); @@ -271,8 +271,8 @@ void CefFrameImpl::Detach() { void CefFrameImpl::ExecuteCommand(const std::string& command) { CEF_REQUIRE_RT_RETURN_VOID(); - if (frame_ && frame_->isWebLocalFrame()) - frame_->toWebLocalFrame()->executeCommand(WebString::fromUTF8(command)); + if (frame_ && frame_->IsWebLocalFrame()) + frame_->ToWebLocalFrame()->ExecuteCommand(WebString::FromUTF8(command)); } diff --git a/libcef/renderer/media/cef_key_systems.cc b/libcef/renderer/media/cef_key_systems.cc index c87959d25..3788c3d5f 100644 --- a/libcef/renderer/media/cef_key_systems.cc +++ b/libcef/renderer/media/cef_key_systems.cc @@ -115,13 +115,13 @@ void AddPepperBasedWidevine( for (size_t i = 0; i < codecs.size(); ++i) { if (codecs[i] == kCdmSupportedCodecVp8) supported_codecs |= media::EME_CODEC_WEBM_VP8; - if (codecs[i] == kCdmSupportedCodecVp9) + if (codecs[i] == kCdmSupportedCodecVp9) { supported_codecs |= media::EME_CODEC_WEBM_VP9; + supported_codecs |= media::EME_CODEC_COMMON_VP9; + } #if BUILDFLAG(USE_PROPRIETARY_CODECS) if (codecs[i] == kCdmSupportedCodecAvc1) supported_codecs |= media::EME_CODEC_MP4_AVC1; - if (codecs[i] == kCdmSupportedCodecVp9) - supported_codecs |= media::EME_CODEC_MP4_VP9; #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) } diff --git a/libcef/renderer/plugins/cef_plugin_placeholder.cc b/libcef/renderer/plugins/cef_plugin_placeholder.cc index eb1b5e15c..85ae0c004 100644 --- a/libcef/renderer/plugins/cef_plugin_placeholder.cc +++ b/libcef/renderer/plugins/cef_plugin_placeholder.cc @@ -28,6 +28,7 @@ #include "third_party/WebKit/public/platform/WebMouseEvent.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" +#include "third_party/WebKit/public/web/WebPluginContainer.h" #include "third_party/WebKit/public/web/WebScriptSource.h" #include "third_party/WebKit/public/web/WebView.h" #include "ui/base/l10n/l10n_util.h" @@ -87,7 +88,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateLoadableMissingPlugin( // Will destroy itself when its WebViewPlugin is going away. return new CefPluginPlaceholder(render_frame, frame, params, html_data, - params.mimeType.utf16()); + params.mime_type.Utf16()); } // static @@ -106,8 +107,8 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin( values.SetString("name", name); values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE)); values.SetString("pluginType", - frame->view()->mainFrame()->isWebLocalFrame() && - frame->view()->mainFrame()->document().isPluginDocument() + frame->View()->MainFrame()->IsWebLocalFrame() && + frame->View()->MainFrame()->GetDocument().IsPluginDocument() ? "document" : "embedded"); @@ -117,7 +118,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin( if (!power_saver_info.custom_poster_size.IsEmpty()) { float zoom_factor = - blink::WebView::zoomLevelToZoomFactor(frame->view()->zoomLevel()); + blink::WebView::ZoomLevelToZoomFactor(frame->View()->ZoomLevel()); int width = roundf(power_saver_info.custom_poster_size.width() / zoom_factor); int height = @@ -174,16 +175,16 @@ void CefPluginPlaceholder::ShowPermissionBubbleCallback() { void CefPluginPlaceholder::PluginListChanged() { if (!GetFrame() || !plugin()) return; - blink::WebDocument document = GetFrame()->top()->document(); - if (document.isNull()) + blink::WebDocument document = GetFrame()->Top()->GetDocument(); + if (document.IsNull()) return; CefViewHostMsg_GetPluginInfo_Output output; - std::string mime_type(GetPluginParams().mimeType.utf8()); + std::string mime_type(GetPluginParams().mime_type.Utf8()); render_frame()->Send(new CefViewHostMsg_GetPluginInfo( routing_id(), GURL(GetPluginParams().url), - GetFrame()->parent() == nullptr, - GetFrame()->top()->getSecurityOrigin(), mime_type, &output)); + GetFrame()->Parent() == nullptr, + GetFrame()->Top()->GetSecurityOrigin(), mime_type, &output)); if (output.status == status_) return; blink::WebPlugin* new_plugin = CefContentRendererClient::CreatePlugin( @@ -252,14 +253,18 @@ void CefPluginPlaceholder::ShowContextMenu( content::MenuItem hide_item; hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE; bool is_main_frame_plugin_document = - GetFrame()->view()->mainFrame()->isWebLocalFrame() && - GetFrame()->view()->mainFrame()->document().isPluginDocument(); + GetFrame()->View()->MainFrame()->IsWebLocalFrame() && + GetFrame()->View()->MainFrame()->GetDocument().IsPluginDocument(); hide_item.enabled = !is_main_frame_plugin_document; hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE); params.custom_items.push_back(hide_item); - params.x = event.windowX; - params.y = event.windowY; + blink::WebPoint point(event.PositionInWidget().x, event.PositionInWidget().y); + if (plugin() && plugin()->Container()) + point = plugin()->Container()->LocalToRootFramePoint(point); + + params.x = point.x; + params.y = point.y; context_menu_request_id_ = render_frame()->ShowContextMenu(this, params); g_last_active_menu = this; diff --git a/libcef/renderer/plugins/plugin_preroller.cc b/libcef/renderer/plugins/plugin_preroller.cc index bdfb3b7d9..9efd5446d 100644 --- a/libcef/renderer/plugins/plugin_preroller.cc +++ b/libcef/renderer/plugins/plugin_preroller.cc @@ -76,14 +76,14 @@ void CefPluginPreroller::OnThrottleStateChange() { placeholder->AllowLoading(); blink::WebPluginContainer* container = - throttler_->GetWebPlugin()->container(); - container->setPlugin(placeholder->plugin()); + throttler_->GetWebPlugin()->Container(); + container->SetPlugin(placeholder->plugin()); - bool success = placeholder->plugin()->initialize(container); + bool success = placeholder->plugin()->Initialize(container); DCHECK(success); - container->invalidate(); - container->reportGeometry(); + container->Invalidate(); + container->ReportGeometry(); delete this; } diff --git a/libcef/renderer/render_frame_observer.cc b/libcef/renderer/render_frame_observer.cc index 5cdc7d82d..dca6981c6 100644 --- a/libcef/renderer/render_frame_observer.cc +++ b/libcef/renderer/render_frame_observer.cc @@ -39,7 +39,7 @@ void CefRenderFrameObserver::DidCreateScriptContext( blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); CefRefPtr browserPtr = - CefBrowserImpl::GetBrowserForMainFrame(frame->top()); + CefBrowserImpl::GetBrowserForMainFrame(frame->Top()); if (!browserPtr.get()) return; @@ -52,7 +52,7 @@ void CefRenderFrameObserver::DidCreateScriptContext( CefRefPtr framePtr = browserPtr->GetWebFrameImpl(frame); - v8::Isolate* isolate = blink::mainThreadIsolate(); + v8::Isolate* isolate = blink::MainThreadIsolate(); v8::HandleScope handle_scope(isolate); v8::Context::Scope scope(context); v8::MicrotasksScope microtasks_scope(isolate, @@ -69,7 +69,7 @@ void CefRenderFrameObserver::WillReleaseScriptContext( blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); CefRefPtr browserPtr = - CefBrowserImpl::GetBrowserForMainFrame(frame->top()); + CefBrowserImpl::GetBrowserForMainFrame(frame->Top()); if (browserPtr.get()) { CefRefPtr application = CefContentClient::Get()->application(); if (application.get()) { @@ -78,7 +78,7 @@ void CefRenderFrameObserver::WillReleaseScriptContext( if (handler.get()) { CefRefPtr framePtr = browserPtr->GetWebFrameImpl(frame); - v8::Isolate* isolate = blink::mainThreadIsolate(); + v8::Isolate* isolate = blink::MainThreadIsolate(); v8::HandleScope handle_scope(isolate); // The released context should not be used for script execution. diff --git a/libcef/renderer/render_thread_observer.cc b/libcef/renderer/render_thread_observer.cc index 74a44fc9e..2997d9bab 100644 --- a/libcef/renderer/render_thread_observer.cc +++ b/libcef/renderer/render_thread_observer.cc @@ -60,20 +60,20 @@ void CefRenderThreadObserver::OnModifyCrossOriginWhitelistEntry( const Cef_CrossOriginWhiteListEntry_Params& params) { GURL gurl = GURL(params.source_origin); if (add) { - blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( + blink::WebSecurityPolicy::AddOriginAccessWhitelistEntry( gurl, - blink::WebString::fromUTF8(params.target_protocol), - blink::WebString::fromUTF8(params.target_domain), + blink::WebString::FromUTF8(params.target_protocol), + blink::WebString::FromUTF8(params.target_domain), params.allow_target_subdomains); } else { - blink::WebSecurityPolicy::removeOriginAccessWhitelistEntry( + blink::WebSecurityPolicy::RemoveOriginAccessWhitelistEntry( gurl, - blink::WebString::fromUTF8(params.target_protocol), - blink::WebString::fromUTF8(params.target_domain), + blink::WebString::FromUTF8(params.target_protocol), + blink::WebString::FromUTF8(params.target_domain), params.allow_target_subdomains); } } void CefRenderThreadObserver::OnClearCrossOriginWhitelist() { - blink::WebSecurityPolicy::resetOriginAccessWhitelists(); + blink::WebSecurityPolicy::ResetOriginAccessWhitelists(); } diff --git a/libcef/renderer/render_urlrequest_impl.cc b/libcef/renderer/render_urlrequest_impl.cc index 104be5bfe..a0826576d 100644 --- a/libcef/renderer/render_urlrequest_impl.cc +++ b/libcef/renderer/render_urlrequest_impl.cc @@ -37,24 +37,24 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient { ~CefWebURLLoaderClient() override; // blink::WebURLLoaderClient methods. - bool willFollowRedirect( + bool WillFollowRedirect( WebURLRequest& newRequest, const WebURLResponse& redirectResponse) override; - void didSendData( + void DidSendData( unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; - void didReceiveResponse( + void DidReceiveResponse( const WebURLResponse& response) override; - void didDownloadData(int dataLength, + void DidDownloadData(int dataLength, int encodedDataLength) override; - void didReceiveData(const char* data, + void DidReceiveData(const char* data, int dataLength) override; - void didReceiveCachedMetadata(const char* data, + void DidReceiveCachedMetadata(const char* data, int dataLength) override; - void didFinishLoading(double finishTime, + void DidFinishLoading(double finishTime, int64_t totalEncodedDataLength, int64_t totalEncodedBodyLength) override; - void didFail(const WebURLError& error, + void DidFail(const WebURLError& error, int64_t totalEncodedDataLength, int64_t totalEncodedBodyLength) override; @@ -100,14 +100,14 @@ class CefRenderURLRequest::Context if (!url.is_valid()) return false; - loader_.reset(blink::Platform::current()->createURLLoader()); + loader_.reset(blink::Platform::Current()->CreateURLLoader()); url_client_.reset(new CefWebURLLoaderClient(this, request_->GetFlags())); WebURLRequest urlRequest; static_cast(request_.get())->Get(urlRequest, upload_data_size_); - loader_->loadAsynchronously(urlRequest, url_client_.get()); + loader_->LoadAsynchronously(urlRequest, url_client_.get()); return true; } @@ -122,7 +122,7 @@ class CefRenderURLRequest::Context error_code_ = ERR_ABORTED; // Will result in a call to OnError(). - loader_->cancel(); + loader_->Cancel(); } void OnResponse(const WebURLResponse& response) { @@ -134,7 +134,7 @@ class CefRenderURLRequest::Context responseImpl->Set(response); responseImpl->SetReadOnly(true); - download_data_total_ = response.expectedContentLength(); + download_data_total_ = response.ExpectedContentLength(); } void OnError(const WebURLError& error) { @@ -244,29 +244,29 @@ CefWebURLLoaderClient::CefWebURLLoaderClient( CefWebURLLoaderClient::~CefWebURLLoaderClient() { } -bool CefWebURLLoaderClient::willFollowRedirect( +bool CefWebURLLoaderClient::WillFollowRedirect( WebURLRequest& newRequest, const WebURLResponse& redirectResponse) { return true; } -void CefWebURLLoaderClient::didSendData( +void CefWebURLLoaderClient::DidSendData( unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { if (request_flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS) context_->OnUploadProgress(bytesSent, totalBytesToBeSent); } -void CefWebURLLoaderClient::didReceiveResponse( +void CefWebURLLoaderClient::DidReceiveResponse( const WebURLResponse& response) { context_->OnResponse(response); } -void CefWebURLLoaderClient::didDownloadData(int dataLength, +void CefWebURLLoaderClient::DidDownloadData(int dataLength, int encodedDataLength) { } -void CefWebURLLoaderClient::didReceiveData(const char* data, +void CefWebURLLoaderClient::DidReceiveData(const char* data, int dataLength) { context_->OnDownloadProgress(dataLength); @@ -274,17 +274,17 @@ void CefWebURLLoaderClient::didReceiveData(const char* data, context_->OnDownloadData(data, dataLength); } -void CefWebURLLoaderClient::didReceiveCachedMetadata(const char* data, +void CefWebURLLoaderClient::DidReceiveCachedMetadata(const char* data, int dataLength) { } -void CefWebURLLoaderClient::didFinishLoading(double finishTime, +void CefWebURLLoaderClient::DidFinishLoading(double finishTime, int64_t totalEncodedDataLength, int64_t totalEncodedBodyLength) { context_->OnComplete(); } -void CefWebURLLoaderClient::didFail(const WebURLError& error, +void CefWebURLLoaderClient::DidFail(const WebURLError& error, int64_t totalEncodedDataLength, int64_t totalEncodedBodyLength) { context_->OnError(error); diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index 3b9a31886..61fbeb641 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -290,7 +290,8 @@ class CefV8StateManager { base::ThreadLocalPointer current_tls_; }; -base::LazyInstance g_v8_state = LAZY_INSTANCE_INITIALIZER; +base::LazyInstance::Leaky g_v8_state = + LAZY_INSTANCE_INITIALIZER; CefV8IsolateManager* GetIsolateManager() { return g_v8_state.Pointer()->GetIsolateManager(); @@ -1005,7 +1006,7 @@ CefRefPtr CefV8ContextImpl::GetBrowser() { blink::WebFrame* webframe = GetWebFrame(); if (webframe) - browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->top()); + browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->Top()); return browser; } @@ -1017,7 +1018,7 @@ CefRefPtr CefV8ContextImpl::GetFrame() { blink::WebFrame* webframe = GetWebFrame(); if (webframe) { CefRefPtr browser = - CefBrowserImpl::GetBrowserForMainFrame(webframe->top()); + CefBrowserImpl::GetBrowserForMainFrame(webframe->Top()); frame = browser->GetFrame(webkit_glue::GetIdentifier(webframe)); } @@ -1116,8 +1117,8 @@ bool CefV8ContextImpl::Eval(const CefString& code, v8::Local context = GetV8Context(); v8::Context::Scope context_scope(context); - const blink::WebString& source = blink::WebString::fromUTF16(code); - const blink::WebString& source_url = blink::WebString::fromUTF16(script_url); + const blink::WebString& source = blink::WebString::FromUTF16(code); + const blink::WebString& source_url = blink::WebString::FromUTF16(script_url); v8::TryCatch try_catch(isolate); try_catch.SetVerbose(true); @@ -1125,7 +1126,7 @@ bool CefV8ContextImpl::Eval(const CefString& code, v8::MaybeLocal func_rv = webkit_glue::ExecuteV8ScriptAndReturnValue(source, source_url, start_line, context, isolate, try_catch, - blink::AccessControlStatus::NotSharableCrossOrigin); + blink::AccessControlStatus::kNotSharableCrossOrigin); if (try_catch.HasCaught()) { exception = new CefV8ExceptionImpl(context, try_catch.Message()); @@ -1152,7 +1153,7 @@ blink::WebFrame* CefV8ContextImpl::GetWebFrame() { v8::HandleScope handle_scope(handle_->isolate()); v8::Local context = GetV8Context(); v8::Context::Scope context_scope(context); - return blink::WebLocalFrame::frameForContext(context); + return blink::WebLocalFrame::FrameForContext(context); } diff --git a/libcef/renderer/webkit_glue.cc b/libcef/renderer/webkit_glue.cc index cb03e6be4..592156f9a 100644 --- a/libcef/renderer/webkit_glue.cc +++ b/libcef/renderer/webkit_glue.cc @@ -40,7 +40,7 @@ MSVC_POP_WARNING(); #undef LOG #include "base/logging.h" -#include "content/public/renderer/render_frame.h" +#include "content/renderer/render_frame_impl.h" namespace webkit_glue { @@ -50,45 +50,45 @@ bool CanGoBack(blink::WebView* view) { if (!view) return false; blink::WebViewImpl* impl = reinterpret_cast(view); - return (impl->client()->historyBackListCount() > 0); + return (impl->Client()->HistoryBackListCount() > 0); } bool CanGoForward(blink::WebView* view) { if (!view) return false; blink::WebViewImpl* impl = reinterpret_cast(view); - return (impl->client()->historyForwardListCount() > 0); + return (impl->Client()->HistoryForwardListCount() > 0); } void GoBack(blink::WebView* view) { if (!view) return; blink::WebViewImpl* impl = reinterpret_cast(view); - if (impl->client()->historyBackListCount() > 0) - impl->client()->navigateBackForwardSoon(-1); + if (impl->Client()->HistoryBackListCount() > 0) + impl->Client()->NavigateBackForwardSoon(-1); } void GoForward(blink::WebView* view) { if (!view) return; blink::WebViewImpl* impl = reinterpret_cast(view); - if (impl->client()->historyForwardListCount() > 0) - impl->client()->navigateBackForwardSoon(1); + if (impl->Client()->HistoryForwardListCount() > 0) + impl->Client()->NavigateBackForwardSoon(1); } std::string DumpDocumentText(blink::WebFrame* frame) { // We use the document element's text instead of the body text here because // not all documents have a body, such as XML documents. - blink::WebElement document_element = frame->document().documentElement(); - if (document_element.isNull()) + blink::WebElement document_element = frame->GetDocument().DocumentElement(); + if (document_element.IsNull()) return std::string(); - blink::Element* web_element = document_element.unwrap(); - return blink::WebString(web_element->innerText()).utf8(); + blink::Element* web_element = document_element.Unwrap(); + return blink::WebString(web_element->innerText()).Utf8(); } cef_dom_node_type_t GetNodeType(const blink::WebNode& node) { - const blink::Node* web_node = node.constUnwrap(); + const blink::Node* web_node = node.ConstUnwrap(); switch (web_node->getNodeType()) { case blink::Node::kElementNode: return DOM_NODE_TYPE_ELEMENT; @@ -113,17 +113,17 @@ cef_dom_node_type_t GetNodeType(const blink::WebNode& node) { } blink::WebString GetNodeName(const blink::WebNode& node) { - const blink::Node* web_node = node.constUnwrap(); + const blink::Node* web_node = node.ConstUnwrap(); return web_node->nodeName(); } blink::WebString CreateNodeMarkup(const blink::WebNode& node) { - const blink::Node* web_node = node.constUnwrap(); - return blink::createMarkup(web_node); + const blink::Node* web_node = node.ConstUnwrap(); + return blink::CreateMarkup(web_node); } bool SetNodeValue(blink::WebNode& node, const blink::WebString& value) { - blink::Node* web_node = node.unwrap(); + blink::Node* web_node = node.Unwrap(); web_node->setNodeValue(value); return true; } @@ -139,30 +139,13 @@ int64_t GetIdentifier(blink::WebFrame* frame) { return kInvalidFrameId; } -// Based on WebViewImpl::findFrameByName and FrameTree::find. -blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name, - blink::WebFrame* relative_to_frame) { - blink::Frame* start_frame = toWebLocalFrameImpl(relative_to_frame)->frame(); - if (!start_frame) - return NULL; - - const AtomicString& atomic_name = unique_name; - blink::Frame* found_frame = NULL; - - // Search the subtree starting with |start_frame|. - for (blink::Frame* frame = start_frame; - frame; - frame = frame->tree().traverseNext(start_frame)) { - if (frame->tree().uniqueName() == atomic_name) { - found_frame = frame; - break; - } - } - - if (found_frame && found_frame->isLocalFrame()) - return blink::WebLocalFrameImpl::fromFrame(toLocalFrame(found_frame)); - - return NULL; +std::string GetUniqueName(blink::WebFrame* frame) { + content::RenderFrameImpl* render_frame = + content::RenderFrameImpl::FromWebFrame(frame); + DCHECK(render_frame); + if (render_frame) + return render_frame->unique_name(); + return std::string(); } v8::MaybeLocal CallV8Function(v8::Local context, @@ -175,21 +158,20 @@ v8::MaybeLocal CallV8Function(v8::Local context, // Execute the function call using the V8ScriptRunner so that inspector // instrumentation works. - blink::LocalFrame* frame = - toLocalFrame(blink::toFrameIfNotDetached(context)); + blink::LocalFrame* frame = blink::ToLocalFrameIfNotDetached(context); DCHECK(frame); if (frame && - frame->document()->canExecuteScripts(blink::AboutToExecuteScript)) { - func_rv = blink::V8ScriptRunner::callFunction( - function, frame->document(), receiver, argc, args, isolate); + frame->GetDocument()->CanExecuteScripts(blink::kAboutToExecuteScript)) { + func_rv = blink::V8ScriptRunner::CallFunction( + function, frame->GetDocument(), receiver, argc, args, isolate); } return func_rv; } bool IsTextControlElement(const blink::WebElement& element) { - const blink::Element* web_element = element.constUnwrap(); - return web_element->isTextControl(); + const blink::Element* web_element = element.ConstUnwrap(); + return web_element->IsTextControl(); } v8::MaybeLocal ExecuteV8ScriptAndReturnValue( @@ -206,51 +188,50 @@ v8::MaybeLocal ExecuteV8ScriptAndReturnValue( if (start_line < 1) start_line = 1; - const blink::KURL kurl = source_url.isEmpty() ? - blink::KURL() : blink::KURL(blink::ParsedURLString, source_url); + const blink::KURL kurl = source_url.IsEmpty() ? + blink::KURL() : blink::KURL(blink::kParsedURLString, source_url); const blink::ScriptSourceCode ssc = blink::ScriptSourceCode(source, kurl, - WTF::TextPosition(WTF::OrdinalNumber::fromOneBasedInt(start_line), - WTF::OrdinalNumber::fromZeroBasedInt(0))); + WTF::TextPosition(WTF::OrdinalNumber::FromOneBasedInt(start_line), + WTF::OrdinalNumber::FromZeroBasedInt(0))); v8::MaybeLocal result; - blink::LocalFrame* frame = - toLocalFrame(blink::toFrameIfNotDetached(context)); + blink::LocalFrame* frame = blink::ToLocalFrameIfNotDetached(context); DCHECK(frame); if (frame) { - blink::V8CacheOptions v8CacheOptions(blink::V8CacheOptionsDefault); - if (frame && frame->settings()) - v8CacheOptions = frame->settings()->getV8CacheOptions(); + blink::V8CacheOptions v8CacheOptions(blink::kV8CacheOptionsDefault); + if (frame && frame->GetSettings()) + v8CacheOptions = frame->GetSettings()->GetV8CacheOptions(); v8::Local script; - if (!blink::v8Call(blink::V8ScriptRunner::compileScript(ssc, isolate, + if (!blink::V8Call(blink::V8ScriptRunner::CompileScript(ssc, isolate, accessControlStatus, v8CacheOptions), script, tryCatch)) { return result; } - result = blink::V8ScriptRunner::runCompiledScript(isolate, script, - blink::toExecutionContext(context)); + result = blink::V8ScriptRunner::RunCompiledScript(isolate, script, + blink::ToExecutionContext(context)); } return result; } bool IsScriptForbidden() { - return blink::ScriptForbiddenScope::isScriptForbidden(); + return blink::ScriptForbiddenScope::IsScriptForbidden(); } -void registerURLSchemeAsLocal(const blink::WebString& scheme) { - blink::SchemeRegistry::registerURLSchemeAsLocal(scheme); +void RegisterURLSchemeAsLocal(const blink::WebString& scheme) { + blink::SchemeRegistry::RegisterURLSchemeAsLocal(scheme); } -void registerURLSchemeAsSecure(const blink::WebString& scheme) { - blink::SchemeRegistry::registerURLSchemeAsSecure(scheme); +void RegisterURLSchemeAsSecure(const blink::WebString& scheme) { + blink::SchemeRegistry::RegisterURLSchemeAsSecure(scheme); } -void registerURLSchemeAsCORSEnabled(const blink::WebString& scheme) { - blink::SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme); +void RegisterURLSchemeAsCORSEnabled(const blink::WebString& scheme) { + blink::SchemeRegistry::RegisterURLSchemeAsCORSEnabled(scheme); } } // webkit_glue diff --git a/libcef/renderer/webkit_glue.h b/libcef/renderer/webkit_glue.h index 2c20a7632..45f575248 100644 --- a/libcef/renderer/webkit_glue.h +++ b/libcef/renderer/webkit_glue.h @@ -41,11 +41,7 @@ blink::WebString CreateNodeMarkup(const blink::WebNode& node); bool SetNodeValue(blink::WebNode& node, const blink::WebString& value); int64_t GetIdentifier(blink::WebFrame* frame); - -// Find the frame with the specified |unique_name| relative to -// |relative_to_frame| in the frame hierarchy. -blink::WebFrame* FindFrameByUniqueName(const blink::WebString& unique_name, - blink::WebFrame* relative_to_frame); +std::string GetUniqueName(blink::WebFrame* frame); bool IsTextControlElement(const blink::WebElement& element); @@ -67,9 +63,9 @@ v8::MaybeLocal ExecuteV8ScriptAndReturnValue( bool IsScriptForbidden(); -void registerURLSchemeAsLocal(const blink::WebString& scheme); -void registerURLSchemeAsSecure(const blink::WebString& scheme); -void registerURLSchemeAsCORSEnabled(const blink::WebString& scheme); +void RegisterURLSchemeAsLocal(const blink::WebString& scheme); +void RegisterURLSchemeAsSecure(const blink::WebString& scheme); +void RegisterURLSchemeAsCORSEnabled(const blink::WebString& scheme); } // webkit_glue diff --git a/patch/patch.cfg b/patch/patch.cfg index a9e57b12f..0d295dcb2 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -68,15 +68,12 @@ patches = [ # # Support creation of captionless windows with resizable borders. # https://bitbucket.org/chromiumembedded/cef/issues/1749 + # + # Remove console spam from RenderWidgetHostViewBase::IsInVR. + # https://codereview.chromium.org/2822223002 'name': 'views_widget_180_1481_1565_1677_1749', 'path': '../', }, - { - # Allow continued use of ContentRendererClient::HandleNavigation. - # https://bitbucket.org/chromiumembedded/cef/issues/1129 - 'name': 'content_nav_1129', - 'path': '../content/', - }, { # Allow specification of a custom WebContentsView. # https://bitbucket.org/chromiumembedded/cef/issues/1257 @@ -152,10 +149,13 @@ patches = [ 'path': '../', }, { + # Split service_manager::Main into the separate steps required by CEF. + # https://bugs.chromium.org/p/chromium/issues/detail?id=654986#c17 + # # Remove DCHECK on Linux when initialized CEF from a non-main thread. # https://bitbucket.org/chromiumembedded/cef/issue/1639 - 'name': 'process_title_1639', - 'path': '../content/common/', + 'name': 'service_manager_654986', + 'path': '../', }, { # Fix rendering of the PDF extension with OSR when the device scale factor @@ -206,8 +206,20 @@ patches = [ # Modify views::View to extend SupportsUserData. # Modify views::MenuButton behavior. # https://bitbucket.org/chromiumembedded/cef/issues/1749 + # + # Don't add TestDesktopScreenX11 dependency on Linux. + # Reverts ui_controls_factory_desktop_aurax11.cc changes from + # https://codereview.chromium.org/2327623002 + # + # Add InkDropHostView::ink_drop_mode method. + # Reverts ink_drop_host_view.h changes from + # https://codereview.chromium.org/2723843002 + # + # Make LabelButton::SetFontList method public. + # Reverts label_button.h changes from + # https://codereview.chromium.org/2793283002 'name': 'views_1749', - 'path': '../ui/views/', + 'path': '../', }, { # Expose RenderViewHostImpl swapped-out state. @@ -248,13 +260,6 @@ patches = [ 'name': 'storage_partition_1973', 'path': '../', }, - { - # Don't add TestDesktopScreenX11 dependency on Linux. - # Revert ui_controls_factory_desktop_aurax11.cc changes from - # https://codereview.chromium.org/2327623002 - 'name': 'ui_views_test_640741', - 'path': '../', - }, { # Fix plugin placeholder blocked message. # https://bitbucket.org/chromiumembedded/cef/issues/2020/ @@ -293,9 +298,6 @@ patches = [ # # Implement better rate-limiting/retry logic. # https://bugs.chromium.org/p/crashpad/issues/detail?id=23 - # - # Windows: Support crash upload URLs with query component. - # https://bugs.chromium.org/p/crashpad/issues/detail?id=163 'name': 'crashpad_tp_1995', 'path': '../third_party/crashpad/', }, @@ -306,18 +308,25 @@ patches = [ 'path': '../', }, { + # Allow continued use of ContentRendererClient::HandleNavigation. + # https://bitbucket.org/chromiumembedded/cef/issues/1129 + # # Pass is_main_frame to PluginServiceFilter::IsPluginAvailable. # https://bitbucket.org/chromiumembedded/cef/issues/2015 # # Pass the render process id to PluginServiceFilter::IsPluginAvailable. # https://bugs.chromium.org/p/chromium/issues/detail?id=626728#c15 - 'name': 'plugin_info_2015', + # + # Expose RFH via NavigationHandle for retrieval in DidFinishNavigation on + # network error. + # https://groups.google.com/a/chromium.org/d/msg/chromium-dev/6iAQPx_hwh8/gaTR5f1GAQAJ + 'name': 'content_1129_2015', 'path': '../', }, { # Pass is_main_frame to PluginServiceFilter::IsPluginAvailable. # https://bitbucket.org/chromiumembedded/cef/issues/2015 - 'name': 'plugin_info_webkit_2015', + 'name': 'webkit_plugin_info_2015', 'path': '../third_party/WebKit/', }, { @@ -328,10 +337,15 @@ patches = [ 'path': '../', }, { - # Expose RFH via NavigationHandle for retrieval in DidFinishNavigation on - # network error. - # https://groups.google.com/a/chromium.org/d/msg/chromium-dev/6iAQPx_hwh8/gaTR5f1GAQAJ - 'name': 'navigation_handle', + # Mac: Fix build error when including openssl/opensslconf.h. + # https://bugs.chromium.org/p/chromium/issues/detail?id=711670 + 'name': 'mac_build_711670', + 'path': '../', + }, + { + # Linux: Remove DCHECK during GPU feature info detection. + # https://bugs.chromium.org/p/chromium/issues/detail?id=699278 + 'name': 'gpu_feature_info_699278', 'path': '../', }, ] diff --git a/patch/patches/browser_compositor_mac.patch b/patch/patches/browser_compositor_mac.patch index bfd780c34..41a2692f7 100644 --- a/patch/patches/browser_compositor_mac.patch +++ b/patch/patches/browser_compositor_mac.patch @@ -1,8 +1,8 @@ diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h -index d0ecb71..84c20b4 100644 +index 1c73b7f..606f29c 100644 --- content/browser/renderer_host/browser_compositor_view_mac.h +++ content/browser/renderer_host/browser_compositor_view_mac.h -@@ -56,9 +56,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver, +@@ -51,9 +51,11 @@ class BrowserCompositorMac : public DelegatedFrameHostClient { // These will not return nullptr until Destroy is called. DelegatedFrameHost* GetDelegatedFrameHost(); @@ -13,12 +13,12 @@ index d0ecb71..84c20b4 100644 + ui::Compositor* GetCompositor(); ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac(); - void SwapCompositorFrame(uint32_t compositor_frame_sink_id, + void DidCreateNewRendererCompositorFrameSink( diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm -index e4c25e73..e2f789e 100644 +index fba983b..8cf9629 100644 --- content/browser/renderer_host/browser_compositor_view_mac.mm +++ content/browser/renderer_host/browser_compositor_view_mac.mm -@@ -201,6 +201,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { +@@ -202,6 +202,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { g_spare_recyclable_compositors.Get().clear(); } @@ -31,7 +31,7 @@ index e4c25e73..e2f789e 100644 ui::AcceleratedWidgetMac* BrowserCompositorMac::GetAcceleratedWidgetMac() { if (recyclable_compositor_) return recyclable_compositor_->accelerated_widget_mac(); -@@ -417,8 +423,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor( +@@ -421,8 +427,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor( } gfx::Size BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP() const { diff --git a/patch/patches/browser_frame_host_guest_1687.patch b/patch/patches/browser_frame_host_guest_1687.patch index af5a8a8e0..63875b553 100644 --- a/patch/patches/browser_frame_host_guest_1687.patch +++ b/patch/patches/browser_frame_host_guest_1687.patch @@ -1,5 +1,5 @@ diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc -index 2197f73a..ab100b6 100644 +index fc720a7..1c30365 100644 --- render_widget_host_view_guest.cc +++ render_widget_host_view_guest.cc @@ -247,13 +247,14 @@ void RenderWidgetHostViewGuest::Destroy() { diff --git a/patch/patches/browser_plugin_guest_1565.patch b/patch/patches/browser_plugin_guest_1565.patch index 52fb636f4..369d71d4a 100644 --- a/patch/patches/browser_plugin_guest_1565.patch +++ b/patch/patches/browser_plugin_guest_1565.patch @@ -1,8 +1,8 @@ diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc -index 7b85e54..5afa575 100644 +index e6baddc7..17dff91 100644 --- content/browser/browser_plugin/browser_plugin_guest.cc +++ content/browser/browser_plugin/browser_plugin_guest.cc -@@ -318,14 +318,20 @@ void BrowserPluginGuest::InitInternal( +@@ -316,14 +316,20 @@ void BrowserPluginGuest::InitInternal( static_cast(GetWebContents()->GetView()); } @@ -25,7 +25,7 @@ index 7b85e54..5afa575 100644 } RendererPreferences* renderer_prefs = -@@ -800,7 +806,8 @@ void BrowserPluginGuest::OnWillAttachComplete( +@@ -799,7 +805,8 @@ void BrowserPluginGuest::OnWillAttachComplete( static_cast(GetWebContents()->GetView()); if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { web_contents_view->CreateViewForWidget( @@ -36,10 +36,10 @@ index 7b85e54..5afa575 100644 } diff --git content/browser/frame_host/interstitial_page_impl.cc content/browser/frame_host/interstitial_page_impl.cc -index 1a04a52..4cfe9aa 100644 +index d0c4ffa..6399af8 100644 --- content/browser/frame_host/interstitial_page_impl.cc +++ content/browser/frame_host/interstitial_page_impl.cc -@@ -594,7 +594,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { +@@ -598,7 +598,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { WebContentsView* wcv = static_cast(web_contents())->GetView(); RenderWidgetHostViewBase* view = @@ -69,10 +69,10 @@ index e4401f8..f2fdb9b 100644 // Creates a new View that holds a popup and receives messages for it. virtual RenderWidgetHostViewBase* CreateViewForPopupWidget( diff --git content/browser/web_contents/web_contents_view_aura.cc content/browser/web_contents/web_contents_view_aura.cc -index 1bfef2c..7555040 100644 +index 68481ad..4018641 100644 --- content/browser/web_contents/web_contents_view_aura.cc +++ content/browser/web_contents/web_contents_view_aura.cc -@@ -843,7 +843,8 @@ void WebContentsViewAura::CreateView( +@@ -846,7 +846,8 @@ void WebContentsViewAura::CreateView( } RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( @@ -82,7 +82,7 @@ index 1bfef2c..7555040 100644 if (render_widget_host->GetView()) { // During testing, the view will already be set up in most cases to the // test view, so we don't want to clobber it with a real one. To verify that -@@ -855,6 +856,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( +@@ -858,6 +859,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( render_widget_host->GetView()); } @@ -91,10 +91,10 @@ index 1bfef2c..7555040 100644 g_create_render_widget_host_view ? g_create_render_widget_host_view(render_widget_host, diff --git content/browser/web_contents/web_contents_view_aura.h content/browser/web_contents/web_contents_view_aura.h -index ed3641c..f8816357 100644 +index fc703087..2a1c368 100644 --- content/browser/web_contents/web_contents_view_aura.h +++ content/browser/web_contents/web_contents_view_aura.h -@@ -117,7 +117,7 @@ class CONTENT_EXPORT WebContentsViewAura +@@ -118,7 +118,7 @@ class CONTENT_EXPORT WebContentsViewAura gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -104,7 +104,7 @@ index ed3641c..f8816357 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_child_frame.cc content/browser/web_contents/web_contents_view_child_frame.cc -index 74a587a..9f02836 100644 +index d10fbca..18df45f 100644 --- content/browser/web_contents/web_contents_view_child_frame.cc +++ content/browser/web_contents/web_contents_view_child_frame.cc @@ -94,7 +94,7 @@ void WebContentsViewChildFrame::CreateView(const gfx::Size& initial_size, @@ -130,7 +130,7 @@ index 86ce68b..fd21e5a 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_guest.cc content/browser/web_contents/web_contents_view_guest.cc -index a93bc37..18fed2e 100644 +index 702a579..2acceda 100644 --- content/browser/web_contents/web_contents_view_guest.cc +++ content/browser/web_contents/web_contents_view_guest.cc @@ -72,6 +72,8 @@ void WebContentsViewGuest::GetScreenInfo(ScreenInfo* screen_info) const { @@ -211,7 +211,7 @@ index 4141b7f..921bc79 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_mac.mm content/browser/web_contents/web_contents_view_mac.mm -index b236639..167f973 100644 +index 2b45749..21c19b3 100644 --- content/browser/web_contents/web_contents_view_mac.mm +++ content/browser/web_contents/web_contents_view_mac.mm @@ -348,7 +348,8 @@ void WebContentsViewMac::CreateView( @@ -256,7 +256,7 @@ index a32205c..49f3c35 100644 // reported from the guest renderer should be ignored. The reported value // from the guest renderer is incorrect in situations where BrowserPlugin is diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc -index 6e59562..b517389 100644 +index 44793e9..77603b2 100644 --- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc +++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc @@ -179,6 +179,8 @@ void MimeHandlerViewGuest::CreateWebContents( diff --git a/patch/patches/chrome_profile.patch b/patch/patches/chrome_profile.patch index 17263c30c..b2c31c98a 100644 --- a/patch/patches/chrome_profile.patch +++ b/patch/patches/chrome_profile.patch @@ -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, diff --git a/patch/patches/chrome_widevine.patch b/patch/patches/chrome_widevine.patch index 0cc6c50c9..102b2073c 100644 --- a/patch/patches/chrome_widevine.patch +++ b/patch/patches/chrome_widevine.patch @@ -1,8 +1,8 @@ diff --git chrome/common/chrome_content_client.cc chrome/common/chrome_content_client.cc -index 91acb7d..d4f57cd 100644 +index de5a0d8..59251d3 100644 --- chrome/common/chrome_content_client.cc +++ chrome/common/chrome_content_client.cc -@@ -81,7 +81,7 @@ +@@ -82,7 +82,7 @@ #endif #if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) && \ diff --git a/patch/patches/compositor_1368.patch b/patch/patches/compositor_1368.patch index cbafbfdb7..b63278d29 100644 --- a/patch/patches/compositor_1368.patch +++ b/patch/patches/compositor_1368.patch @@ -1,8 +1,8 @@ diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc -index 50a66bb..4daaadf 100644 +index 25b59f0..5d1c80f 100644 --- content/browser/compositor/gpu_process_transport_factory.cc +++ content/browser/compositor/gpu_process_transport_factory.cc -@@ -220,6 +220,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { +@@ -217,6 +217,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { std::unique_ptr GpuProcessTransportFactory::CreateSoftwareOutputDevice( ui::Compositor* compositor) { @@ -17,7 +17,7 @@ index 50a66bb..4daaadf 100644 if (command_line->HasSwitch(switches::kHeadless)) return base::WrapUnique(new cc::SoftwareOutputDevice); diff --git ui/compositor/compositor.h ui/compositor/compositor.h -index 92696ad..50aa222 100644 +index fe85a4e..e5584d2 100644 --- ui/compositor/compositor.h +++ ui/compositor/compositor.h @@ -18,6 +18,7 @@ @@ -28,8 +28,8 @@ index 92696ad..50aa222 100644 #include "cc/surfaces/surface_sequence.h" #include "cc/trees/layer_tree_host_client.h" #include "cc/trees/layer_tree_host_single_thread_client.h" -@@ -190,6 +191,17 @@ class COMPOSITOR_EXPORT CompositorLock - DISALLOW_COPY_AND_ASSIGN(CompositorLock); +@@ -168,6 +169,17 @@ class COMPOSITOR_EXPORT ContextFactory { + virtual void RemoveObserver(ContextFactoryObserver* observer) = 0; }; +class COMPOSITOR_EXPORT CompositorDelegate { @@ -46,7 +46,7 @@ index 92696ad..50aa222 100644 // Compositor object to take care of GPU painting. // A Browser compositor object is responsible for generating the final // displayable form of pixels comprising a single widget's contents. It draws an -@@ -219,6 +231,9 @@ class COMPOSITOR_EXPORT Compositor +@@ -200,6 +212,9 @@ class COMPOSITOR_EXPORT Compositor // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -56,12 +56,12 @@ index 92696ad..50aa222 100644 // Sets the root of the layer tree drawn by this Compositor. The root layer // must have no parent. The compositor's root layer is reset if the root layer // is destroyed. NULL can be passed to reset the root layer, in which case the -@@ -398,6 +413,8 @@ class COMPOSITOR_EXPORT Compositor +@@ -377,6 +392,8 @@ class COMPOSITOR_EXPORT Compositor ui::ContextFactory* context_factory_; ui::ContextFactoryPrivate* context_factory_private_; + CompositorDelegate* delegate_ = nullptr; + // The root of the Layer tree drawn by this compositor. - Layer* root_layer_; + Layer* root_layer_ = nullptr; diff --git a/patch/patches/plugin_info_2015.patch b/patch/patches/content_1129_2015.patch similarity index 67% rename from patch/patches/plugin_info_2015.patch rename to patch/patches/content_1129_2015.patch index 14f913663..42afc561a 100644 --- a/patch/patches/plugin_info_2015.patch +++ b/patch/patches/content_1129_2015.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc -index 9320803..9b5d328 100644 +index 47820a5..520ca4cd 100644 --- chrome/browser/download/download_target_determiner.cc +++ chrome/browser/download/download_target_determiner.cc -@@ -483,8 +483,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, +@@ -475,8 +475,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, content::PluginService* plugin_service = content::PluginService::GetInstance(); bool plugin_found = plugin_service->GetPluginInfo( @@ -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 09b5753..11a5f32 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( +@@ -451,8 +451,8 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin( for (; i < matching_plugins.size(); ++i) { if (!filter || filter->IsPluginAvailable(render_process_id_, render_frame_id, @@ -66,7 +66,7 @@ index 0ce31db0..58c4633 100644 } diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc -index b4b700b..46acc35 100644 +index c147373..2e7cb5f 100644 --- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc @@ -591,6 +591,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted( @@ -77,6 +77,75 @@ index b4b700b..46acc35 100644 + model_->profile()->GetResourceContext(), url, true, url::Origin(), mime_type, false, NULL, &plugin, NULL)); } +diff --git content/browser/frame_host/navigation_handle_impl.cc content/browser/frame_host/navigation_handle_impl.cc +index 8dca644..d60c069 100644 +--- content/browser/frame_host/navigation_handle_impl.cc ++++ content/browser/frame_host/navigation_handle_impl.cc +@@ -265,12 +265,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { + } + + RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { +- // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once +- // ReadyToCommitNavigation is available whether or not PlzNavigate is +- // enabled. https://crbug.com/621856 +- CHECK_GE(state_, WILL_PROCESS_RESPONSE) +- << "This accessor should only be called after a response has been " +- "delivered for processing."; + return render_frame_host_; + } + +diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc +index ccd8ee7..cc52a93 100644 +--- content/browser/frame_host/render_frame_host_impl.cc ++++ content/browser/frame_host/render_frame_host_impl.cc +@@ -814,10 +814,8 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { + IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) + IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) + #endif +-#if defined(OS_ANDROID) + IPC_MESSAGE_HANDLER(FrameHostMsg_NavigationHandledByEmbedder, + OnNavigationHandledByEmbedder) +-#endif + IPC_MESSAGE_HANDLER(FrameHostMsg_ShowCreatedWindow, OnShowCreatedWindow) + IPC_END_MESSAGE_MAP() + +@@ -1229,6 +1227,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( + if (navigation_handle_) { + navigation_handle_->set_net_error_code( + static_cast(params.error_code)); ++ navigation_handle_->set_render_frame_host(this); + } + + frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); +@@ -2425,14 +2424,12 @@ void RenderFrameHostImpl::OnHidePopup() { + } + #endif + +-#if defined(OS_ANDROID) + void RenderFrameHostImpl::OnNavigationHandledByEmbedder() { + if (navigation_handle_) + navigation_handle_->set_net_error_code(net::ERR_ABORTED); + + OnDidStopLoading(); + } +-#endif + + void RenderFrameHostImpl::OnShowCreatedWindow(int pending_widget_routing_id, + WindowOpenDisposition disposition, +diff --git content/browser/frame_host/render_frame_host_impl.h content/browser/frame_host/render_frame_host_impl.h +index 7d13f01..9b2d494 100644 +--- content/browser/frame_host/render_frame_host_impl.h ++++ content/browser/frame_host/render_frame_host_impl.h +@@ -783,8 +783,8 @@ class CONTENT_EXPORT RenderFrameHostImpl + void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); + void OnHidePopup(); + #endif +-#if defined(OS_ANDROID) + void OnNavigationHandledByEmbedder(); ++#if defined(OS_ANDROID) + void ForwardGetInterfaceToRenderFrame(const std::string& interface_name, + mojo::ScopedMessagePipeHandle pipe); + #endif diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc index 5b8f571..958ebfb1 100644 --- content/browser/frame_host/render_frame_message_filter.cc @@ -161,10 +230,10 @@ index 05500b4..cd00c4c 100644 const std::string& mime_type, bool* found, diff --git content/browser/loader/mime_sniffing_resource_handler.cc content/browser/loader/mime_sniffing_resource_handler.cc -index e90fa81..dc3e20d 100644 +index 11adad4..283f116 100644 --- content/browser/loader/mime_sniffing_resource_handler.cc +++ content/browser/loader/mime_sniffing_resource_handler.cc -@@ -469,8 +469,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( +@@ -519,8 +519,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( WebPluginInfo plugin; bool has_plugin = plugin_service_->GetPluginInfo( info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), @@ -198,10 +267,10 @@ index 480c659..ec4d108 100644 if (actual_mime_type) *actual_mime_type = mime_types[i]; diff --git content/browser/plugin_service_impl.h content/browser/plugin_service_impl.h -index 3e92d37..ecd8493 100644 +index 9e7a5ef..ee721d0 100644 --- content/browser/plugin_service_impl.h +++ content/browser/plugin_service_impl.h -@@ -71,6 +71,7 @@ class CONTENT_EXPORT PluginServiceImpl +@@ -70,6 +70,7 @@ class CONTENT_EXPORT PluginServiceImpl int render_frame_id, ResourceContext* context, const GURL& url, @@ -210,10 +279,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 b8be34e..db85a84 100644 --- content/common/frame_messages.h +++ content/common/frame_messages.h -@@ -1244,8 +1244,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, +@@ -1277,8 +1277,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 +293,7 @@ index 774d9cb..c74223f 100644 url::Origin /* main_frame_origin */, std::vector /* plugins */) -@@ -1253,9 +1254,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, +@@ -1286,9 +1287,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. @@ -236,30 +305,41 @@ index 774d9cb..c74223f 100644 url::Origin /* main_frame_origin */, std::string /* mime_type */, bool /* found */, +@@ -1648,9 +1650,9 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_FindMatchRects_Reply, + IPC_MESSAGE_ROUTED2(FrameHostMsg_GetNearestFindResult_Reply, + int /* nfr_request_id */, + float /* distance */) ++#endif + + IPC_MESSAGE_ROUTED0(FrameHostMsg_NavigationHandledByEmbedder) +-#endif + + // Adding a new message? Stick to the sort order above: first platform + // independent FrameMsg, then ifdefs for platform specific FrameMsg, then diff --git content/ppapi_plugin/ppapi_blink_platform_impl.cc content/ppapi_plugin/ppapi_blink_platform_impl.cc -index 92f31e7..fccf0b9 100644 +index 6c24359..279edb2 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.cc +++ content/ppapi_plugin/ppapi_blink_platform_impl.cc -@@ -210,6 +210,7 @@ blink::WebURLLoader* PpapiBlinkPlatformImpl::createURLLoader() { +@@ -211,6 +211,7 @@ blink::WebURLLoader* PpapiBlinkPlatformImpl::CreateURLLoader() { - void PpapiBlinkPlatformImpl::getPluginList( + void PpapiBlinkPlatformImpl::GetPluginList( bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) { NOTREACHED(); diff --git content/ppapi_plugin/ppapi_blink_platform_impl.h content/ppapi_plugin/ppapi_blink_platform_impl.h -index 9c2ba25..11a0839 100644 +index afcf809..1c9af66 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.h +++ content/ppapi_plugin/ppapi_blink_platform_impl.h -@@ -44,6 +44,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl { - blink::WebThemeEngine* themeEngine() override; - blink::WebURLLoader* createURLLoader() override; - void getPluginList(bool refresh, +@@ -45,6 +45,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl { + blink::WebThemeEngine* ThemeEngine() override; + blink::WebURLLoader* CreateURLLoader() override; + void GetPluginList(bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder*) override; - blink::WebData loadResource(const char* name) override; + blink::WebData LoadResource(const char* name) override; diff --git content/public/browser/plugin_service.h content/public/browser/plugin_service.h index c404ac8..9dd87e7 100644 --- content/public/browser/plugin_service.h @@ -284,23 +364,63 @@ index 3b610b1..7c439e0 100644 const url::Origin& main_frame_origin, WebPluginInfo* plugin) = 0; +diff --git content/public/renderer/content_renderer_client.cc content/public/renderer/content_renderer_client.cc +index d29d85f..6c32ef2 100644 +--- content/public/renderer/content_renderer_client.cc ++++ content/public/renderer/content_renderer_client.cc +@@ -97,7 +97,6 @@ bool ContentRendererClient::AllowPopup() { + return false; + } + +-#if defined(OS_ANDROID) + bool ContentRendererClient::HandleNavigation( + RenderFrame* render_frame, + bool is_content_initiated, +@@ -110,6 +109,7 @@ bool ContentRendererClient::HandleNavigation( + return false; + } + ++#if defined(OS_ANDROID) + bool ContentRendererClient::ShouldUseMediaPlayerForURL(const GURL& url) { + return false; + } +diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h +index d544fb7..260079c 100644 +--- content/public/renderer/content_renderer_client.h ++++ content/public/renderer/content_renderer_client.h +@@ -197,7 +197,6 @@ class CONTENT_EXPORT ContentRendererClient { + // Returns true if a popup window should be allowed. + virtual bool AllowPopup(); + +-#if defined(OS_ANDROID) + // TODO(sgurun) This callback is deprecated and will be removed as soon + // as android webview completes implementation of a resource throttle based + // shouldoverrideurl implementation. See crbug.com/325351 +@@ -213,6 +212,7 @@ class CONTENT_EXPORT ContentRendererClient { + blink::WebNavigationPolicy default_policy, + bool is_redirect); + ++#if defined(OS_ANDROID) + // Indicates if the Android MediaPlayer should be used instead of Chrome's + // built in media player for the given |url|. Defaults to false. + virtual bool ShouldUseMediaPlayerForURL(const GURL& url); diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc -index 4af9b67..d73ac0b 100644 +index 6922b94..473d148 100644 --- content/renderer/render_frame_impl.cc +++ content/renderer/render_frame_impl.cc -@@ -2752,7 +2752,8 @@ blink::WebPlugin* RenderFrameImpl::createPlugin( +@@ -2795,7 +2795,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( std::string mime_type; bool found = false; Send(new FrameHostMsg_GetPluginInfo( -- routing_id_, params.url, frame->top()->getSecurityOrigin(), -+ routing_id_, params.url, frame->parent() == nullptr, -+ frame->top()->getSecurityOrigin(), - params.mimeType.utf8(), &found, &info, &mime_type)); +- routing_id_, params.url, frame->Top()->GetSecurityOrigin(), ++ routing_id_, params.url, frame->Parent() == nullptr, ++ frame->Top()->GetSecurityOrigin(), + params.mime_type.Utf8(), &found, &info, &mime_type)); if (!found) return NULL; -@@ -5246,9 +5247,8 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( - (pending_navigation_params_ && - !pending_navigation_params_->request_params.redirects.empty()); +@@ -5364,9 +5365,8 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( + (!IsBrowserSideNavigationEnabled() || + url != pending_navigation_params_->request_params.redirects[0])); -#ifdef OS_ANDROID - bool render_view_was_created_by_renderer = @@ -310,27 +430,27 @@ 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( - is_redirect)) { - return blink::WebNavigationPolicyIgnore; +@@ -5379,7 +5379,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( + } + return blink::kWebNavigationPolicyIgnore; } -#endif Referrer referrer( - RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest)); + RenderViewImpl::GetReferrerFromRequest(frame_, info.url_request)); diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc -index ed2baee..19f294b 100644 +index 4ba0c48..46f2afde 100644 --- content/renderer/renderer_blink_platform_impl.cc +++ content/renderer/renderer_blink_platform_impl.cc -@@ -712,6 +712,7 @@ blink::WebMIDIAccessor* RendererBlinkPlatformImpl::createMIDIAccessor( +@@ -737,6 +737,7 @@ blink::WebMIDIAccessor* RendererBlinkPlatformImpl::CreateMIDIAccessor( - void RendererBlinkPlatformImpl::getPluginList( + void RendererBlinkPlatformImpl::GetPluginList( bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) { #if BUILDFLAG(ENABLE_PLUGINS) -@@ -719,7 +720,8 @@ void RendererBlinkPlatformImpl::getPluginList( +@@ -744,7 +745,8 @@ void RendererBlinkPlatformImpl::GetPluginList( if (!plugin_refresh_allowed_) refresh = false; RenderThread::Get()->Send( @@ -338,17 +458,17 @@ index ed2baee..19f294b 100644 + new FrameHostMsg_GetPlugins(refresh, isMainFrame, mainFrameOrigin, + &plugins)); for (const WebPluginInfo& plugin : plugins) { - builder->addPlugin(WebString::fromUTF16(plugin.name), - WebString::fromUTF16(plugin.desc), + builder->AddPlugin(WebString::FromUTF16(plugin.name), + WebString::FromUTF16(plugin.desc), diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h -index df62a99..992fa6e 100644 +index 19306df..a731786 100644 --- content/renderer/renderer_blink_platform_impl.h +++ content/renderer/renderer_blink_platform_impl.h -@@ -117,6 +117,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { - cc::FrameSinkId generateFrameSinkId() override; +@@ -121,6 +121,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { + cc::FrameSinkId GenerateFrameSinkId() override; - void getPluginList(bool refresh, + void GetPluginList(bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) override; - blink::WebPublicSuffixList* publicSuffixList() override; + blink::WebPublicSuffixList* PublicSuffixList() override; diff --git a/patch/patches/content_nav_1129.patch b/patch/patches/content_nav_1129.patch deleted file mode 100644 index 04330e1df..000000000 --- a/patch/patches/content_nav_1129.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc -index 3cab7f9..98a151f 100644 ---- public/renderer/content_renderer_client.cc -+++ public/renderer/content_renderer_client.cc -@@ -97,7 +97,6 @@ bool ContentRendererClient::AllowPopup() { - return false; - } - --#if defined(OS_ANDROID) - bool ContentRendererClient::HandleNavigation( - RenderFrame* render_frame, - bool is_content_initiated, -@@ -110,6 +109,7 @@ bool ContentRendererClient::HandleNavigation( - return false; - } - -+#if defined(OS_ANDROID) - bool ContentRendererClient::ShouldUseMediaPlayerForURL(const GURL& url) { - return false; - } -diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h -index 0764782..6a12636 100644 ---- public/renderer/content_renderer_client.h -+++ public/renderer/content_renderer_client.h -@@ -197,7 +197,6 @@ class CONTENT_EXPORT ContentRendererClient { - // Returns true if a popup window should be allowed. - virtual bool AllowPopup(); - --#if defined(OS_ANDROID) - // TODO(sgurun) This callback is deprecated and will be removed as soon - // as android webview completes implementation of a resource throttle based - // shouldoverrideurl implementation. See crbug.com/325351 -@@ -213,6 +212,7 @@ class CONTENT_EXPORT ContentRendererClient { - blink::WebNavigationPolicy default_policy, - bool is_redirect); - -+#if defined(OS_ANDROID) - // Indicates if the Android MediaPlayer should be used instead of Chrome's - // built in media player for the given |url|. Defaults to false. - virtual bool ShouldUseMediaPlayerForURL(const GURL& url); diff --git a/patch/patches/crashpad_1995.patch b/patch/patches/crashpad_1995.patch index 4bcea0d54..a699fcaa3 100644 --- a/patch/patches/crashpad_1995.patch +++ b/patch/patches/crashpad_1995.patch @@ -1,5 +1,5 @@ diff --git build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn -index d2ce8b9..e4fc7c6 100644 +index c4ca09c..40b981e 100644 --- build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn +++ build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn @@ -2,6 +2,8 @@ @@ -11,7 +11,7 @@ index d2ce8b9..e4fc7c6 100644 static_library("handler_lib") { sources = [ "crash_report_upload_thread.cc", -@@ -26,8 +28,18 @@ static_library("handler_lib") { +@@ -28,8 +30,18 @@ static_library("handler_lib") { "../snapshot", "../tools:tool_support", "//base", @@ -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 78b04f4..abf9c98 100644 --- chrome/common/crash_keys.cc +++ chrome/common/crash_keys.cc @@ -4,6 +4,8 @@ @@ -43,7 +43,7 @@ index 4750471..a341ac0 100644 #include "base/base_switches.h" #include "base/command_line.h" #include "base/format_macros.h" -@@ -96,7 +98,7 @@ const char kViewCount[] = "view-count"; +@@ -88,7 +90,7 @@ const char kViewCount[] = "view-count"; const char kZeroEncodeDetails[] = "zero-encode-details"; @@ -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() { +@@ -254,10 +256,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() { +@@ -291,7 +299,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) { +@@ -347,7 +355,7 @@ static bool IsBoringSwitch(const std::string& flag) { } void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { @@ -90,7 +90,7 @@ index 4750471..a341ac0 100644 void SetActiveExtensions(const std::set& extensions) { diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h -index e7c9bc3..c97f667 100644 +index 7abe208..424a2a4 100644 --- chrome/common/crash_keys.h +++ chrome/common/crash_keys.h @@ -22,10 +22,18 @@ class CommandLine; @@ -113,7 +113,7 @@ index e7c9bc3..c97f667 100644 // on the given |command_line|. void SetCrashKeysFromCommandLine(const base::CommandLine& command_line); diff --git chrome_elf/BUILD.gn chrome_elf/BUILD.gn -index 53a29c8..9d0ee4c 100644 +index 40f611f..b5e7d64 100644 --- chrome_elf/BUILD.gn +++ chrome_elf/BUILD.gn @@ -7,6 +7,7 @@ @@ -124,7 +124,7 @@ index 53a29c8..9d0ee4c 100644 import("//chrome/process_version_rc_template.gni") import("//testing/test.gni") -@@ -136,16 +137,40 @@ static_library("blacklist") { +@@ -137,16 +138,40 @@ static_library("blacklist") { static_library("crash") { sources = [ @@ -147,7 +147,7 @@ index 53a29c8..9d0ee4c 100644 + "//chrome/common/chrome_switches.cc", + "//components/flags_ui/flags_ui_switches.cc", + "//content/public/common/content_switches.cc", -+ ++ "//gpu/config/gpu_crash_keys.cc", + ] + include_dirs = [ + "//cef", @@ -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 0d3de65..a1b8b09 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, +@@ -1357,7 +1359,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) { +@@ -1696,10 +1698,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) { +@@ -2004,6 +2015,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 2e9ee28..de53f59 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() { +@@ -179,9 +207,4 @@ bool CrashReporterClient::ShouldMonitorCrashHandlerExpensively() { } #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 9f69c19..2abaee00 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 { +@@ -197,6 +200,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 dcec346..6272df6 100644 --- components/crash/content/app/crashpad.cc +++ components/crash/content/app/crashpad.cc @@ -142,7 +142,8 @@ void InitializeCrashpadImpl(bool initial_client, @@ -437,7 +437,7 @@ index a0eabba..94039c4 100644 crashpad::TriState::kDisabled); } diff --git components/crash/content/app/crashpad_mac.mm components/crash/content/app/crashpad_mac.mm -index 7df66ea..4ee709a 100644 +index 3bae07e..12b0a16 100644 --- components/crash/content/app/crashpad_mac.mm +++ components/crash/content/app/crashpad_mac.mm @@ -16,11 +16,14 @@ @@ -501,10 +501,10 @@ index 7df66ea..4ee709a 100644 + } #if defined(GOOGLE_CHROME_BUILD) - NSString* channel = base::mac::ObjCCast( -@@ -73,12 +88,16 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, + // Empty means stable. +@@ -79,12 +94,16 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, + process_annotations["channel"] = ""; } - #endif - NSString* version = - base::mac::ObjCCast([base::mac::FrameworkBundle() @@ -523,25 +523,25 @@ index 7df66ea..4ee709a 100644 + process_annotations["platform"] = std::string("macos"); std::vector arguments; - if (!browser_process) { -@@ -90,6 +109,12 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, + +@@ -105,6 +124,12 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, + arguments.push_back( "--reset-own-crash-exception-port-to-system-default"); } - ++ + // Since we're using the same subprocess helper exe we must specify the + // process type. + arguments.push_back(std::string("--type=") + switches::kCrashpadHandler); + + crash_reporter_client->GetCrashOptionalArguments(&arguments); -+ - crashpad::CrashpadClient crashpad_client; - bool result = crashpad_client.StartHandler(handler_path, - database_path, + + bool result = GetCrashpadClient().StartHandler( + handler_path, database_path, metrics_path, url, process_annotations, diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc -index 3ad5f8d..77a0fe6 100644 +index 94a350f..61667a8 100644 --- components/crash/content/app/crashpad_win.cc +++ components/crash/content/app/crashpad_win.cc -@@ -41,15 +41,15 @@ void GetPlatformCrashpadAnnotations( +@@ -33,8 +33,8 @@ void GetPlatformCrashpadAnnotations( base::string16 product_name, version, special_build, channel_name; crash_reporter_client->GetProductNameAndVersion( exe_file, &product_name, &version, &special_build, &channel_name); @@ -549,19 +549,22 @@ index 3ad5f8d..77a0fe6 100644 - (*annotations)["ver"] = base::UTF16ToUTF8(version); + (*annotations)["product"] = base::UTF16ToUTF8(product_name); + (*annotations)["version"] = base::UTF16ToUTF8(version); - (*annotations)["channel"] = base::UTF16ToUTF8(channel_name); + #if defined(GOOGLE_CHROME_BUILD) + // Empty means stable. + const bool allow_empty_channel = true; +@@ -46,9 +46,9 @@ void GetPlatformCrashpadAnnotations( if (!special_build.empty()) (*annotations)["special"] = base::UTF16ToUTF8(special_build); #if defined(ARCH_CPU_X86) - (*annotations)["plat"] = std::string("Win32"); -+ (*annotations)["platform"] = std::string("win32"); ++ (*annotations)["platform"] = std::string("Win32"); #elif defined(ARCH_CPU_X86_64) - (*annotations)["plat"] = std::string("Win64"); -+ (*annotations)["platform"] = std::string("win64"); ++ (*annotations)["platform"] = std::string("Win64"); #endif } -@@ -81,7 +81,7 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, +@@ -80,7 +80,7 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, #if defined(GOOGLE_CHROME_BUILD) std::string url = "https://clients2.google.com/cr/report"; #else @@ -570,25 +573,27 @@ index 3ad5f8d..77a0fe6 100644 #endif // Allow the crash server to be overridden for testing. If the variable -@@ -101,21 +101,25 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, +@@ -100,22 +100,26 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, crashpad::TriState::kEnabled, kIndirectMemoryLimit); } - // If the handler is embedded in the binary (e.g. chrome, setup), we - // reinvoke it with --type=crashpad-handler. Otherwise, we use the - // standalone crashpad_handler.exe (for tests, etc.). - std::vector arguments; -+ + std::vector start_arguments; ++ + // Always add --type=crashpad-handler because the value is expected by + // CefExecuteProcess. -+ arguments.push_back(std::string("--type=") + switches::kCrashpadHandler); ++ start_arguments.push_back( ++ std::string("--type=") + switches::kCrashpadHandler); + if (embedded_handler) { -- arguments.push_back(std::string("--type=") + switches::kCrashpadHandler); +- start_arguments.push_back(std::string("--type=") + +- switches::kCrashpadHandler); // The prefetch argument added here has to be documented in // chrome_switches.cc, below the kPrefetchArgument* constants. A constant // can't be used here because crashpad can't depend on Chrome. - arguments.push_back("/prefetch:7"); + start_arguments.push_back("/prefetch:7"); } else { base::FilePath exe_dir = exe_file.DirName(); - exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); @@ -596,13 +601,13 @@ index 3ad5f8d..77a0fe6 100644 + crash_reporter_client->GetCrashExternalHandler(exe_dir.value())); } -+ crash_reporter_client->GetCrashOptionalArguments(&arguments); ++ crash_reporter_client->GetCrashOptionalArguments(&start_arguments); + - if (!g_crashpad_client.Get().StartHandler( - exe_file, database_path, metrics_path, url, process_annotations, - arguments, false, true)) { + std::vector arguments(start_arguments); + + if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) { diff --git content/browser/frame_host/debug_urls.cc content/browser/frame_host/debug_urls.cc -index c693078..e58465b 100644 +index bcf53d5..d4f070b 100644 --- content/browser/frame_host/debug_urls.cc +++ content/browser/frame_host/debug_urls.cc @@ -139,7 +139,9 @@ bool HandleDebugURL(const GURL& url, ui::PageTransition transition) { diff --git a/patch/patches/crashpad_tp_1995.patch b/patch/patches/crashpad_tp_1995.patch index 44e434a8d..0c6be15f7 100644 --- a/patch/patches/crashpad_tp_1995.patch +++ b/patch/patches/crashpad_tp_1995.patch @@ -40,7 +40,7 @@ index 6dac5f3..34f5ee1 100644 virtual ~PruneCondition() {} diff --git crashpad/client/settings.cc crashpad/client/settings.cc -index 7757ecb..d458337 100644 +index 15d16f2..5e8eadf 100644 --- crashpad/client/settings.cc +++ crashpad/client/settings.cc @@ -38,7 +38,7 @@ void ScopedLockedFileHandleTraits::Free(FileHandle handle) { @@ -177,21 +177,21 @@ index 14debac..c25c653 100644 //! \brief Attempts to upload a crash report. //! diff --git crashpad/handler/handler_main.cc crashpad/handler/handler_main.cc -index 5006cf6..26b3b6a 100644 +index 641bf0f..3a86eb3 100644 --- crashpad/handler/handler_main.cc +++ crashpad/handler/handler_main.cc -@@ -33,8 +33,10 @@ - #include "base/logging.h" +@@ -35,8 +35,10 @@ #include "base/metrics/persistent_histogram_allocator.h" #include "base/scoped_generic.h" + #include "base/strings/stringprintf.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" +#include "cef/libcef/features/features.h" #include "client/crash_report_database.h" #include "client/crashpad_client.h" - #include "client/prune_crash_reports.h" -@@ -69,6 +71,10 @@ + #include "client/crashpad_info.h" +@@ -75,6 +77,10 @@ #include "util/win/session_end_watcher.h" #endif // OS_MACOSX @@ -202,8 +202,18 @@ index 5006cf6..26b3b6a 100644 namespace crashpad { namespace { -@@ -403,6 +409,9 @@ int HandlerMain(int argc, char* argv[]) { - kOptionPipeName, +@@ -144,6 +150,9 @@ struct Options { + bool monitor_self; + bool rate_limit; + bool upload_gzip; ++ int max_uploads; ++ int max_database_size; ++ int max_database_age; + }; + + // Splits |key_value| on '=' and inserts the resulting key and value into |map|. +@@ -425,6 +434,9 @@ int HandlerMain(int argc, + kOptionResetOwnCrashExceptionPortToSystemDefault, #endif // OS_MACOSX kOptionURL, + kOptionMaxUploads, @@ -212,26 +222,7 @@ index 5006cf6..26b3b6a 100644 // Standard options. kOptionHelp = -2, -@@ -424,12 +433,18 @@ int HandlerMain(int argc, char* argv[]) { - #endif // OS_MACOSX - bool rate_limit; - bool upload_gzip; -+ int max_uploads; -+ int max_database_size; -+ int max_database_age; - } options = {}; - #if defined(OS_MACOSX) - options.handshake_fd = -1; - #endif - options.rate_limit = true; - options.upload_gzip = true; -+ options.max_uploads = 0; -+ options.max_database_size = 0; -+ options.max_database_age = 0; - - const option long_options[] = { - {"annotation", required_argument, nullptr, kOptionAnnotation}, -@@ -460,6 +475,9 @@ int HandlerMain(int argc, char* argv[]) { +@@ -470,6 +482,9 @@ int HandlerMain(int argc, {"url", required_argument, nullptr, kOptionURL}, {"help", no_argument, nullptr, kOptionHelp}, {"version", no_argument, nullptr, kOptionVersion}, @@ -241,7 +232,7 @@ index 5006cf6..26b3b6a 100644 {nullptr, 0, nullptr, 0}, }; -@@ -535,6 +553,27 @@ int HandlerMain(int argc, char* argv[]) { +@@ -564,6 +579,27 @@ int HandlerMain(int argc, options.url = optarg; break; } @@ -269,7 +260,7 @@ index 5006cf6..26b3b6a 100644 case kOptionHelp: { Usage(me); MetricsRecordExit(Metrics::LifetimeMilestone::kExitedEarly); -@@ -672,12 +711,19 @@ int HandlerMain(int argc, char* argv[]) { +@@ -721,12 +757,19 @@ int HandlerMain(int argc, // TODO(scottmg): options.rate_limit should be removed when we have a // configurable database setting to control upload limiting. // See https://crashpad.chromium.org/bug/23. @@ -289,17 +280,4 @@ index 5006cf6..26b3b6a 100644 + options.max_database_age)); prune_thread.Start(); - CrashReportExceptionHandler exception_handler( -diff --git crashpad/util/net/http_transport_win.cc crashpad/util/net/http_transport_win.cc -index 294048a..e87e47e 100644 ---- crashpad/util/net/http_transport_win.cc -+++ crashpad/util/net/http_transport_win.cc -@@ -146,7 +146,7 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) { - ScopedHINTERNET request(WinHttpOpenRequest( - connect.get(), - base::UTF8ToUTF16(method()).c_str(), -- url_path.c_str(), -+ (url_path + extra_info).c_str(), - nullptr, - WINHTTP_NO_REFERER, - WINHTTP_DEFAULT_ACCEPT_TYPES, + CrashReportExceptionHandler exception_handler(database.get(), diff --git a/patch/patches/gn_config.patch b/patch/patches/gn_config.patch index 16d5727ab..a88585406 100644 --- a/patch/patches/gn_config.patch +++ b/patch/patches/gn_config.patch @@ -1,20 +1,21 @@ diff --git .gn .gn -index b0565e5..4fd1771 100644 +index cd7ed79..0c318f9 100644 --- .gn +++ .gn -@@ -259,6 +259,7 @@ exec_script_whitelist = +@@ -257,6 +257,8 @@ exec_script_whitelist = # in the Chromium repo outside of //build. - "//android_webview/BUILD.gn", "//build_overrides/build.gni", -+ "//cef/BUILD.gn", - "//chromeos/BUILD.gn", ++ "//cef/BUILD.gn", ++ # TODO(dgn): Layer violation but breaks the build otherwise, see + # https://crbug.com/474506. + "//clank/java/BUILD.gn", diff --git BUILD.gn BUILD.gn -index d783ebe..ae5e8d1 100644 +index d24c2da..7f0d451 100644 --- BUILD.gn +++ BUILD.gn -@@ -282,6 +282,7 @@ group("both_gn_and_gyp") { +@@ -158,6 +158,7 @@ group("gn_all") { # and whether there should be other targets that are iOS-only and missing. deps += [ "//cc:cc_unittests", @@ -55,13 +56,13 @@ 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 e8b0849..0bfc676 100644 --- build/toolchain/win/setup_toolchain.py +++ build/toolchain/win/setup_toolchain.py -@@ -127,15 +127,17 @@ def _LoadToolchainEnv(cpu, sdk_dir): - os.environ['GYP_MSVS_OVERRIDE_PATH'], - 'VC/vcvarsall.bat')) - if not os.path.exists(script_path): +@@ -132,18 +132,20 @@ def _LoadToolchainEnv(cpu, sdk_dir): + # variable. + if 'VSINSTALLDIR' in os.environ: + del os.environ['VSINSTALLDIR'] - other_path = os.path.normpath(os.path.join( + script_path = os.path.normpath(os.path.join( os.environ['GYP_MSVS_OVERRIDE_PATH'], @@ -70,10 +71,16 @@ index 43a7e09..2af18e9 100644 - raise Exception('%s is missing - make sure VC++ tools are installed.' % - script_path) - script_path = other_path -- args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] +- # Chromium requires the 10.0.14393.0 SDK. Previous versions don't have all +- # of the required declarations, and 10.0.15063.0 is buggy. +- args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64', +- '10.0.14393.0'] - variables = _LoadEnvFromBat(args) + if os.path.exists(script_path): -+ args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] ++ # Chromium requires the 10.0.14393.0 SDK. Previous versions don't have all ++ # of the required declarations, and 10.0.15063.0 is buggy. ++ args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64', ++ '10.0.14393.0'] + variables = _LoadEnvFromBat(args) + else: + variables = [] @@ -84,10 +91,10 @@ index 43a7e09..2af18e9 100644 diff --git build/vs_toolchain.py build/vs_toolchain.py -index c5db1b24..e4f5839 100755 +index 90a562d..8c63b12 100755 --- build/vs_toolchain.py +++ build/vs_toolchain.py -@@ -74,11 +74,18 @@ def SetEnvironmentAndGetRuntimeDllDirs(): +@@ -78,11 +78,18 @@ def SetEnvironmentAndGetRuntimeDllDirs(): runtime_path = os.path.pathsep.join(vs_runtime_dll_dirs) os.environ['PATH'] = runtime_path + os.path.pathsep + os.environ['PATH'] elif sys.platform == 'win32' and not depot_tools_win_toolchain: @@ -107,7 +114,7 @@ index c5db1b24..e4f5839 100755 # directory in order to run binaries locally, but they are needed in order # to create isolates or the mini_installer. Copying them to the output diff --git chrome/chrome_paks.gni chrome/chrome_paks.gni -index 811afda..8d21b5f 100644 +index 4e303dc..a0398f1 100644 --- chrome/chrome_paks.gni +++ chrome/chrome_paks.gni @@ -249,7 +249,7 @@ template("chrome_paks") { diff --git a/patch/patches/gpu_feature_info_699278.patch b/patch/patches/gpu_feature_info_699278.patch new file mode 100644 index 000000000..f9e19eae0 --- /dev/null +++ b/patch/patches/gpu_feature_info_699278.patch @@ -0,0 +1,13 @@ +diff --git gpu/command_buffer/service/feature_info.cc gpu/command_buffer/service/feature_info.cc +index 32e72c6..495ccdd 100644 +--- gpu/command_buffer/service/feature_info.cc ++++ gpu/command_buffer/service/feature_info.cc +@@ -1524,8 +1524,6 @@ void FeatureInfo::InitializeFloatAndHalfFloatFeatures( + glBindFramebufferEXT(GL_FRAMEBUFFER, static_cast(fb_binding)); + glBindTexture(GL_TEXTURE_2D, static_cast(tex_binding)); + +- DCHECK_EQ(glGetError(), static_cast(GL_NO_ERROR)); +- + if (status_rgba == GL_FRAMEBUFFER_COMPLETE) { + feature_flags_.chromium_color_buffer_float_rgba = true; + if (!disallowed_features_.chromium_color_buffer_float_rgba) diff --git a/patch/patches/mac_build_711670.patch b/patch/patches/mac_build_711670.patch new file mode 100644 index 000000000..d6504b7b6 --- /dev/null +++ b/patch/patches/mac_build_711670.patch @@ -0,0 +1,57 @@ +diff --git chrome/browser/ui/views/BUILD.gn chrome/browser/ui/views/BUILD.gn +index 47aa8b5bdbc9..d198a017a63c 100644 +--- chrome/browser/ui/views/BUILD.gn ++++ chrome/browser/ui/views/BUILD.gn +@@ -27,6 +27,7 @@ component("views") { + deps = [ + "//base", + "//chrome/app:command_ids", ++ "//content/public/browser", + "//printing/features", + "//skia", + "//ui/base", +diff --git extensions/browser/api/BUILD.gn extensions/browser/api/BUILD.gn +index dcf2bdb8fe74..96c9bf870c67 100644 +--- extensions/browser/api/BUILD.gn ++++ extensions/browser/api/BUILD.gn +@@ -25,6 +25,8 @@ source_set("api") { + ] + + public_deps = [ ++ "//content/public/browser", ++ "//content/public/common", + "//extensions/browser/api/activity_log", + "//extensions/browser/api/alarms", + "//extensions/browser/api/app_current_window_internal", +diff --git extensions/common/BUILD.gn extensions/common/BUILD.gn +index 8af643d9d426..189cf47e7756 100644 +--- extensions/common/BUILD.gn ++++ extensions/common/BUILD.gn +@@ -271,6 +271,7 @@ if (enable_extensions) { + public_deps = [ + ":common_constants", + ":mojo", ++ "//content/public/common", + "//ipc", + "//skia", + ] +@@ -284,7 +285,6 @@ if (enable_extensions) { + "//chrome:resources", + "//components/crx_file", + "//components/url_matcher", +- "//content/public/common", + "//crypto", + "//device/bluetooth", + "//device/usb", +diff --git extensions/renderer/BUILD.gn extensions/renderer/BUILD.gn +index fca1114a561b..b049678396ee 100644 +--- extensions/renderer/BUILD.gn ++++ extensions/renderer/BUILD.gn +@@ -245,6 +245,7 @@ source_set("renderer") { + "//components/guest_view/renderer", + "//content:resources", + "//extensions:extensions_resources", ++ "//extensions/common", + "//extensions/common/api", + "//gin", + "//mojo/edk/js", diff --git a/patch/patches/message_loop_443_1992243003.patch b/patch/patches/message_loop_443_1992243003.patch index 574354114..90a2c0942 100644 --- a/patch/patches/message_loop_443_1992243003.patch +++ b/patch/patches/message_loop_443_1992243003.patch @@ -26,7 +26,7 @@ index 3d55920..721aca1 100644 run_loop_(nullptr), current_pending_task_(nullptr), diff --git message_loop.h message_loop.h -index 8417ce4..ee253a9 100644 +index 2ef4537..9c657f8 100644 --- message_loop.h +++ message_loop.h @@ -303,6 +303,16 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { @@ -46,7 +46,7 @@ index 8417ce4..ee253a9 100644 // Can only be called from the thread that owns the MessageLoop. bool is_running() const; -@@ -442,6 +452,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { +@@ -444,6 +454,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { // insider a (accidentally induced?) nested message pump. bool nestable_tasks_allowed_; diff --git a/patch/patches/navigation_handle.patch b/patch/patches/navigation_handle.patch deleted file mode 100644 index d1a03e13b..000000000 --- a/patch/patches/navigation_handle.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git content/browser/frame_host/navigation_handle_impl.cc content/browser/frame_host/navigation_handle_impl.cc -index 2e525bb..646b81b 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() { - } - - RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { -- // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once -- // ReadyToCommitNavigation is available whether or not PlzNavigate is -- // enabled. https://crbug.com/621856 -- CHECK_GE(state_, WILL_PROCESS_RESPONSE) -- << "This accessor should only be called after a response has been " -- "delivered for processing."; - return render_frame_host_; - } - -diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc -index ff676db..63f862d 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( - if (navigation_handle_) { - navigation_handle_->set_net_error_code( - static_cast(params.error_code)); -+ navigation_handle_->set_render_frame_host(this); - } - - frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); diff --git a/patch/patches/net_security_expiration_1994.patch b/patch/patches/net_security_expiration_1994.patch index 5e3d278c1..875caa377 100644 --- a/patch/patches/net_security_expiration_1994.patch +++ b/patch/patches/net_security_expiration_1994.patch @@ -55,10 +55,10 @@ index 7111970..f751d6c 100644 } // namespace net diff --git net/http/transport_security_state.cc net/http/transport_security_state.cc -index 5f82c28..0ebee04 100644 +index 2e829ad..5272c10 100644 --- net/http/transport_security_state.cc +++ net/http/transport_security_state.cc -@@ -1371,8 +1371,10 @@ void TransportSecurityState::SetShouldRequireCTForTesting(bool* required) { +@@ -1382,8 +1382,10 @@ void TransportSecurityState::SetShouldRequireCTForTesting(bool* required) { g_ct_required_for_testing = *required ? 1 : -1; } @@ -72,10 +72,10 @@ index 5f82c28..0ebee04 100644 // We consider built-in information to be timely for 10 weeks. return (base::Time::Now() - build_time).InDays() < 70 /* 10 weeks */; diff --git net/http/transport_security_state.h net/http/transport_security_state.h -index a55cf62..b984474 100644 +index 5d3c126..2c970e8 100644 --- net/http/transport_security_state.h +++ net/http/transport_security_state.h -@@ -475,6 +475,10 @@ class NET_EXPORT TransportSecurityState +@@ -479,6 +479,10 @@ class NET_EXPORT TransportSecurityState // nullptr to reset. static void SetShouldRequireCTForTesting(bool* required); @@ -86,7 +86,7 @@ index a55cf62..b984474 100644 private: friend class TransportSecurityStateTest; friend class TransportSecurityStateStaticFuzzer; -@@ -499,7 +503,7 @@ class NET_EXPORT TransportSecurityState +@@ -503,7 +507,7 @@ class NET_EXPORT TransportSecurityState // IsBuildTimely returns true if the current build is new enough ensure that // built in security information (i.e. HSTS preloading and pinning // information) is timely. @@ -95,7 +95,7 @@ index a55cf62..b984474 100644 // Helper method for actually checking pins. PKPStatus CheckPublicKeyPinsImpl( -@@ -590,6 +594,8 @@ class NET_EXPORT TransportSecurityState +@@ -594,6 +598,8 @@ class NET_EXPORT TransportSecurityState // True if public key pinning bypass is enabled for local trust anchors. bool enable_pkp_bypass_for_local_trust_anchors_; diff --git a/patch/patches/pdfium_print_549365.patch b/patch/patches/pdfium_print_549365.patch index dd70c96c9..e41cb5b72 100644 --- a/patch/patches/pdfium_print_549365.patch +++ b/patch/patches/pdfium_print_549365.patch @@ -1,10 +1,10 @@ diff --git BUILD.gn BUILD.gn -index de7f21b..cb3dcb1 100644 +index 1d8f353..419c18d 100644 --- BUILD.gn +++ BUILD.gn -@@ -208,6 +208,10 @@ static_library("pdfium") { - } else { - libs += [ "freetype" ] +@@ -220,6 +220,10 @@ static_library("pdfium") { + if (pdf_is_complete_lib) { + complete_static_lib = true } + + include_dirs = [ @@ -14,7 +14,7 @@ index de7f21b..cb3dcb1 100644 static_library("test_support") { diff --git fpdfsdk/fpdfview.cpp fpdfsdk/fpdfview.cpp -index 1e7a651..9523c7e 100644 +index 5010c17..ffc81fd 100644 --- fpdfsdk/fpdfview.cpp +++ fpdfsdk/fpdfview.cpp @@ -31,6 +31,7 @@ @@ -24,8 +24,8 @@ index 1e7a651..9523c7e 100644 +#include "fxjs/fxjs_v8.h" #include "public/fpdf_ext.h" #include "public/fpdf_progressive.h" - #include "third_party/base/numerics/safe_conversions_impl.h" -@@ -419,6 +420,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() { + #include "third_party/base/allocator/partition_allocator/partition_alloc.h" +@@ -421,6 +422,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() { CPDF_ModuleMgr::Destroy(); CFX_GEModule::Destroy(); diff --git a/patch/patches/plugin_info_webkit_2015.patch b/patch/patches/plugin_info_webkit_2015.patch deleted file mode 100644 index eab1c781f..000000000 --- a/patch/patches/plugin_info_webkit_2015.patch +++ /dev/null @@ -1,163 +0,0 @@ -diff --git Source/core/dom/DOMImplementation.cpp Source/core/dom/DOMImplementation.cpp -index 2b04a24..85653cf 100644 ---- Source/core/dom/DOMImplementation.cpp -+++ Source/core/dom/DOMImplementation.cpp -@@ -240,9 +240,9 @@ Document* DOMImplementation::createDocument(const String& type, - // For that reason, the origin must be retrieved directly from init.url(). - if (init.frame()->isMainFrame()) { - RefPtr origin = SecurityOrigin::create(init.url()); -- pluginData = init.frame()->page()->pluginData(origin.get()); -+ pluginData = init.frame()->page()->pluginData(true, origin.get()); - } else { -- pluginData = init.frame()->page()->pluginData( -+ pluginData = init.frame()->page()->pluginData(false, - init.frame()->tree().top()->securityContext()->getSecurityOrigin()); - } - } -diff --git Source/core/frame/LocalFrame.cpp Source/core/frame/LocalFrame.cpp -index 6fa75cf..20cba50 100644 ---- Source/core/frame/LocalFrame.cpp -+++ Source/core/frame/LocalFrame.cpp -@@ -898,6 +898,7 @@ PluginData* LocalFrame::pluginData() const { - if (!loader().allowPlugins(NotAboutToInstantiatePlugin)) - return nullptr; - return page()->pluginData( -+ isMainFrame(), - tree().top()->securityContext()->getSecurityOrigin()); - } - -diff --git Source/core/page/Page.cpp Source/core/page/Page.cpp -index cb46ff7..7c63196 100644 ---- Source/core/page/Page.cpp -+++ Source/core/page/Page.cpp -@@ -226,16 +226,26 @@ void Page::refreshPlugins() { - - for (const Page* page : allPages()) { - // Clear out the page's plugin data. -- if (page->m_pluginData) -- page->m_pluginData = nullptr; -+ if (page->m_pluginDataMainFrame) -+ page->m_pluginDataMainFrame = nullptr; -+ if (page->m_pluginDataSubFrame) -+ page->m_pluginDataSubFrame = nullptr; - } - } - --PluginData* Page::pluginData(SecurityOrigin* mainFrameOrigin) const { -- if (!m_pluginData || -- !mainFrameOrigin->isSameSchemeHostPort(m_pluginData->origin())) -- m_pluginData = PluginData::create(mainFrameOrigin); -- return m_pluginData.get(); -+PluginData* Page::pluginData(bool isMainFrame, -+ SecurityOrigin* mainFrameOrigin) const { -+ if (isMainFrame) { -+ if (!m_pluginDataMainFrame || -+ !mainFrameOrigin->isSameSchemeHostPort(m_pluginDataMainFrame->origin())) -+ m_pluginDataMainFrame = PluginData::create(true, mainFrameOrigin); -+ } else { -+ if (!m_pluginDataSubFrame || -+ !mainFrameOrigin->isSameSchemeHostPort(m_pluginDataSubFrame->origin())) -+ m_pluginDataSubFrame = PluginData::create(false, mainFrameOrigin); -+ } -+ -+ return isMainFrame ? m_pluginDataMainFrame.get() : m_pluginDataSubFrame.get(); - } - - void Page::setValidationMessageClient(ValidationMessageClient* client) { -diff --git Source/core/page/Page.h Source/core/page/Page.h -index 9c429bd..667207e 100644 ---- Source/core/page/Page.h -+++ Source/core/page/Page.h -@@ -130,7 +130,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, - ViewportDescription viewportDescription() const; - - static void refreshPlugins(); -- PluginData* pluginData(SecurityOrigin* mainFrameOrigin) const; -+ PluginData* pluginData(bool isMainFrame, -+ SecurityOrigin* mainFrameOrigin) const; - - EditorClient& editorClient() const { return *m_editorClient; } - SpellCheckerClient& spellCheckerClient() const { -@@ -285,7 +286,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, - // longer needed. - Member m_mainFrame; - -- mutable RefPtr m_pluginData; -+ mutable RefPtr m_pluginDataMainFrame; -+ mutable RefPtr m_pluginDataSubFrame; - - EditorClient* const m_editorClient; - SpellCheckerClient* const m_spellCheckerClient; -diff --git Source/platform/plugins/PluginData.cpp Source/platform/plugins/PluginData.cpp -index a6da275..c879e64 100644 ---- Source/platform/plugins/PluginData.cpp -+++ Source/platform/plugins/PluginData.cpp -@@ -30,11 +30,12 @@ - - namespace blink { - --PluginData::PluginData(SecurityOrigin* mainFrameOrigin) -- : m_mainFrameOrigin(mainFrameOrigin) { -+PluginData::PluginData(bool isMainFrame, SecurityOrigin* mainFrameOrigin) -+ : m_isMainFrame(isMainFrame), -+ m_mainFrameOrigin(mainFrameOrigin) { - PluginListBuilder builder(&m_plugins); - Platform::current()->getPluginList( -- false, WebSecurityOrigin(m_mainFrameOrigin), &builder); -+ false, m_isMainFrame, WebSecurityOrigin(m_mainFrameOrigin), &builder); - - for (unsigned i = 0; i < m_plugins.size(); ++i) { - const PluginInfo& plugin = m_plugins[i]; -@@ -73,7 +74,8 @@ String PluginData::pluginNameForMimeType(const String& mimeType) const { - void PluginData::refreshBrowserSidePluginCache() { - Vector plugins; - PluginListBuilder builder(&plugins); -- Platform::current()->getPluginList(true, WebSecurityOrigin::createUnique(), -+ Platform::current()->getPluginList(true, true, -+ WebSecurityOrigin::createUnique(), - &builder); - } - -diff --git Source/platform/plugins/PluginData.h Source/platform/plugins/PluginData.h -index 0edfd70..a81c128 100644 ---- Source/platform/plugins/PluginData.h -+++ Source/platform/plugins/PluginData.h -@@ -52,8 +52,9 @@ class PLATFORM_EXPORT PluginData : public RefCounted { - WTF_MAKE_NONCOPYABLE(PluginData); - - public: -- static PassRefPtr create(SecurityOrigin* mainFrameOrigin) { -- return adoptRef(new PluginData(mainFrameOrigin)); -+ static PassRefPtr create(bool isMainFrame, -+ SecurityOrigin* mainFrameOrigin) { -+ return adoptRef(new PluginData(isMainFrame, mainFrameOrigin)); - } - - const Vector& plugins() const { return m_plugins; } -@@ -71,12 +72,13 @@ class PLATFORM_EXPORT PluginData : public RefCounted { - static void refreshBrowserSidePluginCache(); - - private: -- explicit PluginData(SecurityOrigin* mainFrameOrigin); -+ explicit PluginData(bool isMainFrame, SecurityOrigin* mainFrameOrigin); - const PluginInfo* pluginInfoForMimeType(const String& mimeType) const; - - Vector m_plugins; - Vector m_mimes; - Vector m_mimePluginIndices; -+ bool m_isMainFrame; - RefPtr m_mainFrameOrigin; - }; - -diff --git public/platform/Platform.h public/platform/Platform.h -index 2cd7334..7541a5e 100644 ---- public/platform/Platform.h -+++ public/platform/Platform.h -@@ -357,6 +357,7 @@ class BLINK_PLATFORM_EXPORT Platform { - // satisfy this call. mainFrameOrigin is used by the browser process to - // filter plugins from the plugin list based on content settings. - virtual void getPluginList(bool refresh, -+ bool isMainFrame, - const WebSecurityOrigin& mainFrameOrigin, - WebPluginListBuilder*) {} - diff --git a/patch/patches/prefs_content_1161.patch b/patch/patches/prefs_content_1161.patch index b55fef435..f63e51c1e 100644 --- a/patch/patches/prefs_content_1161.patch +++ b/patch/patches/prefs_content_1161.patch @@ -1,8 +1,8 @@ diff --git public/common/common_param_traits_macros.h public/common/common_param_traits_macros.h -index a7d48d0..15df86a 100644 +index 3dd2e75..9f61aad 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) +@@ -201,6 +201,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) IPC_STRUCT_TRAITS_MEMBER(main_frame_resizes_are_orientation_changes) IPC_STRUCT_TRAITS_MEMBER(initialize_at_minimum_page_scale) IPC_STRUCT_TRAITS_MEMBER(smart_insert_delete_enabled) @@ -11,10 +11,10 @@ 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 72f7bd8..850e591 100644 --- public/common/web_preferences.cc +++ public/common/web_preferences.cc -@@ -173,6 +173,7 @@ WebPreferences::WebPreferences() +@@ -172,6 +172,7 @@ WebPreferences::WebPreferences() spatial_navigation_enabled(false), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), @@ -23,10 +23,10 @@ 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 ae9756c..d0f2f1b 100644 --- public/common/web_preferences.h +++ public/common/web_preferences.h -@@ -187,6 +187,7 @@ struct CONTENT_EXPORT WebPreferences { +@@ -184,6 +184,7 @@ struct CONTENT_EXPORT WebPreferences { bool spatial_navigation_enabled; bool use_solid_color_scrollbars; bool navigate_on_drag_drop; @@ -35,15 +35,15 @@ 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 7d6113c..d600026 100644 --- renderer/render_view_impl.cc +++ renderer/render_view_impl.cc -@@ -1401,6 +1401,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( +@@ -1383,6 +1383,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( blink::WebView* web_view, CompositorDependencies* compositor_deps) { ApplyWebPreferences(prefs, web_view); + if (GetWebFrameWidget()) -+ GetWebFrameWidget()->setBaseBackgroundColor(prefs.base_background_color); ++ GetWebFrameWidget()->SetBaseBackgroundColor(prefs.base_background_color); } void RenderViewImpl::OnForceRedraw(const ui::LatencyInfo& latency_info) { diff --git a/patch/patches/prefs_tab_helper_1680.patch b/patch/patches/prefs_tab_helper_1680.patch deleted file mode 100644 index 21e9d3b99..000000000 --- a/patch/patches/prefs_tab_helper_1680.patch +++ /dev/null @@ -1,48 +0,0 @@ -diff --git prefs_tab_helper.cc prefs_tab_helper.cc -index 72267d2..5146b39 100644 ---- prefs_tab_helper.cc -+++ prefs_tab_helper.cc -@@ -11,8 +11,8 @@ - #include - - #include "base/command_line.h" -+#include "base/lazy_instance.h" - #include "base/macros.h" --#include "base/memory/singleton.h" - #include "base/strings/string_number_conversions.h" - #include "base/strings/string_util.h" - #include "base/strings/stringprintf.h" -@@ -431,12 +431,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { - GetInstance()->GetServiceForBrowserContext(profile, true)); - } - -- static PrefWatcherFactory* GetInstance() { -- return base::Singleton::get(); -- } -+ static PrefWatcherFactory* GetInstance(); - - private: -- friend struct base::DefaultSingletonTraits; -+ friend struct base::DefaultLazyInstanceTraits; - - PrefWatcherFactory() : BrowserContextKeyedServiceFactory( - "PrefWatcher", -@@ -457,6 +455,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { - } - }; - -+namespace { -+ -+base::LazyInstance::Leaky g_pref_watcher_factory = -+ LAZY_INSTANCE_INITIALIZER; -+ -+} // namespace -+ -+// static -+PrefWatcherFactory* PrefWatcherFactory::GetInstance() { -+ return g_pref_watcher_factory.Pointer(); -+} -+ - // static - PrefWatcher* PrefWatcher::Get(Profile* profile) { - return PrefWatcherFactory::GetForProfile(profile); diff --git a/patch/patches/print_header_footer_1478_1565.patch b/patch/patches/print_header_footer_1478_1565.patch index bed799c9e..69cff3a47 100644 --- a/patch/patches/print_header_footer_1478_1565.patch +++ b/patch/patches/print_header_footer_1478_1565.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/ui/cocoa/applescript/tab_applescript.mm chrome/browser/ui/cocoa/applescript/tab_applescript.mm -index 7ec0135..9f68626 100644 +index 0cd84f3..2f872dd 100644 --- chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -9,7 +9,6 @@ @@ -61,10 +61,10 @@ index f5712a7..11c0366 100644 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) diff --git components/printing/common/print_messages.cc components/printing/common/print_messages.cc -index a9291a2..1a50724 100644 +index de03634..76ee3a7 100644 --- components/printing/common/print_messages.cc +++ components/printing/common/print_messages.cc -@@ -107,7 +107,6 @@ void PrintMsg_PrintPages_Params::Reset() { +@@ -105,7 +105,6 @@ void PrintMsg_PrintPages_Params::Reset() { pages = std::vector(); } @@ -72,16 +72,16 @@ index a9291a2..1a50724 100644 PrintHostMsg_RequestPrintPreview_Params:: PrintHostMsg_RequestPrintPreview_Params() : is_modifiable(false), -@@ -129,4 +128,3 @@ PrintHostMsg_SetOptionsFromDocument_Params:: +@@ -127,4 +126,3 @@ PrintHostMsg_SetOptionsFromDocument_Params:: PrintHostMsg_SetOptionsFromDocument_Params:: ~PrintHostMsg_SetOptionsFromDocument_Params() { } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) diff --git components/printing/common/print_messages.h components/printing/common/print_messages.h -index 9a90bc1..046262f 100644 +index d11d28d..e075be3 100644 --- components/printing/common/print_messages.h +++ components/printing/common/print_messages.h -@@ -75,7 +75,6 @@ struct PrintMsg_PrintPages_Params { +@@ -74,7 +74,6 @@ struct PrintMsg_PrintPages_Params { std::vector pages; }; @@ -89,7 +89,7 @@ index 9a90bc1..046262f 100644 struct PrintHostMsg_RequestPrintPreview_Params { PrintHostMsg_RequestPrintPreview_Params(); ~PrintHostMsg_RequestPrintPreview_Params(); -@@ -94,7 +93,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { +@@ -93,7 +92,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { printing::DuplexMode duplex; printing::PageRanges page_ranges; }; @@ -97,7 +97,7 @@ index 9a90bc1..046262f 100644 #endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ -@@ -187,7 +185,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) +@@ -173,7 +171,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) IPC_STRUCT_TRAITS_MEMBER(to) IPC_STRUCT_TRAITS_END() @@ -105,7 +105,7 @@ index 9a90bc1..046262f 100644 IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params) IPC_STRUCT_TRAITS_MEMBER(is_modifiable) IPC_STRUCT_TRAITS_MEMBER(webnode_only) -@@ -208,7 +205,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) +@@ -194,7 +191,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) // Specifies page range to be printed. IPC_STRUCT_TRAITS_MEMBER(page_ranges) IPC_STRUCT_TRAITS_END() @@ -113,7 +113,7 @@ index 9a90bc1..046262f 100644 IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins) IPC_STRUCT_TRAITS_MEMBER(content_width) -@@ -228,7 +224,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) +@@ -214,7 +210,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) IPC_STRUCT_TRAITS_MEMBER(pages) IPC_STRUCT_TRAITS_END() @@ -121,7 +121,7 @@ index 9a90bc1..046262f 100644 // Parameters to describe a rendered document. IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) // A shared memory handle to metafile data. -@@ -285,7 +280,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params) +@@ -271,7 +266,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params) // Indicates whether the existing preview data needs to be cleared or not. IPC_STRUCT_MEMBER(bool, clear_preview_data) IPC_STRUCT_END() @@ -129,7 +129,7 @@ index 9a90bc1..046262f 100644 // Parameters to describe a rendered page. IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintPage_Params) -@@ -328,22 +322,20 @@ IPC_STRUCT_END() +@@ -314,22 +308,20 @@ IPC_STRUCT_END() // Messages sent from the browser to the renderer. @@ -154,7 +154,7 @@ index 9a90bc1..046262f 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Tells the RenderFrame to switch the CSS to print media type, renders every -@@ -361,13 +353,11 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, +@@ -347,13 +339,11 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, // Tells the RenderFrame whether printing is enabled or not. IPC_MESSAGE_ROUTED1(PrintMsg_SetPrintingEnabled, bool /* enabled */) @@ -168,7 +168,7 @@ index 9a90bc1..046262f 100644 // Messages sent from the renderer to the browser. -@@ -423,7 +413,6 @@ IPC_MESSAGE_CONTROL2(PrintHostMsg_TempFileForPrintingWritten, +@@ -409,7 +399,6 @@ IPC_MESSAGE_CONTROL2(PrintHostMsg_TempFileForPrintingWritten, int /* fd in browser */) #endif // defined(OS_ANDROID) @@ -176,7 +176,7 @@ index 9a90bc1..046262f 100644 // Asks the browser to do print preview. IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview, PrintHostMsg_RequestPrintPreview_Params /* params */) -@@ -457,7 +446,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, +@@ -443,7 +432,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, // The memory handle in this message is already valid in the browser process. IPC_MESSAGE_ROUTED1(PrintHostMsg_MetafileReadyForPrinting, PrintHostMsg_DidPreviewDocument_Params /* params */) @@ -184,7 +184,7 @@ index 9a90bc1..046262f 100644 // This is sent when there are invalid printer settings. IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) -@@ -466,7 +454,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) +@@ -452,7 +440,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, int /* document cookie */) @@ -192,13 +192,13 @@ index 9a90bc1..046262f 100644 // Tell the browser print preview failed. IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, int /* document cookie */) -@@ -493,4 +480,3 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview, +@@ -479,4 +466,3 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview, // Notify the browser to set print presets based on source PDF document. IPC_MESSAGE_ROUTED1(PrintHostMsg_SetOptionsFromDocument, PrintHostMsg_SetOptionsFromDocument_Params /* params */) -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) diff --git components/printing/renderer/print_web_view_helper.cc components/printing/renderer/print_web_view_helper.cc -index eaa294d..6dd6482 100644 +index 7f22427..bf43260 100644 --- components/printing/renderer/print_web_view_helper.cc +++ components/printing/renderer/print_web_view_helper.cc @@ -89,6 +89,9 @@ const float kPrintingMinimumShrinkFactor = 1.333f; @@ -213,7 +213,7 @@ index eaa294d..6dd6482 100644 "document.open(); document.write(%s); document.close();"; @@ -103,9 +106,6 @@ void ExecuteScript(blink::WebFrame* frame, std::string script = base::StringPrintf(script_format, json.c_str()); - frame->executeScript(blink::WebString::fromUTF8(script)); + frame->ExecuteScript(blink::WebString::FromUTF8(script)); } -#else -bool g_is_preview_enabled = false; @@ -221,15 +221,15 @@ index eaa294d..6dd6482 100644 int GetDPI(const PrintMsg_Print_Params* print_params) { #if defined(OS_MACOSX) -@@ -323,7 +323,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, - return plugin && plugin->supportsPaginatedPrint(); +@@ -319,7 +319,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, + return plugin && plugin->SupportsPaginatedPrint(); } -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Returns true if the current destination printer is PRINT_TO_PDF. bool IsPrintToPdfRequested(const base::DictionaryValue& job_settings) { bool print_to_pdf = false; -@@ -345,7 +344,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame, +@@ -341,7 +340,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame, } return frame_has_custom_page_size_style; } @@ -237,7 +237,7 @@ index eaa294d..6dd6482 100644 #if BUILDFLAG(ENABLE_PRINTING) // Disable scaling when either: -@@ -401,7 +399,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, +@@ -397,7 +395,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, } #endif @@ -245,15 +245,15 @@ index eaa294d..6dd6482 100644 bool FitToPageEnabled(const base::DictionaryValue& job_settings) { bool fit_to_paper_size = false; if (!job_settings.GetBoolean(kSettingFitToPageEnabled, &fit_to_paper_size)) { -@@ -444,7 +441,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( +@@ -440,7 +437,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( } - return blink::WebPrintScalingOptionFitToPrintableArea; + return blink::kWebPrintScalingOptionFitToPrintableArea; } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) // Helper function to scale and round an integer value with a double valued // scaling. -@@ -563,7 +559,6 @@ blink::WebView* FrameReference::view() { +@@ -559,7 +555,6 @@ blink::WebView* FrameReference::view() { return view_; } @@ -261,15 +261,15 @@ index eaa294d..6dd6482 100644 // static - Not anonymous so that platform implementations can use it. void PrintWebViewHelper::PrintHeaderAndFooter( blink::WebCanvas* canvas, -@@ -621,7 +616,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter( +@@ -617,7 +612,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter( - web_view->close(); + web_view->Close(); } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) // static - Not anonymous so that platform implementations can use it. float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame, -@@ -907,6 +901,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderFrame* render_frame, +@@ -909,6 +903,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderFrame* render_frame, print_for_preview_(false), delegate_(std::move(delegate)), print_node_in_progress_(false), @@ -277,7 +277,7 @@ index eaa294d..6dd6482 100644 is_loading_(false), is_scripted_preview_delayed_(false), ipc_nesting_level_(0), -@@ -968,10 +963,8 @@ void PrintWebViewHelper::ScriptedPrint(bool user_initiated) { +@@ -970,10 +965,8 @@ void PrintWebViewHelper::ScriptedPrint(bool user_initiated) { return; if (g_is_preview_enabled) { @@ -288,7 +288,7 @@ index eaa294d..6dd6482 100644 } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) Print(web_frame, blink::WebNode(), true /* is_scripted? */); -@@ -999,14 +992,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { +@@ -1001,14 +994,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -303,7 +303,7 @@ index eaa294d..6dd6482 100644 IPC_MESSAGE_HANDLER(PrintMsg_SetPrintingEnabled, OnSetPrintingEnabled) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() -@@ -1050,7 +1039,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { +@@ -1052,7 +1041,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { } #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -311,7 +311,7 @@ index eaa294d..6dd6482 100644 void PrintWebViewHelper::OnPrintForPrintPreview( const base::DictionaryValue& job_settings) { CHECK_LE(ipc_nesting_level_, 1); -@@ -1110,7 +1098,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview( +@@ -1112,7 +1100,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview( DidFinishPrinting(FAIL_PRINT); } } @@ -319,7 +319,7 @@ index eaa294d..6dd6482 100644 void PrintWebViewHelper::GetPageSizeAndContentAreaFromPageLayout( const PageSizeMargins& page_layout_in_points, -@@ -1135,7 +1122,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( +@@ -1137,7 +1124,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( ignore_css_margins_ = (margins_type != DEFAULT_MARGINS); } @@ -327,7 +327,7 @@ index eaa294d..6dd6482 100644 void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) { if (ipc_nesting_level_ > 1) return; -@@ -1331,7 +1317,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { +@@ -1333,7 +1319,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { return true; } @@ -364,7 +364,7 @@ index eaa294d..6dd6482 100644 @@ -1417,7 +1401,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { // that instead. auto plugin = delegate_->GetPdfElement(frame); - if (!plugin.isNull()) { + if (!plugin.IsNull()) { + force_print_preview_ = true; PrintNode(plugin); + force_print_preview_ = false; @@ -408,7 +408,7 @@ index eaa294d..6dd6482 100644 } prep_frame_view_.reset(); print_pages_params_.reset(); -@@ -1684,7 +1665,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, +@@ -1685,7 +1666,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, return true; } @@ -416,7 +416,7 @@ index eaa294d..6dd6482 100644 bool PrintWebViewHelper::SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options) { blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); -@@ -1791,7 +1771,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( +@@ -1792,7 +1772,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS); return false; } @@ -424,23 +424,34 @@ index eaa294d..6dd6482 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) void PrintWebViewHelper::GetPrintSettingsFromUser( -@@ -1904,7 +1883,6 @@ void PrintWebViewHelper::PrintPageInternal( +@@ -1854,10 +1833,8 @@ void PrintWebViewHelper::PrintPageInternal(const PrintMsg_Print_Params& params, + PageSizeMargins page_layout_in_points; + + double css_scale_factor = 1.0f; +-#if BUILDFLAG(ENABLE_PRINT_PREVIEW) + if (params.scale_factor >= kEpsilon) + css_scale_factor = params.scale_factor; +-#endif + + // Save the original page size here to avoid rounding errors incurred by + // converting to pixels and back and by scaling the page for reflow and +@@ -1904,7 +1881,6 @@ void PrintWebViewHelper::PrintPageInternal(const PrintMsg_Print_Params& params, MetafileSkiaWrapper::SetMetafileOnCanvas(canvas, metafile); -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) - if (params.params.display_header_footer) { + if (params.display_header_footer) { // TODO(thestig): Figure out why Linux needs this. It is almost certainly // |printingMinimumShrinkFactor| from Blink. -@@ -1919,7 +1897,6 @@ void PrintWebViewHelper::PrintPageInternal( - scale_factor / fudge_factor, page_layout_in_points, - params.params); +@@ -1918,7 +1894,6 @@ void PrintWebViewHelper::PrintPageInternal(const PrintMsg_Print_Params& params, + canvas, page_number + 1, print_preview_context_.total_page_count(), + *frame, scale_factor / fudge_factor, page_layout_in_points, params); } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) - float webkit_scale_factor = - RenderPageContent(frame, params.page_number, canvas_area, content_area, -@@ -1955,7 +1932,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( + float webkit_scale_factor = RenderPageContent( + frame, page_number, canvas_area, content_area, scale_factor, canvas); +@@ -1953,7 +1928,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( return true; } @@ -448,7 +459,7 @@ index eaa294d..6dd6482 100644 void PrintWebViewHelper::ShowScriptedPrintPreview() { if (is_scripted_preview_delayed_) { is_scripted_preview_delayed_ = false; -@@ -2086,7 +2062,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number, +@@ -2084,7 +2058,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number, Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params)); return true; } @@ -457,10 +468,10 @@ index eaa294d..6dd6482 100644 PrintWebViewHelper::PrintPreviewContext::PrintPreviewContext() : total_page_count_(0), diff --git components/printing/renderer/print_web_view_helper.h components/printing/renderer/print_web_view_helper.h -index d979333..8786274 100644 +index 652fbf0..0050918 100644 --- components/printing/renderer/print_web_view_helper.h +++ components/printing/renderer/print_web_view_helper.h -@@ -145,9 +145,7 @@ class PrintWebViewHelper +@@ -153,9 +153,7 @@ class PrintWebViewHelper OK, FAIL_PRINT_INIT, FAIL_PRINT, @@ -470,7 +481,7 @@ index d979333..8786274 100644 }; enum PrintPreviewErrorBuckets { -@@ -183,10 +181,8 @@ class PrintWebViewHelper +@@ -191,10 +189,8 @@ class PrintWebViewHelper void OnPrintForSystemDialog(); void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -481,7 +492,7 @@ index d979333..8786274 100644 void OnPrintingDone(bool success); // Get |page_size| and |content_area| information from -@@ -199,7 +195,6 @@ class PrintWebViewHelper +@@ -207,7 +203,6 @@ class PrintWebViewHelper // Update |ignore_css_margins_| based on settings. void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); @@ -489,7 +500,7 @@ index d979333..8786274 100644 // Prepare frame for creating preview document. void PrepareFrameForPreviewDocument(); -@@ -216,7 +211,6 @@ class PrintWebViewHelper +@@ -224,7 +219,6 @@ class PrintWebViewHelper // Finalize the print ready preview document. bool FinalizePrintReadyDocument(); @@ -497,7 +508,7 @@ index d979333..8786274 100644 // Enable/Disable printing. void OnSetPrintingEnabled(bool enabled); -@@ -246,7 +240,6 @@ class PrintWebViewHelper +@@ -254,7 +248,6 @@ class PrintWebViewHelper const blink::WebNode& node, int* number_of_pages); @@ -505,7 +516,7 @@ index d979333..8786274 100644 // Set options for print preset from source PDF document. bool SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options); -@@ -257,7 +250,6 @@ class PrintWebViewHelper +@@ -265,7 +258,6 @@ class PrintWebViewHelper bool UpdatePrintSettings(blink::WebLocalFrame* frame, const blink::WebNode& node, const base::DictionaryValue& passed_job_settings); @@ -513,7 +524,7 @@ index d979333..8786274 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Get final print settings from the user. -@@ -336,7 +328,6 @@ class PrintWebViewHelper +@@ -346,7 +338,6 @@ class PrintWebViewHelper const PrintMsg_PrintPages_Params& params, int page_count); @@ -521,7 +532,7 @@ index d979333..8786274 100644 // Given the |device| and |canvas| to draw on, prints the appropriate headers // and footers using strings from |header_footer_info| on to the canvas. static void PrintHeaderAndFooter(blink::WebCanvas* canvas, -@@ -346,7 +337,6 @@ class PrintWebViewHelper +@@ -356,7 +347,6 @@ class PrintWebViewHelper float webkit_scale_factor, const PageSizeMargins& page_layout_in_points, const PrintMsg_Print_Params& params); @@ -529,7 +540,7 @@ index d979333..8786274 100644 // Script Initiated Printing ------------------------------------------------ -@@ -356,7 +346,6 @@ class PrintWebViewHelper +@@ -366,7 +356,6 @@ class PrintWebViewHelper bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame, bool user_initiated); @@ -537,7 +548,7 @@ index d979333..8786274 100644 // Shows scripted print preview when options from plugin are available. void ShowScriptedPrintPreview(); -@@ -374,7 +363,6 @@ class PrintWebViewHelper +@@ -384,7 +373,6 @@ class PrintWebViewHelper // |metafile| is the rendered page. Otherwise |metafile| is NULL. // Returns true if print preview should continue, false on failure. bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile); @@ -545,7 +556,7 @@ index d979333..8786274 100644 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); -@@ -527,6 +515,7 @@ class PrintWebViewHelper +@@ -537,6 +525,7 @@ class PrintWebViewHelper ScriptingThrottler scripting_throttler_; bool print_node_in_progress_; @@ -554,18 +565,18 @@ index d979333..8786274 100644 bool is_loading_; bool is_scripted_preview_delayed_; diff --git components/printing/renderer/print_web_view_helper_mac.mm components/printing/renderer/print_web_view_helper_mac.mm -index 6de15ad..95190ae 100644 +index 4c1c5b9..538845c 100644 --- components/printing/renderer/print_web_view_helper_mac.mm +++ components/printing/renderer/print_web_view_helper_mac.mm -@@ -68,7 +68,6 @@ void PrintWebViewHelper::PrintPageInternal( - Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params)); +@@ -74,7 +74,6 @@ void PrintWebViewHelper::PrintPagesInternal( + } } -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) bool PrintWebViewHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -105,7 +104,6 @@ bool PrintWebViewHelper::RenderPreviewPage( +@@ -111,7 +110,6 @@ bool PrintWebViewHelper::RenderPreviewPage( } return PreviewPageRendered(page_number, draft_metafile.get()); } @@ -573,7 +584,7 @@ index 6de15ad..95190ae 100644 void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, int page_number, -@@ -141,14 +139,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, +@@ -147,14 +145,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, MetafileSkiaWrapper::SetMetafileOnCanvas(canvas, metafile); cc::SetIsPreviewMetafile(canvas, is_preview); diff --git a/patch/patches/process_title_1639.patch b/patch/patches/process_title_1639.patch deleted file mode 100644 index 7153662df..000000000 --- a/patch/patches/process_title_1639.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git set_process_title.cc set_process_title.cc -index 2118598..8f85c70 100644 ---- set_process_title.cc -+++ set_process_title.cc -@@ -44,7 +44,7 @@ void SetProcessTitleFromCommandLine(const char** main_argv) { - bool have_argv0 = false; - - #if defined(OS_LINUX) -- DCHECK_EQ(base::PlatformThread::CurrentId(), getpid()); -+ //DCHECK_EQ(base::PlatformThread::CurrentId(), getpid()); - - if (main_argv) - setproctitle_init(main_argv); diff --git a/patch/patches/render_view_host_impl_1392.patch b/patch/patches/render_view_host_impl_1392.patch index 07cff8adf..5551a89f5 100644 --- a/patch/patches/render_view_host_impl_1392.patch +++ b/patch/patches/render_view_host_impl_1392.patch @@ -1,8 +1,8 @@ diff --git render_view_host_impl.h render_view_host_impl.h -index fece1e0..9c54a78 100644 +index bcc702b..3753c50 100644 --- render_view_host_impl.h +++ render_view_host_impl.h -@@ -153,6 +153,7 @@ class CONTENT_EXPORT RenderViewHostImpl : public RenderViewHost, +@@ -154,6 +154,7 @@ class CONTENT_EXPORT RenderViewHostImpl : public RenderViewHost, void set_is_swapped_out(bool is_swapped_out) { is_swapped_out_ = is_swapped_out; } diff --git a/patch/patches/render_widget_host_1070383005.patch b/patch/patches/render_widget_host_1070383005.patch index 0c4e37e78..56b4f04b7 100644 --- a/patch/patches/render_widget_host_1070383005.patch +++ b/patch/patches/render_widget_host_1070383005.patch @@ -1,8 +1,8 @@ diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm -index b67a5f3..edf32a4 100644 +index 896170a..4beadf9 100644 --- render_widget_host_view_mac.mm +++ render_widget_host_view_mac.mm -@@ -463,9 +463,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, +@@ -453,9 +453,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, // Paint this view host with |background_color_| when there is no content // ready to draw. background_layer_.reset([[CALayer alloc] init]); diff --git a/patch/patches/render_widget_latency_2060.patch b/patch/patches/render_widget_latency_2060.patch index b12f7ce8b..c9682d566 100644 --- a/patch/patches/render_widget_latency_2060.patch +++ b/patch/patches/render_widget_latency_2060.patch @@ -1,12 +1,14 @@ -diff --git content/browser/renderer_host/input/render_widget_host_latency_tracker.cc content/browser/renderer_host/input/render_widget_host_latency_tracker.cc -index f809926..3635113 100644 ---- content/browser/renderer_host/input/render_widget_host_latency_tracker.cc -+++ content/browser/renderer_host/input/render_widget_host_latency_tracker.cc -@@ -80,7 +80,6 @@ void UpdateLatencyCoordinates(const WebInputEvent& event, +diff --git ui/latency/latency_histogram_macros.h ui/latency/latency_histogram_macros.h +index 77e3eee..f8dd635 100644 +--- ui/latency/latency_histogram_macros.h ++++ ui/latency/latency_histogram_macros.h +@@ -10,8 +10,7 @@ + // Check valid timing for start and end latency components. #define CONFIRM_VALID_TIMING(start, end) \ DCHECK(!start.first_event_time.is_null()); \ - DCHECK(!end.last_event_time.is_null()); \ +- DCHECK(!end.last_event_time.is_null()); \ - DCHECK_GE(end.last_event_time, start.first_event_time); ++ DCHECK(!end.last_event_time.is_null()); - // Long scroll latency component that is mostly under 200ms. - #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG(name, start, end) \ + // Event latency that is mostly under 1 second. We should only use 100 buckets + // when needed. diff --git a/patch/patches/rwh_background_color_1984.patch b/patch/patches/rwh_background_color_1984.patch index f68eee875..fcd703d8d 100644 --- a/patch/patches/rwh_background_color_1984.patch +++ b/patch/patches/rwh_background_color_1984.patch @@ -1,11 +1,11 @@ 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 3e49165..ba55f02 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) { - RenderWidgetHostViewBase::SetBackgroundColor(color); - bool opaque = GetBackgroundOpaque(); - host_->SetBackgroundOpaque(opaque); +@@ -740,8 +740,10 @@ void RenderWidgetHostViewAura::UpdateBackgroundColorFromRenderer( + background_color_ = color; + + bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE; - window_->layer()->SetFillsBoundsOpaquely(opaque); - window_->layer()->SetColor(color); + if (window_) { diff --git a/patch/patches/service_factory_1680.patch b/patch/patches/service_factory_1680.patch index 65fa8303d..46ad78855 100644 --- a/patch/patches/service_factory_1680.patch +++ b/patch/patches/service_factory_1680.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/spellchecker/spellcheck_factory.cc chrome/browser/spellchecker/spellcheck_factory.cc -index 3857256..3d1562c 100644 +index 9d94c21..990046f 100644 --- chrome/browser/spellchecker/spellcheck_factory.cc +++ chrome/browser/spellchecker/spellcheck_factory.cc -@@ -16,6 +16,13 @@ +@@ -17,6 +17,13 @@ #include "content/public/browser/render_process_host.h" #include "ui/base/l10n/l10n_util.h" @@ -16,7 +16,7 @@ index 3857256..3d1562c 100644 // static SpellcheckService* SpellcheckServiceFactory::GetForContext( content::BrowserContext* context) { -@@ -38,7 +45,7 @@ SpellcheckService* SpellcheckServiceFactory::GetForRenderProcessId( +@@ -39,7 +46,7 @@ SpellcheckService* SpellcheckServiceFactory::GetForRenderProcessId( // static SpellcheckServiceFactory* SpellcheckServiceFactory::GetInstance() { @@ -26,7 +26,7 @@ index 3857256..3d1562c 100644 SpellcheckServiceFactory::SpellcheckServiceFactory() diff --git chrome/browser/spellchecker/spellcheck_factory.h chrome/browser/spellchecker/spellcheck_factory.h -index e8eb9f7..48126000 100644 +index e8eb9f7..2e1b7cf 100644 --- chrome/browser/spellchecker/spellcheck_factory.h +++ chrome/browser/spellchecker/spellcheck_factory.h @@ -7,7 +7,7 @@ @@ -43,7 +43,7 @@ index e8eb9f7..48126000 100644 private: - friend struct base::DefaultSingletonTraits; -+ friend struct base::DefaultLazyInstanceTraits; ++ friend struct base::LazyInstanceTraitsBase; SpellcheckServiceFactory(); ~SpellcheckServiceFactory() override; @@ -75,7 +75,7 @@ index 173ac31..473e561 100644 SupervisedUserSettingsServiceFactory::SupervisedUserSettingsServiceFactory() diff --git chrome/browser/supervised_user/supervised_user_settings_service_factory.h chrome/browser/supervised_user/supervised_user_settings_service_factory.h -index 2907619..c7a36ea 100644 +index 2907619..f941fba 100644 --- chrome/browser/supervised_user/supervised_user_settings_service_factory.h +++ chrome/browser/supervised_user/supervised_user_settings_service_factory.h @@ -5,7 +5,7 @@ @@ -92,12 +92,12 @@ index 2907619..c7a36ea 100644 private: - friend struct base::DefaultSingletonTraits< -+ friend struct base::DefaultLazyInstanceTraits< ++ friend struct base::LazyInstanceTraitsBase< SupervisedUserSettingsServiceFactory>; SupervisedUserSettingsServiceFactory(); diff --git chrome/browser/ui/prefs/prefs_tab_helper.cc chrome/browser/ui/prefs/prefs_tab_helper.cc -index a46d449..0650084 100644 +index a46d449..8c9a6b8 100644 --- chrome/browser/ui/prefs/prefs_tab_helper.cc +++ chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -11,8 +11,8 @@ @@ -121,7 +121,7 @@ index a46d449..0650084 100644 private: - friend struct base::DefaultSingletonTraits; -+ friend struct base::DefaultLazyInstanceTraits; ++ friend struct base::LazyInstanceTraitsBase; PrefWatcherFactory() : BrowserContextKeyedServiceFactory( "PrefWatcher", diff --git a/patch/patches/service_manager_654986.patch b/patch/patches/service_manager_654986.patch new file mode 100644 index 000000000..391f27163 --- /dev/null +++ b/patch/patches/service_manager_654986.patch @@ -0,0 +1,136 @@ +diff --git services/service_manager/embedder/main.cc services/service_manager/embedder/main.cc +index 0debd91780b5..432d91ef9713 100644 +--- services/service_manager/embedder/main.cc ++++ services/service_manager/embedder/main.cc +@@ -29,7 +29,6 @@ + #endif + + #if defined(OS_MACOSX) +-#include "base/mac/scoped_nsautorelease_pool.h" + #include "services/service_manager/embedder/mac_init.h" + + #if BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM) +@@ -98,7 +97,7 @@ MainParams::MainParams(MainDelegate* delegate) : delegate(delegate) {} + + MainParams::~MainParams() {} + +-int Main(const MainParams& params) { ++int MainInitialize(MainParams& params) { + MainDelegate* delegate = params.delegate; + DCHECK(delegate); + +@@ -155,9 +154,9 @@ int Main(const MainParams& params) { + // loop, but we don't want to leave them hanging around until the app quits. + // Each "main" needs to flush this pool right before it goes into its main + // event loop to get rid of the cruft. +- std::unique_ptr autorelease_pool = ++ params.autorelease_pool = + base::MakeUnique(); +- init_params.autorelease_pool = autorelease_pool.get(); ++ init_params.autorelease_pool = params.autorelease_pool.get(); + InitializeMac(); + #endif + +@@ -173,10 +172,17 @@ int Main(const MainParams& params) { + base::debug::GlobalActivityTracker::PROCESS_LAUNCH_FAILED); + tracker->process_data().SetInt("exit-code", exit_code); + } +- return exit_code; + } ++ return exit_code; ++} ++ ++int MainRun(MainParams& params) { ++ MainDelegate* delegate = params.delegate; ++ DCHECK(delegate); + +- exit_code = delegate->Run(); ++ base::debug::GlobalActivityTracker* tracker = ++ base::debug::GlobalActivityTracker::Get(); ++ int exit_code = delegate->Run(); + if (tracker) { + if (exit_code == 0) { + tracker->SetProcessPhaseIfEnabled( +@@ -187,13 +193,26 @@ int Main(const MainParams& params) { + tracker->process_data().SetInt("exit-code", exit_code); + } + } ++ return exit_code; ++} ++ ++void MainShutdown(MainParams& params) { ++ MainDelegate* delegate = params.delegate; ++ DCHECK(delegate); + + #if defined(OS_MACOSX) +- autorelease_pool.reset(); ++ params.autorelease_pool.reset(); + #endif + + delegate->ShutDown(); ++} + ++int Main(MainParams& params) { ++ int exit_code = MainInitialize(params); ++ if (exit_code >= 0) ++ return exit_code; ++ exit_code = MainRun(params); ++ MainShutdown(params); + return exit_code; + } + +diff --git services/service_manager/embedder/main.h services/service_manager/embedder/main.h +index e86697a26d0f..771acd80a3e1 100644 +--- services/service_manager/embedder/main.h ++++ services/service_manager/embedder/main.h +@@ -5,9 +5,15 @@ + #ifndef SERVICES_SERVICE_MANAGER_EMBEDDER_MAIN_H_ + #define SERVICES_SERVICE_MANAGER_EMBEDDER_MAIN_H_ + ++#include ++ + #include "build/build_config.h" + #include "services/service_manager/embedder/service_manager_embedder_export.h" + ++#if defined(OS_MACOSX) ++#include "base/mac/scoped_nsautorelease_pool.h" ++#endif // defined(OS_MACOSX) ++ + namespace service_manager { + + class MainDelegate; +@@ -22,11 +28,20 @@ struct SERVICE_MANAGER_EMBEDDER_EXPORT MainParams { + int argc = 0; + const char** argv = nullptr; + #endif ++ ++#if defined(OS_MACOSX) ++ std::unique_ptr autorelease_pool; ++#endif + }; + ++// Split Main() into separate stages. ++int SERVICE_MANAGER_EMBEDDER_EXPORT MainInitialize(MainParams& params); ++int SERVICE_MANAGER_EMBEDDER_EXPORT MainRun(MainParams& params); ++void SERVICE_MANAGER_EMBEDDER_EXPORT MainShutdown(MainParams& params); ++ + // Main function which should be called as early as possible by any executable + // embedding the service manager. +-int SERVICE_MANAGER_EMBEDDER_EXPORT Main(const MainParams& params); ++int SERVICE_MANAGER_EMBEDDER_EXPORT Main(MainParams& params); + + } // namespace service_manager + +diff --git services/service_manager/embedder/set_process_title.cc services/service_manager/embedder/set_process_title.cc +index 80b9a0ab2ffc..5162354006b0 100644 +--- services/service_manager/embedder/set_process_title.cc ++++ services/service_manager/embedder/set_process_title.cc +@@ -44,7 +44,7 @@ void SetProcessTitleFromCommandLine(const char** main_argv) { + bool have_argv0 = false; + + #if defined(OS_LINUX) +- DCHECK_EQ(base::PlatformThread::CurrentId(), getpid()); ++ //DCHECK_EQ(base::PlatformThread::CurrentId(), getpid()); + + if (main_argv) + setproctitle_init(main_argv); diff --git a/patch/patches/storage_partition_1973.patch b/patch/patches/storage_partition_1973.patch index 0a2544a81..51ceeb4dc 100644 --- a/patch/patches/storage_partition_1973.patch +++ b/patch/patches/storage_partition_1973.patch @@ -1,5 +1,5 @@ diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc -index 28f33e7..9b0d352 100644 +index e9ad038..2a10c80 100644 --- content/browser/appcache/appcache_internals_ui.cc +++ content/browser/appcache/appcache_internals_ui.cc @@ -369,8 +369,8 @@ void AppCacheInternalsUI::CreateProxyForPartition( @@ -42,10 +42,10 @@ index 4c7cfac..4d5c09c 100644 BrowserContext* browser_context); diff --git content/browser/browser_context.cc content/browser/browser_context.cc -index 2f14933..6894773 100644 +index b7a99d5..b9f70ea 100644 --- content/browser/browser_context.cc +++ content/browser/browser_context.cc -@@ -115,7 +115,14 @@ StoragePartition* GetStoragePartitionFromConfig( +@@ -114,7 +114,14 @@ StoragePartition* GetStoragePartitionFromConfig( if (browser_context->IsOffTheRecord()) in_memory = true; @@ -61,7 +61,7 @@ index 2f14933..6894773 100644 } void SaveSessionStateOnIOThread( -@@ -503,6 +510,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( +@@ -505,6 +512,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( : nullptr; } @@ -91,10 +91,10 @@ index 242d33e..4dfb463 100644 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc -index 7346efe..20560c7 100644 +index 9986ff6..0d2abbd 100644 --- content/browser/renderer_host/render_process_host_impl.cc +++ content/browser/renderer_host/render_process_host_impl.cc -@@ -669,7 +669,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() { +@@ -661,7 +661,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() { RenderProcessHostImpl::RenderProcessHostImpl( BrowserContext* browser_context, @@ -103,7 +103,7 @@ index 7346efe..20560c7 100644 bool is_for_guests_only) : fast_shutdown_started_(false), deleting_soon_(false), -@@ -699,7 +699,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( +@@ -691,7 +691,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( indexed_db_factory_(new IndexedDBDispatcherHost( id_, storage_partition_impl_->GetURLRequestContext(), @@ -113,7 +113,7 @@ index 7346efe..20560c7 100644 ChromeBlobStorageContext::GetFor(browser_context_))), channel_connected_(false), sent_render_process_ready_(false), -@@ -729,7 +730,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( +@@ -722,7 +723,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( } push_messaging_manager_.reset(new PushMessagingManager( @@ -121,9 +121,9 @@ index 7346efe..20560c7 100644 + GetID(), static_cast( + storage_partition_impl_->GetServiceWorkerContext()))); + AddObserver(indexed_db_factory_.get()); #if defined(OS_MACOSX) - if (BootstrapSandboxManager::ShouldEnable()) -@@ -932,7 +934,7 @@ bool RenderProcessHostImpl::Init() { +@@ -926,7 +928,7 @@ bool RenderProcessHostImpl::Init() { } void RenderProcessHostImpl::EnableSendQueue() { @@ -132,7 +132,7 @@ index 7346efe..20560c7 100644 InitializeChannelProxy(); } -@@ -1026,6 +1028,22 @@ void RenderProcessHostImpl::ResetChannelProxy() { +@@ -1020,6 +1022,22 @@ void RenderProcessHostImpl::ResetChannelProxy() { void RenderProcessHostImpl::CreateMessageFilters() { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -155,7 +155,7 @@ index 7346efe..20560c7 100644 AddFilter(new ResourceSchedulerFilter(GetID())); MediaInternals* media_internals = MediaInternals::GetInstance(); // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages -@@ -1040,8 +1058,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1034,8 +1052,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { new RenderMessageFilter( GetID(), GetBrowserContext(), request_context.get(), widget_helper_.get(), media_internals, @@ -166,7 +166,7 @@ index 7346efe..20560c7 100644 AddFilter(render_message_filter.get()); render_frame_message_filter_ = new RenderFrameMessageFilter( -@@ -1071,10 +1089,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1065,10 +1083,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { ChromeBlobStorageContext::GetFor(browser_context); resource_message_filter_ = new ResourceMessageFilter( @@ -174,12 +174,12 @@ index 7346efe..20560c7 100644 + GetID(), app_cache_service, blob_storage_context.get(), storage_partition_impl_->GetFileSystemContext(), -- storage_partition_impl_->GetServiceWorkerContext(), -+ service_worker_context, - get_contexts_callback); +- storage_partition_impl_->GetServiceWorkerContext(), get_contexts_callback, ++ service_worker_context, get_contexts_callback, + BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); AddFilter(resource_message_filter_.get()); -@@ -1098,10 +1116,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1092,10 +1110,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { AddFilter( new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_service())); AddFilter(new AppCacheDispatcherHost( @@ -192,7 +192,7 @@ index 7346efe..20560c7 100644 #if BUILDFLAG(ENABLE_WEBRTC) peer_connection_tracker_host_ = new PeerConnectionTrackerHost( -@@ -1141,13 +1159,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1135,13 +1153,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { scoped_refptr cache_storage_filter = new CacheStorageDispatcherHost(); @@ -208,7 +208,7 @@ index 7346efe..20560c7 100644 AddFilter(service_worker_filter.get()); AddFilter(new SharedWorkerMessageFilter( -@@ -1155,12 +1172,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1149,12 +1166,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { WorkerStoragePartition( storage_partition_impl_->GetURLRequestContext(), storage_partition_impl_->GetMediaURLRequestContext(), @@ -224,7 +224,7 @@ index 7346efe..20560c7 100644 base::Bind(&RenderWidgetHelper::GetNextRoutingID, base::Unretained(widget_helper_.get())))); -@@ -1176,11 +1193,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1170,11 +1187,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { GetID(), storage_partition_impl_->GetQuotaManager(), GetContentClient()->browser()->CreateQuotaPermissionContext())); @@ -237,9 +237,9 @@ index 7346efe..20560c7 100644 resource_context, service_worker_context, browser_context); AddFilter(notification_message_filter_.get()); -@@ -1199,6 +1213,11 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { - auto registry = base::MakeUnique( - service_manager::mojom::kServiceManager_ConnectorSpec); +@@ -1191,6 +1205,11 @@ void RenderProcessHostImpl::CreateMessageFilters() { + void RenderProcessHostImpl::RegisterMojoInterfaces() { + auto registry = base::MakeUnique(); + // Cast to the derived type from StoragePartitionImpl. + auto platform_notification_context = @@ -247,9 +247,9 @@ index 7346efe..20560c7 100644 + storage_partition_impl_->GetPlatformNotificationContext()); + channel_->AddAssociatedInterfaceForIOThread( - base::Bind(&IndexedDBDispatcherHost::AddBinding, indexed_db_factory_)); - -@@ -1259,8 +1278,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { + base::Bind(&IndexedDBDispatcherHost::AddBinding, + base::Unretained(indexed_db_factory_.get()))); +@@ -1252,8 +1271,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { AddUIThreadInterface( registry.get(), base::Bind(&PlatformNotificationContextImpl::CreateService, @@ -259,7 +259,7 @@ index 7346efe..20560c7 100644 GetID())); AddUIThreadInterface( registry.get(), -@@ -1460,6 +1478,7 @@ void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { +@@ -1451,6 +1469,7 @@ void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!is_worker_ref_count_disabled_); is_worker_ref_count_disabled_ = true; @@ -268,18 +268,18 @@ index 7346efe..20560c7 100644 return; service_worker_ref_count_ = 0; diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h -index 1eac862..84c87a5 100644 +index aa6898d..f19264e 100644 --- content/browser/renderer_host/render_process_host_impl.h +++ content/browser/renderer_host/render_process_host_impl.h -@@ -72,7 +72,6 @@ class RenderWidgetHelper; - class RenderWidgetHost; +@@ -75,7 +75,6 @@ class RenderWidgetHost; + class RenderWidgetHostImpl; class ResourceMessageFilter; class StoragePartition; -class StoragePartitionImpl; namespace mojom { class StoragePartitionService; -@@ -108,7 +107,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -111,7 +110,7 @@ class CONTENT_EXPORT RenderProcessHostImpl public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) { public: RenderProcessHostImpl(BrowserContext* browser_context, @@ -288,8 +288,12 @@ index 1eac862..84c87a5 100644 bool is_for_guests_only); ~RenderProcessHostImpl() override; -@@ -508,7 +507,7 @@ class CONTENT_EXPORT RenderProcessHostImpl - BrowserContext* browser_context_; +@@ -516,10 +515,10 @@ class CONTENT_EXPORT RenderProcessHostImpl + // called. + int instance_id_ = 1; + +- BrowserContext* const browser_context_; ++ BrowserContext* browser_context_; // Owned by |browser_context_|. - StoragePartitionImpl* storage_partition_impl_; @@ -314,18 +318,20 @@ index a4c8862..2312f35 100644 is_for_guests_only); } diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h -index 92b46dd..45f372c 100644 +index 5b706ff..6d7f7cd 100644 --- content/browser/storage_partition_impl.h +++ content/browser/storage_partition_impl.h -@@ -77,11 +77,10 @@ class CONTENT_EXPORT StoragePartitionImpl +@@ -78,12 +78,11 @@ class CONTENT_EXPORT StoragePartitionImpl ZoomLevelDelegate* GetZoomLevelDelegate() override; PlatformNotificationContextImpl* GetPlatformNotificationContext() override; void ClearBluetoothAllowedDevicesMapForTesting() override; - +- BackgroundFetchContext* GetBackgroundFetchContext(); - BackgroundSyncContext* GetBackgroundSyncContext(); - PaymentAppContextImpl* GetPaymentAppContext(); - BroadcastChannelProvider* GetBroadcastChannelProvider(); - BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap(); ++ BackgroundFetchContext* GetBackgroundFetchContext() override; + BackgroundSyncContext* GetBackgroundSyncContext() override; + PaymentAppContextImpl* GetPaymentAppContext() override; + BroadcastChannelProvider* GetBroadcastChannelProvider() override; @@ -333,7 +339,7 @@ index 92b46dd..45f372c 100644 // mojom::StoragePartitionService interface. void OpenLocalStorage( -@@ -115,7 +114,8 @@ class CONTENT_EXPORT StoragePartitionImpl +@@ -123,7 +122,8 @@ class CONTENT_EXPORT StoragePartitionImpl BrowserContext* browser_context() const; // Called by each renderer process once. @@ -372,10 +378,10 @@ index 075ae3e..57fb5fd 100644 void InitializeOnIOThread(); diff --git content/public/browser/browser_context.h content/public/browser/browser_context.h -index f5cc21f..0a6cd2b 100644 +index 89461da..619996f 100644 --- content/public/browser/browser_context.h +++ content/public/browser/browser_context.h -@@ -170,6 +170,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { +@@ -171,6 +171,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { static ServiceManagerConnection* GetServiceManagerConnectionFor( BrowserContext* browser_context); @@ -384,11 +390,10 @@ index f5cc21f..0a6cd2b 100644 ~BrowserContext() override; // Shuts down the storage partitions associated to this browser context. -@@ -244,6 +246,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { - CreateMediaRequestContextForStoragePartition( +@@ -246,6 +248,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { const base::FilePath& partition_path, bool in_memory) = 0; -+ + + // CEF returns a proxy object that forwards method calls to |partition_impl|. + virtual content::StoragePartition* GetStoragePartitionProxy( + BrowserContext* browser_context, @@ -396,11 +401,12 @@ index f5cc21f..0a6cd2b 100644 + NOTREACHED(); + return nullptr; + } - }; ++ + using StaticServiceMap = std::map; - } // namespace content + // Registers per-browser-context services to be loaded in the browser process diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h -index ae4ba1e..f595bcf 100644 +index 4d4021d..00f0c6a 100644 --- content/public/browser/storage_partition.h +++ content/public/browser/storage_partition.h @@ -13,6 +13,7 @@ @@ -411,10 +417,11 @@ index ae4ba1e..f595bcf 100644 #include "net/cookies/cookie_store.h" class GURL; -@@ -41,16 +42,24 @@ class DatabaseTracker; +@@ -41,16 +42,25 @@ class DatabaseTracker; namespace content { class AppCacheService; ++class BackgroundFetchContext; +class BackgroundSyncContext; +class BluetoothAllowedDevicesMap; +class BroadcastChannelProvider; @@ -436,10 +443,11 @@ index ae4ba1e..f595bcf 100644 // Defines what persistent state a child process can access. // // The StoragePartition defines the view each child process has of the -@@ -74,6 +83,10 @@ class CONTENT_EXPORT StoragePartition { +@@ -74,6 +84,11 @@ class CONTENT_EXPORT StoragePartition { virtual HostZoomLevelContext* GetHostZoomLevelContext() = 0; virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0; virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0; ++ virtual BackgroundFetchContext* GetBackgroundFetchContext() = 0; + virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0; + virtual PaymentAppContextImpl* GetPaymentAppContext() = 0; + virtual BroadcastChannelProvider* GetBroadcastChannelProvider() = 0; @@ -447,7 +455,7 @@ index ae4ba1e..f595bcf 100644 enum : uint32_t { REMOVE_DATA_MASK_APPCACHE = 1 << 0, -@@ -169,6 +182,10 @@ class CONTENT_EXPORT StoragePartition { +@@ -179,6 +194,10 @@ class CONTENT_EXPORT StoragePartition { // Clear the bluetooth allowed devices map. For test use only. virtual void ClearBluetoothAllowedDevicesMapForTesting() = 0; diff --git a/patch/patches/ui_views_test_640741.patch b/patch/patches/ui_views_test_640741.patch deleted file mode 100644 index 5306d82b5..000000000 --- a/patch/patches/ui_views_test_640741.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git ui/views/test/ui_controls_factory_desktop_aurax11.cc ui/views/test/ui_controls_factory_desktop_aurax11.cc -index 117a268..6065c73 100644 ---- ui/views/test/ui_controls_factory_desktop_aurax11.cc -+++ ui/views/test/ui_controls_factory_desktop_aurax11.cc -@@ -146,10 +146,6 @@ class UIControlsDesktopX11 : public UIControlsAura { - aura::test::QueryLatestMousePositionRequestInHost(host); - host->ConvertPixelsToDIP(&root_current_location); - -- auto* screen = views::test::TestDesktopScreenX11::GetInstance(); -- DCHECK_EQ(screen, display::Screen::GetScreen()); -- screen->set_cursor_screen_point(gfx::Point(screen_x, screen_y)); -- - if (root_location != root_current_location && button_down_mask == 0) { - // Move the cursor because EnterNotify/LeaveNotify are generated with the - // current mouse position as a result of XGrabPointer() diff --git a/patch/patches/views_1749.patch b/patch/patches/views_1749.patch index 7628375f9..bd61881cd 100644 --- a/patch/patches/views_1749.patch +++ b/patch/patches/views_1749.patch @@ -1,7 +1,36 @@ -diff --git controls/button/menu_button.cc controls/button/menu_button.cc +diff --git ui/views/animation/ink_drop_host_view.h ui/views/animation/ink_drop_host_view.h +index 15199209..a45b1ac 100644 +--- ui/views/animation/ink_drop_host_view.h ++++ ui/views/animation/ink_drop_host_view.h +@@ -122,6 +122,8 @@ class VIEWS_EXPORT InkDropHostView : public View, public InkDropHost { + // of CreateInkDrop() delegates to this function. + std::unique_ptr CreateDefaultInkDropImpl(); + ++ InkDropMode ink_drop_mode() const { return ink_drop_mode_; } ++ + private: + class InkDropGestureHandler; + friend class InkDropGestureHandler; +diff --git ui/views/controls/button/label_button.h ui/views/controls/button/label_button.h +index 6dade72..7dd110d 100644 +--- ui/views/controls/button/label_button.h ++++ ui/views/controls/button/label_button.h +@@ -116,9 +116,11 @@ class VIEWS_EXPORT LabelButton : public CustomButton, + // these bounds if they need room to do manual painting. + virtual gfx::Rect GetChildAreaBounds(); + ++ public: + // Sets the font list used by this button. + virtual void SetFontList(const gfx::FontList& font_list); + ++ protected: + // View: + void OnPaint(gfx::Canvas* canvas) override; + void OnFocus() override; +diff --git ui/views/controls/button/menu_button.cc ui/views/controls/button/menu_button.cc index 173194b..8bb4f6e 100644 ---- controls/button/menu_button.cc -+++ controls/button/menu_button.cc +--- ui/views/controls/button/menu_button.cc ++++ ui/views/controls/button/menu_button.cc @@ -193,7 +193,7 @@ void MenuButton::OnPaint(gfx::Canvas* canvas) { gfx::Size MenuButton::GetPreferredSize() const { gfx::Size prefsize = LabelButton::GetPreferredSize(); @@ -31,10 +60,10 @@ index 173194b..8bb4f6e 100644 +} + } // namespace views -diff --git controls/button/menu_button.h controls/button/menu_button.h +diff --git ui/views/controls/button/menu_button.h ui/views/controls/button/menu_button.h index b0ddf331..4d573ed 100644 ---- controls/button/menu_button.h -+++ controls/button/menu_button.h +--- ui/views/controls/button/menu_button.h ++++ ui/views/controls/button/menu_button.h @@ -54,6 +54,9 @@ class VIEWS_EXPORT MenuButton : public LabelButton { ~MenuButton() override; @@ -55,10 +84,25 @@ index b0ddf331..4d573ed 100644 // We use a time object in order to keep track of when the menu was closed. // The time is used for simulating menu behavior for the menu button; that // is, if the menu is shown and the button is pressed, we need to close the -diff --git view.h view.h -index fcbee85..8ba4fd0 100644 ---- view.h -+++ view.h +diff --git ui/views/test/ui_controls_factory_desktop_aurax11.cc ui/views/test/ui_controls_factory_desktop_aurax11.cc +index 117a268..6065c73 100644 +--- ui/views/test/ui_controls_factory_desktop_aurax11.cc ++++ ui/views/test/ui_controls_factory_desktop_aurax11.cc +@@ -146,10 +146,6 @@ class UIControlsDesktopX11 : public UIControlsAura { + aura::test::QueryLatestMousePositionRequestInHost(host); + host->ConvertPixelsToDIP(&root_current_location); + +- auto* screen = views::test::TestDesktopScreenX11::GetInstance(); +- DCHECK_EQ(screen, display::Screen::GetScreen()); +- screen->set_cursor_screen_point(gfx::Point(screen_x, screen_y)); +- + if (root_location != root_current_location && button_down_mask == 0) { + // Move the cursor because EnterNotify/LeaveNotify are generated with the + // current mouse position as a result of XGrabPointer() +diff --git ui/views/view.h ui/views/view.h +index bfa107c..01df3f4cd 100644 +--- ui/views/view.h ++++ ui/views/view.h @@ -18,6 +18,7 @@ #include "base/i18n/rtl.h" #include "base/logging.h" @@ -67,7 +111,7 @@ index fcbee85..8ba4fd0 100644 #include "build/build_config.h" #include "ui/accessibility/ax_enums.h" #include "ui/base/accelerators/accelerator.h" -@@ -114,7 +115,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, +@@ -115,7 +116,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, public ui::LayerOwner, public ui::AcceleratorTarget, public ui::EventTarget, diff --git a/patch/patches/views_menu_2102.patch b/patch/patches/views_menu_2102.patch index f77dc70b9..4a0f0c33c 100644 --- a/patch/patches/views_menu_2102.patch +++ b/patch/patches/views_menu_2102.patch @@ -39,10 +39,10 @@ index 0755f27..0322b8c 100644 virtual void MenuWillShow() {} diff --git ui/gfx/render_text.cc ui/gfx/render_text.cc -index e3a15e6..5fae563 100644 +index 97b6c8f..84b9387 100644 --- ui/gfx/render_text.cc +++ ui/gfx/render_text.cc -@@ -595,6 +595,14 @@ void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { +@@ -567,6 +567,14 @@ void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { } } @@ -57,7 +57,7 @@ index e3a15e6..5fae563 100644 void RenderText::SetDisplayRect(const Rect& r) { if (r != display_rect_) { display_rect_ = r; -@@ -1472,6 +1480,19 @@ void RenderText::OnTextAttributeChanged() { +@@ -1466,6 +1474,19 @@ void RenderText::OnTextAttributeChanged() { if (!multiline_ && replace_newline_chars_with_symbols_) base::ReplaceChars(layout_text_, kNewline, kNewlineSymbol, &layout_text_); @@ -78,10 +78,10 @@ index e3a15e6..5fae563 100644 } diff --git ui/gfx/render_text.h ui/gfx/render_text.h -index bcb7314..4063073 100644 +index 00fe00c..bc4fd59 100644 --- ui/gfx/render_text.h +++ ui/gfx/render_text.h -@@ -313,6 +313,10 @@ class GFX_EXPORT RenderText { +@@ -312,6 +312,10 @@ class GFX_EXPORT RenderText { void SetElideBehavior(ElideBehavior elide_behavior); ElideBehavior elide_behavior() const { return elide_behavior_; } @@ -92,7 +92,7 @@ index bcb7314..4063073 100644 const Rect& display_rect() const { return display_rect_; } void SetDisplayRect(const Rect& r); -@@ -861,6 +865,8 @@ class GFX_EXPORT RenderText { +@@ -858,6 +862,8 @@ class GFX_EXPORT RenderText { // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. std::vector lines_; @@ -102,22 +102,22 @@ index bcb7314..4063073 100644 }; diff --git ui/views/controls/button/label_button.cc ui/views/controls/button/label_button.cc -index 4a7cfd9..750a6ca 100644 +index d114946..30f4283 100644 --- ui/views/controls/button/label_button.cc +++ ui/views/controls/button/label_button.cc -@@ -239,6 +239,7 @@ gfx::Size LabelButton::GetPreferredSize() const { - // Use a temporary label copy for sizing to avoid calculation side-effects. - Label label(GetText(), label_->font_list()); +@@ -236,6 +236,7 @@ gfx::Size LabelButton::GetPreferredSize() const { + Label label(GetText(), {label_->font_list()}); + label.SetLineHeight(label_->line_height()); label.SetShadows(label_->shadows()); + label.SetDrawStringsFlags(label_->draw_strings_flags()); 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 762227f..18a7293 100644 --- ui/views/controls/label.cc +++ ui/views/controls/label.cc -@@ -28,6 +28,7 @@ +@@ -27,6 +27,7 @@ #include "ui/gfx/color_utils.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/text_elider.h" @@ -125,7 +125,7 @@ index 2d16942..dc60700 100644 #include "ui/native_theme/native_theme.h" #include "ui/strings/grit/ui_strings.h" #include "ui/views/background.h" -@@ -37,6 +38,25 @@ +@@ -36,6 +37,25 @@ #include "ui/views/selection_controller.h" namespace views { @@ -151,7 +151,7 @@ index 2d16942..dc60700 100644 // static const char Label::kViewClassName[] = "Label"; const int Label::kFocusBorderPadding = 1; -@@ -211,6 +231,15 @@ void Label::SetElideBehavior(gfx::ElideBehavior elide_behavior) { +@@ -215,6 +235,15 @@ void Label::SetElideBehavior(gfx::ElideBehavior elide_behavior) { ResetLayout(); } @@ -167,7 +167,7 @@ index 2d16942..dc60700 100644 void Label::SetTooltipText(const base::string16& tooltip_text) { DCHECK(handles_tooltips_); tooltip_text_ = tooltip_text; -@@ -445,7 +474,19 @@ std::unique_ptr Label::CreateRenderText( +@@ -449,7 +478,19 @@ std::unique_ptr Label::CreateRenderText( render_text->SetFontList(font_list()); render_text->set_shadows(shadows()); render_text->SetCursorEnabled(false); @@ -189,10 +189,10 @@ index 2d16942..dc60700 100644 } diff --git ui/views/controls/label.h ui/views/controls/label.h -index 516368e..22c597a 100644 +index f9c49d0..b1fa1fa 100644 --- ui/views/controls/label.h +++ ui/views/controls/label.h -@@ -120,6 +120,10 @@ class VIEWS_EXPORT Label : public View, +@@ -147,6 +147,10 @@ class VIEWS_EXPORT Label : public View, void SetElideBehavior(gfx::ElideBehavior elide_behavior); gfx::ElideBehavior elide_behavior() const { return elide_behavior_; } @@ -203,7 +203,7 @@ index 516368e..22c597a 100644 // Sets the tooltip text. Default behavior for a label (single-line) is to // show the full text if it is wider than its bounds. Calling this overrides // the default behavior and lets you set a custom tooltip. To revert to -@@ -340,6 +344,7 @@ class VIEWS_EXPORT Label : public View, +@@ -367,6 +371,7 @@ class VIEWS_EXPORT Label : public View, bool collapse_when_hidden_; int fixed_width_; int max_width_; @@ -212,10 +212,10 @@ index 516368e..22c597a 100644 // TODO(ckocagil): Remove is_first_paint_text_ before crbug.com/441028 is // closed. diff --git ui/views/controls/menu/menu_controller.cc ui/views/controls/menu/menu_controller.cc -index 335945f..99ad0d9 100644 +index 3f9436d..0bf813a1 100644 --- ui/views/controls/menu/menu_controller.cc +++ ui/views/controls/menu/menu_controller.cc -@@ -2270,8 +2270,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( +@@ -2261,8 +2261,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( void MenuController::OpenSubmenuChangeSelectionIfCan() { MenuItemView* item = pending_state_.item; @@ -230,7 +230,7 @@ index 335945f..99ad0d9 100644 MenuItemView* to_select = NULL; if (item->GetSubmenu()->GetMenuItemCount() > 0) to_select = FindInitialSelectableMenuItem(item, INCREMENT_SELECTION_DOWN); -@@ -2286,8 +2291,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() { +@@ -2277,8 +2282,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() { void MenuController::CloseSubmenu() { MenuItemView* item = state_.item; DCHECK(item); diff --git a/patch/patches/views_widget_180_1481_1565_1677_1749.patch b/patch/patches/views_widget_180_1481_1565_1677_1749.patch index 077ebd4cf..870bf20ce 100644 --- a/patch/patches/views_widget_180_1481_1565_1677_1749.patch +++ b/patch/patches/views_widget_180_1481_1565_1677_1749.patch @@ -1,16 +1,24 @@ diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc -index 029e72d..07d574d 100644 +index 4dd0e59..d9394c7 100644 --- content/browser/renderer_host/render_widget_host_view_base.cc +++ content/browser/renderer_host/render_widget_host_view_base.cc -@@ -41,6 +41,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase() +@@ -40,6 +40,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase() current_device_scale_factor_(0), current_display_rotation_(display::Display::ROTATE_0), text_input_manager_(nullptr), + has_external_parent_(false), renderer_frame_number_(0), - weak_factory_(this) { + weak_factory_(this) {} + +@@ -138,7 +139,6 @@ void RenderWidgetHostViewBase::SetIsInVR(bool is_in_vr) { } -@@ -325,6 +326,14 @@ void RenderWidgetHostViewBase::FocusedNodeTouched( + + bool RenderWidgetHostViewBase::IsInVR() const { +- NOTIMPLEMENTED(); + return false; + } + +@@ -310,6 +310,14 @@ void RenderWidgetHostViewBase::FocusedNodeTouched( DVLOG(1) << "FocusedNodeTouched: " << editable; } @@ -26,10 +34,10 @@ index 029e72d..07d574d 100644 return renderer_frame_number_; } diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h -index 657ad20..fcd514a 100644 +index 3f0cdab..581b984 100644 --- content/browser/renderer_host/render_widget_host_view_base.h +++ content/browser/renderer_host/render_widget_host_view_base.h -@@ -66,6 +66,7 @@ class BrowserAccessibilityDelegate; +@@ -73,6 +73,7 @@ class BrowserAccessibilityDelegate; class BrowserAccessibilityManager; class RenderWidgetHostImpl; class RenderWidgetHostViewBaseObserver; @@ -37,7 +45,7 @@ index 657ad20..fcd514a 100644 class SyntheticGestureTarget; class TextInputManager; class WebCursor; -@@ -115,6 +116,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -119,6 +120,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, void EndFrameSubscription() override; void FocusedNodeTouched(const gfx::Point& location_dips_screen, bool editable) override; @@ -46,7 +54,7 @@ index 657ad20..fcd514a 100644 // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. -@@ -338,6 +341,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -353,6 +356,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, // helps to position the full screen widget on the correct monitor. virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0; @@ -59,7 +67,7 @@ index 657ad20..fcd514a 100644 // Sets the cursor to the one associated with the specified cursor_type virtual void UpdateCursor(const WebCursor& cursor) = 0; -@@ -442,6 +451,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -454,6 +463,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, // destroyed before the RWHV is destroyed. TextInputManager* text_input_manager_; @@ -71,7 +79,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 980a6780..cfcc1e2 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 @@ @@ -85,7 +93,7 @@ index 628aa29..f2098f9 100644 #if defined(OS_WIN) #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/public/common/context_menu_params.h" -@@ -817,6 +821,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { +@@ -822,6 +826,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { } } #endif @@ -101,10 +109,10 @@ index 628aa29..f2098f9 100644 if (host_ && set_focus_on_mouse_down_or_key_event_) { set_focus_on_mouse_down_or_key_event_ = false; diff --git content/public/browser/render_widget_host_view.h content/public/browser/render_widget_host_view.h -index 8d52b0f..eda7104 100644 +index e295ef2..dcce231 100644 --- content/public/browser/render_widget_host_view.h +++ content/public/browser/render_widget_host_view.h -@@ -233,6 +233,14 @@ class CONTENT_EXPORT RenderWidgetHostView { +@@ -234,6 +234,14 @@ class CONTENT_EXPORT RenderWidgetHostView { // when the value has changed. Views must initially default to false. virtual void SetNeedsBeginFrames(bool needs_begin_frames) = 0; @@ -133,7 +141,7 @@ index f772f64..7d13f9f 100644 return host ? host->GetAcceleratedWidget() : NULL; } diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 2756595..6385de1 100644 +index fd25fc6..80b8093 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -85,6 +85,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( @@ -192,10 +200,10 @@ index 12d0616..ec5742a 100644 // a reference. corewm::TooltipWin* tooltip_; diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc -index 448baf89..0bebfd8 100644 +index 4215122..846f45e 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc -@@ -194,6 +194,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -198,6 +198,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( use_native_frame_(false), should_maximize_after_map_(false), use_argb_visual_(false), @@ -203,7 +211,7 @@ index 448baf89..0bebfd8 100644 drag_drop_client_(NULL), native_widget_delegate_(native_widget_delegate), desktop_native_widget_aura_(desktop_native_widget_aura), -@@ -207,6 +208,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -211,6 +212,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( has_window_focus_(false), has_pointer_focus_(false), modal_dialog_counter_(0), @@ -211,7 +219,7 @@ index 448baf89..0bebfd8 100644 close_widget_factory_(this), weak_factory_(this) {} -@@ -242,6 +244,8 @@ std::vector DesktopWindowTreeHostX11::GetAllOpenWindows() { +@@ -246,6 +248,8 @@ std::vector DesktopWindowTreeHostX11::GetAllOpenWindows() { } gfx::Rect DesktopWindowTreeHostX11::GetX11RootWindowBounds() const { @@ -220,7 +228,7 @@ index 448baf89..0bebfd8 100644 return bounds_in_pixels_; } -@@ -550,7 +554,8 @@ void DesktopWindowTreeHostX11::CloseNow() { +@@ -554,7 +558,8 @@ void DesktopWindowTreeHostX11::CloseNow() { // Actually free our native resources. if (ui::PlatformEventSource::GetInstance()) ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); @@ -230,7 +238,7 @@ index 448baf89..0bebfd8 100644 xwindow_ = None; desktop_native_widget_aura_->OnHostClosed(); -@@ -691,6 +696,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( +@@ -695,6 +700,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( } gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const { @@ -239,7 +247,7 @@ index 448baf89..0bebfd8 100644 return ToDIPRect(bounds_in_pixels_); } -@@ -1289,6 +1296,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( +@@ -1293,6 +1300,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( } gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const { @@ -248,7 +256,7 @@ index 448baf89..0bebfd8 100644 return bounds_in_pixels_.origin(); } -@@ -1415,9 +1424,15 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1419,9 +1428,15 @@ void DesktopWindowTreeHostX11::InitX11Window( attribute_mask |= CWBorderPixel; swa.border_pixel = 0; @@ -265,7 +273,7 @@ index 448baf89..0bebfd8 100644 bounds_in_pixels_.y(), bounds_in_pixels_.width(), bounds_in_pixels_.height(), 0, // border width -@@ -2048,6 +2063,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( +@@ -2040,6 +2055,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( } break; } @@ -277,7 +285,7 @@ index 448baf89..0bebfd8 100644 case FocusOut: OnFocusEvent(xev->type == FocusIn, event->xfocus.mode, diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -index 544f086..0e81c59 100644 +index 757b780..45d57ae 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h @@ -87,6 +87,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 @@ -293,7 +301,7 @@ index 544f086..0e81c59 100644 protected: // Overridden from DesktopWindowTreeHost: void Init(aura::Window* content_window, -@@ -302,6 +308,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -300,6 +306,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // The bounds of |xwindow_|. gfx::Rect bounds_in_pixels_; @@ -303,7 +311,7 @@ index 544f086..0e81c59 100644 // Whenever the bounds are set, we keep the previous set of bounds around so // we can have a better chance of getting the real // |restored_bounds_in_pixels_|. Window managers tend to send a Configure -@@ -341,6 +350,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -339,6 +348,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // Whether we used an ARGB visual for our window. bool use_argb_visual_; @@ -314,7 +322,7 @@ index 544f086..0e81c59 100644 DesktopDragDropClientAuraX11* drag_drop_client_; std::unique_ptr x11_non_client_event_filter_; -@@ -428,6 +441,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -426,6 +439,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 uint32_t modal_dialog_counter_; @@ -325,7 +333,7 @@ index 544f086..0e81c59 100644 base::WeakPtrFactory weak_factory_; diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc -index 38ade37..e66b0cd 100644 +index de3ac38..b417146 100644 --- ui/views/widget/widget.cc +++ ui/views/widget/widget.cc @@ -131,6 +131,7 @@ Widget::InitParams::InitParams(Type type) @@ -336,7 +344,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 +353,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 +368,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 36b86ea..9a39084 100644 --- ui/views/widget/widget.h +++ ui/views/widget/widget.h @@ -253,6 +253,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, @@ -372,10 +380,10 @@ 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 7590741..0e06a35 100644 --- ui/views/win/hwnd_message_handler.cc +++ ui/views/win/hwnd_message_handler.cc -@@ -2539,8 +2539,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -2664,8 +2664,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, active_mouse_tracking_flags_ = 0; } else if (event.type() == ui::ET_MOUSEWHEEL) { // Reroute the mouse wheel to the window under the pointer if applicable. diff --git a/patch/patches/web_contents_1257_1565.patch b/patch/patches/web_contents_1257_1565.patch index 1c8e2aa6c..90dec0d00 100644 --- a/patch/patches/web_contents_1257_1565.patch +++ b/patch/patches/web_contents_1257_1565.patch @@ -1,8 +1,8 @@ diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc -index 8800f75..6b047eb 100644 +index 6c9c358..fe5df86 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) { +@@ -1581,6 +1581,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..6b047eb 100644 WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -1581,6 +1587,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1591,6 +1597,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { view_.reset(CreateWebContentsView(this, delegate, &render_view_host_delegate_view_)); } @@ -23,7 +23,7 @@ index 8800f75..6b047eb 100644 if (browser_plugin_guest_ && !GuestMode::IsCrossProcessFrameGuest(this)) { view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), -@@ -2093,6 +2100,15 @@ void WebContentsImpl::CreateNewWindow( +@@ -2127,6 +2134,15 @@ void WebContentsImpl::CreateNewWindow( create_params.renderer_initiated_creation = main_frame_route_id != MSG_ROUTING_NONE; @@ -39,7 +39,7 @@ index 8800f75..6b047eb 100644 WebContentsImpl* new_contents = NULL; if (!is_guest) { create_params.context = view_->GetNativeView(); -@@ -2122,7 +2138,7 @@ void WebContentsImpl::CreateNewWindow( +@@ -2156,7 +2172,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( @@ -48,7 +48,7 @@ index 8800f75..6b047eb 100644 } // Save the created window associated with the route so we can show it // later. -@@ -4985,7 +5001,7 @@ NavigationEntry* +@@ -5029,7 +5045,7 @@ NavigationEntry* void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager( RenderViewHost* render_view_host) { RenderWidgetHostViewBase* rwh_view = @@ -73,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; @@ -100,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..391b9a0 100644 +index 232d3a9..6622768 100644 --- content/public/browser/web_contents_delegate.h +++ content/public/browser/web_contents_delegate.h @@ -42,11 +42,13 @@ class ColorChooser; diff --git a/patch/patches/webkit_plugin_info_2015.patch b/patch/patches/webkit_plugin_info_2015.patch new file mode 100644 index 000000000..a6253a330 --- /dev/null +++ b/patch/patches/webkit_plugin_info_2015.patch @@ -0,0 +1,170 @@ +diff --git Source/core/dom/DOMImplementation.cpp Source/core/dom/DOMImplementation.cpp +index 8aab9bb..e3286f6 100644 +--- Source/core/dom/DOMImplementation.cpp ++++ Source/core/dom/DOMImplementation.cpp +@@ -241,10 +241,11 @@ Document* DOMImplementation::createDocument(const String& type, + // For that reason, the origin must be retrieved directly from init.url(). + if (init.GetFrame()->IsMainFrame()) { + RefPtr origin = SecurityOrigin::Create(init.Url()); +- plugin_data = init.GetFrame()->GetPage()->GetPluginData(origin.Get()); ++ plugin_data = init.GetFrame()->GetPage()->GetPluginData(true, ++ origin.Get()); + } else { + plugin_data = +- init.GetFrame()->GetPage()->GetPluginData(init.GetFrame() ++ init.GetFrame()->GetPage()->GetPluginData(false, init.GetFrame() + ->Tree() + .Top() + ->GetSecurityContext() +diff --git Source/core/frame/LocalFrame.cpp Source/core/frame/LocalFrame.cpp +index b64d75d..869b45d 100644 +--- Source/core/frame/LocalFrame.cpp ++++ Source/core/frame/LocalFrame.cpp +@@ -927,7 +927,7 @@ ContentSettingsClient* LocalFrame::GetContentSettingsClient() { + PluginData* LocalFrame::GetPluginData() const { + if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin)) + return nullptr; +- return GetPage()->GetPluginData( ++ return GetPage()->GetPluginData(IsMainFrame(), + Tree().Top()->GetSecurityContext()->GetSecurityOrigin()); + } + +diff --git Source/core/page/Page.cpp Source/core/page/Page.cpp +index 941a30c..2c5764c 100644 +--- Source/core/page/Page.cpp ++++ Source/core/page/Page.cpp +@@ -289,16 +289,30 @@ void Page::RefreshPlugins() { + + for (const Page* page : AllPages()) { + // Clear out the page's plugin data. +- if (page->plugin_data_) +- page->plugin_data_ = nullptr; ++ if (page->plugin_data_main_frame_) ++ page->plugin_data_main_frame_ = nullptr; ++ if (page->plugin_data_sub_frame_) ++ page->plugin_data_sub_frame_ = nullptr; + } + } + +-PluginData* Page::GetPluginData(SecurityOrigin* main_frame_origin) const { +- if (!plugin_data_ || +- !main_frame_origin->IsSameSchemeHostPort(plugin_data_->Origin())) +- plugin_data_ = PluginData::Create(main_frame_origin); +- return plugin_data_.Get(); ++PluginData* Page::GetPluginData(bool is_main_frame, ++ SecurityOrigin* main_frame_origin) const { ++ if (is_main_frame) { ++ if (!plugin_data_main_frame_ || ++ !main_frame_origin->IsSameSchemeHostPort( ++ plugin_data_main_frame_->Origin())) { ++ plugin_data_main_frame_ = PluginData::Create(true, main_frame_origin); ++ } ++ return plugin_data_main_frame_.Get(); ++ } else { ++ if (!plugin_data_sub_frame_ || ++ !main_frame_origin->IsSameSchemeHostPort( ++ plugin_data_sub_frame_->Origin())) { ++ plugin_data_sub_frame_ = PluginData::Create(false, main_frame_origin); ++ } ++ return plugin_data_sub_frame_.Get(); ++ } + } + + void Page::SetValidationMessageClient(ValidationMessageClient* client) { +diff --git Source/core/page/Page.h Source/core/page/Page.h +index e644faa..2fe0d37 100644 +--- Source/core/page/Page.h ++++ Source/core/page/Page.h +@@ -132,7 +132,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, + ViewportDescription GetViewportDescription() const; + + static void RefreshPlugins(); +- PluginData* GetPluginData(SecurityOrigin* main_frame_origin) const; ++ PluginData* GetPluginData(bool is_main_frame, ++ SecurityOrigin* main_frame_origin) const; + + EditorClient& GetEditorClient() const { return *editor_client_; } + SpellCheckerClient& GetSpellCheckerClient() const { +@@ -324,7 +325,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, + // longer needed. + Member main_frame_; + +- mutable RefPtr plugin_data_; ++ mutable RefPtr plugin_data_main_frame_; ++ mutable RefPtr plugin_data_sub_frame_; + + EditorClient* const editor_client_; + SpellCheckerClient* const spell_checker_client_; +diff --git Source/platform/plugins/PluginData.cpp Source/platform/plugins/PluginData.cpp +index 03618f6..5ac59e8 100644 +--- Source/platform/plugins/PluginData.cpp ++++ Source/platform/plugins/PluginData.cpp +@@ -30,11 +30,12 @@ + + namespace blink { + +-PluginData::PluginData(SecurityOrigin* main_frame_origin) +- : main_frame_origin_(main_frame_origin) { ++PluginData::PluginData(bool is_main_frame, SecurityOrigin* main_frame_origin) ++ : is_main_frame_(is_main_frame), ++ main_frame_origin_(main_frame_origin) { + PluginListBuilder builder(&plugins_); + Platform::Current()->GetPluginList( +- false, WebSecurityOrigin(main_frame_origin_), &builder); ++ false, is_main_frame_, WebSecurityOrigin(main_frame_origin_), &builder); + + for (unsigned i = 0; i < plugins_.size(); ++i) { + const PluginInfo& plugin = plugins_[i]; +@@ -73,7 +74,8 @@ String PluginData::PluginNameForMimeType(const String& mime_type) const { + void PluginData::RefreshBrowserSidePluginCache() { + Vector plugins; + PluginListBuilder builder(&plugins); +- Platform::Current()->GetPluginList(true, WebSecurityOrigin::CreateUnique(), ++ Platform::Current()->GetPluginList(true, true, ++ WebSecurityOrigin::CreateUnique(), + &builder); + } + +diff --git Source/platform/plugins/PluginData.h Source/platform/plugins/PluginData.h +index cdf3381..671f17c 100644 +--- Source/platform/plugins/PluginData.h ++++ Source/platform/plugins/PluginData.h +@@ -52,8 +52,9 @@ class PLATFORM_EXPORT PluginData : public RefCounted { + WTF_MAKE_NONCOPYABLE(PluginData); + + public: +- static PassRefPtr Create(SecurityOrigin* main_frame_origin) { +- return AdoptRef(new PluginData(main_frame_origin)); ++ static PassRefPtr Create(bool is_main_frame, ++ SecurityOrigin* main_frame_origin) { ++ return AdoptRef(new PluginData(is_main_frame, main_frame_origin)); + } + + const Vector& Plugins() const { return plugins_; } +@@ -71,12 +72,13 @@ class PLATFORM_EXPORT PluginData : public RefCounted { + static void RefreshBrowserSidePluginCache(); + + private: +- explicit PluginData(SecurityOrigin* main_frame_origin); ++ explicit PluginData(bool is_main_frame, SecurityOrigin* main_frame_origin); + const PluginInfo* PluginInfoForMimeType(const String& mime_type) const; + + Vector plugins_; + Vector mimes_; + Vector mime_plugin_indices_; ++ bool is_main_frame_; + RefPtr main_frame_origin_; + }; + +diff --git public/platform/Platform.h public/platform/Platform.h +index eab1ca5..6657878 100644 +--- public/platform/Platform.h ++++ public/platform/Platform.h +@@ -365,6 +365,7 @@ class BLINK_PLATFORM_EXPORT Platform { + // satisfy this call. mainFrameOrigin is used by the browser process to + // filter plugins from the plugin list based on content settings. + virtual void GetPluginList(bool refresh, ++ bool is_main_frame, + const WebSecurityOrigin& main_frame_origin, + WebPluginListBuilder*) {} + diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index 07e055584..03a9f9923 100644 --- a/patch/patches/webkit_popups.patch +++ b/patch/patches/webkit_popups.patch @@ -1,75 +1,75 @@ diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp -index a5721cf..d89dcff 100644 +index ba81ee3..648d7ce 100644 --- Source/web/ChromeClientImpl.cpp +++ Source/web/ChromeClientImpl.cpp -@@ -898,7 +898,7 @@ bool ChromeClientImpl::hasOpenedPopup() const { - PopupMenu* ChromeClientImpl::openPopupMenu(LocalFrame& frame, +@@ -908,7 +908,7 @@ bool ChromeClientImpl::HasOpenedPopup() const { + PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame, HTMLSelectElement& select) { - notifyPopupOpeningObservers(); -- if (WebViewImpl::useExternalPopupMenus()) -+ if (m_webView->useExternalPopupMenus()) - return new ExternalPopupMenu(frame, select, *m_webView); + NotifyPopupOpeningObservers(); +- if (WebViewImpl::UseExternalPopupMenus()) ++ if (web_view_->UseExternalPopupMenus()) + return new ExternalPopupMenu(frame, select, *web_view_); DCHECK(RuntimeEnabledFeatures::pagePopupEnabled()); diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp -index 8a38208..90784a8 100644 +index 16ac66b..7053b54 100644 --- Source/web/WebViewImpl.cpp +++ Source/web/WebViewImpl.cpp -@@ -357,6 +357,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, - m_enableFakePageScaleAnimationForTesting(false), - m_fakePageScaleAnimationPageScaleFactor(0), - m_fakePageScaleAnimationUseAnchor(false), -+ m_shouldUseExternalPopupMenus(shouldUseExternalPopupMenus), - m_compositorDeviceScaleFactorOverride(0), - m_suppressNextKeypressEvent(false), - m_imeAcceptEvents(true), -@@ -3704,8 +3705,13 @@ void WebViewImpl::mainFrameScrollOffsetChanged() { - m_devToolsEmulator->mainFrameScrollOrScaleChanged(); +@@ -355,6 +355,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, + enable_fake_page_scale_animation_for_testing_(false), + fake_page_scale_animation_page_scale_factor_(0), + fake_page_scale_animation_use_anchor_(false), ++ should_use_external_popup_menus_(g_should_use_external_popup_menus), + compositor_device_scale_factor_override_(0), + suppress_next_keypress_event_(false), + ime_accept_events_(true), +@@ -3743,8 +3744,13 @@ void WebViewImpl::MainFrameScrollOffsetChanged() { + dev_tools_emulator_->MainFrameScrollOrScaleChanged(); } -+void WebViewImpl::setUseExternalPopupMenusThisInstance( ++void WebViewImpl::SetUseExternalPopupMenusThisInstance( + bool useExternalPopupMenus) { -+ m_shouldUseExternalPopupMenus = useExternalPopupMenus; ++ should_use_external_popup_menus_ = useExternalPopupMenus; +} + - bool WebViewImpl::useExternalPopupMenus() { -- return shouldUseExternalPopupMenus; -+ return m_shouldUseExternalPopupMenus; + bool WebViewImpl::UseExternalPopupMenus() { +- return g_should_use_external_popup_menus; ++ return should_use_external_popup_menus_; } - void WebViewImpl::setBackgroundColorOverride(WebColor color) { + void WebViewImpl::SetBackgroundColorOverride(WebColor color) { diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h -index f94b695..4828185 100644 +index a22ef37..33dbab4 100644 --- Source/web/WebViewImpl.h +++ Source/web/WebViewImpl.h -@@ -369,7 +369,8 @@ class WEB_EXPORT WebViewImpl final +@@ -362,7 +362,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). -- static bool useExternalPopupMenus(); -+ void setUseExternalPopupMenusThisInstance(bool); -+ bool useExternalPopupMenus(); +- static bool UseExternalPopupMenus(); ++ void SetUseExternalPopupMenusThisInstance(bool); ++ bool UseExternalPopupMenus(); - bool shouldAutoResize() const { return m_shouldAutoResize; } + bool ShouldAutoResize() const { return should_auto_resize_; } -@@ -652,6 +653,8 @@ class WEB_EXPORT WebViewImpl final - float m_fakePageScaleAnimationPageScaleFactor; - bool m_fakePageScaleAnimationUseAnchor; +@@ -647,6 +648,8 @@ class WEB_EXPORT WebViewImpl final + float fake_page_scale_animation_page_scale_factor_; + bool fake_page_scale_animation_use_anchor_; -+ bool m_shouldUseExternalPopupMenus; ++ bool should_use_external_popup_menus_; + - float m_compositorDeviceScaleFactorOverride; - TransformationMatrix m_deviceEmulationTransform; + float compositor_device_scale_factor_override_; + TransformationMatrix device_emulation_transform_; diff --git public/web/WebView.h public/web/WebView.h -index 92bdf07..1a813a9 100644 +index e811392..d6d5bf8 100644 --- public/web/WebView.h +++ public/web/WebView.h -@@ -402,6 +402,7 @@ class WebView : protected WebWidget { +@@ -403,6 +403,7 @@ class WebView : protected WebWidget { // Sets whether select popup menus should be rendered by the browser. - BLINK_EXPORT static void setUseExternalPopupMenus(bool); -+ virtual void setUseExternalPopupMenusThisInstance(bool) = 0; + BLINK_EXPORT static void SetUseExternalPopupMenus(bool); ++ virtual void SetUseExternalPopupMenusThisInstance(bool) = 0; // Hides any popup (suggestions, selects...) that might be showing. - virtual void hidePopups() = 0; + virtual void HidePopups() = 0; diff --git a/patch/patches/webui_2037.patch b/patch/patches/webui_2037.patch index c68e6cacf..5db83ed29 100644 --- a/patch/patches/webui_2037.patch +++ b/patch/patches/webui_2037.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/ui/webui/net_internals/net_internals_ui.cc chrome/browser/ui/webui/net_internals/net_internals_ui.cc -index 268d526..607f7e3 100644 +index 3a72ef9..303258b 100644 --- chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ chrome/browser/ui/webui/net_internals/net_internals_ui.cc -@@ -530,8 +530,7 @@ void NetInternalsMessageHandler::OnGetSessionNetworkStats( +@@ -531,8 +531,7 @@ void NetInternalsMessageHandler::OnGetSessionNetworkStats( const base::ListValue* list) { DCHECK_CURRENTLY_ON(BrowserThread::UI); SendJavascriptCommand( @@ -12,7 +12,7 @@ index 268d526..607f7e3 100644 } void NetInternalsMessageHandler::OnGetExtensionInfo( -@@ -627,9 +626,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( +@@ -628,9 +627,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( PrePopulateEventList(); diff --git a/patch/patches/webview_plugin_2020.patch b/patch/patches/webview_plugin_2020.patch index b2cbe5cdc..9b009dfa4 100644 --- a/patch/patches/webview_plugin_2020.patch +++ b/patch/patches/webview_plugin_2020.patch @@ -1,8 +1,8 @@ diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd -index c10c883..a03df69 100644 +index eabe276..63e127d 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 +@@ -5279,7 +5279,7 @@ Keep your key file in a safe place. You will need it to create new versions of y diff --git a/tests/cefclient/browser/browser_window_osr_gtk.cc b/tests/cefclient/browser/browser_window_osr_gtk.cc index 67775ecf7..d817b536d 100644 --- a/tests/cefclient/browser/browser_window_osr_gtk.cc +++ b/tests/cefclient/browser/browser_window_osr_gtk.cc @@ -942,7 +942,7 @@ void BrowserWindowOsrGtk::CreateBrowser( DCHECK(xwindow); CefWindowInfo window_info; - window_info.SetAsWindowless(xwindow, renderer_.IsTransparent()); + window_info.SetAsWindowless(xwindow); // Create the browser asynchronously. CefBrowserHost::CreateBrowser(window_info, client_handler_, @@ -955,7 +955,7 @@ void BrowserWindowOsrGtk::GetPopupConfig(CefWindowHandle temp_handle, CefRefPtr& client, CefBrowserSettings& settings) { // Note: This method may be called on any thread. - windowInfo.SetAsWindowless(temp_handle, renderer_.IsTransparent()); + windowInfo.SetAsWindowless(temp_handle); client = client_handler_; } diff --git a/tests/cefclient/browser/browser_window_osr_mac.mm b/tests/cefclient/browser/browser_window_osr_mac.mm index 92ae48435..dc19118b8 100644 --- a/tests/cefclient/browser/browser_window_osr_mac.mm +++ b/tests/cefclient/browser/browser_window_osr_mac.mm @@ -12,6 +12,7 @@ #include "include/cef_parser.h" #include "include/wrapper/cef_closure_task.h" #include "tests/cefclient/browser/bytes_write_handler.h" +#include "tests/cefclient/browser/main_context.h" #include "tests/cefclient/browser/text_input_client_osr_mac.h" #include "tests/shared/browser/geometry_util.h" #include "tests/shared/browser/main_message_loop.h" @@ -696,7 +697,8 @@ - (void)drawRect: (NSRect) dirtyRect { CefRefPtr browser = [self getBrowser]; if ([self inLiveResize] || !browser.get()) { // Fill with the background color. - const cef_color_t background_color = renderer_->GetBackgroundColor(); + const cef_color_t background_color = + client::MainContext::Get()->GetBackgroundColor(); NSColor* color = [NSColor colorWithCalibratedRed: float(CefColorGetR(background_color)) / 255.0f @@ -1166,7 +1168,7 @@ - (void)ChangeCompositionRange:(CefRange)range Create(parent_handle, rect); CefWindowInfo window_info; - window_info.SetAsWindowless(nsview_, renderer_.IsTransparent()); + window_info.SetAsWindowless(nsview_); // Create the browser asynchronously. CefBrowserHost::CreateBrowser(window_info, client_handler_, @@ -1179,7 +1181,7 @@ - (void)ChangeCompositionRange:(CefRange)range CefRefPtr& client, CefBrowserSettings& settings) { // Note: This method may be called on any thread. - windowInfo.SetAsWindowless(temp_handle, renderer_.IsTransparent()); + windowInfo.SetAsWindowless(temp_handle); client = client_handler_; } diff --git a/tests/cefclient/browser/browser_window_osr_win.cc b/tests/cefclient/browser/browser_window_osr_win.cc index a950e0d51..00cbd7bf7 100644 --- a/tests/cefclient/browser/browser_window_osr_win.cc +++ b/tests/cefclient/browser/browser_window_osr_win.cc @@ -13,7 +13,6 @@ BrowserWindowOsrWin::BrowserWindowOsrWin(BrowserWindow::Delegate* delegate, const std::string& startup_url, const OsrRenderer::Settings& settings) : BrowserWindow(delegate), - transparent_(settings.transparent), osr_hwnd_(NULL), device_scale_factor_(client::GetDeviceScaleFactor()) { osr_window_ = new OsrWindowWin(this, settings); @@ -38,7 +37,7 @@ void BrowserWindowOsrWin::GetPopupConfig(CefWindowHandle temp_handle, CefRefPtr& client, CefBrowserSettings& settings) { // Note: This method may be called on any thread. - windowInfo.SetAsWindowless(temp_handle, transparent_); + windowInfo.SetAsWindowless(temp_handle); client = client_handler_; } diff --git a/tests/cefclient/browser/browser_window_osr_win.h b/tests/cefclient/browser/browser_window_osr_win.h index 54f38699e..5b1215eb5 100644 --- a/tests/cefclient/browser/browser_window_osr_win.h +++ b/tests/cefclient/browser/browser_window_osr_win.h @@ -49,8 +49,6 @@ class BrowserWindowOsrWin : public BrowserWindow, // OsrWindowWin::Delegate methods. void OnOsrNativeWindowCreated(HWND hwnd) OVERRIDE; - const bool transparent_; - // The below members are only accessed on the main thread. scoped_refptr osr_window_; HWND osr_hwnd_; diff --git a/tests/cefclient/browser/main_context_impl.cc b/tests/cefclient/browser/main_context_impl.cc index b826992e2..d1f83be33 100644 --- a/tests/cefclient/browser/main_context_impl.cc +++ b/tests/cefclient/browser/main_context_impl.cc @@ -45,6 +45,7 @@ MainContextImpl::MainContextImpl(CefRefPtr command_line, initialized_(false), shutdown_(false), background_color_(0), + browser_background_color_(0), use_views_(false) { DCHECK(command_line_.get()); @@ -58,6 +59,11 @@ MainContextImpl::MainContextImpl(CefRefPtr command_line, use_windowless_rendering_ = command_line_->HasSwitch(switches::kOffScreenRenderingEnabled); + // Whether transparent painting is used with windowless rendering. + const bool use_transparent_painting = + use_windowless_rendering_ && + command_line_->HasSwitch(switches::kTransparentPaintingEnabled); + #if defined(OS_WIN) || defined(OS_LINUX) // Whether the Views framework will be used. use_views_ = command_line_->HasSwitch(switches::kUseViews); @@ -81,11 +87,16 @@ MainContextImpl::MainContextImpl(CefRefPtr command_line, ParseColor(command_line_->GetSwitchValue(switches::kBackgroundColor)); } - if (!use_views_ && background_color_ == 0) { - // Set an explicit background color when not using Views. + if (background_color_ == 0 && !use_views_) { + // Set an explicit background color. background_color_ = CefColorSetARGB(255, 255, 255, 255); } + // |browser_background_color_| should remain 0 to enable transparent painting. + if (!use_transparent_painting) { + browser_background_color_ = background_color_; + } + const std::string& cdm_path = command_line_->GetSwitchValue(switches::kWidevineCdmPath); if (!cdm_path.empty()) { @@ -140,8 +151,8 @@ void MainContextImpl::PopulateSettings(CefSettings* settings) { if (use_windowless_rendering_) settings->windowless_rendering_enabled = true; - if (background_color_ != 0) - settings->background_color = background_color_; + if (browser_background_color_ != 0) + settings->background_color = browser_background_color_; } void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) { @@ -149,15 +160,17 @@ void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) { settings->windowless_frame_rate = atoi(command_line_-> GetSwitchValue(switches::kOffScreenFrameRate).ToString().c_str()); } + + if (browser_background_color_ != 0) + settings->background_color = browser_background_color_; } void MainContextImpl::PopulateOsrSettings(OsrRenderer::Settings* settings) { - settings->transparent = - command_line_->HasSwitch(switches::kTransparentPaintingEnabled); settings->show_update_rect = command_line_->HasSwitch(switches::kShowUpdateRect); - if (background_color_ != 0) - settings->background_color = background_color_; + + if (browser_background_color_ != 0) + settings->background_color = browser_background_color_; } RootWindowManager* MainContextImpl::GetRootWindowManager() { diff --git a/tests/cefclient/browser/main_context_impl.h b/tests/cefclient/browser/main_context_impl.h index f9ff6b08f..3c6465bd5 100644 --- a/tests/cefclient/browser/main_context_impl.h +++ b/tests/cefclient/browser/main_context_impl.h @@ -68,6 +68,7 @@ class MainContextImpl : public MainContext { std::string main_url_; cef_color_t background_color_; + cef_color_t browser_background_color_; bool use_windowless_rendering_; bool use_views_; diff --git a/tests/cefclient/browser/osr_renderer.cc b/tests/cefclient/browser/osr_renderer.cc index 06f452c8b..76dcb06b4 100644 --- a/tests/cefclient/browser/osr_renderer.cc +++ b/tests/cefclient/browser/osr_renderer.cc @@ -40,12 +40,6 @@ namespace client { -OsrRenderer::Settings::Settings() - : transparent(false), - show_update_rect(false), - background_color(CefColorSetARGB(255, 255, 255, 255)) { -} - OsrRenderer::OsrRenderer(const Settings& settings) : settings_(settings), initialized_(false), @@ -66,10 +60,14 @@ void OsrRenderer::Initialize() { glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); VERIFY_NO_ERROR; - glClearColor(float(CefColorGetR(settings_.background_color)) / 255.0f, - float(CefColorGetG(settings_.background_color)) / 255.0f, - float(CefColorGetB(settings_.background_color)) / 255.0f, - 1.0f); VERIFY_NO_ERROR; + if (IsTransparent()) { + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); VERIFY_NO_ERROR; + } else { + glClearColor(float(CefColorGetR(settings_.background_color)) / 255.0f, + float(CefColorGetG(settings_.background_color)) / 255.0f, + float(CefColorGetB(settings_.background_color)) / 255.0f, + 1.0f); VERIFY_NO_ERROR; + } // Necessary for non-power-of-2 textures to render correctly. glPixelStorei(GL_UNPACK_ALIGNMENT, 1); VERIFY_NO_ERROR; @@ -140,7 +138,7 @@ void OsrRenderer::Render() { glRotatef(-spin_y_, 0.0f, 1.0f, 0.0f); VERIFY_NO_ERROR; } - if (settings_.transparent) { + if (IsTransparent()) { // Alpha blending style. Texture values have premultiplied alpha. glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); VERIFY_NO_ERROR; @@ -160,7 +158,7 @@ void OsrRenderer::Render() { // Disable 2D textures. glDisable(GL_TEXTURE_2D); VERIFY_NO_ERROR; - if (settings_.transparent) { + if (IsTransparent()) { // Disable alpha blending. glDisable(GL_BLEND); VERIFY_NO_ERROR; } @@ -252,7 +250,7 @@ void OsrRenderer::OnPaint(CefRefPtr browser, if (!initialized_) Initialize(); - if (settings_.transparent) { + if (IsTransparent()) { // Enable alpha blending. glEnable(GL_BLEND); VERIFY_NO_ERROR; } @@ -330,7 +328,7 @@ void OsrRenderer::OnPaint(CefRefPtr browser, // Disable 2D textures. glDisable(GL_TEXTURE_2D); VERIFY_NO_ERROR; - if (settings_.transparent) { + if (IsTransparent()) { // Disable alpha blending. glDisable(GL_BLEND); VERIFY_NO_ERROR; } diff --git a/tests/cefclient/browser/osr_renderer.h b/tests/cefclient/browser/osr_renderer.h index 881da0e9e..9ee24f437 100644 --- a/tests/cefclient/browser/osr_renderer.h +++ b/tests/cefclient/browser/osr_renderer.h @@ -14,15 +14,10 @@ namespace client { class OsrRenderer { public: struct Settings { - Settings(); - - // If true use transparent rendering. - bool transparent; - // If true draw a border around update rectangles. bool show_update_rect; - // Background color. + // Background color. Enables transparency if the alpha component is 0. cef_color_t background_color; }; @@ -53,9 +48,6 @@ class OsrRenderer { void SetSpin(float spinX, float spinY); void IncrementSpin(float spinDX, float spinDY); - bool IsTransparent() const { return settings_.transparent; } - cef_color_t GetBackgroundColor() const { return settings_.background_color; } - int GetViewWidth() const { return view_width_; } int GetViewHeight() const { return view_height_; } @@ -66,6 +58,10 @@ class OsrRenderer { void ClearPopupRects(); private: + inline bool IsTransparent() const { + return CefColorGetA(settings_.background_color) == 0; + }; + const Settings settings_; bool initialized_; unsigned int texture_id_; diff --git a/tests/cefclient/browser/osr_window_win.cc b/tests/cefclient/browser/osr_window_win.cc index e066bbcd9..1a8e1ca7b 100644 --- a/tests/cefclient/browser/osr_window_win.cc +++ b/tests/cefclient/browser/osr_window_win.cc @@ -9,6 +9,7 @@ #include "include/base/cef_build.h" #include "tests/shared/browser/geometry_util.h" #include "tests/shared/browser/main_message_loop.h" +#include "tests/cefclient/browser/main_context.h" #include "tests/cefclient/browser/resource.h" #include "tests/cefclient/browser/osr_ime_handler_win.h" #include "tests/shared/browser/util_win.h" @@ -97,7 +98,7 @@ void OsrWindowWin::CreateBrowser(HWND parent_hwnd, Create(parent_hwnd, rect); CefWindowInfo window_info; - window_info.SetAsWindowless(hwnd_, renderer_.IsTransparent()); + window_info.SetAsWindowless(hwnd_); // Create the browser asynchronously. CefBrowserHost::CreateBrowser(window_info, handler, startup_url, settings, @@ -227,7 +228,7 @@ void OsrWindowWin::Create(HWND parent_hwnd, const RECT& rect) { HINSTANCE hInst = ::GetModuleHandle(NULL); - const cef_color_t background_color = renderer_.GetBackgroundColor(); + const cef_color_t background_color = MainContext::Get()->GetBackgroundColor(); const HBRUSH background_brush = CreateSolidBrush( RGB(CefColorGetR(background_color), CefColorGetG(background_color), diff --git a/tests/cefclient/browser/root_window_gtk.cc b/tests/cefclient/browser/root_window_gtk.cc index 276854d5b..87671b066 100644 --- a/tests/cefclient/browser/root_window_gtk.cc +++ b/tests/cefclient/browser/root_window_gtk.cc @@ -228,7 +228,7 @@ ClientWindowHandle RootWindowGtk::GetWindowHandle() const { void RootWindowGtk::CreateBrowserWindow(const std::string& startup_url) { if (with_osr_) { - OsrRenderer::Settings settings; + OsrRenderer::Settings settings = {}; MainContext::Get()->PopulateOsrSettings(&settings); browser_window_.reset(new BrowserWindowOsrGtk(this, startup_url, settings)); } else { diff --git a/tests/cefclient/browser/root_window_mac.mm b/tests/cefclient/browser/root_window_mac.mm index ca0434c59..d96d13efd 100644 --- a/tests/cefclient/browser/root_window_mac.mm +++ b/tests/cefclient/browser/root_window_mac.mm @@ -433,7 +433,7 @@ NSRect GetScreenRectForWindow(NSWindow* window) { void RootWindowMac::CreateBrowserWindow(const std::string& startup_url) { if (with_osr_) { - OsrRenderer::Settings settings; + OsrRenderer::Settings settings = {}; MainContext::Get()->PopulateOsrSettings(&settings); browser_window_.reset(new BrowserWindowOsrMac(this, startup_url, settings)); } else { diff --git a/tests/cefclient/browser/root_window_win.cc b/tests/cefclient/browser/root_window_win.cc index c743c65bc..6d7f63b95 100644 --- a/tests/cefclient/browser/root_window_win.cc +++ b/tests/cefclient/browser/root_window_win.cc @@ -257,7 +257,7 @@ ClientWindowHandle RootWindowWin::GetWindowHandle() const { void RootWindowWin::CreateBrowserWindow(const std::string& startup_url) { if (with_osr_) { - OsrRenderer::Settings settings; + OsrRenderer::Settings settings = {}; MainContext::Get()->PopulateOsrSettings(&settings); browser_window_.reset(new BrowserWindowOsrWin(this, startup_url, settings)); } else { diff --git a/tests/ceftests/os_rendering_unittest.cc b/tests/ceftests/os_rendering_unittest.cc index 8fa110fa1..b118ac661 100644 --- a/tests/ceftests/os_rendering_unittest.cc +++ b/tests/ceftests/os_rendering_unittest.cc @@ -1092,19 +1092,22 @@ class OSRTestHandler : public RoutingTestHandler, CefWindowInfo windowInfo; CefBrowserSettings settings; - const bool transparent = (test_type_ == OSR_TEST_TRANSPARENCY); + if (test_type_ != OSR_TEST_TRANSPARENCY) { + // Explicitly set an opaque background color to disable transparency. + settings.background_color = CefColorSetARGB(255, 255, 255, 255); + } #if defined(OS_WIN) - windowInfo.SetAsWindowless(GetDesktopWindow(), transparent); + windowInfo.SetAsWindowless(GetDesktopWindow()); #elif defined(OS_MACOSX) // An actual vies is needed only for the ContextMenu test. The menu runner // checks if the view is not nil before showing the context menu. if (test_type_ == OSR_TEST_CONTEXT_MENU) - windowInfo.SetAsWindowless(osr_unittests::GetFakeView(), transparent); + windowInfo.SetAsWindowless(osr_unittests::GetFakeView()); else - windowInfo.SetAsWindowless(kNullWindowHandle, transparent); + windowInfo.SetAsWindowless(kNullWindowHandle); #elif defined(OS_LINUX) - windowInfo.SetAsWindowless(kNullWindowHandle, transparent); + windowInfo.SetAsWindowless(kNullWindowHandle); #else #error "Unsupported platform" #endif diff --git a/tests/ceftests/request_handler_unittest.cc b/tests/ceftests/request_handler_unittest.cc index a1e1fcb59..21aa0e008 100644 --- a/tests/ceftests/request_handler_unittest.cc +++ b/tests/ceftests/request_handler_unittest.cc @@ -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); } diff --git a/tools/gn_args.py b/tools/gn_args.py index 70246e3c6..08721756a 100644 --- a/tools/gn_args.py +++ b/tools/gn_args.py @@ -192,6 +192,14 @@ def GetRecommendedDefaultArgs(): } if platform == 'linux': + # Use GTK3 instead of GTK2. Default is true. False is recommended because + # the cefclient sample application requires GTK2. This avoids the "GTK+ 2.x + # symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not + # supported" error when running cefclient. Using a value of true is fine if + # your application requires GTK3 and you're not planning to build the + # cefclient target (see issue #2014). + result['use_gtk3'] = False + # Use a sysroot environment. Default is true. False is recommended for local # builds. # Run the following commands to download the sysroot environment: @@ -219,9 +227,6 @@ def GetRequiredArgs(): # Enable support for Widevine CDM. 'enable_widevine': True, - # Disable support for plugin installation. - 'enable_plugin_installation': False, - # CEF does not currently support component builds. See # https://bitbucket.org/chromiumembedded/cef/issues/1617 'is_component_build': False,