diff --git a/BUILD.gn b/BUILD.gn index cf4609ac9..a62388087 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -241,10 +241,10 @@ static_library("libcef_static") { "libcef/browser/context_menu_params_impl.h", "libcef/browser/cookie_manager_impl.cc", "libcef/browser/cookie_manager_impl.h", - "libcef/browser/devtools_delegate.cc", - "libcef/browser/devtools_delegate.h", "libcef/browser/devtools_frontend.cc", "libcef/browser/devtools_frontend.h", + "libcef/browser/devtools_manager_delegate.cc", + "libcef/browser/devtools_manager_delegate.h", "libcef/browser/download_item_impl.cc", "libcef/browser/download_item_impl.h", "libcef/browser/download_manager_delegate.cc", @@ -566,11 +566,8 @@ static_library("libcef_static") { "//components/cdm/renderer", "//components/content_settings/core/browser", "//components/content_settings/core/common", - "//components/crash/content/app:app_breakpad_mac_win_to_be_deleted", "//components/crx_file", "//components/data_use_measurement/core", - "//components/devtools_discovery", - "//components/devtools_http_handler", "//components/google/core/browser", "//components/keyed_service/content:content", "//components/keyed_service/core:core", @@ -600,7 +597,7 @@ static_library("libcef_static") { "//content/public/utility", "//crypto", "//device/core", - "//device/geolocation:device_geolocation", + "//device/geolocation", "//device/hid", "//extensions/browser", "//extensions/common/api", @@ -666,6 +663,11 @@ static_library("libcef_static") { "libcef/utility/printing_handler.cc", "libcef/utility/printing_handler.h", ] + + deps += [ + "//chrome_elf", + "//components/crash/content/app:run_as_crashpad_handler", + ] } if (is_linux) { diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index d24407c3d..8be3f089d 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,5 +7,5 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': '1ae106dbab4bddd85132d5b75c670794311f4c57', + 'chromium_checkout': '9cedf75377d817c6b32a01f1d30fbe10663b8bb8', } diff --git a/include/capi/cef_navigation_entry_capi.h b/include/capi/cef_navigation_entry_capi.h index ecfbda01b..eb4c21518 100644 --- a/include/capi/cef_navigation_entry_capi.h +++ b/include/capi/cef_navigation_entry_capi.h @@ -39,12 +39,12 @@ #pragma once #include "include/capi/cef_base_capi.h" +#include "include/capi/cef_ssl_status_capi.h" #ifdef __cplusplus extern "C" { #endif -struct _cef_sslstatus_t; /// // Structure used to represent an entry in navigation history. diff --git a/include/capi/cef_ssl_status_capi.h b/include/capi/cef_ssl_status_capi.h index 5013c97ae..055803a54 100644 --- a/include/capi/cef_ssl_status_capi.h +++ b/include/capi/cef_ssl_status_capi.h @@ -40,12 +40,12 @@ #include "include/capi/cef_base_capi.h" #include "include/capi/cef_values_capi.h" +#include "include/capi/cef_x509_certificate_capi.h" #ifdef __cplusplus extern "C" { #endif -struct _cef_x509certificate_t; /// // Structure representing the SSL information for a navigation entry. diff --git a/include/capi/views/cef_textfield_capi.h b/include/capi/views/cef_textfield_capi.h index 769f60e7f..8bd431c8e 100644 --- a/include/capi/views/cef_textfield_capi.h +++ b/include/capi/views/cef_textfield_capi.h @@ -251,12 +251,6 @@ typedef struct _cef_textfield_t { void (CEF_CALLBACK *set_placeholder_text_color)(struct _cef_textfield_t* self, cef_color_t color); - /// - // Returns the placeholder text color. - /// - cef_color_t (CEF_CALLBACK *get_placeholder_text_color)( - struct _cef_textfield_t* self); - /// // Set the accessible name that will be exposed to assistive technology (AT). /// diff --git a/include/cef_navigation_entry.h b/include/cef_navigation_entry.h index 8e8e22ee6..6dc3a4c57 100644 --- a/include/cef_navigation_entry.h +++ b/include/cef_navigation_entry.h @@ -39,8 +39,7 @@ #pragma once #include "include/cef_base.h" - -class CefSSLStatus; +#include "include/cef_ssl_status.h" /// // Class used to represent an entry in navigation history. diff --git a/include/cef_ssl_status.h b/include/cef_ssl_status.h index e46c4331e..614a607d5 100644 --- a/include/cef_ssl_status.h +++ b/include/cef_ssl_status.h @@ -40,8 +40,7 @@ #include "include/cef_base.h" #include "include/cef_values.h" - -class CefX509Certificate; +#include "include/cef_x509_certificate.h" /// // Class representing the SSL information for a navigation entry. diff --git a/include/views/cef_textfield.h b/include/views/cef_textfield.h index fadd89d7d..8f562f095 100644 --- a/include/views/cef_textfield.h +++ b/include/views/cef_textfield.h @@ -262,12 +262,6 @@ class CefTextfield : public CefView { /*--cef()--*/ virtual void SetPlaceholderTextColor(cef_color_t color) =0; - /// - // Returns the placeholder text color. - /// - /*--cef()--*/ - virtual cef_color_t GetPlaceholderTextColor() =0; - /// // Set the accessible name that will be exposed to assistive technology (AT). /// diff --git a/libcef/browser/browser_context.cc b/libcef/browser/browser_context.cc index 3680c59dd..a50e96f93 100644 --- a/libcef/browser/browser_context.cc +++ b/libcef/browser/browser_context.cc @@ -124,3 +124,33 @@ ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() { return static_cast( GetStoragePartition(this, NULL)->GetZoomLevelDelegate()); } + +void CefBrowserContext::OnRenderFrameDeleted(int render_process_id, + int render_frame_id, + bool is_main_frame, + bool is_guest_view) { + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefBrowserContext::RenderFrameDeletedOnIOThread, this, + render_process_id, render_frame_id, is_main_frame, + is_guest_view)); +} + +void CefBrowserContext::OnPurgePluginListCache() { + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefBrowserContext::PurgePluginListCacheOnIOThread, this)); +} + +void CefBrowserContext::RenderFrameDeletedOnIOThread(int render_process_id, + int render_frame_id, + bool is_main_frame, + bool is_guest_view) { + if (resource_context_ && is_main_frame) { + DCHECK_GE(render_process_id, 0); + resource_context_->ClearPluginLoadDecision(render_process_id); + } +} + +void CefBrowserContext::PurgePluginListCacheOnIOThread() { + if (resource_context_) + resource_context_->ClearPluginLoadDecision(-1); +} diff --git a/libcef/browser/browser_context.h b/libcef/browser/browser_context.h index 716bc30db..57266f271 100644 --- a/libcef/browser/browser_context.h +++ b/libcef/browser/browser_context.h @@ -164,6 +164,18 @@ class CefBrowserContext // visited links. virtual void AddVisitedURLs(const std::vector& urls) = 0; + // Called from CefBrowserHostImpl::RenderFrameDeleted or + // CefMimeHandlerViewGuestDelegate::OnGuestDetached when a render frame is + // deleted. + void OnRenderFrameDeleted(int render_process_id, + int render_frame_id, + bool is_main_frame, + bool is_guest_view); + + // Called from CefRequestContextImpl::PurgePluginListCacheInternal when the + // plugin list cache should be purged. + void OnPurgePluginListCache(); + CefResourceContext* resource_context() const { return resource_context_.get(); } @@ -188,6 +200,12 @@ class CefBrowserContext content::BrowserThread::UI>; friend class base::DeleteHelper; + void RenderFrameDeletedOnIOThread(int render_process_id, + int render_frame_id, + bool is_main_frame, + bool is_guest_view); + void PurgePluginListCacheOnIOThread(); + // True if this CefBrowserContext is a CefBrowserContextProxy. const bool is_proxy_; diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 8911d7082..92abce077 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -15,8 +15,8 @@ #include "libcef/browser/browser_util.h" #include "libcef/browser/content_browser_client.h" #include "libcef/browser/context.h" -#include "libcef/browser/devtools_delegate.h" #include "libcef/browser/devtools_frontend.h" +#include "libcef/browser/devtools_manager_delegate.h" #include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/image_impl.h" #include "libcef/browser/media_capture_devices_dispatcher.h" @@ -2390,6 +2390,16 @@ void CefBrowserHostImpl::RenderFrameDeleted( const int render_routing_id = render_frame_host->GetRoutingID(); browser_info_->render_id_manager()->remove_render_frame_id( render_process_id, render_routing_id); + + if (web_contents()) { + const bool is_main_frame = (render_frame_host->GetParent() == nullptr); + scoped_refptr context = + static_cast(web_contents()->GetBrowserContext()); + if (context) { + context->OnRenderFrameDeleted(render_process_id, render_routing_id, + is_main_frame, false); + } + } } void CefBrowserHostImpl::RenderViewCreated( diff --git a/libcef/browser/browser_main.cc b/libcef/browser/browser_main.cc index 850aa2c06..083a626bd 100644 --- a/libcef/browser/browser_main.cc +++ b/libcef/browser/browser_main.cc @@ -13,7 +13,7 @@ #include "libcef/browser/browser_message_loop.h" #include "libcef/browser/content_browser_client.h" #include "libcef/browser/context.h" -#include "libcef/browser/devtools_delegate.h" +#include "libcef/browser/devtools_manager_delegate.h" #include "libcef/browser/extensions/browser_context_keyed_service_factories.h" #include "libcef/browser/extensions/extensions_browser_client.h" #include "libcef/browser/extensions/extension_system_factory.h" @@ -194,19 +194,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { global_browser_context_ = new CefBrowserContextImpl(settings); global_browser_context_->Initialize(); - const base::CommandLine* command_line = - base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) { - std::string port_str = - command_line->GetSwitchValueASCII(switches::kRemoteDebuggingPort); - int port; - if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) { - devtools_delegate_ = - new CefDevToolsDelegate(static_cast(port)); - } else { - LOG(WARNING) << "Invalid http debugger port number " << port; - } - } + CefDevToolsManagerDelegate::StartHttpHandler(global_browser_context_.get()); // Triggers initialization of the singleton instance on UI thread. PluginFinder::GetInstance()->Init(); @@ -217,18 +205,16 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { } void CefBrowserMainParts::PostMainMessageLoopRun() { + // NOTE: Destroy objects in reverse order of creation. + CefDevToolsManagerDelegate::StopHttpHandler(); + + global_browser_context_ = NULL; + if (extensions::ExtensionsEnabled()) { extensions::ExtensionsBrowserClient::Set(NULL); extensions_browser_client_.reset(); } - if (devtools_delegate_) { - devtools_delegate_->Stop(); - devtools_delegate_ = NULL; - } - - global_browser_context_ = NULL; - #if DCHECK_IS_ON() // No CefBrowserContext instances should exist at this point. DCHECK_EQ(0, CefBrowserContext::DebugObjCt); diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index 11ebfd03f..a92a63b63 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -14,7 +14,7 @@ #include "libcef/browser/browser_message_filter.h" #include "libcef/browser/browser_platform_delegate.h" #include "libcef/browser/context.h" -#include "libcef/browser/devtools_delegate.h" +#include "libcef/browser/devtools_manager_delegate.h" #include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/net/chrome_scheme_handler.h" diff --git a/libcef/browser/context.cc b/libcef/browser/context.cc index e9bc4558f..101ba7161 100644 --- a/libcef/browser/context.cc +++ b/libcef/browser/context.cc @@ -31,7 +31,11 @@ #include "ui/base/ui_base_switches.h" #if defined(OS_WIN) +#include "chrome_elf/chrome_elf_main.h" #include "content/public/app/sandbox_helper_win.h" +#include "components/crash/content/app/crash_switches.h" +#include "components/crash/content/app/crashpad.h" +#include "components/crash/content/app/run_as_crashpad_handler_win.h" #include "sandbox/win/src/sandbox_types.h" #endif @@ -93,6 +97,11 @@ int CefExecuteProcess(const CefMainArgs& args, if (process_type.empty()) return -1; +#if defined(OS_WIN) + if (process_type == crash_reporter::switches::kCrashpadHandler) + return crash_reporter::RunAsCrashpadHandler(command_line); +#endif + CefMainDelegate main_delegate(application); // Execute the secondary process. @@ -260,6 +269,11 @@ bool CefContext::Initialize(const CefMainArgs& args, } #endif +#if defined(OS_WIN) + // Signal Chrome Elf that Chrome has begun to start. + SignalChromeElf(); +#endif + main_delegate_.reset(new CefMainDelegate(application)); main_runner_.reset(content::ContentMainRunner::Create()); browser_info_manager_.reset(new CefBrowserInfoManager); diff --git a/libcef/browser/devtools_delegate.cc b/libcef/browser/devtools_delegate.cc deleted file mode 100644 index 928f8a7d1..000000000 --- a/libcef/browser/devtools_delegate.cc +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2013 the Chromium Embedded Framework Authors. Portions Copyright -// 2012 The Chromium Authors. All rights reserved. Use of this source code is -// governed by a BSD-style license that can be found in the LICENSE file. - -#include "libcef/browser/devtools_delegate.h" - -#include -#include - -#include "libcef/browser/net/devtools_scheme_handler.h" -#include "libcef/common/content_client.h" - -#include "base/command_line.h" -#include "base/md5.h" -#include "base/rand_util.h" -#include "base/strings/stringprintf.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/utf_string_conversions.h" -#include "base/time/time.h" -#include "cef/grit/cef_resources.h" -#include "components/devtools_discovery/basic_target_descriptor.h" -#include "components/devtools_discovery/devtools_discovery_manager.h" -#include "content/public/browser/devtools_agent_host.h" -#include "content/public/browser/devtools_frontend_host.h" -#include "content/public/browser/favicon_status.h" -#include "content/public/browser/navigation_entry.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/render_widget_host_iterator.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_delegate.h" -#include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" -#include "net/base/net_errors.h" -#include "net/socket/tcp_server_socket.h" -#include "ui/base/layout.h" -#include "ui/base/resource/resource_bundle.h" - -namespace { - -const int kBackLog = 10; - -class TCPServerSocketFactory - : public devtools_http_handler::DevToolsHttpHandler::ServerSocketFactory { - public: - TCPServerSocketFactory(const std::string& address, uint16_t port) - : address_(address), port_(port) { - } - - private: - // DevToolsHttpHandler::ServerSocketFactory. - std::unique_ptr CreateForHttpServer() override { - std::unique_ptr socket( - new net::TCPServerSocket(nullptr, net::NetLog::Source())); - if (socket->ListenWithAddressAndPort(address_, port_, kBackLog) != net::OK) - return std::unique_ptr(); - - return socket; - } - - std::string address_; - uint16_t port_; - - DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); -}; - -std::unique_ptr - CreateSocketFactory(uint16_t port) { - return std::unique_ptr< - devtools_http_handler::DevToolsHttpHandler::ServerSocketFactory>( - new TCPServerSocketFactory("127.0.0.1", port)); -} - -} // namespace - -// CefDevToolsDelegate - -CefDevToolsDelegate::CefDevToolsDelegate(uint16_t port) { - devtools_http_handler_.reset(new devtools_http_handler::DevToolsHttpHandler( - CreateSocketFactory(port), - std::string(), - this, - base::FilePath(), - base::FilePath(), - std::string(), - CefContentClient::Get()->GetUserAgent())); -} - -CefDevToolsDelegate::~CefDevToolsDelegate() { - DCHECK(!devtools_http_handler_.get()); -} - -void CefDevToolsDelegate::Stop() { - // Release the reference before deleting the handler. Deleting the handler - // will delete |this| and no members of |this| should be accessed after that - // call. - devtools_http_handler::DevToolsHttpHandler* handler = - devtools_http_handler_.release(); - delete handler; -} - -std::string CefDevToolsDelegate::GetDiscoveryPageHTML() { - return CefContentClient::Get()->GetDataResource( - IDR_CEF_DEVTOOLS_DISCOVERY_PAGE, ui::SCALE_FACTOR_NONE).as_string(); -} - -std::string CefDevToolsDelegate::GetPageThumbnailData(const GURL& url) { - return std::string(); -} - -std::string CefDevToolsDelegate::GetFrontendResource( - const std::string& path) { - return content::DevToolsFrontendHost::GetFrontendResource(path).as_string(); -} - -content::DevToolsExternalAgentProxyDelegate* -CefDevToolsDelegate::HandleWebSocketConnection(const std::string& path) { - return nullptr; -} - -std::string CefDevToolsDelegate::GetChromeDevToolsURL() { - return base::StringPrintf("%s://%s/inspector.html", - content::kChromeDevToolsScheme, scheme::kChromeDevToolsHost); -} - -// CefDevToolsManagerDelegate - -CefDevToolsManagerDelegate::CefDevToolsManagerDelegate() { -} - -CefDevToolsManagerDelegate::~CefDevToolsManagerDelegate() { -} - -base::DictionaryValue* CefDevToolsManagerDelegate::HandleCommand( - content::DevToolsAgentHost* agent_host, - base::DictionaryValue* command_dict) { - std::unique_ptr result = - devtools_discovery::DevToolsDiscoveryManager::GetInstance() - ->HandleCreateTargetCommand(command_dict); - return result.release(); // Caller takes ownership. -} diff --git a/libcef/browser/devtools_delegate.h b/libcef/browser/devtools_delegate.h deleted file mode 100644 index 30d7d9b8c..000000000 --- a/libcef/browser/devtools_delegate.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2013 the Chromium Embedded Framework Authors. Portions Copyright -// 2012 The Chromium Authors. All rights reserved. Use of this source code is -// governed by a BSD-style license that can be found in the LICENSE file. - -#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_ -#define CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_ -#pragma once - -#include - -#include -#include - -#include "base/compiler_specific.h" -#include "components/devtools_http_handler/devtools_http_handler.h" -#include "components/devtools_http_handler/devtools_http_handler_delegate.h" -#include "content/public/browser/devtools_agent_host.h" -#include "content/public/browser/devtools_manager_delegate.h" - -namespace content { -class RenderViewHost; -} - -class CefDevToolsDelegate : - public devtools_http_handler::DevToolsHttpHandlerDelegate { - public: - explicit CefDevToolsDelegate(uint16_t port); - ~CefDevToolsDelegate() override; - - // Stops http server. - void Stop(); - - // DevToolsHttpHandlerDelegate overrides. - std::string GetDiscoveryPageHTML() override; - std::string GetFrontendResource(const std::string& path) override; - std::string GetPageThumbnailData(const GURL& url) override; - content::DevToolsExternalAgentProxyDelegate* - HandleWebSocketConnection(const std::string& path) override; - - // Returns the chrome-devtools URL. - std::string GetChromeDevToolsURL(); - - private: - std::unique_ptr devtools_http_handler_; - - DISALLOW_COPY_AND_ASSIGN(CefDevToolsDelegate); -}; - -class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate { - public: - CefDevToolsManagerDelegate(); - ~CefDevToolsManagerDelegate() override; - - // DevToolsManagerDelegate implementation. - void Inspect(content::BrowserContext* browser_context, - content::DevToolsAgentHost* agent_host) override {} - void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host, - bool attached) override {} - base::DictionaryValue* HandleCommand( - content::DevToolsAgentHost* agent_host, - base::DictionaryValue* command) override; - - private: - DISALLOW_COPY_AND_ASSIGN(CefDevToolsManagerDelegate); -}; - -#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DELEGATE_H_ diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index 4cdd118a2..becc92d63 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -1,29 +1,30 @@ -// Copyright 2013 the Chromium Embedded Framework Authors. Portions Copyright -// 2012 The Chromium Authors. All rights reserved. Use of this source code is -// governed by a BSD-style license that can be found in the LICENSE file. +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "libcef/browser/devtools_frontend.h" -#include "libcef/browser/content_browser_client.h" -#include "libcef/browser/devtools_delegate.h" -#include "libcef/browser/request_context_impl.h" -#include "libcef/browser/thread_util.h" +#include + +#include "libcef/browser/devtools_manager_delegate.h" +#include "libcef/browser/net/devtools_scheme_handler.h" -#include "base/command_line.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/json/string_escape.h" -#include "base/memory/ptr_util.h" +#include "base/macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_client.h" +#include "content/public/common/url_constants.h" #include "ipc/ipc_channel.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" @@ -38,7 +39,7 @@ namespace { class ResponseWriter : public net::URLFetcherResponseWriter { public: - ResponseWriter(base::WeakPtr devtools_, + ResponseWriter(base::WeakPtr shell_devtools_, int stream_id); ~ResponseWriter() override; @@ -50,16 +51,16 @@ class ResponseWriter : public net::URLFetcherResponseWriter { int Finish(const net::CompletionCallback& callback) override; private: - base::WeakPtr devtools_; + base::WeakPtr shell_devtools_; int stream_id_; DISALLOW_COPY_AND_ASSIGN(ResponseWriter); }; ResponseWriter::ResponseWriter( - base::WeakPtr devtools, + base::WeakPtr shell_devtools, int stream_id) - : devtools_(devtools), + : shell_devtools_(shell_devtools), stream_id_(stream_id) { } @@ -83,7 +84,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer, content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::Bind(&CefDevToolsFrontend::CallClientFunction, - devtools_, "DevToolsAPI.streamWrite", + shell_devtools_, "DevToolsAPI.streamWrite", base::Owned(id), base::Owned(chunkValue), nullptr)); return num_bytes; } @@ -92,12 +93,17 @@ int ResponseWriter::Finish(const net::CompletionCallback& callback) { return net::OK; } +static std::string GetFrontendURL() { + return base::StringPrintf("%s://%s/inspector.html", + content::kChromeDevToolsScheme, scheme::kChromeDevToolsHost); +} + +} // namespace + // This constant should be in sync with // the constant at devtools_ui_bindings.cc. const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; -} // namespace - // static CefDevToolsFrontend* CefDevToolsFrontend::Show( CefRefPtr inspected_browser, @@ -132,13 +138,15 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show( inspected_contents, inspect_element_at); // Need to load the URL after creating the DevTools objects. - CefDevToolsDelegate* delegate = - CefContentBrowserClient::Get()->devtools_delegate(); - frontend_browser->GetMainFrame()->LoadURL(delegate->GetChromeDevToolsURL()); + frontend_browser->GetMainFrame()->LoadURL(GetFrontendURL()); return devtools_frontend; } +void CefDevToolsFrontend::Activate() { + frontend_browser_->ActivateContents(web_contents()); +} + void CefDevToolsFrontend::Focus() { frontend_browser_->SetFocus(true); } @@ -151,7 +159,8 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) { } void CefDevToolsFrontend::Close() { - CEF_POST_TASK(CEF_UIT, + content::BrowserThread::PostTask( + content::BrowserThread::UI, FROM_HERE, base::Bind(&CefBrowserHostImpl::CloseBrowser, frontend_browser_.get(), true)); } @@ -167,7 +176,7 @@ CefDevToolsFrontend::CefDevToolsFrontend( CefRefPtr frontend_browser, content::WebContents* inspected_contents, const CefPoint& inspect_element_at) - : WebContentsObserver(frontend_browser->web_contents()), + : content::WebContentsObserver(frontend_browser->web_contents()), frontend_browser_(frontend_browser), inspected_contents_(inspected_contents), inspect_element_at_(inspect_element_at), @@ -186,7 +195,6 @@ void CefDevToolsFrontend::RenderViewCreated( web_contents()->GetMainFrame(), base::Bind(&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend, base::Unretained(this)))); - } } @@ -199,9 +207,10 @@ void CefDevToolsFrontend::DocumentAvailableInMainFrame() { if (agent_host != agent_host_) { agent_host_ = agent_host; agent_host_->AttachClient(this); - - if (!inspect_element_at_.IsEmpty()) - InspectElementAt(inspect_element_at_.x, inspect_element_at_.y); + if (inspect_element_at_.IsEmpty()) { + agent_host_->InspectElement( + this, inspect_element_at_.x, inspect_element_at_.y); + } } } @@ -211,6 +220,21 @@ void CefDevToolsFrontend::WebContentsDestroyed() { delete this; } +void CefDevToolsFrontend::SetPreferences(const std::string& json) { + preferences_.Clear(); + if (json.empty()) + return; + base::DictionaryValue* dict = nullptr; + std::unique_ptr parsed = base::JSONReader::Read(json); + if (!parsed || !parsed->GetAsDictionary(&dict)) + return; + for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { + if (!it.value().IsType(base::Value::TYPE_STRING)) + continue; + preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); + } +} + void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend( const std::string& message) { if (!agent_host_) @@ -265,8 +289,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend( web_contents()->GetBrowserContext())-> GetURLRequestContext()); fetcher->SetExtraRequestHeaders(headers); - fetcher->SaveResponseWithWriter(base::WrapUnique( - new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); + fetcher->SaveResponseWithWriter( + std::unique_ptr( + new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id))); fetcher->Start(); return; } else if (method == "getPreferences") { @@ -297,8 +322,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend( } void CefDevToolsFrontend::DispatchProtocolMessage( - content::DevToolsAgentHost* agent_host, - const std::string& message) { + content::DevToolsAgentHost* agent_host, const std::string& message) { + if (message.length() < kMaxMessageChunkSize) { std::string param; base::EscapeJSONString(message, true, ¶m); @@ -320,21 +345,6 @@ void CefDevToolsFrontend::DispatchProtocolMessage( } } -void CefDevToolsFrontend::SetPreferences(const std::string& json) { - preferences_.Clear(); - if (json.empty()) - return; - base::DictionaryValue* dict = nullptr; - std::unique_ptr parsed = base::JSONReader::Read(json); - if (!parsed || !parsed->GetAsDictionary(&dict)) - return; - for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { - if (!it.value().IsType(base::Value::TYPE_STRING)) - continue; - preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); - } -} - void CefDevToolsFrontend::OnURLFetchComplete(const net::URLFetcher* source) { // TODO(pfeldman): this is a copy of chrome's devtools_ui_bindings.cc. // We should handle some of the commands including this one in content. @@ -384,15 +394,14 @@ void CefDevToolsFrontend::CallClientFunction( } void CefDevToolsFrontend::SendMessageAck(int request_id, - const base::Value* arg) { + const base::Value* arg) { base::FundamentalValue id_value(request_id); CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr); } void CefDevToolsFrontend::AgentHostClosed( - content::DevToolsAgentHost* agent_host, - bool replaced) { + content::DevToolsAgentHost* agent_host, bool replaced) { DCHECK(agent_host == agent_host_.get()); Close(); } diff --git a/libcef/browser/devtools_frontend.h b/libcef/browser/devtools_frontend.h index a1f8720b3..3af0aeeec 100644 --- a/libcef/browser/devtools_frontend.h +++ b/libcef/browser/devtools_frontend.h @@ -1,13 +1,16 @@ -// Copyright 2013 the Chromium Embedded Framework Authors. Portions Copyright -// 2012 The Chromium Authors. All rights reserved. Use of this source code is -// governed by a BSD-style license that can be found in the LICENSE file. +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_FRONTEND_H_ #define CEF_LIBCEF_BROWSER_DEVTOOLS_FRONTEND_H_ +#include + #include "libcef/browser/browser_host_impl.h" #include "base/compiler_specific.h" +#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/values.h" @@ -36,22 +39,23 @@ class CefDevToolsFrontend : public content::WebContentsObserver, const CefBrowserSettings& settings, const CefPoint& inspect_element_at); + void Activate(); void Focus(); void InspectElementAt(int x, int y); void Close(); void DisconnectFromTarget(); - CefRefPtr frontend_browser() const { - return frontend_browser_; - } - void CallClientFunction(const std::string& function_name, const base::Value* arg1, const base::Value* arg2, const base::Value* arg3); - private: + CefRefPtr frontend_browser() const { + return frontend_browser_; + } + + protected: CefDevToolsFrontend(CefRefPtr frontend_browser, content::WebContents* inspected_contents, const CefPoint& inspect_element_at); @@ -63,14 +67,14 @@ class CefDevToolsFrontend : public content::WebContentsObserver, void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host, const std::string& message) override; void SetPreferences(const std::string& json); + virtual void HandleMessageFromDevToolsFrontend(const std::string& message); + private: // WebContentsObserver overrides void RenderViewCreated(content::RenderViewHost* render_view_host) override; void DocumentAvailableInMainFrame() override; void WebContentsDestroyed() override; - void HandleMessageFromDevToolsFrontend(const std::string& message); - // net::URLFetcherDelegate overrides. void OnURLFetchComplete(const net::URLFetcher* source) override; @@ -79,8 +83,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver, CefRefPtr frontend_browser_; content::WebContents* inspected_contents_; - CefPoint inspect_element_at_; scoped_refptr agent_host_; + CefPoint inspect_element_at_; std::unique_ptr frontend_host_; using PendingRequestsMap = std::map; PendingRequestsMap pending_requests_; diff --git a/libcef/browser/devtools_manager_delegate.cc b/libcef/browser/devtools_manager_delegate.cc new file mode 100644 index 000000000..2ec8fe55a --- /dev/null +++ b/libcef/browser/devtools_manager_delegate.cc @@ -0,0 +1,144 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/browser/devtools_manager_delegate.h" + +#include + +#include + +#include "libcef/browser/browser_host_impl.h" +#include "libcef/common/content_client.h" + +#include "base/atomicops.h" +#include "base/bind.h" +#include "base/command_line.h" +#include "base/files/file_path.h" +#include "base/macros.h" +#include "base/memory/ptr_util.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/stringprintf.h" +#include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" +#include "cef/grit/cef_resources.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/devtools_agent_host.h" +#include "content/public/browser/devtools_frontend_host.h" +#include "content/public/browser/devtools_socket_factory.h" +#include "content/public/browser/favicon_status.h" +#include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/browser/web_contents.h" +#include "content/public/common/content_switches.h" +#include "content/public/common/url_constants.h" +#include "content/public/common/user_agent.h" +#include "net/base/net_errors.h" +#include "net/socket/tcp_server_socket.h" +#include "ui/base/resource/resource_bundle.h" + +namespace { + +const int kBackLog = 10; + +class TCPServerSocketFactory : public content::DevToolsSocketFactory { + public: + TCPServerSocketFactory(const std::string& address, uint16_t port) + : address_(address), port_(port) {} + + private: + // content::DevToolsSocketFactory. + std::unique_ptr CreateForHttpServer() override { + std::unique_ptr socket( + new net::TCPServerSocket(nullptr, net::NetLog::Source())); + if (socket->ListenWithAddressAndPort(address_, port_, kBackLog) != net::OK) + return std::unique_ptr(); + return socket; + } + + std::unique_ptr CreateForTethering( + std::string* out_name) override { + return nullptr; + } + + std::string address_; + uint16_t port_; + + DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); +}; + +std::unique_ptr CreateSocketFactory() { + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + // See if the user specified a port on the command line. Specifying 0 would + // result in the selection of an ephemeral port but that doesn't make sense + // for CEF where the URL is otherwise undiscoverable. Also, don't allow + // binding of ports between 0 and 1024 exclusive because they're normally + // restricted to root on Posix-based systems. + uint16_t port = 0; + if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { + int temp_port; + std::string port_str = + command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); + if (base::StringToInt(port_str, &temp_port) && + temp_port >= 1024 && temp_port < 65535) { + port = static_cast(temp_port); + } else { + DLOG(WARNING) << "Invalid http debugger port number " << temp_port; + } + } + if (port == 0) + return nullptr; + return std::unique_ptr( + new TCPServerSocketFactory("127.0.0.1", port)); +} + +} // namespace + +// CefDevToolsManagerDelegate ---------------------------------------------- + +// static +void CefDevToolsManagerDelegate::StartHttpHandler( + content::BrowserContext* browser_context) { + std::unique_ptr socket_factory = + CreateSocketFactory(); + if (!socket_factory) + return; + content::DevToolsAgentHost::StartRemoteDebuggingServer( + std::move(socket_factory), + std::string(), + browser_context->GetPath(), + base::FilePath(), + std::string(), + CefContentClient::Get()->GetUserAgent()); +} + +// static +void CefDevToolsManagerDelegate::StopHttpHandler() { + // This is a no-op if the server was never started. + content::DevToolsAgentHost::StopRemoteDebuggingServer(); +} + +CefDevToolsManagerDelegate::CefDevToolsManagerDelegate() { +} + +CefDevToolsManagerDelegate::~CefDevToolsManagerDelegate() { +} + +scoped_refptr +CefDevToolsManagerDelegate::CreateNewTarget(const GURL& url) { + // This is reached when the user selects "Open link in new tab" from the + // DevTools interface. + // TODO(cef): Consider exposing new API to support this. + return nullptr; +} + +std::string CefDevToolsManagerDelegate::GetDiscoveryPageHTML() { + return ui::ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_CEF_DEVTOOLS_DISCOVERY_PAGE).as_string(); +} + +std::string CefDevToolsManagerDelegate::GetFrontendResource( + const std::string& path) { + return content::DevToolsFrontendHost::GetFrontendResource(path).as_string(); +} diff --git a/libcef/browser/devtools_manager_delegate.h b/libcef/browser/devtools_manager_delegate.h new file mode 100644 index 000000000..2352162ba --- /dev/null +++ b/libcef/browser/devtools_manager_delegate.h @@ -0,0 +1,37 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ +#define CEF_LIBCEF_BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "content/public/browser/devtools_manager_delegate.h" + +namespace content { +class BrowserContext; +} + +class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate { + public: + static void StartHttpHandler(content::BrowserContext* browser_context); + static void StopHttpHandler(); + + CefDevToolsManagerDelegate(); + ~CefDevToolsManagerDelegate() override; + + // DevToolsManagerDelegate implementation. + void Inspect(content::DevToolsAgentHost* agent_host) override {} + void DevToolsAgentStateChanged(content::DevToolsAgentHost* agent_host, + bool attached) override {} + scoped_refptr CreateNewTarget(const GURL& url) + override; + std::string GetDiscoveryPageHTML() override; + std::string GetFrontendResource(const std::string& path) override; + + private: + DISALLOW_COPY_AND_ASSIGN(CefDevToolsManagerDelegate); +}; + +#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_MANAGER_DELEGATE_H_ diff --git a/libcef/browser/extensions/api/tabs/tabs_api.cc b/libcef/browser/extensions/api/tabs/tabs_api.cc index 12dd47e15..fbc1a382b 100644 --- a/libcef/browser/extensions/api/tabs/tabs_api.cc +++ b/libcef/browser/extensions/api/tabs/tabs_api.cc @@ -26,6 +26,8 @@ namespace tabs = api::tabs; namespace { +const char kNotImplementedError[] = "Not implemented"; + // Any out parameter (|browser|, |contents|, & |tab_index|) may be NULL and will // not be set within the function. // Based on ExtensionTabUtil::GetTabById(). @@ -124,6 +126,10 @@ void ZoomModeToZoomSettings(zoom::ZoomController::ZoomMode zoom_mode, } // namespace +ExtensionFunction::ResponseAction TabsGetFunction::Run() { + return RespondNow(Error(kNotImplementedError)); +} + content::WebContents* ZoomAPIFunction::GetWebContents(int tab_id) { content::WebContents* web_contents = NULL; if (tab_id != -1) { diff --git a/libcef/browser/extensions/api/tabs/tabs_api.h b/libcef/browser/extensions/api/tabs/tabs_api.h index 9f0f15ddb..483bcae5f 100644 --- a/libcef/browser/extensions/api/tabs/tabs_api.h +++ b/libcef/browser/extensions/api/tabs/tabs_api.h @@ -18,6 +18,14 @@ class WebContents; namespace extensions { namespace cef { +class TabsGetFunction : public UIThreadExtensionFunction { + ~TabsGetFunction() override {} + + ResponseAction Run() override; + + DECLARE_EXTENSION_FUNCTION("tabs.get", TABS_GET) +}; + class ZoomAPIFunction : public AsyncExtensionFunction { protected: ~ZoomAPIFunction() override {} diff --git a/libcef/browser/extensions/chrome_api_registration.cc b/libcef/browser/extensions/chrome_api_registration.cc index 76481193a..fdaeb5efa 100644 --- a/libcef/browser/extensions/chrome_api_registration.cc +++ b/libcef/browser/extensions/chrome_api_registration.cc @@ -31,6 +31,7 @@ bool ChromeFunctionRegistry::IsSupported(const std::string& name) { "streamsPrivate", EXTENSION_FUNCTION_NAME(StreamsPrivateAbortFunction), "tabs", + EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction), EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomFunction), EXTENSION_FUNCTION_NAME(cefimpl::TabsGetZoomFunction), EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomSettingsFunction), @@ -48,6 +49,7 @@ bool ChromeFunctionRegistry::IsSupported(const std::string& name) { void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) { registry->RegisterFunction(); registry->RegisterFunction(); + registry->RegisterFunction(); registry->RegisterFunction(); registry->RegisterFunction(); registry->RegisterFunction(); diff --git a/libcef/browser/extensions/extension_system.cc b/libcef/browser/extensions/extension_system.cc index 3f8a77d0e..0243ae8b3 100644 --- a/libcef/browser/extensions/extension_system.cc +++ b/libcef/browser/extensions/extension_system.cc @@ -112,32 +112,43 @@ void CefExtensionSystem::Init() { // Add the built-in PDF extension. PDF loading works as follows: // 1. PDF PPAPI plugin is registered to handle kPDFPluginOutOfProcessMimeType // in libcef/common/content_client.cc ComputeBuiltInPlugins. - // 2. PDF extension is registered with the below call to AddExtension. - // 3. A page requests a plugin to handle "application/pdf" mime type. This - // results in a call to CefContentRendererClient::OverrideCreatePlugin - // in the renderer process which calls CefContentRendererClient:: - // CreateBrowserPluginDelegate indirectly to create a - // MimeHandlerViewContainer. + // 2. PDF extension is registered and associated with the "application/pdf" + // mime type by the below call to AddExtension. + // 3. A page requests a resource with the "application/pdf" mime type. For + // example, by loading a PDF file. // 4. CefResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream - // intercepts the PDF load in the browser process, associates the load with - // the PDF extension and makes the PDF file contents available to the - // extension via the Stream API. - // 5. A MimeHandlerViewGuest and CefMimeHandlerViewGuestDelegate is created in + // intercepts the PDF resource load in the browser process, generates a + // unique View ID that is associated with the resource request for later + // retrieval via MimeHandlerStreamManager and the + // chrome.mimeHandlerPrivate JS API (extensions/common/api/ + // mime_handler_private.idl), and returns the unique View ID via the + // |payload| argument. + // 5. The unique View ID arrives in the renderer process via + // ResourceLoader::didReceiveData and triggers creation of a new Document. + // DOMImplementation::createDocument indirectly calls + // RendererBlinkPlatformImpl::getPluginList to retrieve the list of + // supported plugins from the browser process. If a plugin supports the + // "application/pdf" mime type then a PluginDocument is created and + // CefContentRendererClient::OverrideCreatePlugin is called. This then + // indirectly calls CefContentRendererClient::CreateBrowserPluginDelegate + // to create a MimeHandlerViewContainer. + // 6. A MimeHandlerViewGuest and CefMimeHandlerViewGuestDelegate is created in // the browser process. - // 6. MimeHandlerViewGuest navigates to the PDF extension URL. - // 7. Access to PDF extension resources is checked by + // 7. MimeHandlerViewGuest navigates to the PDF extension URL. + // 8. Access to PDF extension resources is checked by // CefExtensionsBrowserClient::AllowCrossRendererResourceLoad. - // 8. PDF extension resources are provided from bundle via + // 9. PDF extension resources are provided from bundle via // CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob and // CefComponentExtensionResourceManager. - // 9. The PDF extension communicates via the chrome.mimeHandlerPrivate Mojo - // API which is implemented as described in + // 10.The PDF extension (chrome/browser/resources/pdf/browser_api.js) calls + // chrome.mimeHandlerPrivate.getStreamInfo to retrieve the PDF resource + // stream. This API is implemented using Mojo as described in // libcef/common/extensions/api/README.txt. - // 10.The PDF extension requests a plugin to handle + // 11.The PDF extension requests a plugin to handle // kPDFPluginOutOfProcessMimeType which loads the PDF PPAPI plugin. - // 11.Routing of print-related commands are handled by ChromePDFPrintClient + // 12.Routing of print-related commands are handled by ChromePDFPrintClient // and CefPrintWebViewHelperDelegate in the renderer process. - // 12.The PDF extension is granted access to chrome://resources via + // 13.The PDF extension is granted access to chrome://resources via // CefExtensionWebContentsObserver::RenderViewCreated in the browser // process. if (PdfExtensionEnabled()) { diff --git a/libcef/browser/extensions/mime_handler_view_guest_delegate.cc b/libcef/browser/extensions/mime_handler_view_guest_delegate.cc index 56b2f790f..fda55dfc6 100644 --- a/libcef/browser/extensions/mime_handler_view_guest_delegate.cc +++ b/libcef/browser/extensions/mime_handler_view_guest_delegate.cc @@ -95,14 +95,24 @@ bool CefMimeHandlerViewGuestDelegate::OnGuestDetached( CefRefPtr owner_browser = GetOwnerBrowser(guest_); + const int render_process_id = main_frame_host->GetProcess()->GetID(); + const int render_frame_id = main_frame_host->GetRoutingID(); + const bool is_main_frame = (main_frame_host->GetParent() == nullptr); + // Disassociate guest state information with the owner browser. scoped_refptr info = owner_browser->browser_info(); info->guest_render_id_manager()->remove_render_view_id( view_host->GetProcess()->GetID(), view_host->GetRoutingID()); info->guest_render_id_manager()->remove_render_frame_id( - main_frame_host->GetProcess()->GetID(), - main_frame_host->GetRoutingID()); + render_process_id, render_frame_id); + + scoped_refptr context = + static_cast(web_contents->GetBrowserContext()); + if (context) { + context->OnRenderFrameDeleted(render_process_id, render_frame_id, + is_main_frame, true); + } // Do nothing when the browser is windowless. return owner_browser->IsWindowless(); diff --git a/libcef/browser/frame_host_impl.cc b/libcef/browser/frame_host_impl.cc index 1ea19e4bf..a626a9303 100644 --- a/libcef/browser/frame_host_impl.cc +++ b/libcef/browser/frame_host_impl.cc @@ -240,8 +240,12 @@ void CefFrameHostImpl::SendJavaScript( int startLine) { if (jsCode.empty()) return; - if (startLine < 0) - startLine = 0; + if (startLine <= 0) { + // A value of 0 is v8::Message::kNoLineNumberInfo in V8. There is code in + // V8 that will assert on that value (e.g. V8StackTraceImpl::Frame::Frame + // if a JS exception is thrown) so make sure |startLine| > 0. + startLine = 1; + } CefRefPtr browser; int64 frame_id; diff --git a/libcef/browser/menu_model_impl.cc b/libcef/browser/menu_model_impl.cc index f2a6b644e..37d36ecec 100644 --- a/libcef/browser/menu_model_impl.cc +++ b/libcef/browser/menu_model_impl.cc @@ -142,8 +142,8 @@ class CefSimpleMenuModel : public ui::MenuModel { impl_->MenuWillShow(); } - void MenuClosed() override { - impl_->MenuClosed(); + void MenuWillClose() override { + impl_->MenuWillClose(); } void SetMenuModelDelegate( @@ -657,7 +657,7 @@ void CefMenuModelImpl::MenuWillShow() { FOR_EACH_OBSERVER(Observer, observers_, MenuWillShow(this)); } -void CefMenuModelImpl::MenuClosed() { +void CefMenuModelImpl::MenuWillClose() { if (!VerifyContext()) return; diff --git a/libcef/browser/menu_model_impl.h b/libcef/browser/menu_model_impl.h index 13fccc74e..fa6f06bca 100644 --- a/libcef/browser/menu_model_impl.h +++ b/libcef/browser/menu_model_impl.h @@ -125,7 +125,7 @@ class CefMenuModelImpl : public CefMenuModel { // Callbacks from the ui::MenuModel implementation. void ActivatedAt(int index, cef_event_flags_t event_flags); void MenuWillShow(); - void MenuClosed(); + void MenuWillClose(); base::string16 GetFormattedLabelAt(int index); // Verify that only a single reference exists to all CefMenuModelImpl objects. diff --git a/libcef/browser/native/native_menu_win.cc b/libcef/browser/native/native_menu_win.cc index e034aa12b..dc02ebc0d 100644 --- a/libcef/browser/native/native_menu_win.cc +++ b/libcef/browser/native/native_menu_win.cc @@ -456,9 +456,9 @@ void CefNativeMenuWin::RunMenuAt(const gfx::Point& point, int alignment) { menu_to_select_factory_.GetWeakPtr())); menu_action_ = MENU_ACTION_SELECTED; } - // Send MenuClosed after we schedule the select, otherwise MenuClosed is - // processed after the select (MenuClosed posts a delayed task too). - model_->MenuClosed(); + // Send MenuWillClose after we schedule the select, otherwise MenuWillClose is + // processed after the select (MenuWillClose posts a delayed task too). + model_->MenuWillClose(); } void CefNativeMenuWin::CancelMenu() { diff --git a/libcef/browser/navigate_params.cc b/libcef/browser/navigate_params.cc index 03c420963..6baf16121 100644 --- a/libcef/browser/navigate_params.cc +++ b/libcef/browser/navigate_params.cc @@ -10,7 +10,7 @@ CefNavigateParams::CefNavigateParams( ui::PageTransition a_transition) : url(a_url), frame_id(-1), - disposition(CURRENT_TAB), + disposition(WindowOpenDisposition::CURRENT_TAB), transition(a_transition), is_renderer_initiated(false), user_gesture(true) { diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index de0ebd1ca..52fadff42 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -33,7 +33,6 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view_frame_subscriber.h" #include "content/public/common/content_switches.h" -#include "third_party/WebKit/public/platform/WebScreenInfo.h" #include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/image/image_skia_operations.h" @@ -45,20 +44,20 @@ const float kDefaultScaleFactor = 1.0; // The maximum number of retry counts if frame capture fails. const int kFrameRetryLimit = 2; -static blink::WebScreenInfo webScreenInfoFrom(const CefScreenInfo& src) { - blink::WebScreenInfo webScreenInfo; - webScreenInfo.deviceScaleFactor = src.device_scale_factor; - webScreenInfo.depth = src.depth; - webScreenInfo.depthPerComponent = src.depth_per_component; - webScreenInfo.isMonochrome = src.is_monochrome ? true : false; - webScreenInfo.rect = blink::WebRect(src.rect.x, src.rect.y, - src.rect.width, src.rect.height); - webScreenInfo.availableRect = blink::WebRect(src.available_rect.x, - src.available_rect.y, - src.available_rect.width, - src.available_rect.height); +static content::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) { + content::ScreenInfo screenInfo; + screenInfo.device_scale_factor = src.device_scale_factor; + screenInfo.depth = src.depth; + screenInfo.depth_per_component = src.depth_per_component; + screenInfo.is_monochrome = src.is_monochrome ? true : false; + screenInfo.rect = gfx::Rect(src.rect.x, src.rect.y, + src.rect.width, src.rect.height); + screenInfo.available_rect = gfx::Rect(src.available_rect.x, + src.available_rect.y, + src.available_rect.width, + src.available_rect.height); - return webScreenInfo; + return screenInfo; } #if !defined(OS_MACOSX) @@ -1051,12 +1050,6 @@ void CefRenderWidgetHostViewOSR::DelegatedFrameHostOnLostCompositorResources() { render_widget_host_->ScheduleComposite(); } -void CefRenderWidgetHostViewOSR::DelegatedFrameHostUpdateVSyncParameters( - const base::TimeTicks& timebase, - const base::TimeDelta& interval) { - render_widget_host_->UpdateVSyncParameters(timebase, interval); -} - void CefRenderWidgetHostViewOSR::SetBeginFrameSource( cc::BeginFrameSource* source) { // TODO(cef): Maybe we can use this method in combination with @@ -1096,7 +1089,7 @@ void CefRenderWidgetHostViewOSR::WasResized() { GetDelegatedFrameHost()->WasResized(); } -void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::WebScreenInfo* results) { +void CefRenderWidgetHostViewOSR::GetScreenInfo(content::ScreenInfo* results) { if (!browser_impl_.get()) return; @@ -1127,7 +1120,7 @@ void CefRenderWidgetHostViewOSR::GetScreenInfo(blink::WebScreenInfo* results) { screen_info.available_rect = screenRect; } - *results = webScreenInfoFrom(screen_info); + *results = ScreenInfoFrom(screen_info); } void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() { @@ -1361,16 +1354,13 @@ void CefRenderWidgetHostViewOSR::SetFrameRate() { frame_rate_threshold_ms_); } - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (!command_line->HasSwitch(cc::switches::kDisableBeginFrameScheduling)) { - if (begin_frame_timer_.get()) { - begin_frame_timer_->SetFrameRateThresholdMs(frame_rate_threshold_ms_); - } else { - begin_frame_timer_.reset(new CefBeginFrameTimer( - frame_rate_threshold_ms_, - base::Bind(&CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick, - weak_ptr_factory_.GetWeakPtr()))); - } + if (begin_frame_timer_.get()) { + begin_frame_timer_->SetFrameRateThresholdMs(frame_rate_threshold_ms_); + } else { + begin_frame_timer_.reset(new CefBeginFrameTimer( + frame_rate_threshold_ms_, + base::Bind(&CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick, + weak_ptr_factory_.GetWeakPtr()))); } } diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index 7e594b8db..c72f60aa8 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -204,9 +204,6 @@ class CefRenderWidgetHostViewOSR bool is_swap_ack, const cc::ReturnedResourceArray& resources) override; void DelegatedFrameHostOnLostCompositorResources() override; - void DelegatedFrameHostUpdateVSyncParameters( - const base::TimeTicks& timebase, - const base::TimeDelta& interval) override; void SetBeginFrameSource(cc::BeginFrameSource* source) override; bool IsAutoResizeEnabled() const override; #endif // !defined(OS_MACOSX) @@ -214,7 +211,7 @@ class CefRenderWidgetHostViewOSR bool InstallTransparency(); void WasResized(); - void GetScreenInfo(blink::WebScreenInfo* results); + void GetScreenInfo(content::ScreenInfo* results); void OnScreenInfoChanged(); void Invalidate(CefBrowserHost::PaintElementType type); void SendKeyEvent(const content::NativeWebKeyboardEvent& event); 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 850ca7227..14ae72eae 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_mac.mm +++ b/libcef/browser/osr/render_widget_host_view_osr_mac.mm @@ -74,12 +74,6 @@ class MacHelper : view_->render_widget_host()->ScheduleComposite(); } - void BrowserCompositorMacUpdateVSyncParameters( - const base::TimeTicks& timebase, - const base::TimeDelta& interval) override { - view_->render_widget_host()->UpdateVSyncParameters(timebase, interval); - } - void BrowserCompositorMacSendBeginFrame( const cc::BeginFrameArgs& args) override { view_->render_widget_host()->Send( diff --git a/libcef/browser/osr/text_input_client_osr_mac.mm b/libcef/browser/osr/text_input_client_osr_mac.mm index 74155ead7..d7a6a34e2 100644 --- a/libcef/browser/osr/text_input_client_osr_mac.mm +++ b/libcef/browser/osr/text_input_client_osr_mac.mm @@ -100,8 +100,8 @@ extern "C" { } else { gfx::Range replacement_range(replacementRange); - renderWidgetHostView_->render_widget_host()->ImeConfirmComposition( - base::SysNSStringToUTF16(im_text), replacement_range, false); + renderWidgetHostView_->render_widget_host()->ImeCommitText( + base::SysNSStringToUTF16(im_text), replacement_range, 0); } // Inserting text will delete all marked text automatically. @@ -184,11 +184,10 @@ extern "C" { markedText_.clear(); underlines_.clear(); - // If we are handling a key down event, then ConfirmComposition() will be + // If we are handling a key down event, then FinishComposingText() will be // called in keyEvent: method. if (!handlingKeyDown_) { - renderWidgetHostView_->render_widget_host()->ImeConfirmComposition( - base::string16(), gfx::Range::InvalidRange(), false); + renderWidgetHostView_->render_widget_host()->ImeFinishComposingText(false); } else { unmarkTextCalled_ = YES; } @@ -328,7 +327,7 @@ extern "C" { // Then send keypress and/or composition related events. // If there was a marked text or the text to be inserted is longer than 1 - // character, then we send the text by calling ConfirmComposition(). + // character, then we send the text by calling FinishComposingText(). // Otherwise, if the text to be inserted only contains 1 character, then we // can just send a keypress event which is fabricated by changing the type of // the keydown event, so that we can retain all necessary informations, such @@ -351,9 +350,9 @@ extern "C" { BOOL textInserted = NO; if (textToBeInserted_.length() > - ((hasMarkedText_ || oldHasMarkedText_) ? 0u : 1u)) { - renderWidgetHostView_->render_widget_host()->ImeConfirmComposition( - textToBeInserted_, gfx::Range::InvalidRange(), false); + ((hasMarkedText_ || oldHasMarkedText_) ? 0u : 1u)) { + renderWidgetHostView_->render_widget_host()->ImeCommitText( + textToBeInserted_, gfx::Range::InvalidRange(), 0); textToBeInserted_ = YES; } @@ -369,8 +368,8 @@ extern "C" { selectedRange_.location, NSMaxRange(selectedRange_)); } else if (oldHasMarkedText_ && !hasMarkedText_ && !textInserted) { if (unmarkTextCalled_) { - renderWidgetHostView_->render_widget_host()->ImeConfirmComposition( - base::string16(), gfx::Range::InvalidRange(), false); + renderWidgetHostView_->render_widget_host()->ImeFinishComposingText( + false); } else { renderWidgetHostView_->render_widget_host()->ImeCancelComposition(); } diff --git a/libcef/browser/osr/web_contents_view_osr.cc b/libcef/browser/osr/web_contents_view_osr.cc index 52f1a8733..8a2aa8aeb 100644 --- a/libcef/browser/osr/web_contents_view_osr.cc +++ b/libcef/browser/osr/web_contents_view_osr.cc @@ -49,7 +49,7 @@ gfx::NativeWindow CefWebContentsViewOSR::GetTopLevelNativeWindow() const { return gfx::NativeWindow(); } -void CefWebContentsViewOSR::GetScreenInfo(blink::WebScreenInfo* results) const { +void CefWebContentsViewOSR::GetScreenInfo(content::ScreenInfo* results) const { if (view_) view_->GetScreenInfo(results); else diff --git a/libcef/browser/osr/web_contents_view_osr.h b/libcef/browser/osr/web_contents_view_osr.h index f8a5dbc78..3c6d1831f 100644 --- a/libcef/browser/osr/web_contents_view_osr.h +++ b/libcef/browser/osr/web_contents_view_osr.h @@ -32,7 +32,7 @@ class CefWebContentsViewOSR : public content::WebContentsView, gfx::NativeView GetNativeView() const override; gfx::NativeView GetContentNativeView() const override; gfx::NativeWindow GetTopLevelNativeWindow() const override; - void GetScreenInfo(blink::WebScreenInfo* web_screen_info) const override; + void GetScreenInfo(content::ScreenInfo* screen_info) const override; void GetContainerBounds(gfx::Rect* out) const override; void SizeContents(const gfx::Size& size) override; void Focus() override; diff --git a/libcef/browser/plugins/plugin_info_message_filter.cc b/libcef/browser/plugins/plugin_info_message_filter.cc index ec99e6e13..ad8563c73 100644 --- a/libcef/browser/plugins/plugin_info_message_filter.cc +++ b/libcef/browser/plugins/plugin_info_message_filter.cc @@ -19,9 +19,9 @@ #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/plugins/plugin_finder.h" +#include "chrome/browser/plugins/plugins_field_trial.h" #include "chrome/common/pref_names.h" #include "components/content_settings/core/browser/content_settings_utils.h" -#include "components/content_settings/core/browser/plugins_field_trial.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/plugin_service.h" @@ -310,7 +310,7 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus( // TODO(tommycli): Remove once we deprecate the plugin ASK policy. bool legacy_ask_user = plugin_setting == CONTENT_SETTING_ASK; - plugin_setting = content_settings::PluginsFieldTrial::EffectiveContentSetting( + plugin_setting = PluginsFieldTrial::EffectiveContentSetting( CONTENT_SETTINGS_TYPE_PLUGINS, plugin_setting); DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); diff --git a/libcef/browser/plugins/plugin_service_filter.cc b/libcef/browser/plugins/plugin_service_filter.cc index ea3212c93..255960204 100644 --- a/libcef/browser/plugins/plugin_service_filter.cc +++ b/libcef/browser/plugins/plugin_service_filter.cc @@ -12,6 +12,8 @@ #include "libcef/common/cef_messages.h" #include "libcef/common/content_client.h" +#include "extensions/common/constants.h" + CefPluginServiceFilter::CefPluginServiceFilter() { } @@ -22,12 +24,25 @@ bool CefPluginServiceFilter::IsPluginAvailable( const GURL& url, const GURL& policy_url, content::WebPluginInfo* plugin) { - CefRefPtr handler = - reinterpret_cast(context)->GetHandler(); + CefResourceContext* resource_context = const_cast( + reinterpret_cast(context)); + bool allow_load = true; + if (resource_context->HasPluginLoadDecision(render_process_id, plugin->path, + &allow_load)) { + return allow_load; + } + + CefRefPtr handler = resource_context->GetHandler(); CefViewHostMsg_GetPluginInfo_Status status = CefViewHostMsg_GetPluginInfo_Status::kAllowed; - return IsPluginAvailable(handler.get(), url, policy_url, plugin, &status); + allow_load = IsPluginAvailable(handler.get(), url, policy_url, plugin, + &status); + + resource_context->AddPluginLoadDecision(render_process_id, plugin->path, + allow_load); + + return allow_load; } bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id, @@ -53,6 +68,15 @@ bool CefPluginServiceFilter::IsPluginAvailable( return true; } + if (!policy_url.is_empty() && + policy_url.scheme() == extensions::kExtensionScheme) { + // Always allow extension origins to load plugins. + // TODO(extensions): Revisit this decision once CEF supports more than just + // the PDF extension. + *status = CefViewHostMsg_GetPluginInfo_Status::kAllowed; + return true; + } + if (handler) { CefRefPtr pluginInfo( new CefWebPluginInfoImpl(*plugin)); diff --git a/libcef/browser/plugins/plugin_service_filter.h b/libcef/browser/plugins/plugin_service_filter.h index 1de4c17a3..fa3bbbb8d 100644 --- a/libcef/browser/plugins/plugin_service_filter.h +++ b/libcef/browser/plugins/plugin_service_filter.h @@ -33,6 +33,7 @@ class CefPluginServiceFilter : public content::PluginServiceFilter { // Returns false if the plugin is not found or disabled. May call // CefRequestContextHandler::OnBeforePluginLoad if possible/necessary. + // See related discussion in issue #2015. bool IsPluginAvailable(CefRequestContextHandler* handler, const GURL& url, const GURL& policy_url, diff --git a/libcef/browser/prefs/renderer_prefs.cc b/libcef/browser/prefs/renderer_prefs.cc index 525bf6e64..43f34bccb 100644 --- a/libcef/browser/prefs/renderer_prefs.cc +++ b/libcef/browser/prefs/renderer_prefs.cc @@ -120,15 +120,11 @@ void SetChromePrefs(CefBrowserContext* profile, if (prefs->GetBoolean(prefs::kDisable3DAPIs)) web.experimental_webgl_enabled = false; - web.allow_displaying_insecure_content = - prefs->GetBoolean(prefs::kWebKitAllowDisplayingInsecureContent); web.allow_running_insecure_content = prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent); web.password_echo_enabled = browser_defaults::kPasswordEchoEnabled; - web.uses_universal_detector = - prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector); web.text_areas_are_resizable = prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable); web.hyperlink_auditing_enabled = @@ -147,9 +143,8 @@ void SetChromePrefs(CefBrowserContext* profile, } // Make sure we will set the default_encoding with canonical encoding name. - web.default_encoding = - CharacterEncoding::GetCanonicalEncodingNameByAliasName( - web.default_encoding); + web.default_encoding = GetCanonicalEncodingNameByAliasName( + web.default_encoding); if (web.default_encoding.empty()) { prefs->ClearPref(prefs::kDefaultCharset); web.default_encoding = prefs->GetString(prefs::kDefaultCharset); diff --git a/libcef/browser/printing/print_view_manager.cc b/libcef/browser/printing/print_view_manager.cc index 09e783eeb..d267e0c36 100644 --- a/libcef/browser/printing/print_view_manager.cc +++ b/libcef/browser/printing/print_view_manager.cc @@ -12,7 +12,7 @@ #include "base/bind.h" #include "base/lazy_instance.h" -#include "base/metrics/histogram.h" +#include "base/memory/ref_counted_memory.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/print_preview_dialog_controller.h" @@ -181,7 +181,7 @@ bool CefPrintViewManager::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() - return handled ? true : CefPrintViewManagerBase::OnMessageReceived(message); + return handled || CefPrintViewManagerBase::OnMessageReceived(message); } void CefPrintViewManager::NavigationStopped() { diff --git a/libcef/browser/printing/print_view_manager_base.cc b/libcef/browser/printing/print_view_manager_base.cc index 22757120a..a4a235844 100644 --- a/libcef/browser/printing/print_view_manager_base.cc +++ b/libcef/browser/printing/print_view_manager_base.cc @@ -512,7 +512,7 @@ void CefPrintViewManagerBase::ReleasePrinterQuery() { return; BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&PrinterQuery::StopWorker, printer_query.get())); + base::Bind(&PrinterQuery::StopWorker, printer_query)); } } // namespace printing diff --git a/libcef/browser/request_context_impl.cc b/libcef/browser/request_context_impl.cc index f5ad685d3..92a6ce9af 100644 --- a/libcef/browser/request_context_impl.cc +++ b/libcef/browser/request_context_impl.cc @@ -630,6 +630,7 @@ void CefRequestContextImpl::PurgePluginListCacheInternal( bool reload_pages, scoped_refptr browser_context) { CEF_REQUIRE_UIT(); + browser_context->OnPurgePluginListCache(); content::PluginService::GetInstance()->PurgePluginListCache( browser_context.get(), false); } @@ -642,7 +643,7 @@ void CefRequestContextImpl::ClearCertificateExceptionsInternal( content::SSLHostStateDelegate* ssl_delegate = browser_context->GetSSLHostStateDelegate(); if (ssl_delegate) - ssl_delegate->Clear(); + ssl_delegate->Clear(base::Callback()); if (callback) { CEF_POST_TASK(CEF_UIT, diff --git a/libcef/browser/resource_context.cc b/libcef/browser/resource_context.cc index 975bdfee5..388e2f46c 100644 --- a/libcef/browser/resource_context.cc +++ b/libcef/browser/resource_context.cc @@ -5,6 +5,7 @@ #include "libcef/browser/resource_context.h" #include "libcef/browser/net/url_request_context_getter.h" +#include "libcef/browser/thread_util.h" #include "base/logging.h" #include "content/public/browser/browser_thread.h" @@ -78,3 +79,50 @@ void CefResourceContext::set_url_request_context_getter( DCHECK(!getter_.get()); getter_ = getter; } + +void CefResourceContext::AddPluginLoadDecision( + int render_process_id, + const base::FilePath& plugin_path, + bool allow_load) { + CEF_REQUIRE_IOT(); + DCHECK_GE(render_process_id, 0); + DCHECK(!plugin_path.empty()); + + plugin_load_decision_map_.insert( + std::make_pair(std::make_pair(render_process_id, plugin_path), + allow_load)); +} + +bool CefResourceContext::HasPluginLoadDecision( + int render_process_id, + const base::FilePath& plugin_path, + bool* allow_load) const { + CEF_REQUIRE_IOT(); + DCHECK_GE(render_process_id, 0); + DCHECK(!plugin_path.empty()); + + PluginLoadDecisionMap::const_iterator it = + plugin_load_decision_map_.find( + std::make_pair(render_process_id, plugin_path)); + if (it == plugin_load_decision_map_.end()) + return false; + + *allow_load = it->second; + return true; +} + +void CefResourceContext::ClearPluginLoadDecision(int render_process_id) { + CEF_REQUIRE_IOT(); + + if (render_process_id == -1) { + plugin_load_decision_map_.clear(); + } else { + PluginLoadDecisionMap::iterator it = plugin_load_decision_map_.begin(); + while (it != plugin_load_decision_map_.end()) { + if (it->first.first == render_process_id) + it = plugin_load_decision_map_.erase(it); + else + ++it; + } + } +} diff --git a/libcef/browser/resource_context.h b/libcef/browser/resource_context.h index efb61c83c..b4a7461d3 100644 --- a/libcef/browser/resource_context.h +++ b/libcef/browser/resource_context.h @@ -8,6 +8,7 @@ #include "include/cef_request_context_handler.h" +#include "base/files/file_path.h" #include "content/public/browser/resource_context.h" #include "extensions/browser/info_map.h" #include "net/ssl/client_cert_store.h" @@ -37,6 +38,22 @@ class CefResourceContext : public content::ResourceContext { void set_url_request_context_getter(CefURLRequestContextGetter* getter); + // Remember the plugin load decision for plugin status requests that arrive + // via CefPluginServiceFilter::IsPluginAvailable. + // TODO(cef): Per-frame decisions are not currently supported because + // Chromium does not pipe the frame id through to RenderFrameMessageFilter:: + // GetPluginsCallback. Fix this once https://crbug.com/626728#c15 is resolved. + void AddPluginLoadDecision(int render_process_id, + const base::FilePath& plugin_path, + bool allow_load); + bool HasPluginLoadDecision(int render_process_id, + const base::FilePath& plugin_path, + bool* allow_load) const; + + // Clear the plugin load decisions associated with |render_process_id|, or all + // plugin load decisions if |render_process_id| is -1. + void ClearPluginLoadDecision(int render_process_id); + // State transferred from the BrowserContext for use on the IO thread. bool IsOffTheRecord() const { return is_off_the_record_; } const extensions::InfoMap* GetExtensionInfoMap() const { @@ -47,10 +64,16 @@ class CefResourceContext : public content::ResourceContext { private: scoped_refptr getter_; + // Only accessed on the IO thread. bool is_off_the_record_; scoped_refptr extension_info_map_; CefRefPtr handler_; + // Map (render_process_id, plugin_path) to plugin load decision. + typedef std::map, bool> + PluginLoadDecisionMap; + PluginLoadDecisionMap plugin_load_decision_map_; + DISALLOW_COPY_AND_ASSIGN(CefResourceContext); }; diff --git a/libcef/browser/ssl_host_state_delegate.cc b/libcef/browser/ssl_host_state_delegate.cc index f61306f17..5f44a2d65 100644 --- a/libcef/browser/ssl_host_state_delegate.cc +++ b/libcef/browser/ssl_host_state_delegate.cc @@ -4,6 +4,7 @@ #include "libcef/browser/ssl_host_state_delegate.h" +#include "base/callback.h" #include "net/base/hash_value.h" using content::SSLHostStateDelegate; @@ -75,8 +76,22 @@ void CefSSLHostStateDelegate::AllowCert(const std::string& host, cert_policy_for_host_[host].Allow(cert, error); } -void CefSSLHostStateDelegate::Clear() { - cert_policy_for_host_.clear(); +void CefSSLHostStateDelegate::Clear( + const base::Callback& host_filter) { + if (host_filter.is_null()) { + cert_policy_for_host_.clear(); + return; + } + + for (auto it = cert_policy_for_host_.begin(); + it != cert_policy_for_host_.end();) { + auto next_it = std::next(it); + + if (host_filter.Run(it->first)) + cert_policy_for_host_.erase(it); + + it = next_it; + } } SSLHostStateDelegate::CertJudgment CefSSLHostStateDelegate::QueryPolicy( diff --git a/libcef/browser/ssl_host_state_delegate.h b/libcef/browser/ssl_host_state_delegate.h index 9b9d6d700..95fa13c02 100644 --- a/libcef/browser/ssl_host_state_delegate.h +++ b/libcef/browser/ssl_host_state_delegate.h @@ -52,7 +52,8 @@ class CefSSLHostStateDelegate : public content::SSLHostStateDelegate { void AllowCert(const std::string& host, const net::X509Certificate& cert, net::CertStatus error) override; - void Clear() override; + void Clear( + const base::Callback& host_filter) override; content::SSLHostStateDelegate::CertJudgment QueryPolicy( const std::string& host, const net::X509Certificate& cert, diff --git a/libcef/browser/ssl_status_impl.cc b/libcef/browser/ssl_status_impl.cc index 1ed4a62f4..7b9348598 100644 --- a/libcef/browser/ssl_status_impl.cc +++ b/libcef/browser/ssl_status_impl.cc @@ -6,7 +6,6 @@ #include "libcef/browser/x509_certificate_impl.h" -#include "content/public/browser/cert_store.h" #include "net/ssl/ssl_connection_status_flags.h" CefSSLStatusImpl::CefSSLStatusImpl(const content::SSLStatus& value) { @@ -14,12 +13,11 @@ CefSSLStatusImpl::CefSSLStatusImpl(const content::SSLStatus& value) { content_status_ = static_cast(value.content_status); ssl_version_ = static_cast( net::SSLConnectionStatusToVersion(value.connection_status)); - cert_id_ = value.cert_id; + certificate_ = value.certificate; } bool CefSSLStatusImpl::IsSecureConnection() { - // Secure connection if there was a certificate ID in SSLStatus. - return (cert_id_ != 0); + return !!certificate_.get(); } cef_cert_status_t CefSSLStatusImpl::GetCertStatus() { @@ -35,11 +33,7 @@ cef_ssl_content_status_t CefSSLStatusImpl::GetContentStatus() { } CefRefPtr CefSSLStatusImpl::GetX509Certificate() { - if (cert_id_) { - scoped_refptr cert; - content::CertStore::GetInstance()->RetrieveCert(cert_id_, &cert); - if (cert.get()) - return new CefX509CertificateImpl(*cert); - } - return nullptr; + if (certificate_ && !cef_certificate_) + cef_certificate_ = new CefX509CertificateImpl(*certificate_); + return cef_certificate_; } diff --git a/libcef/browser/ssl_status_impl.h b/libcef/browser/ssl_status_impl.h index 5a07079e6..cd07060af 100644 --- a/libcef/browser/ssl_status_impl.h +++ b/libcef/browser/ssl_status_impl.h @@ -8,7 +8,7 @@ #include "include/cef_ssl_status.h" -#include "content/public/common/ssl_status.h" +#include "content/public/browser/ssl_status.h" // CefSSLStatus implementation class CefSSLStatusImpl : public CefSSLStatus { @@ -26,7 +26,10 @@ class CefSSLStatusImpl : public CefSSLStatus { cef_cert_status_t cert_status_; cef_ssl_version_t ssl_version_; cef_ssl_content_status_t content_status_; - int cert_id_; + + // Don't create a CefX509Certificate object until requested. + scoped_refptr certificate_; + CefRefPtr cef_certificate_; IMPLEMENT_REFCOUNTING(CefSSLStatusImpl); DISALLOW_COPY_AND_ASSIGN(CefSSLStatusImpl); diff --git a/libcef/browser/views/textfield_impl.cc b/libcef/browser/views/textfield_impl.cc index d13ebb555..7c90f718e 100644 --- a/libcef/browser/views/textfield_impl.cc +++ b/libcef/browser/views/textfield_impl.cc @@ -185,11 +185,6 @@ void CefTextfieldImpl::SetPlaceholderTextColor(cef_color_t color) { root_view()->set_placeholder_text_color(color); } -cef_color_t CefTextfieldImpl::GetPlaceholderTextColor() { - CEF_REQUIRE_VALID_RETURN(0U); - return root_view()->placeholder_text_color(); -} - void CefTextfieldImpl::SetBackgroundColor(cef_color_t color) { CEF_REQUIRE_VALID_RETURN_VOID(); root_view()->SetBackgroundColor(color); diff --git a/libcef/browser/views/textfield_impl.h b/libcef/browser/views/textfield_impl.h index 373b6e0f9..9da071d70 100644 --- a/libcef/browser/views/textfield_impl.h +++ b/libcef/browser/views/textfield_impl.h @@ -56,7 +56,6 @@ class CefTextfieldImpl : void SetPlaceholderText(const CefString& text) override; CefString GetPlaceholderText() override; void SetPlaceholderTextColor(cef_color_t color) override; - cef_color_t GetPlaceholderTextColor() override; void SetAccessibleName(const CefString& name) override; // CefView methods: diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index 80e04aa05..f7bbee1b9 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -170,7 +170,7 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { if (!manifest_value->GetAsDictionary(&manifest)) return false; - Version version; + base::Version version; if (!chrome::CheckPepperFlashManifest(*manifest, &version)) return false; diff --git a/libcef/common/extensions/api/BUILD.gn b/libcef/common/extensions/api/BUILD.gn index 9a90077ea..c48bb813c 100644 --- a/libcef/common/extensions/api/BUILD.gn +++ b/libcef/common/extensions/api/BUILD.gn @@ -4,10 +4,20 @@ import("//build/json_schema_api.gni") import("//tools/json_schema_compiler/json_features.gni") -import("schemas.gni") # TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See README.txt for # details. +#schema_sources = [ +# # TODO(cef): Add CEF-specific Mojo APIs here. +#] +# +#uncompiled_sources = [ +#] +# +#root_namespace = "extensions::api::cef::%(namespace)s" +#schema_include_rules = "//cef/libcef/browser/extensions/api:extensions::api::cef::%(namespace)s" +#schema_dependencies = [ "//extensions/common/api" ] +# #json_schema_api("api") { # sources = schema_sources # schemas = true diff --git a/libcef/common/extensions/api/README.txt b/libcef/common/extensions/api/README.txt index e851f1821..c77005f1f 100644 --- a/libcef/common/extensions/api/README.txt +++ b/libcef/common/extensions/api/README.txt @@ -9,7 +9,7 @@ To add a new extension API implemented only in CEF ***: 1. Add libcef/common/extensions/api/.idl or .json file which defines the API. 2. Add .idl or .json to the 'schema_sources' list in - libcef/common/extensions/api/schemas.gni. Serialization code will be + libcef/common/extensions/api/BUILD.gn. Serialization code will be generated based on this list in step 5. 3. Add an entry in the libcef/common/extensions/api/_*_features.json files if necessary [1]. diff --git a/libcef/common/extensions/api/schemas.gni b/libcef/common/extensions/api/schemas.gni deleted file mode 100644 index 41ec46e80..000000000 --- a/libcef/common/extensions/api/schemas.gni +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2016 The Chromium Embedded Framework Authors. Portions copyright -# 2014 the Chromium Authors. All rights reserved. Use of this source code is -# governed by a BSD-style license that can be found in the LICENSE file. - -schema_sources = [ - # TODO(cef): Add CEF-specific Mojo APIs here. -] - -uncompiled_sources = [ -] - -root_namespace = "extensions::api::cef::%(namespace)s" -schema_include_rules = "//cef/libcef/browser/extensions/api:extensions::api::cef::%(namespace)s" -schema_dependencies = [ "//extensions/common/api" ] diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index c7f241161..657298fb8 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -53,7 +53,6 @@ #if defined(OS_WIN) #include // NOLINT(build/include_order) #include "base/win/registry.h" -#include "components/crash/content/app/breakpad_win.h" #endif #if defined(OS_MACOSX) @@ -61,7 +60,8 @@ #include "base/mac/os_crash_dumps.h" #include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" -#include "components/crash/content/app/breakpad_mac.h" +#include "components/crash/content/app/crashpad.h" +#include "components/crash/core/common/crash_keys.h" #include "content/public/common/content_paths.h" #endif @@ -76,8 +76,10 @@ namespace { +#if defined(OS_POSIX) base::LazyInstance::Leaky g_crash_reporter_client = LAZY_INSTANCE_INITIALIZER; +#endif #if defined(OS_MACOSX) @@ -522,25 +524,19 @@ void CefMainDelegate::PreSandboxStartup() { const std::string& process_type = command_line->GetSwitchValueASCII(switches::kProcessType); +#if defined(OS_POSIX) if (command_line->HasSwitch(switches::kEnableCrashReporter)) { crash_reporter::SetCrashReporterClient(g_crash_reporter_client.Pointer()); #if defined(OS_MACOSX) - base::mac::DisableOSCrashDumps(); - breakpad::InitCrashReporter(process_type); - breakpad::InitCrashProcessInfo(process_type); -#elif defined(OS_POSIX) && !defined(OS_MACOSX) + InitMacCrashReporter(*command_line, process_type); +#else if (process_type != switches::kZygoteProcess) breakpad::InitCrashReporter(process_type); -#elif defined(OS_WIN) - UINT new_flags = - SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX; - UINT existing_flags = SetErrorMode(new_flags); - SetErrorMode(existing_flags | new_flags); - breakpad::InitCrashReporter(process_type); #endif } +#endif // defined(OS_POSIX) - if (!command_line->HasSwitch(switches::kProcessType)) { + if (process_type.empty()) { // Only override these paths when executing the main process. #if defined(OS_MACOSX) OverrideChildProcessPath(); @@ -761,3 +757,51 @@ void CefMainDelegate::InitializeResourceBundle() { content_client_.set_allow_pack_file_load(false); } } + +#if defined(OS_MACOSX) +// Based on ChromeMainDelegate::InitMacCrashReporter. +void CefMainDelegate::InitMacCrashReporter( + const base::CommandLine& command_line, + const std::string& process_type) { + // TODO(mark): Right now, InitializeCrashpad() needs to be called after + // CommandLine::Init() and chrome::RegisterPathProvider(). Ideally, Crashpad + // initialization could occur sooner, preferably even before the framework + // dylib is even loaded, to catch potential early crashes. + + const bool browser_process = process_type.empty(); + const bool install_from_dmg_relauncher_process = + process_type == switches::kRelauncherProcess && + command_line.HasSwitch(switches::kRelauncherProcessDMGDevice); + + const bool initial_client = + browser_process || install_from_dmg_relauncher_process; + + crash_reporter::InitializeCrashpad(initial_client, process_type); + + if (!browser_process) { + std::string metrics_client_id = + command_line.GetSwitchValueASCII(switches::kMetricsClientID); + crash_keys::SetMetricsClientIdFromGUID(metrics_client_id); + } + + // Mac Chrome is packaged with a main app bundle and a helper app bundle. + // The main app bundle should only be used for the browser process, so it + // should never see a --type switch (switches::kProcessType). Likewise, + // the helper should always have a --type switch. + // + // This check is done this late so there is already a call to + // base::mac::IsBackgroundOnlyProcess(), so there is no change in + // startup/initialization order. + + // The helper's Info.plist marks it as a background only app. + if (base::mac::IsBackgroundOnlyProcess()) { + CHECK(command_line.HasSwitch(switches::kProcessType) && + !process_type.empty()) + << "Helper application requires --type."; + } else { + CHECK(!command_line.HasSwitch(switches::kProcessType) && + process_type.empty()) + << "Main application forbids --type, saw " << process_type; + } +} +#endif // defined(OS_MACOSX) \ No newline at end of file diff --git a/libcef/common/main_delegate.h b/libcef/common/main_delegate.h index aeff1f6b7..7722b7cf8 100644 --- a/libcef/common/main_delegate.h +++ b/libcef/common/main_delegate.h @@ -15,6 +15,7 @@ #include "content/public/app/content_main_delegate.h" namespace base { +class CommandLine; class Thread; } @@ -55,6 +56,11 @@ class CefMainDelegate : public content::ContentMainDelegate { private: void InitializeResourceBundle(); +#if defined(OS_MACOSX) + void InitMacCrashReporter(const base::CommandLine& command_line, + const std::string& process_type); +#endif // defined(OS_MACOSX) + std::unique_ptr browser_runner_; std::unique_ptr ui_thread_; diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index 704e61994..02bb9a844 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -7,6 +7,8 @@ #include #include +#include "base/memory/ptr_util.h" + // CefValueImpl implementation. // static @@ -1373,7 +1375,7 @@ bool CefListValueImpl::RemoveInternal(int index) { void CefListValueImpl::SetInternal(int index, base::Value* value) { DCHECK(value); if (RemoveInternal(index)) - mutable_value()->Insert(index, value); + mutable_value()->Insert(index, base::WrapUnique(value)); else mutable_value()->Set(index, value); } diff --git a/libcef/renderer/dom_node_impl.cc b/libcef/renderer/dom_node_impl.cc index 1095b0c34..9b644d37a 100644 --- a/libcef/renderer/dom_node_impl.cc +++ b/libcef/renderer/dom_node_impl.cc @@ -244,7 +244,7 @@ bool CefDOMNodeImpl::HasChildren() { if (!VerifyContext()) return false; - return node_.hasChildNodes(); + return !node_.firstChild().isNull(); } CefRefPtr CefDOMNodeImpl::GetFirstChild() { diff --git a/libcef/renderer/media/cef_key_systems.cc b/libcef/renderer/media/cef_key_systems.cc index 4cc6779ed..53bc4f86d 100644 --- a/libcef/renderer/media/cef_key_systems.cc +++ b/libcef/renderer/media/cef_key_systems.cc @@ -79,7 +79,7 @@ void GetSupportedCodecsForPepperCdm( void AddPepperBasedWidevine( std::vector>* concrete_key_systems) { #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) - Version glibc_version(gnu_get_libc_version()); + base::Version glibc_version(gnu_get_libc_version()); DCHECK(glibc_version.IsValid()); if (glibc_version < base::Version(WIDEVINE_CDM_MIN_GLIBC_VERSION)) return; diff --git a/libcef/utility/content_utility_client.cc b/libcef/utility/content_utility_client.cc index f88575302..ee813776d 100644 --- a/libcef/utility/content_utility_client.cc +++ b/libcef/utility/content_utility_client.cc @@ -10,6 +10,7 @@ #include "build/build_config.h" #include "chrome/common/chrome_utility_messages.h" #include "chrome/utility/utility_message_handler.h" +#include "mojo/public/cpp/bindings/strong_binding.h" #include "net/proxy/mojo_proxy_resolver_factory_impl.h" #include "services/shell/public/cpp/interface_registry.h" @@ -20,12 +21,9 @@ namespace { void CreateProxyResolverFactory( - mojo::InterfaceRequest request) { - // MojoProxyResolverFactoryImpl is strongly bound to the Mojo message pipe it - // is connected to. When that message pipe is closed, either explicitly on the - // other end (in the browser process), or by a connection error, this object - // will be destroyed. - new net::MojoProxyResolverFactoryImpl(std::move(request)); + net::interfaces::ProxyResolverFactoryRequest request) { + mojo::MakeStrongBinding(base::MakeUnique(), + std::move(request)); } } // namespace diff --git a/libcef_dll/cpptoc/navigation_entry_cpptoc.h b/libcef_dll/cpptoc/navigation_entry_cpptoc.h index 6b2cf77bb..798c0f4c5 100644 --- a/libcef_dll/cpptoc/navigation_entry_cpptoc.h +++ b/libcef_dll/cpptoc/navigation_entry_cpptoc.h @@ -20,8 +20,6 @@ #include "include/cef_navigation_entry.h" #include "include/capi/cef_navigation_entry_capi.h" -#include "include/cef_ssl_status.h" -#include "include/capi/cef_ssl_status_capi.h" #include "libcef_dll/cpptoc/cpptoc.h" // Wrap a C++ class with a C structure. diff --git a/libcef_dll/cpptoc/sslstatus_cpptoc.h b/libcef_dll/cpptoc/sslstatus_cpptoc.h index 9f3926e6f..24ed1c99e 100644 --- a/libcef_dll/cpptoc/sslstatus_cpptoc.h +++ b/libcef_dll/cpptoc/sslstatus_cpptoc.h @@ -20,8 +20,6 @@ #include "include/cef_ssl_status.h" #include "include/capi/cef_ssl_status_capi.h" -#include "include/cef_x509_certificate.h" -#include "include/capi/cef_x509_certificate_capi.h" #include "libcef_dll/cpptoc/cpptoc.h" // Wrap a C++ class with a C structure. diff --git a/libcef_dll/cpptoc/views/textfield_cpptoc.cc b/libcef_dll/cpptoc/views/textfield_cpptoc.cc index 6c8d8836c..c9b78ab6e 100644 --- a/libcef_dll/cpptoc/views/textfield_cpptoc.cc +++ b/libcef_dll/cpptoc/views/textfield_cpptoc.cc @@ -495,22 +495,6 @@ void CEF_CALLBACK textfield_set_placeholder_text_color( color); } -cef_color_t CEF_CALLBACK textfield_get_placeholder_text_color( - struct _cef_textfield_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return 0; - - // Execute - cef_color_t _retval = CefTextfieldCppToC::Get(self)->GetPlaceholderTextColor( - ); - - // Return type: simple - return _retval; -} - void CEF_CALLBACK textfield_set_accessible_name(struct _cef_textfield_t* self, const cef_string_t* name) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -1362,8 +1346,6 @@ CefTextfieldCppToC::CefTextfieldCppToC() { GetStruct()->get_placeholder_text = textfield_get_placeholder_text; GetStruct()->set_placeholder_text_color = textfield_set_placeholder_text_color; - GetStruct()->get_placeholder_text_color = - textfield_get_placeholder_text_color; GetStruct()->set_accessible_name = textfield_set_accessible_name; GetStruct()->base.as_browser_view = textfield_as_browser_view; GetStruct()->base.as_button = textfield_as_button; diff --git a/libcef_dll/ctocpp/navigation_entry_ctocpp.h b/libcef_dll/ctocpp/navigation_entry_ctocpp.h index 56dc6f31c..f1665fd7b 100644 --- a/libcef_dll/ctocpp/navigation_entry_ctocpp.h +++ b/libcef_dll/ctocpp/navigation_entry_ctocpp.h @@ -20,8 +20,6 @@ #include "include/cef_navigation_entry.h" #include "include/capi/cef_navigation_entry_capi.h" -#include "include/cef_ssl_status.h" -#include "include/capi/cef_ssl_status_capi.h" #include "libcef_dll/ctocpp/ctocpp.h" // Wrap a C structure with a C++ class. diff --git a/libcef_dll/ctocpp/sslstatus_ctocpp.h b/libcef_dll/ctocpp/sslstatus_ctocpp.h index 0242480b8..d6f953b40 100644 --- a/libcef_dll/ctocpp/sslstatus_ctocpp.h +++ b/libcef_dll/ctocpp/sslstatus_ctocpp.h @@ -20,8 +20,6 @@ #include "include/cef_ssl_status.h" #include "include/capi/cef_ssl_status_capi.h" -#include "include/cef_x509_certificate.h" -#include "include/capi/cef_x509_certificate_capi.h" #include "libcef_dll/ctocpp/ctocpp.h" // Wrap a C structure with a C++ class. diff --git a/libcef_dll/ctocpp/views/textfield_ctocpp.cc b/libcef_dll/ctocpp/views/textfield_ctocpp.cc index 1ca93f72a..a237c5015 100644 --- a/libcef_dll/ctocpp/views/textfield_ctocpp.cc +++ b/libcef_dll/ctocpp/views/textfield_ctocpp.cc @@ -459,20 +459,6 @@ void CefTextfieldCToCpp::SetPlaceholderTextColor(cef_color_t color) { color); } -cef_color_t CefTextfieldCToCpp::GetPlaceholderTextColor() { - cef_textfield_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, get_placeholder_text_color)) - return 0; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_color_t _retval = _struct->get_placeholder_text_color(_struct); - - // Return type: simple - return _retval; -} - void CefTextfieldCToCpp::SetAccessibleName(const CefString& name) { cef_textfield_t* _struct = GetStruct(); if (CEF_MEMBER_MISSING(_struct, set_accessible_name)) diff --git a/libcef_dll/ctocpp/views/textfield_ctocpp.h b/libcef_dll/ctocpp/views/textfield_ctocpp.h index c80186fa1..f73a9efdc 100644 --- a/libcef_dll/ctocpp/views/textfield_ctocpp.h +++ b/libcef_dll/ctocpp/views/textfield_ctocpp.h @@ -61,7 +61,6 @@ class CefTextfieldCToCpp void SetPlaceholderText(const CefString& text) OVERRIDE; CefString GetPlaceholderText() OVERRIDE; void SetPlaceholderTextColor(cef_color_t color) OVERRIDE; - cef_color_t GetPlaceholderTextColor() OVERRIDE; void SetAccessibleName(const CefString& name) OVERRIDE; // CefView methods. diff --git a/patch/patch.cfg b/patch/patch.cfg index a5c0e7221..ac75d0ad1 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -234,13 +234,6 @@ patches = [ 'name': 'chrome_widevine', 'path': '../', }, - { - # Remove references to crashpad from chrome/ code on Mac. This avoids - # linker conflicts with breakpad. - # TODO(cef/chrome): Remove this patch once crashpad is supported. - 'name': 'chrome_crashpad_mac', - 'path': '../', - }, { # Make some methods of ProfileManager virtual. # Allow CEF to intercept GetBrowserContext*InIncognito functions. @@ -257,9 +250,16 @@ patches = [ 'path': '../', }, { - # Fix debug assertion on right-click context menu. - # https://codereview.chromium.org/2288083002 - 'name': 'webkit_eventhandler_2288083002', + # Pass the render process id to PluginServiceFilter::IsPluginAvailable. + # https://bugs.chromium.org/p/chromium/issues/detail?id=626728#c15 + 'name': 'render_frame_message_filter_626728', + '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': '../', }, ] diff --git a/patch/patches/browser_compositor_mac.patch b/patch/patches/browser_compositor_mac.patch index f62690f36..9914ffbf2 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 75651c4..e422ae7 100644 +index 8d92b06..618d23e 100644 --- content/browser/renderer_host/browser_compositor_view_mac.h +++ content/browser/renderer_host/browser_compositor_view_mac.h -@@ -59,9 +59,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver, +@@ -56,9 +56,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver, // These will not return nullptr until Destroy is called. DelegatedFrameHost* GetDelegatedFrameHost(); @@ -15,7 +15,7 @@ index 75651c4..e422ae7 100644 void SwapCompositorFrame(uint32_t output_surface_id, diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm -index 3619d4d..89adf27 100644 +index 219effe..5122a99 100644 --- content/browser/renderer_host/browser_compositor_view_mac.mm +++ content/browser/renderer_host/browser_compositor_view_mac.mm @@ -198,6 +198,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { diff --git a/patch/patches/browser_frame_host_guest_1687.patch b/patch/patches/browser_frame_host_guest_1687.patch index 55058bd85..b9e85291e 100644 --- a/patch/patches/browser_frame_host_guest_1687.patch +++ b/patch/patches/browser_frame_host_guest_1687.patch @@ -1,8 +1,8 @@ diff --git render_widget_host_view_guest.cc render_widget_host_view_guest.cc -index 64e1be3..834a4dc 100644 +index cdb2d17..fb53fa6 100644 --- render_widget_host_view_guest.cc +++ render_widget_host_view_guest.cc -@@ -243,6 +243,9 @@ void RenderWidgetHostViewGuest::Destroy() { +@@ -242,6 +242,9 @@ void RenderWidgetHostViewGuest::Destroy() { } gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const { diff --git a/patch/patches/browser_plugin_guest_1565.patch b/patch/patches/browser_plugin_guest_1565.patch index 7e7c2266c..d1e42fd75 100644 --- a/patch/patches/browser_plugin_guest_1565.patch +++ b/patch/patches/browser_plugin_guest_1565.patch @@ -1,5 +1,5 @@ diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc -index d0a39e2..8fa0e1e 100644 +index 6d06122..bc964c7 100644 --- browser/browser_plugin/browser_plugin_guest.cc +++ browser/browser_plugin/browser_plugin_guest.cc @@ -28,7 +28,7 @@ @@ -11,7 +11,7 @@ index d0a39e2..8fa0e1e 100644 #include "content/common/browser_plugin/browser_plugin_constants.h" #include "content/common/browser_plugin/browser_plugin_messages.h" #include "content/common/content_constants_internal.h" -@@ -289,20 +289,19 @@ void BrowserPluginGuest::InitInternal( +@@ -292,20 +292,19 @@ void BrowserPluginGuest::InitInternal( guest_window_rect_ = params.view_rect; if (owner_web_contents_ != owner_web_contents) { @@ -36,7 +36,7 @@ index d0a39e2..8fa0e1e 100644 } RendererPreferences* renderer_prefs = -@@ -755,11 +754,10 @@ void BrowserPluginGuest::OnWillAttachComplete( +@@ -758,11 +757,10 @@ void BrowserPluginGuest::OnWillAttachComplete( ->GetWidget() ->Init(); GetWebContents()->GetMainFrame()->Init(); diff --git a/patch/patches/chrome_crashpad_mac.patch b/patch/patches/chrome_crashpad_mac.patch deleted file mode 100644 index 92c443c1f..000000000 --- a/patch/patches/chrome_crashpad_mac.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git chrome/browser/chrome_browser_main_mac.mm chrome/browser/chrome_browser_main_mac.mm -index 0e9c5ae..28fc90a 100644 ---- chrome/browser/chrome_browser_main_mac.mm -+++ chrome/browser/chrome_browser_main_mac.mm -@@ -182,7 +182,7 @@ void ChromeBrowserMainPartsMac::PostProfileInit() { - ChromeBrowserMainPartsPosix::PostProfileInit(); - - g_browser_process->metrics_service()->RecordBreakpadRegistration( -- crash_reporter::GetUploadsEnabled()); -+ false); - - // TODO(calamity): Make this gated on first_run::IsChromeFirstRun() in M45. - content::BrowserThread::PostAfterStartupTask( -diff --git chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc -index d62973e..fc2dfa4 100644 ---- chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc -+++ chrome/browser/crash_upload_list/crash_upload_list_crashpad.cc -@@ -75,8 +75,6 @@ void CrashUploadListCrashpad::LoadUploadList( - // database lives in the .exe, so we need to grab a pointer to a helper in the - // exe to get our reports list. - GetReportsThunk(&reports); --#else -- crash_reporter::GetReports(&reports); - #endif - - for (const crash_reporter::Report& report : reports) { -diff --git chrome/browser/google/google_update_settings_posix.cc chrome/browser/google/google_update_settings_posix.cc -index d053b1e..cdecb1a 100644 ---- chrome/browser/google/google_update_settings_posix.cc -+++ chrome/browser/google/google_update_settings_posix.cc -@@ -63,10 +63,6 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() { - - // static - bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { --#if defined(OS_MACOSX) -- crash_reporter::SetUploadConsent(consented); --#endif -- - base::FilePath consent_dir; - PathService::Get(chrome::DIR_USER_DATA, &consent_dir); - if (!base::DirectoryExists(consent_dir)) diff --git a/patch/patches/chrome_widevine.patch b/patch/patches/chrome_widevine.patch index a437e7c72..4aa75e076 100644 --- a/patch/patches/chrome_widevine.patch +++ b/patch/patches/chrome_widevine.patch @@ -1,5 +1,5 @@ diff --git chrome/common/chrome_content_client.cc chrome/common/chrome_content_client.cc -index 4325cec..7cb8a86 100644 +index eb4d107..0f5dfee 100644 --- chrome/common/chrome_content_client.cc +++ chrome/common/chrome_content_client.cc @@ -76,7 +76,7 @@ diff --git a/patch/patches/compositor_1368.patch b/patch/patches/compositor_1368.patch index d588ff654..d0ed6f99f 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 9af7049..87f1b01 100644 +index 128cb43..fb72012 100644 --- content/browser/compositor/gpu_process_transport_factory.cc +++ content/browser/compositor/gpu_process_transport_factory.cc -@@ -199,6 +199,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { +@@ -198,6 +198,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { std::unique_ptr GpuProcessTransportFactory::CreateSoftwareOutputDevice( ui::Compositor* compositor) { @@ -17,7 +17,7 @@ index 9af7049..87f1b01 100644 if (shell::ShellIsRemote()) { NOTREACHED(); diff --git ui/compositor/compositor.h ui/compositor/compositor.h -index b73eb86..81957b2 100644 +index 1ab836b..1f7a82a 100644 --- ui/compositor/compositor.h +++ ui/compositor/compositor.h @@ -18,6 +18,7 @@ @@ -46,7 +46,7 @@ index b73eb86..81957b2 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 -@@ -220,6 +232,9 @@ class COMPOSITOR_EXPORT Compositor +@@ -217,6 +229,9 @@ class COMPOSITOR_EXPORT Compositor // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -56,7 +56,7 @@ index b73eb86..81957b2 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 -@@ -403,6 +418,8 @@ class COMPOSITOR_EXPORT Compositor +@@ -400,6 +415,8 @@ class COMPOSITOR_EXPORT Compositor ui::ContextFactory* context_factory_; diff --git a/patch/patches/content_nav_1129.patch b/patch/patches/content_nav_1129.patch index 0dafb6945..eeacb1d44 100644 --- a/patch/patches/content_nav_1129.patch +++ b/patch/patches/content_nav_1129.patch @@ -1,8 +1,8 @@ diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc -index b7bafaf..09d1d07 100644 +index bb040a6..c801841 100644 --- public/renderer/content_renderer_client.cc +++ public/renderer/content_renderer_client.cc -@@ -99,7 +99,6 @@ bool ContentRendererClient::AllowPopup() { +@@ -100,7 +100,6 @@ bool ContentRendererClient::AllowPopup() { return false; } @@ -10,7 +10,7 @@ index b7bafaf..09d1d07 100644 bool ContentRendererClient::HandleNavigation( RenderFrame* render_frame, bool is_content_initiated, -@@ -112,6 +111,7 @@ bool ContentRendererClient::HandleNavigation( +@@ -113,6 +112,7 @@ bool ContentRendererClient::HandleNavigation( return false; } @@ -19,10 +19,10 @@ index b7bafaf..09d1d07 100644 return false; } diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h -index b7b042f..69a62f2 100644 +index 752ae2d..de04432 100644 --- public/renderer/content_renderer_client.h +++ public/renderer/content_renderer_client.h -@@ -204,7 +204,6 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -208,7 +208,6 @@ class CONTENT_EXPORT ContentRendererClient { // Returns true if a popup window should be allowed. virtual bool AllowPopup(); @@ -30,7 +30,7 @@ index b7b042f..69a62f2 100644 // 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 -@@ -220,6 +219,7 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -224,6 +223,7 @@ class CONTENT_EXPORT ContentRendererClient { blink::WebNavigationPolicy default_policy, bool is_redirect); @@ -39,10 +39,10 @@ index b7b042f..69a62f2 100644 // built in media player for the given |url|. Defaults to false. virtual bool ShouldUseMediaPlayerForURL(const GURL& url); diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc -index 95165ff..608409e 100644 +index e74b334..2fe1e1a 100644 --- renderer/render_frame_impl.cc +++ renderer/render_frame_impl.cc -@@ -4917,7 +4917,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( +@@ -4972,7 +4972,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( (pending_navigation_params_ && !pending_navigation_params_->request_params.redirects.empty()); @@ -50,7 +50,7 @@ index 95165ff..608409e 100644 // The handlenavigation API is deprecated and will be removed once // crbug.com/325351 is resolved. if (GetContentClient()->renderer()->HandleNavigation( -@@ -4926,7 +4925,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( +@@ -4981,7 +4980,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( is_redirect)) { return blink::WebNavigationPolicyIgnore; } diff --git a/patch/patches/gn_config.patch b/patch/patches/gn_config.patch index bf790b9c2..ab3f48918 100644 --- a/patch/patches/gn_config.patch +++ b/patch/patches/gn_config.patch @@ -1,21 +1,20 @@ diff --git .gn .gn -index 1e0e3bd..9e70917 100644 +index 2034420..1675275 100644 --- .gn +++ .gn -@@ -231,6 +231,8 @@ exec_script_whitelist = [ +@@ -238,6 +238,7 @@ exec_script_whitelist = [ "//build/toolchain/win/BUILD.gn", "//build/util/branding.gni", "//build/util/version.gni", + "//cef/BUILD.gn", -+ "//cef/libcef/common/extensions/api/schemas.gni", - "//chrome/android/BUILD.gn", - "//chrome/browser/BUILD.gn", - "//chrome/browser/chromeos/BUILD.gn", + "//chromeos/BUILD.gn", + + # TODO(dgn): Layer violation but breaks the build otherwise, see diff --git BUILD.gn BUILD.gn -index acc203c..49113a4 100644 +index 6aad399..9c42f8e 100644 --- BUILD.gn +++ BUILD.gn -@@ -265,6 +265,7 @@ group("both_gn_and_gyp") { +@@ -270,6 +270,7 @@ group("both_gn_and_gyp") { # and whether there should be other targets that are iOS-only and missing. deps += [ "//cc:cc_unittests", @@ -56,10 +55,10 @@ index 5bfa9a7..5e6e05d 100644 + "studio path") } diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py -index 0d0975d..cfb5d3f 100644 +index fbc201e..299156d 100644 --- build/toolchain/win/setup_toolchain.py +++ build/toolchain/win/setup_toolchain.py -@@ -127,11 +127,15 @@ def _LoadToolchainEnv(cpu, sdk_dir): +@@ -126,11 +126,15 @@ def _LoadToolchainEnv(cpu, sdk_dir): script_path = os.path.normpath(os.path.join( os.environ['GYP_MSVS_OVERRIDE_PATH'], 'VC/vcvarsall.bat')) @@ -81,7 +80,7 @@ index 0d0975d..cfb5d3f 100644 diff --git build/vs_toolchain.py build/vs_toolchain.py -index 829e718..89361a0 100755 +index 9c55984..d44d116 100755 --- build/vs_toolchain.py +++ build/vs_toolchain.py @@ -74,11 +74,18 @@ def SetEnvironmentAndGetRuntimeDllDirs(): @@ -104,7 +103,7 @@ index 829e718..89361a0 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/BUILD.gn chrome/BUILD.gn -index aa67e96..e2af2f3 100644 +index 87d4743..dc21a56 100644 --- chrome/BUILD.gn +++ chrome/BUILD.gn @@ -709,7 +709,7 @@ if (is_win) { @@ -117,10 +116,10 @@ index aa67e96..e2af2f3 100644 outputs = [ diff --git chrome/chrome_repack_locales.gni chrome/chrome_repack_locales.gni -index b9a1d95..54d7677 100644 +index f4a3caf..8ae7639 100644 --- chrome/chrome_repack_locales.gni +++ chrome/chrome_repack_locales.gni -@@ -189,9 +189,9 @@ template("chrome_repack_locales") { +@@ -188,9 +188,9 @@ template("chrome_repack_locales") { if (defined(invoker.output_dir)) { output = "${invoker.output_dir}/${output_locale}.pak" } else if (is_mac || is_ios) { diff --git a/patch/patches/gritsettings.patch b/patch/patches/gritsettings.patch index a0ce5c71b..a2fa12d5e 100644 --- a/patch/patches/gritsettings.patch +++ b/patch/patches/gritsettings.patch @@ -1,5 +1,5 @@ diff --git resource_ids resource_ids -index f5f641d..c052709 100644 +index 4b6f6ad..0d17c1c 100644 --- resource_ids +++ resource_ids @@ -14,6 +14,12 @@ diff --git a/patch/patches/ime_1610.patch b/patch/patches/ime_1610.patch index bd31a4e1b..e860c907a 100644 --- a/patch/patches/ime_1610.patch +++ b/patch/patches/ime_1610.patch @@ -1,8 +1,8 @@ diff --git input_method_win.cc input_method_win.cc -index 4ec5a84..7c99e6c 100644 +index 8975069..858bc9b 100644 --- input_method_win.cc +++ input_method_win.cc -@@ -635,8 +635,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { +@@ -642,8 +642,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { // receiving keyboard input as long as it is an active window. This works well // even when the |attached_window_handle| becomes active but has not received // WM_FOCUS yet. diff --git a/patch/patches/mime_handler_view_1565.patch b/patch/patches/mime_handler_view_1565.patch index 54758edcb..ba94aa5b2 100644 --- a/patch/patches/mime_handler_view_1565.patch +++ b/patch/patches/mime_handler_view_1565.patch @@ -1,5 +1,5 @@ diff --git mime_handler_view_guest.cc mime_handler_view_guest.cc -index a58e021..2a20447 100644 +index 0b62a81..e34d210 100644 --- mime_handler_view_guest.cc +++ mime_handler_view_guest.cc @@ -134,6 +134,8 @@ void MimeHandlerViewGuest::CreateWebContents( diff --git a/patch/patches/net_filter_515.patch b/patch/patches/net_filter_515.patch index 4502c6b6d..a5dd0ba36 100644 --- a/patch/patches/net_filter_515.patch +++ b/patch/patches/net_filter_515.patch @@ -1,5 +1,5 @@ diff --git base/network_delegate.h base/network_delegate.h -index 2deb9c58..0896a36 100644 +index 36bdde9..f1ee1ae 100644 --- base/network_delegate.h +++ base/network_delegate.h @@ -36,6 +36,7 @@ namespace net { @@ -10,7 +10,7 @@ index 2deb9c58..0896a36 100644 class HttpRequestHeaders; class HttpResponseHeaders; class ProxyInfo; -@@ -111,6 +112,13 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { +@@ -115,6 +116,13 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { const GURL& target_url, const GURL& referrer_url) const; @@ -45,10 +45,10 @@ index 1940399..bf8722c 100644 friend class GZipUnitTest; friend class SdchFilterChainingTest; diff --git url_request/url_request_job.cc url_request/url_request_job.cc -index 259a2d8..c1d02cc 100644 +index eadeb4b..2341297 100644 --- url_request/url_request_job.cc +++ url_request/url_request_job.cc -@@ -498,6 +498,9 @@ void URLRequestJob::NotifyHeadersComplete() { +@@ -495,6 +495,9 @@ void URLRequestJob::NotifyHeadersComplete() { if (request_->status().is_success()) filter_ = SetupFilter(); diff --git a/patch/patches/net_urlrequest_1327.patch b/patch/patches/net_urlrequest_1327.patch index c320c4127..b7c288124 100644 --- a/patch/patches/net_urlrequest_1327.patch +++ b/patch/patches/net_urlrequest_1327.patch @@ -1,12 +1,13 @@ diff --git url_request.h url_request.h -index 73e02d9..5a20709 100644 +index 7a810a7..08d6331 100644 --- url_request.h +++ url_request.h -@@ -648,10 +648,10 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), - // or after the response headers are received. - void GetConnectionAttempts(ConnectionAttempts* out) const; - +@@ -651,10 +651,11 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), + // Returns the error status of the request. + // Do not use! Going to be protected! + const URLRequestStatus& status() const { return status_; } - protected: ++ // Allow the URLRequestJob class to control the is_pending() flag. void set_is_pending(bool value) { is_pending_ = value; } diff --git a/patch/patches/pdfium_print_549365.patch b/patch/patches/pdfium_print_549365.patch index ba16b25fc..b3dd7a56f 100644 --- a/patch/patches/pdfium_print_549365.patch +++ b/patch/patches/pdfium_print_549365.patch @@ -1,8 +1,8 @@ diff --git BUILD.gn BUILD.gn -index ca2338f..a5e62a2 100644 +index ccb1e0c..0e3b185 100644 --- BUILD.gn +++ BUILD.gn -@@ -172,6 +172,10 @@ static_library("pdfium") { +@@ -181,6 +181,10 @@ static_library("pdfium") { } else { libs += [ "freetype" ] } @@ -14,18 +14,18 @@ index ca2338f..a5e62a2 100644 static_library("test_support") { diff --git fpdfsdk/fpdfview.cpp fpdfsdk/fpdfview.cpp -index dee71ac..e2563bc 100644 +index 76540fc..5b2e2d0 100644 --- fpdfsdk/fpdfview.cpp +++ fpdfsdk/fpdfview.cpp -@@ -28,6 +28,7 @@ - #include "fpdfsdk/include/fsdk_mgr.h" +@@ -29,6 +29,7 @@ + #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_pauseadapter.h" #include "fpdfsdk/javascript/ijs_runtime.h" +#include "fxjs/include/fxjs_v8.h" #include "public/fpdf_ext.h" #include "public/fpdf_progressive.h" #include "third_party/base/numerics/safe_conversions_impl.h" -@@ -296,6 +297,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() { +@@ -297,6 +298,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() { #endif // PDF_ENABLE_XFA CPDF_ModuleMgr::Destroy(); CFX_GEModule::Destroy(); diff --git a/patch/patches/prefs_content_1161.patch b/patch/patches/prefs_content_1161.patch index 75e0edb90..801fbc9c9 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 5627e6f..b3ed37a 100644 +index cb5c7d5..a1f606f 100644 --- public/common/common_param_traits_macros.h +++ public/common/common_param_traits_macros.h -@@ -213,6 +213,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) +@@ -202,6 +202,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 5627e6f..b3ed37a 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 b856339..e71b819 100644 +index 3e53ef5..133fcdd 100644 --- public/common/web_preferences.cc +++ public/common/web_preferences.cc -@@ -175,6 +175,7 @@ WebPreferences::WebPreferences() +@@ -174,6 +174,7 @@ WebPreferences::WebPreferences() pinch_overlay_scrollbar_thickness(0), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), @@ -23,10 +23,10 @@ index b856339..e71b819 100644 inert_visual_viewport(false), record_whole_document(false), diff --git public/common/web_preferences.h public/common/web_preferences.h -index f9b778b..35f1967 100644 +index 3733fb1..1b54799 100644 --- public/common/web_preferences.h +++ public/common/web_preferences.h -@@ -188,6 +188,7 @@ struct CONTENT_EXPORT WebPreferences { +@@ -187,6 +187,7 @@ struct CONTENT_EXPORT WebPreferences { int pinch_overlay_scrollbar_thickness; bool use_solid_color_scrollbars; bool navigate_on_drag_drop; @@ -35,10 +35,10 @@ index f9b778b..35f1967 100644 bool inert_visual_viewport; bool record_whole_document; diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc -index c544c288..3ab4478 100644 +index f06587d..27702eb 100644 --- renderer/render_view_impl.cc +++ renderer/render_view_impl.cc -@@ -1491,6 +1491,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( +@@ -1477,6 +1477,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( blink::WebView* web_view, CompositorDependencies* compositor_deps) { ApplyWebPreferences(prefs, web_view); diff --git a/patch/patches/prefs_tab_helper_1680.patch b/patch/patches/prefs_tab_helper_1680.patch index 4a15911ed..9969991f0 100644 --- a/patch/patches/prefs_tab_helper_1680.patch +++ b/patch/patches/prefs_tab_helper_1680.patch @@ -1,5 +1,5 @@ diff --git prefs_tab_helper.cc prefs_tab_helper.cc -index d22384c..cb9d457 100644 +index 448bb72..aa98dda 100644 --- prefs_tab_helper.cc +++ prefs_tab_helper.cc @@ -11,8 +11,8 @@ @@ -12,7 +12,7 @@ index d22384c..cb9d457 100644 #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -@@ -424,12 +424,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { +@@ -422,12 +422,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { GetInstance()->GetServiceForBrowserContext(profile, true)); } @@ -27,7 +27,7 @@ index d22384c..cb9d457 100644 PrefWatcherFactory() : BrowserContextKeyedServiceFactory( "PrefWatcher", -@@ -450,6 +448,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { +@@ -448,6 +446,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { } }; diff --git a/patch/patches/print_header_footer_1478_1565.patch b/patch/patches/print_header_footer_1478_1565.patch index 69316493a..08f17022f 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 b43b88b..7779496 100644 +index 4552193..dbf30ae 100644 --- chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -9,7 +9,9 @@ @@ -12,7 +12,7 @@ index b43b88b..7779496 100644 #include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/browser/ui/cocoa/applescript/apple_event_util.h" #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" -@@ -227,11 +229,15 @@ void ResumeAppleEventAndSendReply(NSAppleEventManagerSuspensionID suspension_id, +@@ -224,11 +226,15 @@ void ResumeAppleEventAndSendReply(NSAppleEventManagerSuspensionID suspension_id, - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT); @@ -166,7 +166,7 @@ index a019144..af8839d 100644 PrintHostMsg_SetOptionsFromDocument_Params /* params */) -#endif // defined(ENABLE_PRINT_PREVIEW) diff --git components/printing/renderer/print_web_view_helper.cc components/printing/renderer/print_web_view_helper.cc -index 22207f3..5924464 100644 +index 7fa310f..8946ba9 100644 --- components/printing/renderer/print_web_view_helper.cc +++ components/printing/renderer/print_web_view_helper.cc @@ -86,6 +86,9 @@ const float kPrintingMinimumShrinkFactor = 1.333f; @@ -205,7 +205,7 @@ index 22207f3..5924464 100644 // Disable scaling when either: // - The PDF specifies disabling scaling. -@@ -371,7 +369,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, +@@ -378,7 +376,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, } #endif @@ -213,7 +213,7 @@ index 22207f3..5924464 100644 bool FitToPageEnabled(const base::DictionaryValue& job_settings) { bool fit_to_paper_size = false; if (!job_settings.GetBoolean(kSettingFitToPageEnabled, &fit_to_paper_size)) { -@@ -413,7 +410,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( +@@ -421,7 +418,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( } return blink::WebPrintScalingOptionFitToPrintableArea; } @@ -221,7 +221,7 @@ index 22207f3..5924464 100644 PrintMsg_Print_Params CalculatePrintParamsForCss( blink::WebLocalFrame* frame, -@@ -497,7 +493,6 @@ blink::WebView* FrameReference::view() { +@@ -505,7 +501,6 @@ blink::WebView* FrameReference::view() { return view_; } @@ -229,7 +229,7 @@ index 22207f3..5924464 100644 // static - Not anonymous so that platform implementations can use it. void PrintWebViewHelper::PrintHeaderAndFooter( blink::WebCanvas* canvas, -@@ -557,7 +552,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter( +@@ -565,7 +560,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter( web_view->close(); frame->close(); } @@ -237,7 +237,7 @@ index 22207f3..5924464 100644 // static - Not anonymous so that platform implementations can use it. float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame, -@@ -843,6 +837,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view, +@@ -851,6 +845,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view, print_for_preview_(false), delegate_(std::move(delegate)), print_node_in_progress_(false), @@ -245,7 +245,7 @@ index 22207f3..5924464 100644 is_loading_(false), is_scripted_preview_delayed_(false), ipc_nesting_level_(0), -@@ -901,10 +896,8 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame, +@@ -909,10 +904,8 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame, return; if (g_is_preview_enabled) { @@ -256,7 +256,7 @@ index 22207f3..5924464 100644 } else { #if defined(ENABLE_BASIC_PRINTING) Print(frame, blink::WebNode(), true); -@@ -928,14 +921,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { +@@ -936,14 +929,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) #endif // defined(ENABLE_BASIC_PRINTING) @@ -271,7 +271,7 @@ index 22207f3..5924464 100644 IPC_MESSAGE_HANDLER(PrintMsg_SetScriptedPrintingBlocked, SetScriptedPrintBlocked) IPC_MESSAGE_UNHANDLED(handled = false) -@@ -990,7 +979,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { +@@ -998,7 +987,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { } #endif // defined(ENABLE_BASIC_PRINTING) @@ -279,7 +279,7 @@ index 22207f3..5924464 100644 void PrintWebViewHelper::OnPrintForPrintPreview( const base::DictionaryValue& job_settings) { CHECK_LE(ipc_nesting_level_, 1); -@@ -1055,7 +1043,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview( +@@ -1063,7 +1051,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview( DidFinishPrinting(FAIL_PRINT); } } @@ -287,7 +287,7 @@ index 22207f3..5924464 100644 void PrintWebViewHelper::GetPageSizeAndContentAreaFromPageLayout( const PageSizeMargins& page_layout_in_points, -@@ -1080,7 +1067,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( +@@ -1088,7 +1075,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( ignore_css_margins_ = (margins_type != DEFAULT_MARGINS); } @@ -295,7 +295,7 @@ index 22207f3..5924464 100644 void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) { if (ipc_nesting_level_ > 1) return; -@@ -1241,7 +1227,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { +@@ -1249,7 +1235,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { return true; } @@ -304,7 +304,7 @@ index 22207f3..5924464 100644 bool PrintWebViewHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -1271,7 +1257,7 @@ bool PrintWebViewHelper::RenderPreviewPage( +@@ -1279,7 +1265,7 @@ bool PrintWebViewHelper::RenderPreviewPage( } return PreviewPageRendered(page_number, draft_metafile.get()); } @@ -313,7 +313,7 @@ index 22207f3..5924464 100644 bool PrintWebViewHelper::FinalizePrintReadyDocument() { DCHECK(!is_print_ready_metafile_sent_); -@@ -1301,7 +1287,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() { +@@ -1309,7 +1295,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() { Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params)); return true; } @@ -321,7 +321,7 @@ index 22207f3..5924464 100644 void PrintWebViewHelper::OnPrintingDone(bool success) { if (ipc_nesting_level_ > 1) -@@ -1316,7 +1301,6 @@ void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) { +@@ -1324,7 +1309,6 @@ void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) { is_scripted_printing_blocked_ = blocked; } @@ -329,7 +329,7 @@ index 22207f3..5924464 100644 void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { if (ipc_nesting_level_ > 1) return; -@@ -1327,7 +1311,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { +@@ -1335,7 +1319,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { // that instead. auto plugin = delegate_->GetPdfElement(frame); if (!plugin.isNull()) { @@ -339,7 +339,7 @@ index 22207f3..5924464 100644 return; } print_preview_context_.InitWithFrame(frame); -@@ -1335,7 +1321,6 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { +@@ -1343,7 +1329,6 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { ? PRINT_PREVIEW_USER_INITIATED_SELECTION : PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); } @@ -347,7 +347,7 @@ index 22207f3..5924464 100644 bool PrintWebViewHelper::IsPrintingEnabled() { bool result = false; -@@ -1361,11 +1346,9 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) { +@@ -1369,11 +1354,9 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) { // Make a copy of the node, in case RenderView::OnContextMenuClosed resets // its |context_menu_node_|. @@ -360,7 +360,7 @@ index 22207f3..5924464 100644 } else { #if defined(ENABLE_BASIC_PRINTING) blink::WebNode duplicate_node(node); -@@ -1431,7 +1414,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { +@@ -1439,7 +1422,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { } break; @@ -368,7 +368,7 @@ index 22207f3..5924464 100644 case FAIL_PREVIEW: int cookie = print_pages_params_ ? print_pages_params_->params.document_cookie : 0; -@@ -1443,7 +1425,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { +@@ -1451,7 +1433,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { } print_preview_context_.Failed(notify_browser_of_print_failure_); break; @@ -376,7 +376,7 @@ index 22207f3..5924464 100644 } prep_frame_view_.reset(); print_pages_params_.reset(); -@@ -1575,7 +1556,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, +@@ -1583,7 +1564,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, return true; } @@ -384,7 +384,7 @@ index 22207f3..5924464 100644 bool PrintWebViewHelper::SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options) { blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); -@@ -1684,7 +1664,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( +@@ -1692,7 +1672,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( return true; } @@ -392,7 +392,7 @@ index 22207f3..5924464 100644 #if defined(ENABLE_BASIC_PRINTING) bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame, -@@ -1793,7 +1772,6 @@ void PrintWebViewHelper::PrintPageInternal( +@@ -1801,7 +1780,6 @@ void PrintWebViewHelper::PrintPageInternal( MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); @@ -400,7 +400,7 @@ index 22207f3..5924464 100644 if (params.params.display_header_footer) { // TODO(thestig): Figure out why Linux needs this. It is almost certainly // |printingMinimumShrinkFactor| from Blink. -@@ -1808,7 +1786,6 @@ void PrintWebViewHelper::PrintPageInternal( +@@ -1816,7 +1794,6 @@ void PrintWebViewHelper::PrintPageInternal( scale_factor / fudge_factor, page_layout_in_points, params.params); } @@ -408,7 +408,7 @@ index 22207f3..5924464 100644 float webkit_scale_factor = RenderPageContent(frame, params.page_number, canvas_area, content_area, -@@ -1844,7 +1821,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( +@@ -1852,7 +1829,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( return true; } @@ -416,7 +416,7 @@ index 22207f3..5924464 100644 void PrintWebViewHelper::ShowScriptedPrintPreview() { if (is_scripted_preview_delayed_) { is_scripted_preview_delayed_ = false; -@@ -1972,7 +1948,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number, +@@ -1980,7 +1956,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number, Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params)); return true; } diff --git a/patch/patches/render_frame_message_filter_626728.patch b/patch/patches/render_frame_message_filter_626728.patch new file mode 100644 index 000000000..2809c5b53 --- /dev/null +++ b/patch/patches/render_frame_message_filter_626728.patch @@ -0,0 +1,13 @@ +diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc +index 4558e89..6e9a472 100644 +--- content/browser/frame_host/render_frame_message_filter.cc ++++ content/browser/frame_host/render_frame_message_filter.cc +@@ -484,7 +484,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( + PluginServiceFilter* filter = PluginServiceImpl::GetInstance()->GetFilter(); + std::vector plugins; + +- int child_process_id = -1; ++ int child_process_id = render_process_id_; + int routing_id = MSG_ROUTING_NONE; + GURL policy_url = + main_frame_origin.unique() ? GURL() : GURL(main_frame_origin.Serialize()); diff --git a/patch/patches/render_view_host_impl_1392.patch b/patch/patches/render_view_host_impl_1392.patch index d52296a7c..1eda06892 100644 --- a/patch/patches/render_view_host_impl_1392.patch +++ b/patch/patches/render_view_host_impl_1392.patch @@ -1,5 +1,5 @@ diff --git render_view_host_impl.h render_view_host_impl.h -index e550b57..81743c8 100644 +index ca857d5..f3f54fa 100644 --- render_view_host_impl.h +++ render_view_host_impl.h @@ -200,6 +200,7 @@ class CONTENT_EXPORT RenderViewHostImpl : public RenderViewHost, diff --git a/patch/patches/render_widget_host_1070383005.patch b/patch/patches/render_widget_host_1070383005.patch index 55cd97c22..fc228a132 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 ecfcc9c..6bb0eda 100644 +index 2461641..7dfad416 100644 --- render_widget_host_view_mac.mm +++ render_widget_host_view_mac.mm -@@ -467,9 +467,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, +@@ -460,9 +460,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/renderer_preferences_util_545103.patch b/patch/patches/renderer_preferences_util_545103.patch index 8b4d61edc..307fef720 100644 --- a/patch/patches/renderer_preferences_util_545103.patch +++ b/patch/patches/renderer_preferences_util_545103.patch @@ -1,9 +1,9 @@ diff --git renderer_preferences_util.cc renderer_preferences_util.cc -index d47d2d0..e6a5d9d 100644 +index ad5e301..c64325b 100644 --- renderer_preferences_util.cc +++ renderer_preferences_util.cc -@@ -26,7 +26,8 @@ - #include "ui/views/controls/textfield/textfield.h" +@@ -30,7 +30,8 @@ + #include "ui/base/cocoa/defaults_utils.h" #endif -#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) @@ -12,8 +12,8 @@ index d47d2d0..e6a5d9d 100644 #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" #include "ui/views/linux_ui/linux_ui.h" -@@ -120,7 +121,8 @@ void UpdateFromSystemSettings(content::RendererPreferences* prefs, - prefs->caret_blink_interval = views::Textfield::GetCaretBlinkMs() / 1000.0; +@@ -130,7 +131,8 @@ void UpdateFromSystemSettings(content::RendererPreferences* prefs, + prefs->caret_blink_interval = interval.InSecondsF(); #endif -#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) diff --git a/patch/patches/storage_partition_1973.patch b/patch/patches/storage_partition_1973.patch index 039a65073..3fe4103c2 100644 --- a/patch/patches/storage_partition_1973.patch +++ b/patch/patches/storage_partition_1973.patch @@ -74,10 +74,10 @@ index 6ca86e7..cf081e4 100644 CHECK(GetUserData(kMojoWasInitialized)) << "Attempting to destroy a BrowserContext that never called " diff --git content/browser/devtools/protocol/service_worker_handler.cc content/browser/devtools/protocol/service_worker_handler.cc -index 127b0c0..9dce5af 100644 +index a5de8d5..8cd64b3 100644 --- content/browser/devtools/protocol/service_worker_handler.cc +++ content/browser/devtools/protocol/service_worker_handler.cc -@@ -523,10 +523,9 @@ Response ServiceWorkerHandler::DispatchSyncEvent( +@@ -503,10 +503,9 @@ Response ServiceWorkerHandler::DispatchSyncEvent( if (!base::StringToInt64(registration_id, &id)) return CreateInvalidVersionIdErrorResponse(); @@ -91,10 +91,10 @@ index 127b0c0..9dce5af 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 7d69ab0..91d968a 100644 +index 1bab21a4..81156a8 100644 --- content/browser/renderer_host/render_process_host_impl.cc +++ content/browser/renderer_host/render_process_host_impl.cc -@@ -653,7 +653,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() { +@@ -664,7 +664,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() { RenderProcessHostImpl::RenderProcessHostImpl( BrowserContext* browser_context, @@ -103,7 +103,7 @@ index 7d69ab0..91d968a 100644 bool is_for_guests_only) : fast_shutdown_started_(false), deleting_soon_(false), -@@ -978,6 +978,22 @@ std::unique_ptr RenderProcessHostImpl::CreateChannelProxy( +@@ -998,6 +998,22 @@ std::unique_ptr RenderProcessHostImpl::CreateChannelProxy( void RenderProcessHostImpl::CreateMessageFilters() { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -126,7 +126,7 @@ index 7d69ab0..91d968a 100644 AddFilter(new ResourceSchedulerFilter(GetID())); MediaInternals* media_internals = MediaInternals::GetInstance(); // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages -@@ -992,8 +1008,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1012,8 +1028,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { new RenderMessageFilter( GetID(), GetBrowserContext(), request_context.get(), widget_helper_.get(), media_internals, @@ -137,7 +137,7 @@ index 7d69ab0..91d968a 100644 AddFilter(render_message_filter.get()); render_frame_message_filter_ = new RenderFrameMessageFilter( -@@ -1024,9 +1040,9 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1044,9 +1060,9 @@ void RenderProcessHostImpl::CreateMessageFilters() { resource_message_filter_ = new ResourceMessageFilter( GetID(), PROCESS_TYPE_RENDERER, @@ -149,7 +149,7 @@ index 7d69ab0..91d968a 100644 storage_partition_impl_->GetHostZoomLevelContext(), get_contexts_callback); -@@ -1051,14 +1067,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1071,14 +1087,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { AddFilter( new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_manager())); AddFilter(new VideoCaptureHost(media_stream_manager)); @@ -167,7 +167,7 @@ index 7d69ab0..91d968a 100644 blob_storage_context.get())); #if defined(ENABLE_WEBRTC) -@@ -1110,14 +1124,13 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1130,14 +1144,13 @@ void RenderProcessHostImpl::CreateMessageFilters() { scoped_refptr cache_storage_filter = new CacheStorageDispatcherHost(); @@ -184,7 +184,7 @@ index 7d69ab0..91d968a 100644 AddFilter(service_worker_filter.get()); AddFilter(new SharedWorkerMessageFilter( -@@ -1125,12 +1138,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1145,12 +1158,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { WorkerStoragePartition( storage_partition_impl_->GetURLRequestContext(), storage_partition_impl_->GetMediaURLRequestContext(), @@ -200,7 +200,7 @@ index 7d69ab0..91d968a 100644 message_port_message_filter_.get())); #if defined(ENABLE_WEBRTC) -@@ -1145,11 +1158,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1165,11 +1178,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { GetID(), storage_partition_impl_->GetQuotaManager(), GetContentClient()->browser()->CreateQuotaPermissionContext())); @@ -213,7 +213,7 @@ index 7d69ab0..91d968a 100644 resource_context, service_worker_context, browser_context); AddFilter(notification_message_filter_.get()); -@@ -1158,7 +1168,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1178,7 +1188,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { AddFilter(new HistogramMessageFilter()); AddFilter(new MemoryMessageFilter(this)); AddFilter(new PushMessagingMessageFilter( @@ -222,7 +222,7 @@ index 7d69ab0..91d968a 100644 #if defined(OS_ANDROID) AddFilter(new ScreenOrientationMessageFilterAndroid()); #endif -@@ -1167,6 +1177,11 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1187,6 +1197,11 @@ void RenderProcessHostImpl::CreateMessageFilters() { void RenderProcessHostImpl::RegisterMojoInterfaces() { std::unique_ptr registry( new shell::InterfaceRegistry); @@ -234,7 +234,7 @@ index 7d69ab0..91d968a 100644 #if defined(OS_ANDROID) interface_registry_android_ = InterfaceRegistryAndroid::Create(registry.get()); -@@ -1194,8 +1209,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { +@@ -1220,8 +1235,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { AddUIThreadInterface( registry.get(), base::Bind(&PlatformNotificationContextImpl::CreateService, @@ -245,10 +245,10 @@ index 7d69ab0..91d968a 100644 AddUIThreadInterface( registry.get(), diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h -index 7fb91a6..503e6ba 100644 +index f9e74e7..a49359f 100644 --- content/browser/renderer_host/render_process_host_impl.h +++ content/browser/renderer_host/render_process_host_impl.h -@@ -75,7 +75,6 @@ class RenderWidgetHostImpl; +@@ -78,7 +78,6 @@ class RenderWidgetHostImpl; class RenderWidgetHostViewFrameSubscriber; class ResourceMessageFilter; class StoragePartition; @@ -256,8 +256,8 @@ index 7fb91a6..503e6ba 100644 namespace mojom { class StoragePartitionService; -@@ -109,7 +108,7 @@ class CONTENT_EXPORT RenderProcessHostImpl - public ui::GpuSwitchingObserver { +@@ -114,7 +113,7 @@ class CONTENT_EXPORT RenderProcessHostImpl + public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) { public: RenderProcessHostImpl(BrowserContext* browser_context, - StoragePartitionImpl* storage_partition_impl, @@ -265,7 +265,7 @@ index 7fb91a6..503e6ba 100644 bool is_for_guests_only); ~RenderProcessHostImpl() override; -@@ -468,7 +467,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -498,7 +497,7 @@ class CONTENT_EXPORT RenderProcessHostImpl BrowserContext* browser_context_; // Owned by |browser_context_|. @@ -275,7 +275,7 @@ index 7fb91a6..503e6ba 100644 // The observers watching our lifetime. base::ObserverList observers_; diff --git content/browser/site_instance_impl.cc content/browser/site_instance_impl.cc -index 8978640..a1e4cdd 100644 +index a55d786..9e0de6a 100644 --- content/browser/site_instance_impl.cc +++ content/browser/site_instance_impl.cc @@ -116,9 +116,8 @@ RenderProcessHost* SiteInstanceImpl::GetProcess() { @@ -424,3 +424,30 @@ index 909b370..8c6f09d 100644 protected: virtual ~StoragePartition() {} }; +diff --git extensions/browser/guest_view/web_view/web_ui/BUILD.gn extensions/browser/guest_view/web_view/web_ui/BUILD.gn +index 9b26c41..e9f4a0c 100644 +--- extensions/browser/guest_view/web_view/web_ui/BUILD.gn ++++ extensions/browser/guest_view/web_view/web_ui/BUILD.gn +@@ -3,6 +3,10 @@ + # found in the LICENSE file. + + source_set("web_ui") { ++ deps = [ ++ "//content/public/common", ++ ] ++ + sources = [ + "web_ui_url_fetcher.cc", + "web_ui_url_fetcher.h", +diff --git extensions/common/api/BUILD.gn extensions/common/api/BUILD.gn +index 0276c57..ca1d6f6 100644 +--- extensions/common/api/BUILD.gn ++++ extensions/common/api/BUILD.gn +@@ -98,6 +98,7 @@ group("api") { + public_deps = [ + ":generated_api", + ":mojom", ++ "//content/public/common", + ] + } + diff --git a/patch/patches/ui_views_test_640741.patch b/patch/patches/ui_views_test_640741.patch new file mode 100644 index 000000000..61847a769 --- /dev/null +++ b/patch/patches/ui_views_test_640741.patch @@ -0,0 +1,15 @@ +diff --git ui/views/test/ui_controls_factory_desktop_aurax11.cc ui/views/test/ui_controls_factory_desktop_aurax11.cc +index 2be0e63..343176d 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->ConvertPointFromHost(&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 7d9453a14..163316f93 100644 --- a/patch/patches/views_1749.patch +++ b/patch/patches/views_1749.patch @@ -1,8 +1,8 @@ diff --git controls/button/menu_button.cc controls/button/menu_button.cc -index 4b562c5..17e2d3b 100644 +index 38fc310..fdd8a13 100644 --- controls/button/menu_button.cc +++ controls/button/menu_button.cc -@@ -197,7 +197,7 @@ void MenuButton::OnPaint(gfx::Canvas* canvas) { +@@ -195,7 +195,7 @@ void MenuButton::OnPaint(gfx::Canvas* canvas) { gfx::Size MenuButton::GetPreferredSize() const { gfx::Size prefsize = LabelButton::GetPreferredSize(); if (show_menu_marker_) { @@ -11,7 +11,7 @@ index 4b562c5..17e2d3b 100644 kMenuMarkerPaddingRight, 0); } -@@ -324,7 +324,7 @@ gfx::Rect MenuButton::GetChildAreaBounds() { +@@ -322,7 +322,7 @@ gfx::Rect MenuButton::GetChildAreaBounds() { gfx::Size s = size(); if (show_menu_marker_) { @@ -20,7 +20,7 @@ index 4b562c5..17e2d3b 100644 kMenuMarkerPaddingRight); } -@@ -412,4 +412,10 @@ int MenuButton::GetMaximumScreenXCoordinate() { +@@ -411,4 +411,10 @@ int MenuButton::GetMaximumScreenXCoordinate() { return monitor_bounds.right() - 1; } diff --git a/patch/patches/views_widget_180_1481_1677_1749.patch b/patch/patches/views_widget_180_1481_1677_1749.patch index 1f1e5872a..1a1803bd2 100644 --- a/patch/patches/views_widget_180_1481_1677_1749.patch +++ b/patch/patches/views_widget_180_1481_1677_1749.patch @@ -1,5 +1,5 @@ diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc -index c681785..fc49f2d 100644 +index 72004fe..ff7ba8c7 100644 --- content/browser/renderer_host/render_widget_host_view_aura.cc +++ content/browser/renderer_host/render_widget_host_view_aura.cc @@ -747,6 +747,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() { @@ -17,7 +17,7 @@ index c681785..fc49f2d 100644 if (host_ && set_focus_on_mouse_down_or_key_event_) { set_focus_on_mouse_down_or_key_event_ = false; diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc -index b41c4f1..f52b243 100644 +index a8e8627..2ec202f 100644 --- content/browser/renderer_host/render_widget_host_view_base.cc +++ content/browser/renderer_host/render_widget_host_view_base.cc @@ -44,6 +44,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase() @@ -40,7 +40,7 @@ index b41c4f1..f52b243 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 c69e9b8..d1d4f3f 100644 +index b68718d..5b209ca 100644 --- content/browser/renderer_host/render_widget_host_view_base.h +++ content/browser/renderer_host/render_widget_host_view_base.h @@ -107,6 +107,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, @@ -91,7 +91,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 d02a06c0..e5982e0 100644 +index 964fe4a..b878661 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -86,6 +86,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( @@ -169,10 +169,10 @@ index 884df90..518a69c 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 5327938..e8345de 100644 +index 38a416b..6343597 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc -@@ -174,6 +174,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -194,6 +194,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( use_native_frame_(false), should_maximize_after_map_(false), use_argb_visual_(false), @@ -180,17 +180,17 @@ index 5327938..e8345de 100644 drag_drop_client_(NULL), native_widget_delegate_(native_widget_delegate), desktop_native_widget_aura_(desktop_native_widget_aura), -@@ -182,7 +183,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( - custom_window_shape_(false), - urgency_hint_set_(false), - activatable_(true), -- close_widget_factory_(this) { +@@ -206,7 +207,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( + has_pointer_(false), + has_window_focus_(false), + has_pointer_focus_(false), +- close_widget_factory_(this) {} + close_widget_factory_(this), -+ xwindow_destroyed_(false) { - } ++ xwindow_destroyed_(false) {} DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { -@@ -392,7 +394,8 @@ void DesktopWindowTreeHostX11::CloseNow() { + window()->ClearProperty(kHostForRootWindow); +@@ -542,7 +544,8 @@ void DesktopWindowTreeHostX11::CloseNow() { // Actually free our native resources. if (ui::PlatformEventSource::GetInstance()) ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); @@ -200,7 +200,7 @@ index 5327938..e8345de 100644 xwindow_ = None; desktop_native_widget_aura_->OnHostClosed(); -@@ -541,6 +544,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( +@@ -683,6 +686,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( } gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const { @@ -209,7 +209,7 @@ index 5327938..e8345de 100644 return ToDIPRect(bounds_in_pixels_); } -@@ -1005,6 +1010,8 @@ void DesktopWindowTreeHostX11::HideImpl() { +@@ -1205,6 +1210,8 @@ void DesktopWindowTreeHostX11::HideImpl() { } gfx::Rect DesktopWindowTreeHostX11::GetBounds() const { @@ -218,7 +218,7 @@ index 5327938..e8345de 100644 return bounds_in_pixels_; } -@@ -1064,6 +1071,8 @@ void DesktopWindowTreeHostX11::SetBounds( +@@ -1264,6 +1271,8 @@ void DesktopWindowTreeHostX11::SetBounds( } gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const { @@ -227,7 +227,7 @@ index 5327938..e8345de 100644 return bounds_in_pixels_.origin(); } -@@ -1175,9 +1184,15 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1382,9 +1391,15 @@ void DesktopWindowTreeHostX11::InitX11Window( None; } @@ -244,7 +244,7 @@ index 5327938..e8345de 100644 bounds_in_pixels_.y(), bounds_in_pixels_.width(), bounds_in_pixels_.height(), 0, // border width -@@ -1809,6 +1824,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( +@@ -2013,6 +2028,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( } break; } @@ -252,14 +252,14 @@ index 5327938..e8345de 100644 + xwindow_destroyed_ = true; + CloseNow(); + break; + case FocusIn: case FocusOut: - if (xev->xfocus.mode != NotifyGrab) { - ReleaseCapture(); + 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 b9ba521..7478c1a 100644 +index 07e35ca..7746296 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -@@ -86,6 +86,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -83,6 +83,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // internal list of open windows. static void CleanUpWindowList(void (*func)(aura::Window* window)); @@ -272,7 +272,7 @@ index b9ba521..7478c1a 100644 protected: // Overridden from DesktopWindowTreeHost: void Init(aura::Window* content_window, -@@ -271,6 +277,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -290,6 +296,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // The bounds of |xwindow_|. gfx::Rect bounds_in_pixels_; @@ -282,7 +282,7 @@ index b9ba521..7478c1a 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 -@@ -310,6 +319,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -329,6 +338,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // Whether we used an ARGB visual for our window. bool use_argb_visual_; @@ -293,7 +293,7 @@ index b9ba521..7478c1a 100644 DesktopDragDropClientAuraX11* drag_drop_client_; std::unique_ptr x11_non_client_event_filter_; -@@ -362,6 +375,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -414,6 +427,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 base::WeakPtrFactory close_widget_factory_; @@ -303,69 +303,8 @@ index b9ba521..7478c1a 100644 DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostX11); }; -diff --git ui/views/widget/desktop_aura/x11_desktop_handler.cc ui/views/widget/desktop_aura/x11_desktop_handler.cc -index aa3c234..021bd01 100644 ---- ui/views/widget/desktop_aura/x11_desktop_handler.cc -+++ ui/views/widget/desktop_aura/x11_desktop_handler.cc -@@ -33,6 +33,30 @@ views::X11DesktopHandler* g_handler = NULL; - - namespace views { - -+namespace { -+ -+bool IsParentOfWindow(XDisplay* xdisplay, -+ ::Window potential_parent, -+ ::Window window) { -+ ::Window parent_win, root_win; -+ Window* child_windows; -+ unsigned int num_child_windows; -+ while (window) { -+ if (!XQueryTree(xdisplay, window, &root_win, &parent_win, -+ &child_windows, &num_child_windows)) { -+ break; -+ } -+ if(child_windows) -+ XFree(child_windows); -+ if (parent_win == potential_parent) -+ return true; -+ window = parent_win; -+ } -+ return false; -+} -+ -+} // namespace -+ - // static - X11DesktopHandler* X11DesktopHandler::get() { - if (!g_handler) -@@ -88,7 +112,11 @@ void X11DesktopHandler::ActivateWindow(::Window window) { - // in an active X window. - } - -- if (wm_supports_active_window_) { -+ DesktopWindowTreeHostX11* host = -+ DesktopWindowTreeHostX11::GetHostForXID(window); -+ const bool has_external_parent = host && host->has_external_parent(); -+ -+ if (wm_supports_active_window_ && !has_external_parent) { - DCHECK_EQ(gfx::GetXDisplay(), xdisplay_); - - // If the window is not already active, send a hint to activate it -@@ -213,8 +241,10 @@ uint32_t X11DesktopHandler::DispatchEvent(const ui::PlatformEvent& event) { - ::Window window; - if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && - window) { -- x_active_window_ = window; -- OnActiveWindowChanged(window, ACTIVE); -+ if (!IsParentOfWindow(xdisplay_, window, current_window_)) { -+ x_active_window_ = window; -+ OnActiveWindowChanged(window, ACTIVE); -+ } - } else { - x_active_window_ = None; - } diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc -index ca92c5b..f628c39 100644 +index 4b3db3f..103bba3 100644 --- ui/views/widget/widget.cc +++ ui/views/widget/widget.cc @@ -126,9 +126,11 @@ Widget::InitParams::InitParams(Type type) diff --git a/patch/patches/web_contents_1257.patch b/patch/patches/web_contents_1257.patch index 2cb3174cb..f88a2c941 100644 --- a/patch/patches/web_contents_1257.patch +++ b/patch/patches/web_contents_1257.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/extensions/api/tab_capture/offscreen_tab.cc chrome/browser/extensions/api/tab_capture/offscreen_tab.cc -index d7e2677..71436d2 100644 +index f50fdf9..9e59835 100644 --- chrome/browser/extensions/api/tab_capture/offscreen_tab.cc +++ chrome/browser/extensions/api/tab_capture/offscreen_tab.cc -@@ -204,7 +204,9 @@ bool OffscreenTab::ShouldCreateWebContents( +@@ -214,7 +214,9 @@ bool OffscreenTab::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -14,10 +14,10 @@ index d7e2677..71436d2 100644 // Disallow creating separate WebContentses. The WebContents implementation // uses this to spawn new windows/tabs, which is also not allowed for diff --git chrome/browser/extensions/api/tab_capture/offscreen_tab.h chrome/browser/extensions/api/tab_capture/offscreen_tab.h -index 712c117..4dc59be 100644 +index e639319..5f75a9a 100644 --- chrome/browser/extensions/api/tab_capture/offscreen_tab.h +++ chrome/browser/extensions/api/tab_capture/offscreen_tab.h -@@ -149,7 +149,9 @@ class OffscreenTab : protected content::WebContentsDelegate, +@@ -148,7 +148,9 @@ class OffscreenTab : protected content::WebContentsDelegate, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -29,7 +29,7 @@ index 712c117..4dc59be 100644 void EnterFullscreenModeForTab(content::WebContents* contents, const GURL& origin) final; diff --git chrome/browser/prerender/prerender_contents.cc chrome/browser/prerender/prerender_contents.cc -index ff3f72d..6647f76 100644 +index 5e4b3add..7a21502 100644 --- chrome/browser/prerender/prerender_contents.cc +++ chrome/browser/prerender/prerender_contents.cc @@ -131,7 +131,9 @@ class PrerenderContents::WebContentsDelegateImpl @@ -44,10 +44,10 @@ index ff3f72d..6647f76 100644 // window.opener property, terminate prerendering. prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW); diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc -index 93b36dc..b25c512 100644 +index b9b1da9..dde8843 100644 --- chrome/browser/ui/browser.cc +++ chrome/browser/ui/browser.cc -@@ -1616,7 +1616,9 @@ bool Browser::ShouldCreateWebContents( +@@ -1580,7 +1580,9 @@ bool Browser::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -59,10 +59,10 @@ index 93b36dc..b25c512 100644 // If a BackgroundContents is created, suppress the normal WebContents. return !MaybeCreateBackgroundContents( diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h -index 693e84d..be1f1dd 100644 +index dae2e25..b32308c 100644 --- chrome/browser/ui/browser.h +++ chrome/browser/ui/browser.h -@@ -617,7 +617,9 @@ class Browser : public TabStripModelObserver, +@@ -613,7 +613,9 @@ class Browser : public TabStripModelObserver, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -74,10 +74,10 @@ index 693e84d..be1f1dd 100644 int opener_render_frame_id, const std::string& frame_name, diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc -index 51f3bba..dead593 100644 +index be05e4a4c..58d5f4a 100644 --- content/browser/web_contents/web_contents_impl.cc +++ content/browser/web_contents/web_contents_impl.cc -@@ -1543,6 +1543,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1557,6 +1557,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::string unique_name = params.main_frame_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); @@ -90,7 +90,7 @@ index 51f3bba..dead593 100644 WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -1575,6 +1581,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1589,6 +1595,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::move(view_), &render_view_host_delegate_view_)); } @@ -98,7 +98,7 @@ index 51f3bba..dead593 100644 CHECK(render_view_host_delegate_view_); CHECK(view_.get()); -@@ -2028,11 +2035,14 @@ void WebContentsImpl::CreateNewWindow( +@@ -2042,11 +2049,14 @@ void WebContentsImpl::CreateNewWindow( static_cast(session_storage_namespace); CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); @@ -114,13 +114,13 @@ index 51f3bba..dead593 100644 if (route_id != MSG_ROUTING_NONE && !RenderViewHost::FromID(render_process_id, route_id)) { // If the embedder didn't create a WebContents for this route, we need to -@@ -2056,6 +2066,8 @@ void WebContentsImpl::CreateNewWindow( +@@ -2070,6 +2080,8 @@ void WebContentsImpl::CreateNewWindow( create_params.opener_render_process_id = render_process_id; create_params.opener_render_frame_id = params.opener_render_frame_id; create_params.opener_suppressed = params.opener_suppressed; + create_params.view = view; + create_params.delegate_view = delegate_view; - if (params.disposition == NEW_BACKGROUND_TAB) + if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) create_params.initially_hidden = true; create_params.renderer_initiated_creation = diff --git content/public/browser/web_contents.cc content/public/browser/web_contents.cc @@ -139,7 +139,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 efa8ae5..8ea0055 100644 +index 163a2ad..63e116e 100644 --- content/public/browser/web_contents.h +++ content/public/browser/web_contents.h @@ -55,8 +55,10 @@ class PageState; @@ -165,10 +165,10 @@ index efa8ae5..8ea0055 100644 // Creates a new WebContents. diff --git content/public/browser/web_contents_delegate.cc content/public/browser/web_contents_delegate.cc -index df97348..8e2168e 100644 +index 399255a..cde5fd3 100644 --- content/public/browser/web_contents_delegate.cc +++ content/public/browser/web_contents_delegate.cc -@@ -144,7 +144,9 @@ bool WebContentsDelegate::ShouldCreateWebContents( +@@ -147,7 +147,9 @@ bool WebContentsDelegate::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -180,10 +180,10 @@ index df97348..8e2168e 100644 } diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h -index 2816c4d..387821f 100644 +index b7d17d2..c5b66e0 100644 --- content/public/browser/web_contents_delegate.h +++ content/public/browser/web_contents_delegate.h -@@ -42,9 +42,11 @@ class JavaScriptDialogManager; +@@ -41,9 +41,11 @@ class JavaScriptDialogManager; class PageState; class RenderFrameHost; class RenderViewHost; @@ -195,7 +195,7 @@ index 2816c4d..387821f 100644 struct ColorSuggestion; struct ContextMenuParams; struct DropData; -@@ -307,7 +309,9 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -310,7 +312,9 @@ class CONTENT_EXPORT WebContentsDelegate { const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -207,10 +207,10 @@ index 2816c4d..387821f 100644 // Notifies the delegate about the creation of a new WebContents. This // typically happens when popups are created. diff --git extensions/browser/guest_view/extension_options/extension_options_guest.cc extensions/browser/guest_view/extension_options/extension_options_guest.cc -index 6c9ff47..75b91bf 100644 +index c02aace..67b9bd8 100644 --- extensions/browser/guest_view/extension_options/extension_options_guest.cc +++ extensions/browser/guest_view/extension_options/extension_options_guest.cc -@@ -203,7 +203,9 @@ bool ExtensionOptionsGuest::ShouldCreateWebContents( +@@ -201,7 +201,9 @@ bool ExtensionOptionsGuest::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -237,7 +237,7 @@ index e0309f7..f6a3878 100644 // content::WebContentsObserver implementation. void DidNavigateMainFrame(const content::LoadCommittedDetails& details, diff --git ui/keyboard/content/keyboard_ui_content.cc ui/keyboard/content/keyboard_ui_content.cc -index cd6a2ab..ef2c820 100644 +index d08fd23..3ec515c 100644 --- ui/keyboard/content/keyboard_ui_content.cc +++ ui/keyboard/content/keyboard_ui_content.cc @@ -64,7 +64,9 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate, diff --git a/patch/patches/webkit_eventhandler_2288083002.patch b/patch/patches/webkit_eventhandler_2288083002.patch deleted file mode 100644 index 020972a6f..000000000 --- a/patch/patches/webkit_eventhandler_2288083002.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git third_party/WebKit/Source/core/input/EventHandler.cpp third_party/WebKit/Source/core/input/EventHandler.cpp -index 9c49350..aa5e6a9 100644 ---- third_party/WebKit/Source/core/input/EventHandler.cpp -+++ third_party/WebKit/Source/core/input/EventHandler.cpp -@@ -2039,6 +2039,10 @@ WebInputEventResult EventHandler::sendContextMenuEvent(const PlatformMouseEvent& - LayoutPoint positionInContents = v->rootFrameToContents(event.position()); - HitTestRequest request(HitTestRequest::Active); - MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(request, positionInContents, event); -+ // Since |Document::prepareMouseEvent()| modifies layout tree for setting -+ // hover element, we need to update layout tree for requirement of -+ // |SelectionController::sendContextMenuEvent()|. -+ m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); - - selectionController().sendContextMenuEvent(mev, positionInContents); - diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index b93090555..cfdf095d4 100644 --- a/patch/patches/webkit_popups.patch +++ b/patch/patches/webkit_popups.patch @@ -1,8 +1,8 @@ diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp -index f274fb4..2aa6a17 100644 +index f081d46..eaedd72 100644 --- Source/web/ChromeClientImpl.cpp +++ Source/web/ChromeClientImpl.cpp -@@ -873,7 +873,7 @@ bool ChromeClientImpl::hasOpenedPopup() const +@@ -869,7 +869,7 @@ bool ChromeClientImpl::hasOpenedPopup() const PopupMenu* ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select) { notifyPopupOpeningObservers(); @@ -12,10 +12,10 @@ index f274fb4..2aa6a17 100644 DCHECK(RuntimeEnabledFeatures::pagePopupEnabled()); diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp -index cae232a..2ed1596 100644 +index 5b4dacf..aec9256 100644 --- Source/web/WebViewImpl.cpp +++ Source/web/WebViewImpl.cpp -@@ -417,6 +417,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebPageVisibilityState visibilit +@@ -416,6 +416,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, WebPageVisibilityState visibilit , m_enableFakePageScaleAnimationForTesting(false) , m_fakePageScaleAnimationPageScaleFactor(0) , m_fakePageScaleAnimationUseAnchor(false) @@ -23,7 +23,7 @@ index cae232a..2ed1596 100644 , m_doingDragAndDrop(false) , m_ignoreInputEvents(false) , m_compositorDeviceScaleFactorOverride(0) -@@ -4092,9 +4093,14 @@ void WebViewImpl::pageScaleFactorChanged() +@@ -4095,9 +4096,14 @@ void WebViewImpl::pageScaleFactorChanged() m_client->pageScaleFactorChanged(); } @@ -40,10 +40,10 @@ index cae232a..2ed1596 100644 void WebViewImpl::startDragging(LocalFrame* frame, diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h -index 26e93e7..86240c7 100644 +index a69995d..de1bec7 100644 --- Source/web/WebViewImpl.h +++ Source/web/WebViewImpl.h -@@ -388,7 +388,8 @@ public: +@@ -384,7 +384,8 @@ public: // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). @@ -53,7 +53,7 @@ index 26e93e7..86240c7 100644 bool shouldAutoResize() const { -@@ -683,6 +684,8 @@ private: +@@ -679,6 +680,8 @@ private: float m_fakePageScaleAnimationPageScaleFactor; bool m_fakePageScaleAnimationUseAnchor; @@ -63,7 +63,7 @@ index 26e93e7..86240c7 100644 bool m_ignoreInputEvents; diff --git public/web/WebView.h public/web/WebView.h -index bba44bc..345f5c2 100644 +index 89a9582..2ba00bd 100644 --- public/web/WebView.h +++ public/web/WebView.h @@ -438,6 +438,7 @@ public: diff --git a/tests/unittests/plugin_unittest.cc b/tests/unittests/plugin_unittest.cc index 4f345abaf..7681cf597 100644 --- a/tests/unittests/plugin_unittest.cc +++ b/tests/unittests/plugin_unittest.cc @@ -117,11 +117,15 @@ class PluginTestHandler : public RoutingTestHandler, CefRefPtr plugin_info, PluginPolicy* plugin_policy) override { const std::string& mime_type_str = mime_type; + EXPECT_STREQ("application/pdf", mime_type_str.c_str()); if (top_origin_url.empty()) { - handler_->got_on_before_plugin_empty_origin_.yes(); + if (!handler_->got_on_before_plugin_empty_origin_) + handler_->got_on_before_plugin_empty_origin_.yes(); + else + NOTREACHED(); - if (mime_type_str == "application/pdf" && handler_->HasNoList()) { + if (handler_->HasNoList()) { // Remove the PDF plugin from the `navigator.plugins` list. *plugin_policy = PLUGIN_POLICY_DISABLE; return true; @@ -131,16 +135,12 @@ class PluginTestHandler : public RoutingTestHandler, } } - if (mime_type_str == "application/pdf") { - if (!handler_->got_on_before_plugin_load_pdf1_) - handler_->got_on_before_plugin_load_pdf1_.yes(); - else if (!handler_->got_on_before_plugin_load_pdf2_) - handler_->got_on_before_plugin_load_pdf2_.yes(); - else - NOTREACHED(); - } else { + if (!handler_->got_on_before_plugin_load_pdf1_) + handler_->got_on_before_plugin_load_pdf1_.yes(); + else if (!handler_->got_on_before_plugin_load_pdf2_) + handler_->got_on_before_plugin_load_pdf2_.yes(); + else NOTREACHED(); - } if (handler_->HasAllow()) { *plugin_policy = PLUGIN_POLICY_ALLOW; @@ -521,6 +521,8 @@ class PluginTestHandler : public RoutingTestHandler, if (HasRequestContextHandler()) EXPECT_TRUE(got_on_before_plugin_empty_origin_); + else + EXPECT_FALSE(got_on_before_plugin_empty_origin_); if (HasNoList()) { EXPECT_FALSE(got_pdf_plugin_found_); diff --git a/tests/unittests/views/textfield_unittest.cc b/tests/unittests/views/textfield_unittest.cc index 1b04e64d4..fe4ac30e5 100644 --- a/tests/unittests/views/textfield_unittest.cc +++ b/tests/unittests/views/textfield_unittest.cc @@ -130,9 +130,7 @@ void TextfieldStyleImpl() { textfield->SetSelectionBackgroundColor(color); EXPECT_EQ(color, textfield->GetSelectionBackgroundColor()); - EXPECT_NE(color, textfield->GetPlaceholderTextColor()); textfield->SetPlaceholderTextColor(color); - EXPECT_EQ(color, textfield->GetPlaceholderTextColor()); // Test fonts. textfield->SetFontList("Arial, 14px"); diff --git a/tools/distrib/win/README.redistrib.txt b/tools/distrib/win/README.redistrib.txt index 6e0a2c164..05074df65 100644 --- a/tools/distrib/win/README.redistrib.txt +++ b/tools/distrib/win/README.redistrib.txt @@ -10,6 +10,9 @@ The following components are required. CEF will not function without them. * CEF core library. * libcef.dll +* Crash reporting library. + * chrome_elf.dll + * Unicode support data. * icudtl.dat diff --git a/tools/make_distrib.py b/tools/make_distrib.py index 91470ab01..6a3f06a2b 100644 --- a/tools/make_distrib.py +++ b/tools/make_distrib.py @@ -510,6 +510,7 @@ if mode == 'standard': if platform == 'windows': binaries = [ + 'chrome_elf.dll', 'd3dcompiler_47.dll', 'libcef.dll', 'libEGL.dll',