diff --git a/BUILD.gn b/BUILD.gn index aa3abb7fc..77e7db190 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -634,13 +634,14 @@ static_library("libcef_static") { "//media/blink", "//net", "//net:net_browser_services", + "//net:net_utility_services", "//net:net_with_v8", "//pdf", "//ppapi/features", "//printing/features", "//skia", "//storage/browser", - "//third_party/brotli", + "//third_party/brotli:dec", "//third_party/cld", "//third_party/hunspell", "//third_party/leveldatabase", diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index a38e3388e..8d77580c3 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,5 +7,5 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': '3a87aecc31cd1ffe751dd72c04e5a96a1fc8108a', + 'chromium_checkout': 'ad51088c0e8776e8dcd963dbe752c4035ba6dab6', } diff --git a/include/capi/cef_scheme_capi.h b/include/capi/cef_scheme_capi.h index 9022a29f6..f1ce06c5d 100644 --- a/include/capi/cef_scheme_capi.h +++ b/include/capi/cef_scheme_capi.h @@ -87,20 +87,30 @@ typedef struct _cef_scheme_registrar_t { // is. For example, "scheme:///some%20text" will remain the same. Non-standard // scheme URLs cannot be used as a target for form submission. // - // If |is_local| is true (1) the scheme will be treated as local (i.e., with - // the same security rules as those applied to "file" URLs). Normal pages - // cannot link to or access local URLs. Also, by default, local URLs can only - // perform XMLHttpRequest calls to the same URL (origin + path) that - // originated the request. To allow XMLHttpRequest calls from a local URL to - // other URLs with the same origin set the - // CefSettings.file_access_from_file_urls_allowed value to true (1). To allow - // XMLHttpRequest calls from a local URL to all origins set the - // CefSettings.universal_access_from_file_urls_allowed value to true (1). + // If |is_local| is true (1) the scheme will be treated with the same security + // rules as those applied to "file" URLs. Normal pages cannot link to or + // access local URLs. Also, by default, local URLs can only perform + // XMLHttpRequest calls to the same URL (origin + path) that originated the + // request. To allow XMLHttpRequest calls from a local URL to other URLs with + // the same origin set the CefSettings.file_access_from_file_urls_allowed + // value to true (1). To allow XMLHttpRequest calls from a local URL to all + // origins set the CefSettings.universal_access_from_file_urls_allowed value + // to true (1). // - // If |is_display_isolated| is true (1) the scheme will be treated as display- - // isolated. This means that pages cannot display these URLs unless they are - // from the same scheme. For example, pages in another origin cannot create - // iframes or hyperlinks to URLs with this scheme. + // If |is_display_isolated| is true (1) the scheme can only be displayed from + // other content hosted with the same scheme. For example, pages in other + // origins cannot create iframes or hyperlinks to URLs with the scheme. For + // schemes that must be accessible from other schemes set this value to false + // (0), set |is_cors_enabled| to true (1), and use CORS "Access-Control-Allow- + // Origin" headers to further restrict access. + // + // If |is_secure| is true (1) the scheme will be treated with the same + // security rules as those applied to "https" URLs. For example, loading this + // scheme from other secure schemes will not trigger mixed content warnings. + // + // If |is_cors_enabled| is true (1) the scheme that can be sent CORS requests. + // This value should be true (1) in most cases where |is_standard| is true + // (1). // // This function may be called on any thread. It should only be called once // per unique |scheme_name| value. If |scheme_name| is already registered or @@ -108,7 +118,7 @@ typedef struct _cef_scheme_registrar_t { /// int (CEF_CALLBACK *add_custom_scheme)(struct _cef_scheme_registrar_t* self, const cef_string_t* scheme_name, int is_standard, int is_local, - int is_display_isolated); + int is_display_isolated, int is_secure, int is_cors_enabled); } cef_scheme_registrar_t; diff --git a/include/cef_scheme.h b/include/cef_scheme.h index a966a9a79..ec9f33e10 100644 --- a/include/cef_scheme.h +++ b/include/cef_scheme.h @@ -111,9 +111,9 @@ class CefSchemeRegistrar : public virtual CefBase { // as-is. For example, "scheme:///some%20text" will remain the same. // Non-standard scheme URLs cannot be used as a target for form submission. // - // If |is_local| is true the scheme will be treated as local (i.e., with the - // same security rules as those applied to "file" URLs). Normal pages cannot - // link to or access local URLs. Also, by default, local URLs can only perform + // If |is_local| is true the scheme will be treated with the same security + // rules as those applied to "file" URLs. Normal pages cannot link to or + // access local URLs. Also, by default, local URLs can only perform // XMLHttpRequest calls to the same URL (origin + path) that originated the // request. To allow XMLHttpRequest calls from a local URL to other URLs with // the same origin set the CefSettings.file_access_from_file_urls_allowed @@ -121,10 +121,19 @@ class CefSchemeRegistrar : public virtual CefBase { // origins set the CefSettings.universal_access_from_file_urls_allowed value // to true. // - // If |is_display_isolated| is true the scheme will be treated as display- - // isolated. This means that pages cannot display these URLs unless they are - // from the same scheme. For example, pages in another origin cannot create - // iframes or hyperlinks to URLs with this scheme. + // If |is_display_isolated| is true the scheme can only be displayed from + // other content hosted with the same scheme. For example, pages in other + // origins cannot create iframes or hyperlinks to URLs with the scheme. For + // schemes that must be accessible from other schemes set this value to false, + // set |is_cors_enabled| to true, and use CORS "Access-Control-Allow-Origin" + // headers to further restrict access. + // + // If |is_secure| is true the scheme will be treated with the same security + // rules as those applied to "https" URLs. For example, loading this scheme + // from other secure schemes will not trigger mixed content warnings. + // + // If |is_cors_enabled| is true the scheme that can be sent CORS requests. + // This value should be true in most cases where |is_standard| is true. // // This function may be called on any thread. It should only be called once // per unique |scheme_name| value. If |scheme_name| is already registered or @@ -134,7 +143,9 @@ class CefSchemeRegistrar : public virtual CefBase { virtual bool AddCustomScheme(const CefString& scheme_name, bool is_standard, bool is_local, - bool is_display_isolated) =0; + bool is_display_isolated, + bool is_secure, + bool is_cors_enabled) =0; }; diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 9483ef2c4..45356d6a8 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -62,6 +62,7 @@ #include "content/public/browser/render_widget_host.h" #include "content/public/browser/resource_request_info.h" #include "third_party/WebKit/public/web/WebFindOptions.h" +#include "ui/events/base_event_utils.h" #if defined(OS_MACOSX) #include "components/spellcheck/browser/spellcheck_platform.h" @@ -1035,7 +1036,10 @@ void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) { if (!web_contents() || !platform_delegate_) return; - content::NativeWebKeyboardEvent web_event; + content::NativeWebKeyboardEvent web_event( + blink::WebInputEvent::Undefined, + blink::WebInputEvent::NoModifiers, + ui::EventTimeStampToSeconds(ui::EventTimeForNow())); platform_delegate_->TranslateKeyEvent(web_event, event); platform_delegate_->SendKeyEvent(web_event); } @@ -1214,7 +1218,7 @@ void CefBrowserHostImpl::Reload() { } if (web_contents_.get()) - web_contents_->GetController().Reload(true); + web_contents_->GetController().Reload(content::ReloadType::NORMAL, true); } else { CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::Reload, this)); @@ -1230,8 +1234,10 @@ void CefBrowserHostImpl::ReloadIgnoreCache() { return; } - if (web_contents_.get()) - web_contents_->GetController().ReloadBypassingCache(true); + if (web_contents_.get()) { + web_contents_->GetController().Reload( + content::ReloadType::BYPASSING_CACHE, true); + } } else { CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this)); @@ -2235,10 +2241,12 @@ bool CefBrowserHostImpl::CanDragEnter( bool CefBrowserHostImpl::ShouldCreateWebContents( content::WebContents* web_contents, - int route_id, - int main_frame_route_id, + content::SiteInstance* source_site_instance, + int32_t route_id, + int32_t main_frame_route_id, int32_t main_frame_widget_route_id, WindowContainerType window_container_type, + const GURL& opener_url, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 103e28a98..55ad08c73 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -404,10 +404,12 @@ class CefBrowserHostImpl : public CefBrowserHost, blink::WebDragOperationsMask operations_allowed) override; bool ShouldCreateWebContents( content::WebContents* web_contents, - int route_id, - int main_frame_route_id, + content::SiteInstance* source_site_instance, + int32_t route_id, + int32_t main_frame_route_id, int32_t main_frame_widget_route_id, WindowContainerType window_container_type, + const GURL& opener_url, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, diff --git a/libcef/browser/browser_info_manager.cc b/libcef/browser/browser_info_manager.cc index 04d6452d2..e00209fa9 100644 --- a/libcef/browser/browser_info_manager.cc +++ b/libcef/browser/browser_info_manager.cc @@ -145,17 +145,16 @@ bool CefBrowserInfoManager::CanCreateWindow( const blink::WebWindowFeatures& features, bool user_gesture, bool opener_suppressed, - int render_process_id, - int opener_render_view_id, + int opener_render_process_id, int opener_render_frame_id, bool* no_javascript_access) { - DCHECK_NE(render_process_id, content::ChildProcessHost::kInvalidUniqueID); - DCHECK_GT(opener_render_view_id, 0); + DCHECK_NE(opener_render_process_id, + content::ChildProcessHost::kInvalidUniqueID); DCHECK_GT(opener_render_frame_id, 0); bool is_guest_view = false; - CefRefPtr browser = extensions::GetOwnerBrowserForView( - render_process_id, opener_render_view_id, &is_guest_view); + CefRefPtr browser = extensions::GetOwnerBrowserForFrame( + opener_render_process_id, opener_render_frame_id, &is_guest_view); DCHECK(browser.get()); if (!browser.get()) { // Cancel the popup. @@ -190,8 +189,7 @@ bool CefBrowserInfoManager::CanCreateWindow( auto pending_popup = base::MakeUnique(); pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW; - pending_popup->opener_process_id = render_process_id; - pending_popup->opener_view_id = opener_render_view_id; + pending_popup->opener_process_id = opener_render_process_id; pending_popup->opener_frame_id = opener_render_frame_id; pending_popup->target_url = target_url; pending_popup->target_frame_name = frame_name; @@ -250,7 +248,7 @@ bool CefBrowserInfoManager::CanCreateWindow( // Filtering needs to be done on the UI thread. CEF_POST_TASK(CEF_UIT, - base::Bind(FilterPendingPopupURL, render_process_id, + base::Bind(FilterPendingPopupURL, opener_render_process_id, base::Passed(&pending_popup))); } @@ -262,10 +260,11 @@ void CefBrowserInfoManager::ShouldCreateWebContents( const GURL& target_url, content::WebContentsView** view, content::RenderViewHostDelegateView** delegate_view) { + content::RenderFrameHost* host = + web_contents->GetRenderViewHost()->GetMainFrame(); std::unique_ptr pending_popup = PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW, - web_contents->GetRenderViewHost()->GetProcess()->GetID(), - web_contents->GetRenderViewHost()->GetRoutingID(), + host->GetProcess()->GetID(), host->GetRoutingID(), target_url); DCHECK(pending_popup.get()); DCHECK(pending_popup->platform_delegate.get()); @@ -290,11 +289,12 @@ void CefBrowserInfoManager::WebContentsCreated( DCHECK(source_contents); DCHECK(new_contents); + content::RenderFrameHost* host = + source_contents->GetRenderViewHost()->GetMainFrame(); std::unique_ptr pending_popup = PopPendingPopup( CefBrowserInfoManager::PendingPopup::SHOULD_CREATE_WEB_CONTENTS, - source_contents->GetRenderViewHost()->GetProcess()->GetID(), - source_contents->GetRenderViewHost()->GetRoutingID(), + host->GetProcess()->GetID(), host->GetRoutingID(), target_url); DCHECK(pending_popup.get()); DCHECK(pending_popup->platform_delegate.get()); @@ -442,10 +442,10 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed( } void CefBrowserInfoManager::FilterPendingPopupURL( - int render_process_id, + int opener_process_id, std::unique_ptr pending_popup) { content::RenderProcessHost* host = - content::RenderProcessHost::FromID(render_process_id); + content::RenderProcessHost::FromID(opener_process_id); DCHECK(host); host->FilterURL(false, &pending_popup->target_url); @@ -461,10 +461,10 @@ std::unique_ptr CefBrowserInfoManager::PopPendingPopup( PendingPopup::Step step, int opener_process_id, - int opener_view_id, + int opener_frame_id, const GURL& target_url) { DCHECK_GT(opener_process_id, 0); - DCHECK_GT(opener_view_id, 0); + DCHECK_GT(opener_frame_id, 0); base::AutoLock lock_scope(pending_popup_lock_); @@ -473,7 +473,7 @@ std::unique_ptr PendingPopup* popup = *it; if (popup->step == step && popup->opener_process_id == opener_process_id && - popup->opener_view_id == opener_view_id && + popup->opener_frame_id == opener_frame_id && popup->target_url == target_url) { pending_popup_list_.weak_erase(it); return base::WrapUnique(popup); diff --git a/libcef/browser/browser_info_manager.h b/libcef/browser/browser_info_manager.h index 8c1946bb8..55d08d6fc 100644 --- a/libcef/browser/browser_info_manager.h +++ b/libcef/browser/browser_info_manager.h @@ -67,8 +67,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { const blink::WebWindowFeatures& features, bool user_gesture, bool opener_suppressed, - int render_process_id, - int opener_render_view_id, + int opener_render_process_id, int opener_render_frame_id, bool* no_javascript_access); @@ -113,7 +112,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // Retrieves the CefBrowserInfo matching the specified IDs or an empty // pointer if no match is found. It is allowed to add new callers of this // method but consider using CefBrowserHostImpl::GetBrowserFor[View|Frame]() - // or extensions::GetOwnerBrowserForView() instead. + // or extensions::GetOwnerBrowserForFrame() instead. // |is_guest_view| will be set to true if the IDs match a guest view // associated with the returned browser info instead of the browser itself. scoped_refptr GetBrowserInfoForView(int render_process_id, @@ -157,8 +156,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // |target_url| will be empty if a popup is created via window.open() and // never navigated. For example: javascript:window.open(); int opener_process_id; - int opener_view_id; - int64 opener_frame_id; + int opener_frame_id; GURL target_url; std::string target_frame_name; @@ -176,7 +174,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // URIs, rewrites the URL to "about:blank". We need to apply the same filter // otherwise ShouldCreateWebContents will fail to retrieve the PopupInfo. static void FilterPendingPopupURL( - int render_process_id, + int opener_process_id, std::unique_ptr pending_popup); // Manage pending popups. @@ -184,7 +182,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { std::unique_ptr PopPendingPopup( PendingPopup::Step step, int opener_process_id, - int opener_view_id, + int opener_frame_id, const GURL& target_url); // Retrieves the BrowserInfo matching the specified IDs. If both sets are diff --git a/libcef/browser/browser_main.cc b/libcef/browser/browser_main.cc index 2ec4c2194..c1d792ea0 100644 --- a/libcef/browser/browser_main.cc +++ b/libcef/browser/browser_main.cc @@ -47,6 +47,7 @@ #include "ui/views/widget/desktop_aura/desktop_screen.h" #if defined(OS_WIN) +#include "libcef/common/crash_reporting_win.h" #include "ui/base/cursor/cursor_loader_win.h" #endif #endif // defined(USE_AURA) @@ -168,6 +169,10 @@ int CefBrowserMainParts::PreCreateThreads() { } void CefBrowserMainParts::PreMainMessageLoopRun() { +#if defined(OS_WIN) + crash_reporting_win::BlockUntilHandlerStarted(); +#endif + if (extensions::ExtensionsEnabled()) { // Initialize extension global objects before creating the global // BrowserContext. diff --git a/libcef/browser/browser_util.cc b/libcef/browser/browser_util.cc index 0566539ac..92c02f908 100644 --- a/libcef/browser/browser_util.cc +++ b/libcef/browser/browser_util.cc @@ -10,7 +10,7 @@ namespace browser_util { bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event, CefKeyEvent& cef_event) { - switch (event.type) { + switch (event.type()) { case blink::WebKeyboardEvent::RawKeyDown: cef_event.type = KEYEVENT_RAWKEYDOWN; break; @@ -28,15 +28,15 @@ bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event, } cef_event.modifiers = 0; - if (event.modifiers & blink::WebKeyboardEvent::ShiftKey) + if (event.modifiers() & blink::WebKeyboardEvent::ShiftKey) cef_event.modifiers |= EVENTFLAG_SHIFT_DOWN; - if (event.modifiers & blink::WebKeyboardEvent::ControlKey) + if (event.modifiers() & blink::WebKeyboardEvent::ControlKey) cef_event.modifiers |= EVENTFLAG_CONTROL_DOWN; - if (event.modifiers & blink::WebKeyboardEvent::AltKey) + if (event.modifiers() & blink::WebKeyboardEvent::AltKey) cef_event.modifiers |= EVENTFLAG_ALT_DOWN; - if (event.modifiers & blink::WebKeyboardEvent::MetaKey) + if (event.modifiers() & blink::WebKeyboardEvent::MetaKey) cef_event.modifiers |= EVENTFLAG_COMMAND_DOWN; - if (event.modifiers & blink::WebKeyboardEvent::IsKeyPad) + if (event.modifiers() & blink::WebKeyboardEvent::IsKeyPad) cef_event.modifiers |= EVENTFLAG_IS_KEY_PAD; cef_event.windows_key_code = event.windowsKeyCode; diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index 4a76b82e1..4ef7d7e28 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -98,7 +98,7 @@ metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() { return NULL; } -rappor::RapporService* ChromeBrowserProcessStub::rappor_service() { +rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() { NOTREACHED(); return NULL; } @@ -322,7 +322,7 @@ bool ChromeBrowserProcessStub::created_local_state() const { return false; } -#if defined(ENABLE_WEBRTC) +#if BUILDFLAG(ENABLE_WEBRTC) WebRtcLogUploader* ChromeBrowserProcessStub::webrtc_log_uploader() { NOTREACHED(); return NULL; @@ -351,7 +351,8 @@ memory::TabManager* ChromeBrowserProcessStub::GetTabManager() { return NULL; } -PhysicalWebDataSource* ChromeBrowserProcessStub::GetPhysicalWebDataSource() { +physical_web::PhysicalWebDataSource* +ChromeBrowserProcessStub::GetPhysicalWebDataSource() { NOTREACHED(); return NULL; } diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index 0376430af..a83a882e3 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -16,6 +16,7 @@ #include "chrome/browser/extensions/event_router_forwarder.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "base/compiler_specific.h" +#include "media/media_features.h" class ChromeProfileManagerStub; @@ -43,7 +44,7 @@ class ChromeBrowserProcessStub : public BrowserProcess, metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager() override; metrics::MetricsService* metrics_service() override; - rappor::RapporService* rappor_service() override; + rappor::RapporServiceImpl* rappor_service() override; IOThread* io_thread() override; WatchDogThread* watchdog_thread() override; ProfileManager* profile_manager() override; @@ -100,7 +101,7 @@ class ChromeBrowserProcessStub : public BrowserProcess, MediaFileSystemRegistry* media_file_system_registry() override; bool created_local_state() const override; -#if defined(ENABLE_WEBRTC) +#if BUILDFLAG(ENABLE_WEBRTC) WebRtcLogUploader* webrtc_log_uploader() override; #endif network_time::NetworkTimeTracker* network_time_tracker() override; @@ -108,7 +109,7 @@ class ChromeBrowserProcessStub : public BrowserProcess, shell_integration::DefaultWebClientState CachedDefaultWebClientState() override; memory::TabManager* GetTabManager() override; - PhysicalWebDataSource* GetPhysicalWebDataSource() override; + physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() override; // BrowserContextIncognitoHelper implementation. content::BrowserContext* GetBrowserContextRedirectedInIncognito( diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index 827bf5740..ad091ce59 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -284,8 +284,8 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext { bool handled = false; CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForView(render_process_id, - params.render_view_id); + CefBrowserHostImpl::GetBrowserForFrame(render_process_id, + params.render_frame_id); if (browser.get()) { CefRefPtr client = browser->GetClient(); if (client.get()) { @@ -593,8 +593,7 @@ void CefContentBrowserClient::SiteInstanceDeleting( } std::unique_ptr -CefContentBrowserClient::GetServiceManifestOverlay( - const std::string& name) { +CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { int id = -1; if (name == content::mojom::kBrowserServiceName) id = IDR_CEF_BROWSER_MANIFEST_OVERLAY; @@ -820,6 +819,8 @@ void CefContentBrowserClient::SelectClientCertificate( } bool CefContentBrowserClient::CanCreateWindow( + int opener_render_process_id, + int opener_render_frame_id, const GURL& opener_url, const GURL& opener_top_level_frame_url, const GURL& source_origin, @@ -832,17 +833,14 @@ bool CefContentBrowserClient::CanCreateWindow( bool user_gesture, bool opener_suppressed, content::ResourceContext* context, - int render_process_id, - int opener_render_view_id, - int opener_render_frame_id, bool* no_javascript_access) { CEF_REQUIRE_IOT(); *no_javascript_access = false; return CefBrowserInfoManager::GetInstance()->CanCreateWindow( target_url, referrer, frame_name, disposition, features, user_gesture, - opener_suppressed, render_process_id, opener_render_view_id, - opener_render_frame_id, no_javascript_access); + opener_suppressed, opener_render_process_id, opener_render_frame_id, + no_javascript_access); } void CefContentBrowserClient::ResourceDispatcherHostCreated() { @@ -855,6 +853,8 @@ void CefContentBrowserClient::ResourceDispatcherHostCreated() { void CefContentBrowserClient::OverrideWebkitPrefs( content::RenderViewHost* rvh, content::WebPreferences* prefs) { + // Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr + // when this method is called. renderer_prefs::PopulateWebPreferences(rvh, *prefs); if (rvh->GetWidget()->GetView()) { @@ -884,12 +884,12 @@ content::DevToolsManagerDelegate* return new CefDevToolsManagerDelegate(); } -ScopedVector +std::vector> CefContentBrowserClient::CreateThrottlesForNavigation( content::NavigationHandle* navigation_handle) { CEF_REQUIRE_UIT(); - ScopedVector throttles; + std::vector> throttles; const bool is_main_frame = navigation_handle->IsInMainFrame(); @@ -919,13 +919,13 @@ CefContentBrowserClient::CreateThrottlesForNavigation( frame_id = CefFrameHostImpl::kInvalidFrameId; } - content::NavigationThrottle* throttle = - new navigation_interception::InterceptNavigationThrottle( + std::unique_ptr throttle = + base::MakeUnique( navigation_handle, base::Bind(&NavigationOnUIThread, is_main_frame, frame_id, parent_frame_id), true); - throttles.push_back(throttle); + throttles.push_back(std::move(throttle)); return throttles; } diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h index 8bef2ed75..74418f769 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/content_browser_client.h @@ -47,7 +47,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient { void SiteInstanceGotProcess(content::SiteInstance* site_instance) override; void SiteInstanceDeleting(content::SiteInstance* site_instance) override; std::unique_ptr GetServiceManifestOverlay( - const std::string& name) override; + base::StringPiece name) override; void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) override; content::QuotaPermissionContext* @@ -70,7 +70,9 @@ class CefContentBrowserClient : public content::ContentBrowserClient { content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, std::unique_ptr delegate) override; - bool CanCreateWindow(const GURL& opener_url, + bool CanCreateWindow(int opener_render_process_id, + int opener_render_frame_id, + const GURL& opener_url, const GURL& opener_top_level_frame_url, const GURL& source_origin, WindowContainerType container_type, @@ -82,9 +84,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient { bool user_gesture, bool opener_suppressed, content::ResourceContext* context, - int render_process_id, - int opener_render_view_id, - int opener_render_frame_id, bool* no_javascript_access) override; void ResourceDispatcherHostCreated() override; void OverrideWebkitPrefs(content::RenderViewHost* rvh, @@ -95,7 +94,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient { void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override; content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override; - ScopedVector CreateThrottlesForNavigation( + std::vector> + CreateThrottlesForNavigation( content::NavigationHandle* navigation_handle) override; #if defined(OS_POSIX) && !defined(OS_MACOSX) diff --git a/libcef/browser/context.cc b/libcef/browser/context.cc index 7071d51e0..35cae5bb1 100644 --- a/libcef/browser/context.cc +++ b/libcef/browser/context.cc @@ -60,8 +60,7 @@ class CefForceShutdown { } } g_force_shutdown; -#if defined(OS_WIN) -#if defined(ARCH_CPU_X86_64) +#if defined(OS_WIN) && defined(ARCH_CPU_X86_64) // VS2013 only checks the existence of FMA3 instructions, not the enabled-ness // of them at the OS level (this is fixed in VS2015). We force off usage of // FMA3 instructions in the CRT to avoid using that path and hitting illegal @@ -73,18 +72,7 @@ void DisableFMA3() { disabled = true; _set_FMA3_enable(0); } -#endif // defined(ARCH_CPU_X86_64) - -// Signal chrome_elf to initialize crash reporting, rather than doing it in -// DllMain. See https://crbug.com/656800 for details. -void InitCrashReporter() { - static bool initialized = false; - if (initialized) - return; - initialized = true; - SignalInitializeCrashReporting(); -} -#endif // defined(OS_WIN) +#endif #if defined(OS_MACOSX) || defined(OS_WIN) @@ -132,12 +120,9 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line) { int CefExecuteProcess(const CefMainArgs& args, CefRefPtr application, void* windows_sandbox_info) { -#if defined(OS_WIN) -#if defined(ARCH_CPU_X86_64) +#if defined(OS_WIN) && defined(ARCH_CPU_X86_64) DisableFMA3(); #endif - InitCrashReporter(); -#endif base::CommandLine command_line(base::CommandLine::NO_PROGRAM); #if defined(OS_WIN) @@ -191,12 +176,9 @@ bool CefInitialize(const CefMainArgs& args, const CefSettings& settings, CefRefPtr application, void* windows_sandbox_info) { -#if defined(OS_WIN) -#if defined(ARCH_CPU_X86_64) +#if defined(OS_WIN) && defined(ARCH_CPU_X86_64) DisableFMA3(); #endif - InitCrashReporter(); -#endif // Return true if the global context already exists. if (g_context) diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index 54c4bc1ca..11a66e6ae 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -230,7 +230,7 @@ void CefDevToolsFrontend::SetPreferences(const std::string& 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)) + if (!it.value().IsType(base::Value::Type::STRING)) continue; preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); } @@ -404,5 +404,6 @@ void CefDevToolsFrontend::SendMessageAck(int request_id, void CefDevToolsFrontend::AgentHostClosed( content::DevToolsAgentHost* agent_host, bool replaced) { DCHECK(agent_host == agent_host_.get()); + agent_host_ = nullptr; Close(); } diff --git a/libcef/browser/extensions/browser_extensions_util.cc b/libcef/browser/extensions/browser_extensions_util.cc index 0bbab31ce..29bd4b9ee 100644 --- a/libcef/browser/extensions/browser_extensions_util.cc +++ b/libcef/browser/extensions/browser_extensions_util.cc @@ -59,27 +59,27 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) { return NULL; } -CefRefPtr GetOwnerBrowserForView(int render_process_id, - int render_routing_id, - bool* is_guest_view) { +CefRefPtr GetOwnerBrowserForFrame(int render_process_id, + int render_routing_id, + bool* is_guest_view) { if (CEF_CURRENTLY_ON_UIT()) { // Use the non-thread-safe but potentially faster approach. - content::RenderViewHost* host = - content::RenderViewHost::FromID(render_process_id, render_routing_id); + content::RenderFrameHost* host = + content::RenderFrameHost::FromID(render_process_id, render_routing_id); if (host) return GetOwnerBrowserForHost(host, is_guest_view); return NULL; } else { // Use the thread-safe approach. scoped_refptr info = - CefBrowserInfoManager::GetInstance()->GetBrowserInfoForView( + CefBrowserInfoManager::GetInstance()->GetBrowserInfoForFrame( render_process_id, render_routing_id, is_guest_view); if (info.get()) { CefRefPtr browser = info->browser(); if (!browser.get()) { LOG(WARNING) << "Found browser id " << info->browser_id() << " but no browser object matching view process id " << - render_process_id << " and routing id " << + render_process_id << " and frame routing id " << render_routing_id; } return browser; @@ -109,4 +109,25 @@ CefRefPtr GetOwnerBrowserForHost( return browser; } +CefRefPtr GetOwnerBrowserForHost( + content::RenderFrameHost* host, + bool* is_guest_view) { + if (is_guest_view) + *is_guest_view = false; + + CefRefPtr browser = + CefBrowserHostImpl::GetBrowserForHost(host); + if (!browser.get() && ExtensionsEnabled()) { + // Retrieve the owner browser, if any. + content::WebContents* owner = GetOwnerForGuestContents( + content::WebContents::FromRenderFrameHost(host)); + if (owner) { + browser = CefBrowserHostImpl::GetBrowserForContents(owner); + if (browser.get() && is_guest_view) + *is_guest_view = true; + } + } + return browser; +} + } // namespace extensions diff --git a/libcef/browser/extensions/browser_extensions_util.h b/libcef/browser/extensions/browser_extensions_util.h index 8668720ce..e85baf32f 100644 --- a/libcef/browser/extensions/browser_extensions_util.h +++ b/libcef/browser/extensions/browser_extensions_util.h @@ -28,19 +28,24 @@ void GetAllGuestsForOwnerContents(content::WebContents* owner, content::WebContents* GetOwnerForGuestContents(content::WebContents* guest); // Returns the CefBrowserHostImpl that owns the host identified by the specified -// view routing IDs, if any. |is_guest_view| will be set to true if the IDs +// routing IDs, if any. |is_guest_view| will be set to true if the IDs // match a guest view associated with the returned browser instead of the // browser itself. -CefRefPtr GetOwnerBrowserForView(int render_process_id, - int render_routing_id, - bool* is_guest_view); +CefRefPtr GetOwnerBrowserForFrame(int render_process_id, + int render_routing_id, + bool* is_guest_view); // Returns the CefBrowserHostImpl that owns the specified |host|, if any. // |is_guest_view| will be set to true if the host matches a guest view // associated with the returned browser instead of the browser itself. +// TODO(cef): Delete the RVH variant once the remaining use case +// (via CefContentBrowserClient::OverrideWebkitPrefs) has been removed. CefRefPtr GetOwnerBrowserForHost( content::RenderViewHost* host, bool* is_guest_view); +CefRefPtr GetOwnerBrowserForHost( + content::RenderFrameHost* host, + bool* is_guest_view); } // namespace extensions diff --git a/libcef/browser/extensions/extension_system.cc b/libcef/browser/extensions/extension_system.cc index 0243ae8b3..cd4f7a677 100644 --- a/libcef/browser/extensions/extension_system.cc +++ b/libcef/browser/extensions/extension_system.cc @@ -68,7 +68,7 @@ base::DictionaryValue* ParseManifest( JSONStringValueDeserializer deserializer(manifest_contents); std::unique_ptr manifest(deserializer.Deserialize(NULL, NULL)); - if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) { + if (!manifest.get() || !manifest->IsType(base::Value::Type::DICTIONARY)) { LOG(ERROR) << "Failed to parse extension manifest."; return NULL; } diff --git a/libcef/browser/native/browser_platform_delegate_native_linux.cc b/libcef/browser/native/browser_platform_delegate_native_linux.cc index 6c1daf0c4..0fd11cb3a 100644 --- a/libcef/browser/native/browser_platform_delegate_native_linux.cc +++ b/libcef/browser/native/browser_platform_delegate_native_linux.cc @@ -253,21 +253,19 @@ void CefBrowserPlatformDelegateNativeLinux::HandleExternalProtocol( void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent( content::NativeWebKeyboardEvent& result, const CefKeyEvent& key_event) const { - result.timeStampSeconds = GetSystemUptime(); - result.windowsKeyCode = key_event.windows_key_code; result.nativeKeyCode = key_event.native_key_code; result.isSystemKey = key_event.is_system_key ? 1 : 0; switch (key_event.type) { case KEYEVENT_RAWKEYDOWN: case KEYEVENT_KEYDOWN: - result.type = blink::WebInputEvent::RawKeyDown; + result.setType(blink::WebInputEvent::RawKeyDown); break; case KEYEVENT_KEYUP: - result.type = blink::WebInputEvent::KeyUp; + result.setType(blink::WebInputEvent::KeyUp); break; case KEYEVENT_CHAR: - result.type = blink::WebInputEvent::Char; + result.setType(blink::WebInputEvent::Char); break; default: NOTREACHED(); @@ -287,7 +285,8 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent( result.text[0] = key_event.character; result.unmodifiedText[0] = key_event.unmodified_character; - result.modifiers |= TranslateModifiers(key_event.modifiers); + result.setModifiers( + result.modifiers() | TranslateModifiers(key_event.modifiers)); } void CefBrowserPlatformDelegateNativeLinux::TranslateClickEvent( @@ -299,18 +298,18 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateClickEvent( switch (type) { case MBT_LEFT: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Left; break; case MBT_MIDDLE: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Middle; break; case MBT_RIGHT: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Right; break; default: @@ -327,7 +326,7 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMoveEvent( TranslateMouseEvent(result, mouse_event); if (!mouseLeave) { - result.type = blink::WebInputEvent::MouseMove; + result.setType(blink::WebInputEvent::MouseMove); if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) result.button = blink::WebMouseEvent::Button::Left; else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) @@ -337,7 +336,7 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMoveEvent( else result.button = blink::WebMouseEvent::Button::NoButton; } else { - result.type = blink::WebInputEvent::MouseLeave; + result.setType(blink::WebInputEvent::MouseLeave); result.button = blink::WebMouseEvent::Button::NoButton; } @@ -351,7 +350,7 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateWheelEvent( result = blink::WebMouseWheelEvent(); TranslateMouseEvent(result, mouse_event); - result.type = blink::WebInputEvent::MouseWheel; + result.setType(blink::WebInputEvent::MouseWheel); static const double scrollbarPixelsPerGtkTick = 40.0; result.deltaX = deltaX; @@ -401,9 +400,10 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent( result.globalY = screen_pt.y(); // modifiers - result.modifiers |= TranslateModifiers(mouse_event.modifiers); + result.setModifiers( + result.modifiers() | TranslateModifiers(mouse_event.modifiers)); // timestamp - result.timeStampSeconds = GetSystemUptime(); + result.setTimeStampSeconds(GetSystemUptime()); } diff --git a/libcef/browser/native/browser_platform_delegate_native_mac.mm b/libcef/browser/native/browser_platform_delegate_native_mac.mm index 85b4974cf..62f5a4de5 100644 --- a/libcef/browser/native/browser_platform_delegate_native_mac.mm +++ b/libcef/browser/native/browser_platform_delegate_native_mac.mm @@ -21,6 +21,8 @@ #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" #include "third_party/WebKit/public/platform/WebInputEvent.h" +#include "third_party/WebKit/public/platform/WebMouseEvent.h" +#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" #import "ui/base/cocoa/cocoa_base_utils.h" #import "ui/base/cocoa/underlay_opengl_hosting_window.h" #include "ui/events/keycodes/keyboard_codes_posix.h" @@ -345,7 +347,7 @@ void CefBrowserPlatformDelegateNativeMac::TranslateKeyEvent( result = content::NativeWebKeyboardEvent(synthetic_event); if (key_event.type == KEYEVENT_CHAR) - result.type = blink::WebInputEvent::Char; + result.setType(blink::WebInputEvent::Char); result.isSystemKey = key_event.is_system_key; } @@ -359,18 +361,18 @@ void CefBrowserPlatformDelegateNativeMac::TranslateClickEvent( switch (type) { case MBT_LEFT: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Left; break; case MBT_MIDDLE: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Middle; break; case MBT_RIGHT: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Right; break; default: @@ -387,7 +389,7 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMoveEvent( TranslateMouseEvent(result, mouse_event); if (!mouseLeave) { - result.type = blink::WebInputEvent::MouseMove; + result.setType(blink::WebInputEvent::MouseMove); if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) result.button = blink::WebMouseEvent::Button::Left; else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) @@ -397,7 +399,7 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMoveEvent( else result.button = blink::WebMouseEvent::Button::NoButton; } else { - result.type = blink::WebInputEvent::MouseLeave; + result.setType(blink::WebInputEvent::MouseLeave); result.button = blink::WebMouseEvent::Button::NoButton; } @@ -411,7 +413,7 @@ void CefBrowserPlatformDelegateNativeMac::TranslateWheelEvent( result = blink::WebMouseWheelEvent(); TranslateMouseEvent(result, mouse_event); - result.type = blink::WebInputEvent::MouseWheel; + result.setType(blink::WebInputEvent::MouseWheel); static const double scrollbarPixelsPerCocoaTick = 40.0; result.deltaX = deltaX; @@ -469,9 +471,10 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent( result.globalY = screen_pt.y(); // modifiers - result.modifiers |= TranslateModifiers(mouse_event.modifiers); + result.setModifiers( + result.modifiers() | TranslateModifiers(mouse_event.modifiers)); // timestamp - Mac OSX specific - result.timeStampSeconds = currentEventTimestamp(); + result.setTimeStampSeconds(currentEventTimestamp()); } diff --git a/libcef/browser/native/browser_platform_delegate_native_win.cc b/libcef/browser/native/browser_platform_delegate_native_win.cc index 65911387e..e0220296d 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.cc +++ b/libcef/browser/native/browser_platform_delegate_native_win.cc @@ -21,6 +21,8 @@ #include "base/strings/utf_string_conversions.h" #include "base/win/registry.h" #include "content/public/browser/native_web_keyboard_event.h" +#include "third_party/WebKit/public/platform/WebMouseEvent.h" +#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" #include "ui/aura/window.h" #include "ui/base/win/shell.h" #include "ui/display/display.h" @@ -329,7 +331,7 @@ void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent( if (!msg.hwnd) return; - switch (event.type) { + switch (event.type()) { case blink::WebInputEvent::RawKeyDown: msg.message = event.isSystemKey ? WM_SYSKEYDOWN : WM_KEYDOWN; break; @@ -349,7 +351,7 @@ void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent( UINT scan_code = ::MapVirtualKeyW(event.windowsKeyCode, MAPVK_VK_TO_VSC); msg.lParam = (scan_code << 16) | // key scan code 1; // key repeat count - if (event.modifiers & content::NativeWebKeyboardEvent::AltKey) + if (event.modifiers() & content::NativeWebKeyboardEvent::AltKey) msg.lParam |= (1 << 29); DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam); @@ -366,21 +368,19 @@ void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol( void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( content::NativeWebKeyboardEvent& result, const CefKeyEvent& key_event) const { - result.timeStampSeconds = GetMessageTime() / 1000.0; - result.windowsKeyCode = key_event.windows_key_code; result.nativeKeyCode = key_event.native_key_code; result.isSystemKey = key_event.is_system_key ? 1 : 0; switch (key_event.type) { case KEYEVENT_RAWKEYDOWN: case KEYEVENT_KEYDOWN: - result.type = blink::WebInputEvent::RawKeyDown; + result.setType(blink::WebInputEvent::RawKeyDown); break; case KEYEVENT_KEYUP: - result.type = blink::WebInputEvent::KeyUp; + result.setType(blink::WebInputEvent::KeyUp); break; case KEYEVENT_CHAR: - result.type = blink::WebInputEvent::Char; + result.setType(blink::WebInputEvent::Char); break; default: NOTREACHED(); @@ -391,7 +391,7 @@ void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( result.domCode = static_cast(ui::KeycodeConverter::NativeKeycodeToDomCode( key_event.native_key_code)); - if (result.type == blink::WebInputEvent::Char) { + if (result.type() == blink::WebInputEvent::Char) { result.domKey = ui::DomKey::FromCharacter(key_event.windows_key_code); } else { // TODO(cef): CefKeyEvent does not currently pass extended key status (see @@ -401,13 +401,14 @@ void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), 0); } - if (result.type == blink::WebInputEvent::Char || - result.type == blink::WebInputEvent::RawKeyDown) { + if (result.type() == blink::WebInputEvent::Char || + result.type() == blink::WebInputEvent::RawKeyDown) { result.text[0] = result.windowsKeyCode; result.unmodifiedText[0] = result.windowsKeyCode; } - result.modifiers |= TranslateModifiers(key_event.modifiers); + result.setModifiers( + result.modifiers() | TranslateModifiers(key_event.modifiers)); } void CefBrowserPlatformDelegateNativeWin::TranslateClickEvent( @@ -419,18 +420,18 @@ void CefBrowserPlatformDelegateNativeWin::TranslateClickEvent( switch (type) { case MBT_LEFT: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Left; break; case MBT_MIDDLE: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Middle; break; case MBT_RIGHT: - result.type = mouseUp ? blink::WebInputEvent::MouseUp : - blink::WebInputEvent::MouseDown; + result.setType(mouseUp ? blink::WebInputEvent::MouseUp : + blink::WebInputEvent::MouseDown); result.button = blink::WebMouseEvent::Button::Right; break; default: @@ -447,7 +448,7 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMoveEvent( TranslateMouseEvent(result, mouse_event); if (!mouseLeave) { - result.type = blink::WebInputEvent::MouseMove; + result.setType(blink::WebInputEvent::MouseMove); if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) result.button = blink::WebMouseEvent::Button::Left; else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) @@ -457,7 +458,7 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMoveEvent( else result.button = blink::WebMouseEvent::Button::NoButton; } else { - result.type = blink::WebInputEvent::MouseLeave; + result.setType(blink::WebInputEvent::MouseLeave); result.button = blink::WebMouseEvent::Button::NoButton; } @@ -470,7 +471,7 @@ void CefBrowserPlatformDelegateNativeWin::TranslateWheelEvent( int deltaX, int deltaY) const { TranslateMouseEvent(result, mouse_event); - result.type = blink::WebInputEvent::MouseWheel; + result.setType(blink::WebInputEvent::MouseWheel); result.button = blink::WebMouseEvent::Button::NoButton; float wheelDelta; @@ -545,10 +546,11 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent( result.globalY = screen_pt.y(); // modifiers - result.modifiers |= TranslateModifiers(mouse_event.modifiers); + result.setModifiers( + result.modifiers() | TranslateModifiers(mouse_event.modifiers)); // timestamp - result.timeStampSeconds = GetMessageTime() / 1000.0; + result.setTimeStampSeconds(GetMessageTime() / 1000.0); } // static diff --git a/libcef/browser/native/native_menu_win.cc b/libcef/browser/native/native_menu_win.cc index 2abe19b43..8e627f695 100644 --- a/libcef/browser/native/native_menu_win.cc +++ b/libcef/browser/native/native_menu_win.cc @@ -14,6 +14,7 @@ #include "base/strings/string_util.h" #include "base/threading/thread_task_runner_handle.h" #include "base/win/wrapped_window_proc.h" +#include "skia/ext/skia_utils_win.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util_win.h" @@ -27,7 +28,6 @@ #include "ui/gfx/text_utils.h" #include "ui/gfx/win/hwnd_util.h" #include "ui/native_theme/native_theme.h" -#include "ui/native_theme/native_theme_win.h" #include "ui/views/controls/menu/menu_config.h" #include "ui/views/controls/menu/menu_insertion_delegate_win.h" #include "ui/views/controls/menu/menu_listener.h" @@ -49,6 +49,30 @@ static const int kItemLeftMargin = 4; // The width for displaying the sub-menu arrow. static const int kArrowWidth = 10; +namespace { + +// Draws the top layer of the canvas into the specified HDC. Only works +// with a SkCanvas with a BitmapPlatformDevice. Will create a temporary +// HDC to back the canvas if one doesn't already exist, tearing it down +// before returning. If |src_rect| is null, copies the entire canvas. +// Deleted from skia/ext/platform_canvas.h in https://crbug.com/675977#c13 +void DrawToNativeContext(SkCanvas* canvas, HDC destination_hdc, int x, int y, + const RECT* src_rect) { + RECT temp_rect; + if (!src_rect) { + temp_rect.left = 0; + temp_rect.right = canvas->imageInfo().width(); + temp_rect.top = 0; + temp_rect.bottom = canvas->imageInfo().height(); + src_rect = &temp_rect; + } + skia::CopyHDC(skia::GetNativeDrawingContext(canvas), destination_hdc, x, y, + canvas->imageInfo().isOpaque(), *src_rect, + canvas->getTotalMatrix()); +} + +} // namespace + struct CefNativeMenuWin::ItemData { // The Windows API requires that whoever creates the menus must own the // strings used for labels, and keep them around for the lifetime of the @@ -266,7 +290,7 @@ class CefNativeMenuWin::MenuHostWindow { DCHECK(type != ui::MenuModel::TYPE_CHECK); gfx::Canvas canvas(skia_icon.size(), 1.0f, false); canvas.DrawImageInt(skia_icon, 0, 0); - skia::DrawToNativeContext( + DrawToNativeContext( canvas.sk_canvas(), dc, draw_item_struct->rcItem.left + kItemLeftMargin, draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom - @@ -291,7 +315,8 @@ class CefNativeMenuWin::MenuHostWindow { gfx::Rect bounds(0, 0, config.check_width, config.check_height); // Draw the background and the check. - ui::NativeThemeWin* native_theme = ui::NativeThemeWin::instance(); + ui::NativeTheme* native_theme = + ui::NativeTheme::GetInstanceForNativeUi(); native_theme->Paint( canvas.sk_canvas(), NativeTheme::kMenuCheckBackground, state, bounds, extra); @@ -299,7 +324,7 @@ class CefNativeMenuWin::MenuHostWindow { canvas.sk_canvas(), NativeTheme::kMenuCheck, state, bounds, extra); // Draw checkbox to menu. - skia::DrawToNativeContext(canvas.sk_canvas(), dc, + DrawToNativeContext(canvas.sk_canvas(), dc, draw_item_struct->rcItem.left + kItemLeftMargin, draw_item_struct->rcItem.top + (draw_item_struct->rcItem.bottom - draw_item_struct->rcItem.top - config.check_height) / 2, NULL); diff --git a/libcef/browser/net/internal_scheme_handler.cc b/libcef/browser/net/internal_scheme_handler.cc index a2b47abf5..e62c9bdfa 100644 --- a/libcef/browser/net/internal_scheme_handler.cc +++ b/libcef/browser/net/internal_scheme_handler.cc @@ -14,7 +14,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_restrictions.h" #include "net/base/mime_util.h" -#include "third_party/brotli/dec/decode.h" #include "ui/base/resource/resource_bundle.h" namespace scheme { @@ -49,24 +48,6 @@ std::string GetMimeType(const std::string& filename) { return "text/plain"; } -bool DecodeBrotli(const base::StringPiece& encoded, - std::string& decoded) { - size_t decoded_size; - - const uint8_t* encoded_response_buffer = - reinterpret_cast(encoded.data()); - if (!BrotliDecompressedSize(encoded.size(), encoded_response_buffer, - &decoded_size)) { - return false; - } - - decoded.resize(decoded_size); - return BrotliDecompressBuffer(encoded.size(), encoded_response_buffer, - &decoded_size, - reinterpret_cast(&decoded[0])) == - BROTLI_RESULT_SUCCESS; -} - class RedirectHandler : public CefResourceHandler { public: explicit RedirectHandler(const GURL& url) @@ -172,16 +153,6 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory { base::StringPiece piece = CefContentClient::Get()->GetDataResource( action.resource_id, ui::SCALE_FACTOR_NONE); if (!piece.empty()) { - std::string decoded; - if (action.encoding == - InternalHandlerDelegate::Action::ENCODING_BROTLI && - !DecodeBrotli(piece, decoded)) { - decoded = "Unable to decode content!"; - } - - if (!decoded.empty()) - piece = base::StringPiece(decoded); - action.stream = CefStreamReader::CreateForData(const_cast(piece.data()), piece.size()); @@ -212,8 +183,7 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory { InternalHandlerDelegate::Action::Action() : stream_size(-1), - resource_id(-1), - encoding(ENCODING_NONE) { + resource_id(-1) { } CefRefPtr CreateInternalHandlerFactory( diff --git a/libcef/browser/net/internal_scheme_handler.h b/libcef/browser/net/internal_scheme_handler.h index 7c95d65d2..0d5b5adfc 100644 --- a/libcef/browser/net/internal_scheme_handler.h +++ b/libcef/browser/net/internal_scheme_handler.h @@ -31,10 +31,6 @@ class InternalHandlerDelegate { // Option 2: Specify a resource id to load static content. May include an // optional encoding type. int resource_id; - enum Encoding { - ENCODING_NONE, - ENCODING_BROTLI, - } encoding; // Option 3: Redirect to the specified URL. GURL redirect_url; diff --git a/libcef/browser/net/url_request_context_getter_impl.cc b/libcef/browser/net/url_request_context_getter_impl.cc index 40da1d7da..6662108cf 100644 --- a/libcef/browser/net/url_request_context_getter_impl.cc +++ b/libcef/browser/net/url_request_context_getter_impl.cc @@ -337,19 +337,17 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() { // Register internal scheme handlers that can be overridden. scheme::RegisterInternalHandlers(url_request_manager_.get()); - request_interceptors_.push_back(new CefRequestInterceptor()); + request_interceptors_.push_back(base::MakeUnique()); // Set up interceptors in the reverse order. std::unique_ptr top_job_factory = std::move(job_factory); - for (content::URLRequestInterceptorScopedVector::reverse_iterator i = - request_interceptors_.rbegin(); - i != request_interceptors_.rend(); - ++i) { + for (auto i = request_interceptors_.rbegin(); + i != request_interceptors_.rend(); ++i) { top_job_factory.reset(new net::URLRequestInterceptingJobFactory( - std::move(top_job_factory), base::WrapUnique(*i))); + std::move(top_job_factory), std::move(*i))); } - request_interceptors_.weak_clear(); + request_interceptors_.clear(); storage_->set_job_factory(std::move(top_job_factory)); diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index 09dea77a0..62d63cea0 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -483,8 +483,10 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( #if !defined(OS_MACOSX) content::ImageTransportFactory* factory = content::ImageTransportFactory::GetInstance(); + ui::ContextFactoryPrivate* context_factory_private = + factory->GetContextFactoryPrivate(); delegated_frame_host_ = base::MakeUnique( - factory->GetContextFactory()->AllocateFrameSinkId(), this); + context_factory_private->AllocateFrameSinkId(), this); root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); #endif @@ -494,7 +496,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( #if !defined(OS_MACOSX) // On OS X the ui::Compositor is created/owned by the platform view. compositor_.reset( - new ui::Compositor(content::GetContextFactory(), + new ui::Compositor(context_factory_private->AllocateFrameSinkId(), + content::GetContextFactory(), context_factory_private, base::ThreadTaskRunnerHandle::Get())); compositor_->SetAcceleratedWidget(compositor_widget_); compositor_->SetDelegate(this); @@ -679,7 +682,7 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( } } - if (frame.delegated_frame_data) { + if (!frame.render_pass_list.empty()) { if (software_output_device_) { if (!begin_frame_timer_.get()) { // If BeginFrame scheduling is enabled SoftwareOutputDevice activity @@ -705,8 +708,7 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( // Determine the damage rectangle for the current frame. This is the same // calculation that SwapDelegatedFrame uses. - cc::RenderPass* root_pass = - frame.delegated_frame_data->render_pass_list.back().get(); + cc::RenderPass* root_pass = frame.render_pass_list.back().get(); gfx::Size frame_size = root_pass->output_rect.size(); gfx::Rect damage_rect = gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect)); @@ -980,7 +982,9 @@ void CefRenderWidgetHostViewOSR::ImeCommitText( return; gfx::Range range(replacement_range.from, replacement_range.to); - render_widget_host_->ImeCommitText(text, range, relative_cursor_pos); + render_widget_host_->ImeCommitText( + text, std::vector(), range, + relative_cursor_pos); // Stop Monitoring for composition updates after we are done. RequestImeCompositionUpdate(false); @@ -1205,7 +1209,7 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent( const blink::WebMouseEvent& event) { TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendMouseEvent"); if (!IsPopupWidget()) { - if (browser_impl_.get() && event.type == blink::WebMouseEvent::MouseDown) + if (browser_impl_.get() && event.type() == blink::WebMouseEvent::MouseDown) browser_impl_->CancelContextMenu(); if (popup_host_view_ && @@ -1480,10 +1484,17 @@ void CefRenderWidgetHostViewOSR::SendBeginFrame(base::TimeTicks frame_time, base::TimeTicks deadline = display_time - estimated_browser_composite_time; + const cc::BeginFrameArgs& begin_frame_args = + cc::BeginFrameArgs::Create(BEGINFRAME_FROM_HERE, + begin_frame_source_.source_id(), + begin_frame_number_, frame_time, deadline, + vsync_period, cc::BeginFrameArgs::NORMAL); + DCHECK(begin_frame_args.IsValid()); + begin_frame_number_++; + render_widget_host_->Send(new ViewMsg_BeginFrame( render_widget_host_->GetRoutingID(), - cc::BeginFrameArgs::Create(BEGINFRAME_FROM_HERE, frame_time, deadline, - vsync_period, cc::BeginFrameArgs::NORMAL))); + begin_frame_args)); } void CefRenderWidgetHostViewOSR::CancelWidget() { diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index 6377e4a74..ff27a460c 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -15,6 +15,7 @@ #include "base/memory/weak_ptr.h" #include "build/build_config.h" +#include "cc/scheduler/begin_frame_source.h" #include "content/browser/renderer_host/delegated_frame_host.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "ui/compositor/compositor.h" @@ -316,6 +317,10 @@ class CefRenderWidgetHostViewOSR // is enabled. std::unique_ptr begin_frame_timer_; + // Provides |source_id| for BeginFrameArgs that we create. + cc::StubBeginFrameSource begin_frame_source_; + uint64_t begin_frame_number_ = cc::BeginFrameArgs::kStartingFrameNumber; + // Used for direct rendering from the compositor when GPU compositing is // disabled. This object is owned by the compositor. CefSoftwareOutputDeviceOSR* software_output_device_; diff --git a/libcef/browser/osr/render_widget_host_view_osr_linux.cc b/libcef/browser/osr/render_widget_host_view_osr_linux.cc index d239e665d..b0fef43d3 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_linux.cc +++ b/libcef/browser/osr/render_widget_host_view_osr_linux.cc @@ -115,6 +115,55 @@ int ToCursorID(WebCursorInfo::Type type) { return 0; } +// The following XCursorCache code was deleted from ui/base/x/x11_util.cc in +// https://crbug.com/665574#c2 + +// A process wide singleton that manages the usage of X cursors. +class XCursorCache { + public: + XCursorCache() {} + ~XCursorCache() { + Clear(); + } + + ::Cursor GetCursor(int cursor_shape) { + // Lookup cursor by attempting to insert a null value, which avoids + // a second pass through the map after a cache miss. + std::pair::iterator, bool> it = cache_.insert( + std::make_pair(cursor_shape, 0)); + if (it.second) { + XDisplay* display = gfx::GetXDisplay(); + it.first->second = XCreateFontCursor(display, cursor_shape); + } + return it.first->second; + } + + void Clear() { + XDisplay* display = gfx::GetXDisplay(); + for (std::map::iterator it = + cache_.begin(); it != cache_.end(); ++it) { + XFreeCursor(display, it->second); + } + cache_.clear(); + } + + private: + // Maps X11 font cursor shapes to Cursor IDs. + std::map cache_; + + DISALLOW_COPY_AND_ASSIGN(XCursorCache); +}; + +XCursorCache* cursor_cache = nullptr; + +// Returns an X11 Cursor, sharable across the process. +// |cursor_shape| is an X font cursor shape, see XCreateFontCursor(). +::Cursor GetXCursor(int cursor_shape) { + if (!cursor_cache) + cursor_cache = new XCursorCache; + return cursor_cache->GetCursor(cursor_shape); +} + } // namespace void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() { @@ -142,6 +191,6 @@ ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor( } return invisible_cursor_->get(); } else { - return ui::GetXCursor(ToCursorID(type)); + return GetXCursor(ToCursorID(type)); } } diff --git a/libcef/browser/permissions/permission_manager.cc b/libcef/browser/permissions/permission_manager.cc index 9ef8884f4..86909880a 100644 --- a/libcef/browser/permissions/permission_manager.cc +++ b/libcef/browser/permissions/permission_manager.cc @@ -201,9 +201,10 @@ int CefPermissionManager::RequestPermissions( content::WebContents::FromRenderFrameHost(render_frame_host); GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin(); - PendingRequest* pending_request = new PendingRequest( - render_frame_host, permissions, callback); - int request_id = pending_requests_.Add(pending_request); + std::unique_ptr pending_request = + base::MakeUnique( + render_frame_host, permissions, callback); + int request_id = pending_requests_.Add(std::move(pending_request)); const PermissionRequestID request(render_frame_host, request_id); @@ -316,7 +317,7 @@ int CefPermissionManager::SubscribePermissionStatusChange( if (subscriptions_.IsEmpty()) profile_->GetHostContentSettingsMap()->AddObserver(this); - Subscription* subscription = new Subscription(); + std::unique_ptr subscription = base::MakeUnique(); subscription->permission = permission; subscription->requesting_origin = requesting_origin; subscription->embedding_origin = embedding_origin; @@ -327,7 +328,7 @@ int CefPermissionManager::SubscribePermissionStatusChange( subscription->requesting_origin, subscription->embedding_origin)); - return subscriptions_.Add(subscription); + return subscriptions_.Add(std::move(subscription)); } void CefPermissionManager::UnsubscribePermissionStatusChange( diff --git a/libcef/browser/permissions/permission_manager.h b/libcef/browser/permissions/permission_manager.h index e011cefef..4e73d2fac 100644 --- a/libcef/browser/permissions/permission_manager.h +++ b/libcef/browser/permissions/permission_manager.h @@ -68,10 +68,10 @@ class CefPermissionManager : public KeyedService, private: class PendingRequest; - using PendingRequestsMap = IDMap; + using PendingRequestsMap = IDMap>; struct Subscription; - using SubscriptionsMap = IDMap; + using SubscriptionsMap = IDMap>; // Called when a permission was decided for a given PendingRequest. The // PendingRequest is identified by its |request_id| and the permission is diff --git a/libcef/browser/prefs/browser_prefs.cc b/libcef/browser/prefs/browser_prefs.cc index 0c241fa05..149220f22 100644 --- a/libcef/browser/prefs/browser_prefs.cc +++ b/libcef/browser/prefs/browser_prefs.cc @@ -54,7 +54,7 @@ void RegisterLocalizedValue(PrefRegistrySimple* registry, const std::string resource_string = l10n_util::GetStringUTF8(message_id); DCHECK(!resource_string.empty()); switch (type) { - case base::Value::TYPE_BOOLEAN: { + case base::Value::Type::BOOLEAN: { if ("true" == resource_string) registry->RegisterBooleanPref(path, true); else if ("false" == resource_string) @@ -62,21 +62,21 @@ void RegisterLocalizedValue(PrefRegistrySimple* registry, return; } - case base::Value::TYPE_INTEGER: { + case base::Value::Type::INTEGER: { int val; base::StringToInt(resource_string, &val); registry->RegisterIntegerPref(path, val); return; } - case base::Value::TYPE_DOUBLE: { + case base::Value::Type::DOUBLE: { double val; base::StringToDouble(resource_string, &val); registry->RegisterDoublePref(path, val); return; } - case base::Value::TYPE_STRING: { + case base::Value::Type::STRING: { registry->RegisterStringPref(path, resource_string); return; } @@ -190,7 +190,7 @@ std::unique_ptr CreatePrefService( } else { RegisterLocalizedValue(registry.get(), spellcheck::prefs::kSpellCheckDictionary, - base::Value::TYPE_STRING, + base::Value::Type::STRING, IDS_SPELLCHECK_DICTIONARY); } registry->RegisterBooleanPref( diff --git a/libcef/browser/prefs/renderer_prefs.cc b/libcef/browser/prefs/renderer_prefs.cc index a4e9d6cf9..9d82de6c1 100644 --- a/libcef/browser/prefs/renderer_prefs.cc +++ b/libcef/browser/prefs/renderer_prefs.cc @@ -13,10 +13,10 @@ #include "libcef/common/extensions/extensions_util.h" #include "base/command_line.h" +#include "base/i18n/character_encoding.h" #include "base/memory/ptr_util.h" #include "base/values.h" #include "chrome/browser/accessibility/animation_policy_prefs.h" -#include "chrome/browser/character_encoding.h" #include "chrome/browser/defaults.h" #include "chrome/browser/extensions/extension_webkit_preferences.h" #include "chrome/browser/font_family_cache.h" @@ -36,6 +36,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/view_type_utils.h" #include "extensions/common/constants.h" +#include "media/media_features.h" namespace renderer_prefs { @@ -141,7 +142,7 @@ void SetChromePrefs(CefBrowserContext* profile, } // Make sure we will set the default_encoding with canonical encoding name. - web.default_encoding = GetCanonicalEncodingNameByAliasName( + web.default_encoding = base::GetCanonicalEncodingNameByAliasName( web.default_encoding); if (web.default_encoding.empty()) { prefs->ClearPref(prefs::kDefaultCharset); @@ -336,7 +337,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { false, user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); -#if defined(ENABLE_WEBRTC) +#if BUILDFLAG(ENABLE_WEBRTC) // TODO(guoweis): Remove next 2 options at M50. registry->RegisterBooleanPref(prefs::kWebRTCMultipleRoutesEnabled, true); registry->RegisterBooleanPref(prefs::kWebRTCNonProxiedUdpEnabled, true); diff --git a/libcef/browser/printing/print_dialog_linux.cc b/libcef/browser/printing/print_dialog_linux.cc index 15fe27974..970bc5dca 100644 --- a/libcef/browser/printing/print_dialog_linux.cc +++ b/libcef/browser/printing/print_dialog_linux.cc @@ -16,7 +16,6 @@ #include "base/bind.h" #include "base/files/file_util.h" -#include "base/files/file_util_proxy.h" #include "base/lazy_instance.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" @@ -160,9 +159,9 @@ void CefPrintDialogLinux::OnPrintStart(int render_process_id, return; CefRefPtr browser = - extensions::GetOwnerBrowserForView(render_process_id, - render_routing_id, - NULL); + extensions::GetOwnerBrowserForFrame(render_process_id, + render_routing_id, + NULL); if (browser.get()) handler->OnPrintStart(browser.get()); } @@ -326,12 +325,9 @@ void CefPrintDialogLinux::OnPrintCancel() { } void CefPrintDialogLinux::OnJobCompleted() { - base::FileUtilProxy::DeleteFile( - content::BrowserThread::GetTaskRunnerForThread( - BrowserThread::FILE).get(), - path_to_pdf_, - false, - base::FileUtilProxy::StatusCallback()); + content::BrowserThread::PostTask( + content::BrowserThread::FILE, FROM_HERE, + base::Bind(base::IgnoreResult(&base::DeleteFile), path_to_pdf_, false)); // Printing finished. Matches AddRef() in PrintDocument(); Release(); diff --git a/libcef/browser/printing/printing_message_filter.cc b/libcef/browser/printing/printing_message_filter.cc index 65f7f9237..d6166cd42 100644 --- a/libcef/browser/printing/printing_message_filter.cc +++ b/libcef/browser/printing/printing_message_filter.cc @@ -247,14 +247,12 @@ void CefPrintingMessageFilter::OnUpdatePrintSettings( } printer_query = queue_->PopPrinterQuery(document_cookie); if (!printer_query.get()) { - int host_id = render_process_id_; - int routing_id = reply_msg->routing_id(); - if (!new_settings->GetInteger(printing::kPreviewInitiatorHostId, - &host_id) || - !new_settings->GetInteger(printing::kPreviewInitiatorRoutingId, - &routing_id)) { + int host_id; + int routing_id; + if (!new_settings->GetInteger(kPreviewInitiatorHostId, &host_id) || + !new_settings->GetInteger(kPreviewInitiatorRoutingId, &routing_id)) { host_id = content::ChildProcessHost::kInvalidUniqueID; - routing_id = content::ChildProcessHost::kInvalidUniqueID; + routing_id = MSG_ROUTING_NONE; } printer_query = queue_->CreatePrinterQuery(host_id, routing_id); } @@ -276,11 +274,11 @@ void CefPrintingMessageFilter::OnUpdatePrintSettingsReply( params.params.document_cookie = printer_query->cookie(); params.pages = PageRange::GetPages(printer_query->settings().ranges()); } - PrintHostMsg_UpdatePrintSettings::WriteReplyParams( - reply_msg, - params, - printer_query.get() && - (printer_query->last_status() == printing::PrintingContext::CANCEL)); + + bool canceled = printer_query.get() && + (printer_query->last_status() == PrintingContext::CANCEL); + PrintHostMsg_UpdatePrintSettings::WriteReplyParams(reply_msg, params, + canceled); Send(reply_msg); // If user hasn't cancelled. if (printer_query.get()) { diff --git a/libcef/browser/request_context_impl.cc b/libcef/browser/request_context_impl.cc index 2d284a72b..999c6bfc8 100644 --- a/libcef/browser/request_context_impl.cc +++ b/libcef/browser/request_context_impl.cc @@ -28,21 +28,21 @@ base::StaticAtomicSequenceNumber g_next_id; const char* GetTypeString(base::Value::Type type) { switch (type) { - case base::Value::TYPE_NULL: + case base::Value::Type::NONE: return "NULL"; - case base::Value::TYPE_BOOLEAN: + case base::Value::Type::BOOLEAN: return "BOOLEAN"; - case base::Value::TYPE_INTEGER: + case base::Value::Type::INTEGER: return "INTEGER"; - case base::Value::TYPE_DOUBLE: + case base::Value::Type::DOUBLE: return "DOUBLE"; - case base::Value::TYPE_STRING: + case base::Value::Type::STRING: return "STRING"; - case base::Value::TYPE_BINARY: + case base::Value::Type::BINARY: return "BINARY"; - case base::Value::TYPE_DICTIONARY: + case base::Value::Type::DICTIONARY: return "DICTIONARY"; - case base::Value::TYPE_LIST: + case base::Value::Type::LIST: return "LIST"; } diff --git a/libcef/browser/storage_partition_proxy.cc b/libcef/browser/storage_partition_proxy.cc index 12dcd1f80..e7c8d213e 100644 --- a/libcef/browser/storage_partition_proxy.cc +++ b/libcef/browser/storage_partition_proxy.cc @@ -81,7 +81,8 @@ CefStoragePartitionProxy::GetBackgroundSyncContext() { return parent_->GetBackgroundSyncContext(); } -content::PaymentAppContext* CefStoragePartitionProxy::GetPaymentAppContext() { +content::PaymentAppContextImpl* +CefStoragePartitionProxy::GetPaymentAppContext() { return parent_->GetPaymentAppContext(); } diff --git a/libcef/browser/storage_partition_proxy.h b/libcef/browser/storage_partition_proxy.h index 6f785fe45..3ef8f299c 100644 --- a/libcef/browser/storage_partition_proxy.h +++ b/libcef/browser/storage_partition_proxy.h @@ -37,7 +37,7 @@ class CefStoragePartitionProxy : public content::StoragePartition { content::PlatformNotificationContext* GetPlatformNotificationContext() override; content::BackgroundSyncContext* GetBackgroundSyncContext() override; - content::PaymentAppContext* GetPaymentAppContext() override; + content::PaymentAppContextImpl* GetPaymentAppContext() override; content::BroadcastChannelProvider* GetBroadcastChannelProvider() override; void ClearDataForOrigin(uint32_t remove_mask, uint32_t quota_storage_remove_mask, diff --git a/libcef/browser/views/label_button_impl.h b/libcef/browser/views/label_button_impl.h index 45ac76ccf..8ade1650f 100644 --- a/libcef/browser/views/label_button_impl.h +++ b/libcef/browser/views/label_button_impl.h @@ -111,7 +111,7 @@ CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetEnabledTextColors( CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetFontList( const CefString& font_list) { CEF_REQUIRE_VALID_RETURN_VOID(); - ParentClass::root_view()->SetFontList(gfx::FontList(font_list)); + ParentClass::root_view()->SetFontListDeprecated(gfx::FontList(font_list)); } CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetHorizontalAlignment( diff --git a/libcef/browser/views/scroll_view_impl.cc b/libcef/browser/views/scroll_view_impl.cc index bf2e023a6..396aa5922 100644 --- a/libcef/browser/views/scroll_view_impl.cc +++ b/libcef/browser/views/scroll_view_impl.cc @@ -50,7 +50,7 @@ bool CefScrollViewImpl::HasHorizontalScrollbar() { int CefScrollViewImpl::GetHorizontalScrollbarHeight() { CEF_REQUIRE_VALID_RETURN(0); - return root_view()->GetScrollBarHeight(); + return root_view()->GetScrollBarLayoutHeight(); } bool CefScrollViewImpl::HasVerticalScrollbar() { @@ -61,7 +61,7 @@ bool CefScrollViewImpl::HasVerticalScrollbar() { int CefScrollViewImpl::GetVerticalScrollbarWidth() { CEF_REQUIRE_VALID_RETURN(0); - return root_view()->GetScrollBarWidth(); + return root_view()->GetScrollBarLayoutWidth(); } void CefScrollViewImpl::GetDebugInfo(base::DictionaryValue* info, diff --git a/libcef/browser/views/window_view.cc b/libcef/browser/views/window_view.cc index 6440cf937..e0b6a0654 100644 --- a/libcef/browser/views/window_view.cc +++ b/libcef/browser/views/window_view.cc @@ -224,6 +224,18 @@ class CaptionlessFrameView : public views::NonClientFrameView { DISALLOW_COPY_AND_ASSIGN(CaptionlessFrameView); }; +bool IsWindowBorderHit(int code) { + // On Windows HTLEFT = 10 and HTBORDER = 18. Values are not ordered the same + // in base/hit_test.h for non-Windows platforms. +#if defined(OS_WIN) + return code >= HTLEFT && code <= HTBORDER; +#else + return code == HTLEFT || code == HTRIGHT || code == HTTOP || + code == HTTOPLEFT || code == HTTOPRIGHT || code == HTBOTTOM || + code == HTBOTTOMLEFT || code == HTBOTTOMRIGHT || code == HTBORDER; +#endif +} + } // namespace CefWindowView::CefWindowView(CefWindowDelegate* cef_delegate, @@ -393,7 +405,7 @@ bool CefWindowView::ShouldDescendIntoChildForEventHandling( views::NonClientFrameView* ncfv = GetNonClientFrameView(); if (ncfv) { int result = ncfv->NonClientHitTest(location); - if (result >= HTLEFT && result <= HTBORDER) + if (IsWindowBorderHit(result)) return false; } } diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index c2c513361..8f48e9ee0 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -216,31 +216,21 @@ void CefContentClient::AddPepperPlugins( plugins->push_back(plugin); } -void CefContentClient::AddAdditionalSchemes( - std::vector* standard_schemes, - std::vector* referrer_schemes, - std::vector* savable_schemes) { +void CefContentClient::AddAdditionalSchemes(Schemes* schemes) { DCHECK(!scheme_info_list_locked_); if (application_.get()) { CefRefPtr schemeRegistrar( new CefSchemeRegistrarImpl()); application_->OnRegisterCustomSchemes(schemeRegistrar.get()); - schemeRegistrar->GetStandardSchemes(&standard_schemes_); + schemeRegistrar->GetSchemes(schemes); // No references to the registar should be kept. schemeRegistrar->Detach(); DCHECK(schemeRegistrar->VerifyRefCount()); } - scheme::AddInternalSchemes(&standard_schemes_, savable_schemes); - - // The |standard_schemes_| values will be referenced until the current call - // stack unwinds. They will be passed to url::AddStandardScheme. - for (size_t i = 0; i < standard_schemes_.size(); ++i) { - standard_schemes->push_back( - {standard_schemes_[i].c_str(), url::SCHEME_WITHOUT_PORT}); - } + scheme::AddInternalSchemes(schemes); scheme_info_list_locked_ = true; } diff --git a/libcef/common/content_client.h b/libcef/common/content_client.h index a00f5ae45..92817b4b4 100644 --- a/libcef/common/content_client.h +++ b/libcef/common/content_client.h @@ -33,10 +33,7 @@ class CefContentClient : public content::ContentClient, // content::ContentClient methods. void AddPepperPlugins( std::vector* plugins) override; - void AddAdditionalSchemes( - std::vector* standard_schemes, - std::vector* referrer_schemes, - std::vector* savable_schemes) override; + void AddAdditionalSchemes(Schemes* schemes) override; std::string GetUserAgent() const override; base::string16 GetLocalizedString(int message_id) const override; base::StringPiece GetDataResource( @@ -46,31 +43,46 @@ class CefContentClient : public content::ContentClient, int resource_id) const override; gfx::Image& GetNativeImageNamed(int resource_id) const override; + // Values are registered with all processes (url/url_util.h) and with Blink + // (SchemeRegistry) unless otherwise indicated. struct SchemeInfo { + // Lower-case ASCII scheme name. std::string scheme_name; - // Registers a non-HTTP URL scheme which can be sent CORS requests. + // A scheme that is subject to URL canonicalization and parsing rules as + // defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 + // available at http://www.ietf.org/rfc/rfc1738.txt. + // This value is not registered with Blink. bool is_standard; - // Registers a URL scheme that can be saved to disk. - bool is_savable; - - // Registers a URL scheme to be treated as a local scheme (i.e., with the - // same security rules as those applied to "file" URLs). This means that - // normal pages cannot link to or access URLs of this scheme. + // A scheme that will be treated the same as "file". For example, normal + // pages cannot link to or access URLs of this scheme. bool is_local; - // Registers a URL scheme to be treated as display-isolated. This means - // that pages cannot display these URLs unless they are from the same - // scheme. For example, pages in other origin cannot create iframes or + // A scheme that can only be displayed from other content hosted with the + // same scheme. For example, pages in other origins cannot create iframes or // hyperlinks to URLs with the scheme. For schemes that must be accessible - // from other schemes set this value to false and use CORS - // "Access-Control-Allow-Origin" headers to further restrict access. + // from other schemes set this value to false, set |is_cors_enabled| to + // true, and use CORS "Access-Control-Allow-Origin" headers to further + // restrict access. + // This value is registered with Blink only. bool is_display_isolated; + + // A scheme that will be treated the same as "https". For example, loading + // this scheme from other secure schemes will not trigger mixed content + // warnings. + bool is_secure; + + // A scheme that can be sent CORS requests. This value should be true in + // most cases where |is_standard| is true. + bool is_cors_enabled; }; typedef std::list SchemeInfoList; - // Custom scheme registration. + // Custom scheme information will be registered first with all processes + // (url/url_util.h) via CefContentClient::AddAdditionalSchemes which calls + // AddCustomScheme, and second with Blink (SchemeRegistry) via + // CefContentRendererClient::WebKitInitialized which calls GetCustomSchemes. void AddCustomScheme(const SchemeInfo& scheme_info); const SchemeInfoList* GetCustomSchemes(); bool HasCustomScheme(const std::string& scheme_name); @@ -112,8 +124,6 @@ class CefContentClient : public content::ContentClient, // Custom schemes handled by the client. SchemeInfoList scheme_info_list_; bool scheme_info_list_locked_; - - std::vector standard_schemes_; }; #endif // CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_ diff --git a/libcef/common/crash_reporter_client.cc b/libcef/common/crash_reporter_client.cc index 556e3e451..f0c0184ce 100644 --- a/libcef/common/crash_reporter_client.cc +++ b/libcef/common/crash_reporter_client.cc @@ -52,7 +52,6 @@ typedef base::string16 PathString; const char kPathSep = '\\'; #else typedef std::string PathString; -const char kPathSep = '/'; #endif PathString GetCrashConfigPath() { @@ -93,6 +92,8 @@ PathString GetCrashConfigPath() { #endif // defined(OS_POSIX) } +#if defined(OS_WIN) + // On Windows, FAT32 and NTFS both limit filenames to a maximum of 255 // characters. On POSIX systems, the typical filename length limit is 255 // character units. HFS+'s limit is actually 255 Unicode characters using @@ -100,8 +101,6 @@ PathString GetCrashConfigPath() { // really worth dealing with here. const unsigned maxFilenameLength = 255; -#if defined(OS_WIN) - const char kInvalidFileChars[] = "<>:\"/\\|?*"; bool isInvalidFileCharacter(unsigned char c) { @@ -139,35 +138,6 @@ std::string extractAbsolutePathStart(std::string& s) { return start; } -#elif defined(OS_POSIX) - -bool isInvalidFileCharacter(unsigned char c) { - // HFS+ disallows '/' and Linux systems also disallow null. For sanity's sake - // we'll also disallow control characters. - return c < ' ' || c == 0x7F || c == kPathSep; -} - -bool isAbsolutePath(const std::string& s) { - // Check for local paths (beginning with "/") and network paths (beginning - // with "//"). - return s.length() > 1 && s[0] == kPathSep; -} - -std::string extractAbsolutePathStart(std::string& s) { - if (!isAbsolutePath(s)) - return std::string(); - - // May have multiple '/' at the beginning of the path. - std::string start; - do { - s = s.substr(1); - start.push_back(kPathSep); - } while (s.length() > 0 && s[0] == kPathSep); - return start; -} - -#endif // defined(OS_POSIX) - std::string sanitizePathComponentPart(const std::string& s) { if (s.empty()) return std::string(); @@ -239,12 +209,10 @@ std::string joinPath(const std::string& s1, const std::string& s2) { if (s2.empty()) return s1; -#if defined(OS_WIN) // Don't try to join absolute paths on Windows. // Skip this check on POSIX where it's more difficult to differentiate. if (isAbsolutePath(s2)) return s2; -#endif std::string result = s1; if (result[result.size() - 1] != kPathSep) @@ -256,10 +224,11 @@ std::string joinPath(const std::string& s1, const std::string& s2) { return result; } -#if defined(OS_WIN) + // This will only be non-nullptr in the chrome_elf address space. CefCrashReporterClient* g_crash_reporter_client = nullptr; -#endif + +#endif // defined(OS_WIN) } // namespace @@ -286,6 +255,63 @@ bool __declspec(dllexport) __cdecl GetCrashKeyImpl(size_t index, } // extern "C" + +// The below functions were deleted from chrome/install_static/install_util.cc +// in https://crbug.com/565446#c17. + +constexpr wchar_t kUserDataDirname[] = L"User Data"; + +// Populates |result| with the default User Data directory for the current +// user.This may be overidden by a command line option. Returns false if all +// attempts at locating a User Data directory fail. +bool GetDefaultUserDataDirectory( + std::wstring* result, + const std::wstring& install_sub_directory) { + // This environment variable should be set on Windows Vista and later + // (https://msdn.microsoft.com/library/windows/desktop/dd378457.aspx). + std::wstring user_data_dir = + install_static::GetEnvironmentString16(L"LOCALAPPDATA"); + + if (user_data_dir.empty()) { + // LOCALAPPDATA was not set; fallback to the temporary files path. + DWORD size = ::GetTempPath(0, nullptr); + if (!size) + return false; + user_data_dir.resize(size + 1); + size = ::GetTempPath(size + 1, &user_data_dir[0]); + if (!size || size >= user_data_dir.size()) + return false; + user_data_dir.resize(size); + } + + result->swap(user_data_dir); + if ((*result)[result->length() - 1] != L'\\') + result->push_back(L'\\'); + result->append(install_sub_directory); + result->push_back(L'\\'); + result->append(kUserDataDirname); + return true; +} + +// Populates |crash_dir| with the default crash dump location regardless of +// whether DIR_USER_DATA or DIR_CRASH_DUMPS has been overridden. +bool GetDefaultCrashDumpLocation( + std::wstring* crash_dir, + const std::wstring& install_sub_directory) { + // In order to be able to start crash handling very early, we do not rely on + // chrome's PathService entries (for DIR_CRASH_DUMPS) being available on + // Windows. See https://crbug.com/564398. + if (!GetDefaultUserDataDirectory(crash_dir, install_sub_directory)) + return false; + + // We have to make sure the user data dir exists on first run. See + // http://crbug.com/591504. + if (!install_static::RecursiveDirectoryCreate(*crash_dir)) + return false; + crash_dir->append(L"\\Crashpad"); + return true; +} + #endif // OS_WIN CefCrashReporterClient::CefCrashReporterClient() {} @@ -379,8 +405,11 @@ bool CefCrashReporterClient::ReadCrashConfigFile() { if (!val_str.empty()) external_handler_ = sanitizePath(val_str); } else if (name_str == "AppName") { - if (!val_str.empty()) - app_name_ = sanitizePathComponent(val_str); + if (!val_str.empty()) { + val_str = sanitizePathComponent(val_str); + if (!val_str.empty()) + app_name_ = val_str; + } } #endif } else if (current_section == kCrashKeysSection) { @@ -436,8 +465,8 @@ void CefCrashReporterClient::InitializeCrashReportingForProcess() { if (!g_crash_reporter_client->ReadCrashConfigFile()) return; - std::string process_type = install_static::GetSwitchValueFromCommandLine( - ::GetCommandLineA(), install_static::kProcessType); + std::wstring process_type = install_static::GetSwitchValueFromCommandLine( + ::GetCommandLineW(), install_static::kProcessType); if (process_type != install_static::kCrashpadHandler) { crash_reporter::SetCrashReporterClient(g_crash_reporter_client); @@ -447,9 +476,10 @@ void CefCrashReporterClient::InitializeCrashReportingForProcess() { !g_crash_reporter_client->HasCrashExternalHandler(); if (embedded_handler) { crash_reporter::InitializeCrashpadWithEmbeddedHandler( - process_type.empty(), process_type); + process_type.empty(), install_static::UTF16ToUTF8(process_type)); } else { - crash_reporter::InitializeCrashpad(process_type.empty(), process_type); + crash_reporter::InitializeCrashpad( + process_type.empty(), install_static::UTF16ToUTF8(process_type)); } } } @@ -481,14 +511,12 @@ bool CefCrashReporterClient::GetCrashDumpLocation(base::string16* crash_dir) { if (GetAlternativeCrashDumpLocation(crash_dir)) return true; - return install_static::GetDefaultCrashDumpLocation( - crash_dir, base::UTF8ToUTF16(app_name_)); + return GetDefaultCrashDumpLocation(crash_dir, base::UTF8ToUTF16(app_name_)); } bool CefCrashReporterClient::GetCrashMetricsLocation( base::string16* metrics_dir) { - return install_static::GetDefaultUserDataDirectory( - metrics_dir, base::UTF8ToUTF16(app_name_)); + return GetDefaultUserDataDirectory(metrics_dir, base::UTF8ToUTF16(app_name_)); } #elif defined(OS_POSIX) diff --git a/libcef/common/crash_reporting.cc b/libcef/common/crash_reporting.cc index e2e9f34ec..65cdcebfc 100644 --- a/libcef/common/crash_reporting.cc +++ b/libcef/common/crash_reporting.cc @@ -124,6 +124,10 @@ bool IsBoringCEFSwitch(const std::string& flag) { } // namespace +bool Enabled() { + return g_crash_reporting_enabled; +} + #if defined(OS_POSIX) // Be aware that logging is not initialized at the time this method is called. void BasicStartupComplete(base::CommandLine* command_line) { @@ -182,7 +186,7 @@ void ZygoteForked(base::CommandLine* command_line, } // namespace crash_reporting bool CefCrashReportingEnabled() { - return crash_reporting::g_crash_reporting_enabled; + return crash_reporting::Enabled(); } void CefSetCrashKeyValue(const CefString& key, const CefString& value) { diff --git a/libcef/common/crash_reporting.h b/libcef/common/crash_reporting.h index 1e96b950f..59cb0030a 100644 --- a/libcef/common/crash_reporting.h +++ b/libcef/common/crash_reporting.h @@ -12,6 +12,9 @@ class CommandLine; namespace crash_reporting { +// Returns true if crash reporting is enabled. +bool Enabled(); + // Functions are called from similarly named methods in CefMainDelegate. #if defined(OS_POSIX) diff --git a/libcef/common/crash_reporting_win.cc b/libcef/common/crash_reporting_win.cc index aa74c76ef..6d319c146 100644 --- a/libcef/common/crash_reporting_win.cc +++ b/libcef/common/crash_reporting_win.cc @@ -6,6 +6,8 @@ #include "libcef/common/crash_reporting_win.h" +#include "libcef/common/crash_reporting.h" + #include "base/debug/crash_logging.h" #include "base/strings/utf_string_conversions.h" #include "chrome/common/chrome_constants.h" @@ -117,4 +119,17 @@ bool InitializeCrashReportingForModule() { return false; } +void BlockUntilHandlerStarted() { + if (!crash_reporting::Enabled()) + return; + + HMODULE chrome_elf = GetModuleHandle(chrome::kChromeElfDllName); + if (chrome_elf) { + auto block_until_handler_started = reinterpret_cast( + GetProcAddress(chrome_elf, "BlockUntilHandlerStartedImpl")); + if (block_until_handler_started) + block_until_handler_started(); + } +} + } // namespace crash_reporting_win diff --git a/libcef/common/crash_reporting_win.h b/libcef/common/crash_reporting_win.h index 28c43dad8..f08f87164 100644 --- a/libcef/common/crash_reporting_win.h +++ b/libcef/common/crash_reporting_win.h @@ -8,4 +8,8 @@ namespace crash_reporting_win { // state from chrome_elf via exported functions. bool InitializeCrashReportingForModule(); +// Called from libcef early in main process startup to ensure that the crash +// handler process is started before other sub-processes are created. +void BlockUntilHandlerStarted(); + } // namespace crash_reporting_win diff --git a/libcef/common/extensions/api/BUILD.gn b/libcef/common/extensions/api/BUILD.gn index 92adbeac6..ac47083f8 100644 --- a/libcef/common/extensions/api/BUILD.gn +++ b/libcef/common/extensions/api/BUILD.gn @@ -42,7 +42,7 @@ import("//tools/json_schema_compiler/json_features.gni") #} json_features("cef_api_features") { - feature_class = "APIFeature" + feature_type = "APIFeature" provider_class = "CefAPIFeatureProvider" sources = [ "//extensions/common/api/_api_features.json", @@ -51,7 +51,7 @@ json_features("cef_api_features") { } json_features("cef_permission_features") { - feature_class = "PermissionFeature" + feature_type = "PermissionFeature" provider_class = "CefPermissionFeatureProvider" sources = [ "//extensions/common/api/_permission_features.json", @@ -60,7 +60,7 @@ json_features("cef_permission_features") { } json_features("cef_manifest_features") { - feature_class = "ManifestFeature" + feature_type = "ManifestFeature" provider_class = "CefManifestFeatureProvider" sources = [ # Use the same manifest features as Chrome. @@ -70,7 +70,7 @@ json_features("cef_manifest_features") { } json_features("cef_behavior_features") { - feature_class = "BehaviorFeature" + feature_type = "BehaviorFeature" provider_class = "CefBehaviorFeatureProvider" sources = [ "//extensions/common/api/_behavior_features.json", diff --git a/libcef/common/extensions/extensions_client.cc b/libcef/common/extensions/extensions_client.cc index 8c666164b..d6b6d2817 100644 --- a/libcef/common/extensions/extensions_client.cc +++ b/libcef/common/extensions/extensions_client.cc @@ -24,11 +24,7 @@ #include "extensions/common/common_manifest_handlers.h" #include "extensions/common/extensions_aliases.h" #include "extensions/common/extension_urls.h" -#include "extensions/common/features/api_feature.h" -#include "extensions/common/features/behavior_feature.h" #include "extensions/common/features/json_feature_provider_source.h" -#include "extensions/common/features/manifest_feature.h" -#include "extensions/common/features/permission_feature.h" #include "extensions/common/features/simple_feature.h" #include "extensions/common/manifest_handler.h" #include "extensions/common/permissions/permission_message_provider.h" @@ -48,7 +44,9 @@ SimpleFeature* CreateFeature() { } // namespace -CefExtensionsClient::CefExtensionsClient() { +CefExtensionsClient::CefExtensionsClient() + : webstore_base_url_(extension_urls::kChromeWebstoreBaseURL), + webstore_update_url_(extension_urls::kChromeWebstoreUpdateURL) { } CefExtensionsClient::~CefExtensionsClient() { @@ -177,13 +175,11 @@ bool CefExtensionsClient::ShouldSuppressFatalErrors() const { void CefExtensionsClient::RecordDidSuppressFatalError() { } -std::string CefExtensionsClient::GetWebstoreBaseURL() const { - return extension_urls::kChromeWebstoreBaseURL; +const GURL& CefExtensionsClient::GetWebstoreBaseURL() const { + return webstore_base_url_; } const GURL& CefExtensionsClient::GetWebstoreUpdateURL() const { - if (webstore_update_url_.is_empty()) - webstore_update_url_ = GURL(extension_urls::GetWebstoreUpdateUrl()); return webstore_update_url_; } diff --git a/libcef/common/extensions/extensions_client.h b/libcef/common/extensions/extensions_client.h index abb141ed9..da40f43e0 100644 --- a/libcef/common/extensions/extensions_client.h +++ b/libcef/common/extensions/extensions_client.h @@ -44,7 +44,7 @@ class CefExtensionsClient : public ExtensionsClient { base::StringPiece GetAPISchema(const std::string& name) const override; bool ShouldSuppressFatalErrors() const override; void RecordDidSuppressFatalError() override; - std::string GetWebstoreBaseURL() const override; + const GURL& GetWebstoreBaseURL() const override; const GURL& GetWebstoreUpdateURL() const override; bool IsBlacklistUpdateURL(const GURL& url) const override; @@ -56,7 +56,8 @@ class CefExtensionsClient : public ExtensionsClient { ScriptingWhitelist scripting_whitelist_; // Mutable to allow caching in a const method. - mutable GURL webstore_update_url_; + const GURL webstore_base_url_; + const GURL webstore_update_url_; DISALLOW_COPY_AND_ASSIGN(CefExtensionsClient); }; diff --git a/libcef/common/net/scheme_registration.cc b/libcef/common/net/scheme_registration.cc index 493ad1aca..7fdc30e6d 100644 --- a/libcef/common/net/scheme_registration.cc +++ b/libcef/common/net/scheme_registration.cc @@ -13,24 +13,36 @@ namespace scheme { -void AddInternalSchemes(std::vector* standard_schemes, - std::vector* savable_schemes) { +void AddInternalSchemes(content::ContentClient::Schemes* schemes) { // chrome: and chrome-devtools: schemes are registered in // RenderThreadImpl::RegisterSchemes(). // Access restrictions for chrome-extension: and chrome-extension-resource: // schemes will be applied in CefContentRendererClient::WillSendRequest(). - static CefContentClient::SchemeInfo schemes[] = { - { extensions::kExtensionScheme, true, true, false, false }, - { extensions::kExtensionResourceScheme, true, true, false, false }, + static CefContentClient::SchemeInfo internal_schemes[] = { + { + extensions::kExtensionScheme, + true, /* is_standard */ + false, /* is_local */ + false, /* is_display_isolated */ + true, /* is_secure */ + true /* is_cors_enabled */ + }, }; + // The |is_display_isolated| value is excluded here because it's registered + // with Blink only. CefContentClient* client = CefContentClient::Get(); - for (size_t i = 0; i < sizeof(schemes) / sizeof(schemes[0]); ++i) { - if (schemes[i].is_standard) - standard_schemes->push_back(schemes[i].scheme_name); - if (schemes[i].is_savable) - savable_schemes->push_back(schemes[i].scheme_name); - client->AddCustomScheme(schemes[i]); + for (size_t i = 0; i < sizeof(internal_schemes) / sizeof(internal_schemes[0]); + ++i) { + if (internal_schemes[i].is_standard) + schemes->standard_schemes.push_back(internal_schemes[i].scheme_name); + if (internal_schemes[i].is_local) + schemes->local_schemes.push_back(internal_schemes[i].scheme_name); + if (internal_schemes[i].is_secure) + schemes->secure_schemes.push_back(internal_schemes[i].scheme_name); + if (internal_schemes[i].is_cors_enabled) + schemes->cors_enabled_schemes.push_back(internal_schemes[i].scheme_name); + client->AddCustomScheme(internal_schemes[i]); } } @@ -40,10 +52,12 @@ bool IsInternalHandledScheme(const std::string& scheme) { content::kChromeDevToolsScheme, content::kChromeUIScheme, extensions::kExtensionScheme, - extensions::kExtensionResourceScheme, url::kDataScheme, url::kFileScheme, url::kFileSystemScheme, +#if !BUILDFLAG(DISABLE_FTP_SUPPORT) + url::kFtpScheme, +#endif }; for (size_t i = 0; i < sizeof(schemes) / sizeof(schemes[0]); ++i) { @@ -62,7 +76,6 @@ bool IsInternalProtectedScheme(const std::string& scheme) { url::kBlobScheme, content::kChromeUIScheme, extensions::kExtensionScheme, - extensions::kExtensionResourceScheme, url::kDataScheme, url::kFileScheme, url::kFileSystemScheme, diff --git a/libcef/common/net/scheme_registration.h b/libcef/common/net/scheme_registration.h index 2fe6eea2f..dc46e84a8 100644 --- a/libcef/common/net/scheme_registration.h +++ b/libcef/common/net/scheme_registration.h @@ -9,11 +9,12 @@ #include #include +#include "content/public/common/content_client.h" + namespace scheme { // Add internal schemes. -void AddInternalSchemes(std::vector* standard_schemes, - std::vector* savable_schemes); +void AddInternalSchemes(content::ContentClient::Schemes* schemes); // Returns true if the specified |scheme| is handled internally. bool IsInternalHandledScheme(const std::string& scheme); diff --git a/libcef/common/parser_impl.cc b/libcef/common/parser_impl.cc index bb8a14b96..0ae44a976 100644 --- a/libcef/common/parser_impl.cc +++ b/libcef/common/parser_impl.cc @@ -123,7 +123,7 @@ CefRefPtr CefBase64Decode(const CefString& data) { } CefString CefURIEncode(const CefString& text, bool use_plus) { - return net::EscapeQueryParamValue(text, use_plus); + return net::EscapeQueryParamValue(text.ToString(), use_plus); } CefString CefURIDecode(const CefString& text, diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 2d140f80b..8cee8dbb2 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -543,7 +543,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) { ::GetHeaderMap(request, headermap_, referrer_url_); referrer_policy_ = - static_cast(request.referrerPolicy()); + static_cast(request.getReferrerPolicy()); const blink::WebHTTPBody& body = request.httpBody(); if (!body.isNull()) { @@ -565,6 +565,7 @@ void CefRequestImpl::Get(blink::WebURLRequest& request, int64& upload_data_size) const { base::AutoLock lock_scope(lock_); + request.setRequestContext(blink::WebURLRequest::RequestContextInternal); request.setURL(url_); request.setHTTPMethod(blink::WebString::fromUTF8(method_)); diff --git a/libcef/common/scheme_registrar_impl.cc b/libcef/common/scheme_registrar_impl.cc index 26e841742..4d3f87c1a 100644 --- a/libcef/common/scheme_registrar_impl.cc +++ b/libcef/common/scheme_registrar_impl.cc @@ -7,9 +7,22 @@ #include #include "libcef/common/content_client.h" +#include "libcef/common/net/scheme_registration.h" #include "base/bind.h" #include "base/logging.h" +#include "base/strings/string_util.h" + +namespace { + +void AppendArray(const std::vector& source, + std::vector* target) { + if (source.empty()) + return; + target->insert(target->end(), source.begin(), source.end()); +} + +} CefSchemeRegistrarImpl::CefSchemeRegistrarImpl() : supported_thread_id_(base::PlatformThread::CurrentId()) { @@ -19,32 +32,49 @@ bool CefSchemeRegistrarImpl::AddCustomScheme( const CefString& scheme_name, bool is_standard, bool is_local, - bool is_display_isolated) { + bool is_display_isolated, + bool is_secure, + bool is_cors_enabled) { if (!VerifyContext()) return false; - const std::string& scheme = scheme_name; + const std::string& scheme = base::ToLowerASCII(scheme_name.ToString()); + if (scheme::IsInternalHandledScheme(scheme) || + registered_schemes_.find(scheme) != registered_schemes_.end()) { + return false; + } + registered_schemes_.insert(scheme); + + // The |is_display_isolated| value is excluded here because it's registered + // with Blink only. if (is_standard) - standard_schemes_.push_back(scheme); + schemes_.standard_schemes.push_back(scheme); + if (is_local) + schemes_.local_schemes.push_back(scheme); + if (is_secure) + schemes_.secure_schemes.push_back(scheme); + if (is_cors_enabled) + schemes_.cors_enabled_schemes.push_back(scheme); CefContentClient::SchemeInfo scheme_info = { - scheme, is_standard, is_local, is_display_isolated}; + scheme, is_standard, is_local, is_display_isolated, is_secure, + is_cors_enabled + }; CefContentClient::Get()->AddCustomScheme(scheme_info); return true; } -void CefSchemeRegistrarImpl::GetStandardSchemes( - std::vector* standard_schemes) { +void CefSchemeRegistrarImpl::GetSchemes( + content::ContentClient::Schemes* schemes) { if (!VerifyContext()) return; - if (standard_schemes_.empty()) - return; - - standard_schemes->insert(standard_schemes->end(), standard_schemes_.begin(), - standard_schemes_.end()); + AppendArray(schemes_.standard_schemes, &schemes->standard_schemes); + AppendArray(schemes_.local_schemes, &schemes->local_schemes); + AppendArray(schemes_.secure_schemes, &schemes->secure_schemes); + AppendArray(schemes_.cors_enabled_schemes, &schemes->cors_enabled_schemes); } bool CefSchemeRegistrarImpl::VerifyRefCount() { diff --git a/libcef/common/scheme_registrar_impl.h b/libcef/common/scheme_registrar_impl.h index aeb3c01aa..d009bc7ac 100644 --- a/libcef/common/scheme_registrar_impl.h +++ b/libcef/common/scheme_registrar_impl.h @@ -12,6 +12,7 @@ #include "include/cef_scheme.h" #include "base/threading/platform_thread.h" +#include "content/public/common/content_client.h" class CefSchemeRegistrarImpl : public CefSchemeRegistrar { public: @@ -21,9 +22,11 @@ class CefSchemeRegistrarImpl : public CefSchemeRegistrar { bool AddCustomScheme(const CefString& scheme_name, bool is_standard, bool is_local, - bool is_display_isolated) override; + bool is_display_isolated, + bool is_secure, + bool is_cors_enabled) override; - void GetStandardSchemes(std::vector* standard_schemes); + void GetSchemes(content::ContentClient::Schemes* schemes); // Verify that only a single reference exists to all CefSchemeRegistrarImpl // objects. @@ -37,7 +40,8 @@ class CefSchemeRegistrarImpl : public CefSchemeRegistrar { base::PlatformThreadId supported_thread_id_; - std::vector standard_schemes_; + content::ContentClient::Schemes schemes_; + std::set registered_schemes_; IMPLEMENT_REFCOUNTING(CefSchemeRegistrarImpl); DISALLOW_COPY_AND_ASSIGN(CefSchemeRegistrarImpl); diff --git a/libcef/common/time_impl.cc b/libcef/common/time_impl.cc index 68100b0b3..1d47c5c33 100644 --- a/libcef/common/time_impl.cc +++ b/libcef/common/time_impl.cc @@ -4,6 +4,8 @@ #include "libcef/common/time_util.h" +#include "base/macros.h" + void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time) { base::Time::Exploded exploded; exploded.year = cef_time.year; @@ -14,7 +16,7 @@ void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time) { exploded.minute = cef_time.minute; exploded.second = cef_time.second; exploded.millisecond = cef_time.millisecond; - time = base::Time::FromUTCExploded(exploded); + ignore_result(base::Time::FromUTCExploded(exploded, &time)); } void cef_time_from_basetime(const base::Time& time, cef_time_t& cef_time) { diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index db554434e..8a4b6fe1a 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -24,20 +24,20 @@ CefRefPtr CefValueImpl::GetOrCreateRefOrCopy( CefValueController* controller) { DCHECK(value); - if (value->IsType(base::Value::TYPE_BINARY)) { + if (value->IsType(base::Value::Type::BINARY)) { base::BinaryValue* binary_value = static_cast(value); return new CefValueImpl(CefBinaryValueImpl::GetOrCreateRef( binary_value, parent_value, controller)); } - if (value->IsType(base::Value::TYPE_DICTIONARY)) { + if (value->IsType(base::Value::Type::DICTIONARY)) { base::DictionaryValue* dict_value = static_cast(value); return new CefValueImpl(CefDictionaryValueImpl::GetOrCreateRef( dict_value, parent_value, read_only, controller)); } - if (value->IsType(base::Value::TYPE_LIST)) { + if (value->IsType(base::Value::Type::LIST)) { base::ListValue* list_value = static_cast(value); return new CefValueImpl(CefListValueImpl::GetOrCreateRef( list_value, parent_value, read_only, controller)); @@ -221,15 +221,15 @@ CefValueType CefValueImpl::GetType() { if (value_) { switch (value_->GetType()) { - case base::Value::TYPE_NULL: + case base::Value::Type::NONE: return VTYPE_NULL; - case base::Value::TYPE_BOOLEAN: + case base::Value::Type::BOOLEAN: return VTYPE_BOOL; - case base::Value::TYPE_INTEGER: + case base::Value::Type::INTEGER: return VTYPE_INT; - case base::Value::TYPE_DOUBLE: + case base::Value::Type::DOUBLE: return VTYPE_DOUBLE; - case base::Value::TYPE_STRING: + case base::Value::Type::STRING: return VTYPE_STRING; default: NOTREACHED(); @@ -347,15 +347,15 @@ void CefValueImpl::SetValueInternal(base::Value* value) { if (value) { switch (value->GetType()) { - case base::Value::TYPE_BINARY: + case base::Value::Type::BINARY: binary_value_ = new CefBinaryValueImpl( static_cast(value), true); return; - case base::Value::TYPE_DICTIONARY: + case base::Value::Type::DICTIONARY: dictionary_value_ = new CefDictionaryValueImpl( static_cast(value), true, false); return; - case base::Value::TYPE_LIST: + case base::Value::Type::LIST: list_value_ = new CefListValueImpl( static_cast(value), true, false); return; @@ -731,21 +731,21 @@ CefValueType CefDictionaryValueImpl::GetType(const CefString& key) { if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value)) { switch (out_value->GetType()) { - case base::Value::TYPE_NULL: + case base::Value::Type::NONE: return VTYPE_NULL; - case base::Value::TYPE_BOOLEAN: + case base::Value::Type::BOOLEAN: return VTYPE_BOOL; - case base::Value::TYPE_INTEGER: + case base::Value::Type::INTEGER: return VTYPE_INT; - case base::Value::TYPE_DOUBLE: + case base::Value::Type::DOUBLE: return VTYPE_DOUBLE; - case base::Value::TYPE_STRING: + case base::Value::Type::STRING: return VTYPE_STRING; - case base::Value::TYPE_BINARY: + case base::Value::Type::BINARY: return VTYPE_BINARY; - case base::Value::TYPE_DICTIONARY: + case base::Value::Type::DICTIONARY: return VTYPE_DICTIONARY; - case base::Value::TYPE_LIST: + case base::Value::Type::LIST: return VTYPE_LIST; } } @@ -825,7 +825,7 @@ CefRefPtr CefDictionaryValueImpl::GetBinary( if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value) && - out_value->IsType(base::Value::TYPE_BINARY)) { + out_value->IsType(base::Value::Type::BINARY)) { base::BinaryValue* binary_value = static_cast(const_cast(out_value)); return CefBinaryValueImpl::GetOrCreateRef(binary_value, @@ -843,7 +843,7 @@ CefRefPtr CefDictionaryValueImpl::GetDictionary( if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value) && - out_value->IsType(base::Value::TYPE_DICTIONARY)) { + out_value->IsType(base::Value::Type::DICTIONARY)) { base::DictionaryValue* dict_value = static_cast( const_cast(out_value)); @@ -864,7 +864,7 @@ CefRefPtr CefDictionaryValueImpl::GetList(const CefString& key) { if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value) && - out_value->IsType(base::Value::TYPE_LIST)) { + out_value->IsType(base::Value::Type::LIST)) { base::ListValue* list_value = static_cast(const_cast(out_value)); return CefListValueImpl::GetOrCreateRef( @@ -966,8 +966,8 @@ bool CefDictionaryValueImpl::RemoveInternal(const CefString& key) { controller()->Remove(out_value.get(), true); // Only list and dictionary types may have dependencies. - if (out_value->IsType(base::Value::TYPE_LIST) || - out_value->IsType(base::Value::TYPE_DICTIONARY)) { + if (out_value->IsType(base::Value::Type::LIST) || + out_value->IsType(base::Value::Type::DICTIONARY)) { controller()->RemoveDependencies(out_value.get()); } @@ -1141,21 +1141,21 @@ CefValueType CefListValueImpl::GetType(size_t index) { const base::Value* out_value = NULL; if (const_value().Get(index, &out_value)) { switch (out_value->GetType()) { - case base::Value::TYPE_NULL: + case base::Value::Type::NONE: return VTYPE_NULL; - case base::Value::TYPE_BOOLEAN: + case base::Value::Type::BOOLEAN: return VTYPE_BOOL; - case base::Value::TYPE_INTEGER: + case base::Value::Type::INTEGER: return VTYPE_INT; - case base::Value::TYPE_DOUBLE: + case base::Value::Type::DOUBLE: return VTYPE_DOUBLE; - case base::Value::TYPE_STRING: + case base::Value::Type::STRING: return VTYPE_STRING; - case base::Value::TYPE_BINARY: + case base::Value::Type::BINARY: return VTYPE_BINARY; - case base::Value::TYPE_DICTIONARY: + case base::Value::Type::DICTIONARY: return VTYPE_DICTIONARY; - case base::Value::TYPE_LIST: + case base::Value::Type::LIST: return VTYPE_LIST; } } @@ -1232,7 +1232,7 @@ CefRefPtr CefListValueImpl::GetBinary(size_t index) { const base::Value* out_value = NULL; if (const_value().Get(index, &out_value) && - out_value->IsType(base::Value::TYPE_BINARY)) { + out_value->IsType(base::Value::Type::BINARY)) { base::BinaryValue* binary_value = static_cast(const_cast(out_value)); return CefBinaryValueImpl::GetOrCreateRef(binary_value, @@ -1248,7 +1248,7 @@ CefRefPtr CefListValueImpl::GetDictionary(size_t index) { const base::Value* out_value = NULL; if (const_value().Get(index, &out_value) && - out_value->IsType(base::Value::TYPE_DICTIONARY)) { + out_value->IsType(base::Value::Type::DICTIONARY)) { base::DictionaryValue* dict_value = static_cast( const_cast(out_value)); @@ -1268,7 +1268,7 @@ CefRefPtr CefListValueImpl::GetList(size_t index) { const base::Value* out_value = NULL; if (const_value().Get(index, &out_value) && - out_value->IsType(base::Value::TYPE_LIST)) { + out_value->IsType(base::Value::Type::LIST)) { base::ListValue* list_value = static_cast(const_cast(out_value)); return CefListValueImpl::GetOrCreateRef( @@ -1364,8 +1364,8 @@ bool CefListValueImpl::RemoveInternal(size_t index) { controller()->Remove(out_value.get(), true); // Only list and dictionary types may have dependencies. - if (out_value->IsType(base::Value::TYPE_LIST) || - out_value->IsType(base::Value::TYPE_DICTIONARY)) { + if (out_value->IsType(base::Value::Type::LIST) || + out_value->IsType(base::Value::Type::DICTIONARY)) { controller()->RemoveDependencies(out_value.get()); } diff --git a/libcef/common/widevine_loader.cc b/libcef/common/widevine_loader.cc index 02561ae49..b4aa83d78 100644 --- a/libcef/common/widevine_loader.cc +++ b/libcef/common/widevine_loader.cc @@ -20,7 +20,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/common/widevine_cdm_constants.h" #include "content/browser/plugin_service_impl.h" -#include "content/public/browser/cdm_service.h" +#include "content/public/browser/cdm_registry.h" #include "content/public/common/cdm_info.h" #include "content/public/common/content_switches.h" #include "media/cdm/supported_cdm_versions.h" @@ -96,7 +96,7 @@ std::unique_ptr ParseManifestFile( JSONStringValueDeserializer deserializer(manifest_contents); std::unique_ptr manifest(deserializer.Deserialize(NULL, NULL)); - if (!manifest.get() || !manifest->IsType(base::Value::TYPE_DICTIONARY)) + if (!manifest.get() || !manifest->IsType(base::Value::Type::DICTIONARY)) return nullptr; // Transfer ownership to the caller. @@ -281,11 +281,11 @@ void RegisterWidevineCdmOnUIThread( content::PluginService::GetInstance()->RefreshPlugins(); content::PluginService::GetInstance()->PurgePluginListCache(NULL, false); - // Also register Widevine with the CdmService. + // Also register Widevine with the CdmRegistry. const std::vector codecs = base::SplitString( cdm_codecs, std::string(1, kCdmSupportedCodecsValueDelimiter), base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - content::CdmService::GetInstance()->RegisterCdm(content::CdmInfo( + content::CdmRegistry::GetInstance()->RegisterCdm(content::CdmInfo( kWidevineCdmType, base::Version(cdm_version), cdm_path, codecs)); DeliverWidevineCdmCallback(CEF_CDM_REGISTRATION_ERROR_NONE, std::string(), diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index 1fab4fbce..9fa58240d 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -109,8 +109,10 @@ bool CefBrowserImpl::IsLoading() { void CefBrowserImpl::Reload() { CEF_REQUIRE_RT_RETURN_VOID(); - if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) - render_view()->GetWebView()->mainFrame()->reload(); + if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { + render_view()->GetWebView()->mainFrame()->reload( + blink::WebFrameLoadType::Reload); + } } void CefBrowserImpl::ReloadIgnoreCache() { @@ -417,7 +419,7 @@ void CefBrowserImpl::DidFinishLoad(blink::WebLocalFrame* frame) { blink::WebDataSource* ds = frame->dataSource(); Send(new CefHostMsg_DidFinishLoad(routing_id(), webkit_glue::GetIdentifier(frame), - ds->request().url(), + ds->getRequest().url(), !frame->parent(), ds->response().httpStatusCode())); OnLoadEnd(frame); diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index 96b90f7e2..8fbf3820a 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -273,21 +273,21 @@ void CefContentRendererClient::WebKitInitialized() { const CefContentClient::SchemeInfoList* schemes = CefContentClient::Get()->GetCustomSchemes(); if (!schemes->empty()) { - // Register the custom schemes. + // Register the custom schemes. The |is_standard| value is excluded here + // because it's not explicitly registered with Blink. CefContentClient::SchemeInfoList::const_iterator it = schemes->begin(); for (; it != schemes->end(); ++it) { const CefContentClient::SchemeInfo& info = *it; const blink::WebString& scheme = blink::WebString::fromUTF8(info.scheme_name); - if (info.is_standard) { - // Standard schemes must also be registered as CORS enabled to support - // CORS-restricted requests (for example, XMLHttpRequest redirects). - blink::WebSecurityPolicy::registerURLSchemeAsCORSEnabled(scheme); - } if (info.is_local) - blink::WebSecurityPolicy::registerURLSchemeAsLocal(scheme); + webkit_glue::registerURLSchemeAsLocal(scheme); if (info.is_display_isolated) blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(scheme); + if (info.is_secure) + webkit_glue::registerURLSchemeAsSecure(scheme); + if (info.is_cors_enabled) + webkit_glue::registerURLSchemeAsCORSEnabled(scheme); } } @@ -517,7 +517,7 @@ bool CefContentRendererClient::OverrideCreatePlugin( bool CefContentRendererClient::HandleNavigation( content::RenderFrame* render_frame, bool is_content_initiated, - int opener_id, + bool render_view_was_created_by_renderer, blink::WebFrame* frame, const blink::WebURLRequest& request, blink::WebNavigationType type, @@ -596,7 +596,7 @@ bool CefContentRendererClient::ShouldFork(blink::WebLocalFrame* frame, } bool CefContentRendererClient::WillSendRequest( - blink::WebFrame* frame, + blink::WebLocalFrame* frame, ui::PageTransition transition_type, const blink::WebURL& url, GURL* new_url) { diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/content_renderer_client.h index c1476197e..53e553ddf 100644 --- a/libcef/renderer/content_renderer_client.h +++ b/libcef/renderer/content_renderer_client.h @@ -99,7 +99,7 @@ class CefContentRendererClient : public content::ContentRendererClient, blink::WebPlugin** plugin) override; bool HandleNavigation(content::RenderFrame* render_frame, bool is_content_initiated, - int opener_id, + bool render_view_was_created_by_renderer, blink::WebFrame* frame, const blink::WebURLRequest& request, blink::WebNavigationType type, @@ -111,7 +111,7 @@ class CefContentRendererClient : public content::ContentRendererClient, bool is_initial_navigation, bool is_server_redirect, bool* send_referrer) override; - bool WillSendRequest(blink::WebFrame* frame, + bool WillSendRequest(blink::WebLocalFrame* frame, ui::PageTransition transition_type, const blink::WebURL& url, GURL* new_url) override; diff --git a/libcef/renderer/extensions/extensions_renderer_client.cc b/libcef/renderer/extensions/extensions_renderer_client.cc index 3307c2a7e..f82e12a26 100644 --- a/libcef/renderer/extensions/extensions_renderer_client.cc +++ b/libcef/renderer/extensions/extensions_renderer_client.cc @@ -168,7 +168,7 @@ bool CefExtensionsRendererClient::OverrideCreatePlugin( } bool CefExtensionsRendererClient::WillSendRequest( - blink::WebFrame* frame, + blink::WebLocalFrame* frame, ui::PageTransition transition_type, const blink::WebURL& url, GURL* new_url) { @@ -181,13 +181,6 @@ bool CefExtensionsRendererClient::WillSendRequest( return true; } - if (url.protocolIs(extensions::kExtensionResourceScheme) && - !resource_request_policy_->CanRequestExtensionResourceScheme(url, - frame)) { - *new_url = GURL(chrome::kExtensionResourceInvalidRequestURL); - return true; - } - return false; } diff --git a/libcef/renderer/extensions/extensions_renderer_client.h b/libcef/renderer/extensions/extensions_renderer_client.h index 012742762..5e150cd7a 100644 --- a/libcef/renderer/extensions/extensions_renderer_client.h +++ b/libcef/renderer/extensions/extensions_renderer_client.h @@ -49,7 +49,7 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient { void RenderViewCreated(content::RenderView* render_view); bool OverrideCreatePlugin(content::RenderFrame* render_frame, const blink::WebPluginParams& params); - bool WillSendRequest(blink::WebFrame* frame, + bool WillSendRequest(blink::WebLocalFrame* frame, ui::PageTransition transition_type, const blink::WebURL& url, GURL* new_url); diff --git a/libcef/renderer/plugins/cef_plugin_placeholder.cc b/libcef/renderer/plugins/cef_plugin_placeholder.cc index 2da1cdf29..6cca34b83 100644 --- a/libcef/renderer/plugins/cef_plugin_placeholder.cc +++ b/libcef/renderer/plugins/cef_plugin_placeholder.cc @@ -25,6 +25,7 @@ #include "gin/object_template_builder.h" #include "third_party/WebKit/public/platform/URLConversion.h" #include "third_party/WebKit/public/platform/WebInputEvent.h" +#include "third_party/WebKit/public/platform/WebMouseEvent.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebScriptSource.h" @@ -164,12 +165,6 @@ bool CefPluginPlaceholder::OnMessageReceived(const IPC::Message& message) { return false; } -void CefPluginPlaceholder::OpenAboutPluginsCallback() { - // CEF does not use IDR_DISABLED_PLUGIN_HTML which would originate this - // callback for the chrome://plugins link. - NOTREACHED(); -} - void CefPluginPlaceholder::ShowPermissionBubbleCallback() { // CEF does not use IDR_PREFER_HTML_PLUGIN_HTML which would originate this // callback. @@ -304,8 +299,6 @@ gin::ObjectTemplateBuilder CefPluginPlaceholder::GetObjectTemplateBuilder( .SetMethod( "didFinishLoading", &CefPluginPlaceholder::DidFinishLoadingCallback) - .SetMethod("openAboutPlugins", - &CefPluginPlaceholder::OpenAboutPluginsCallback) .SetMethod("showPermissionBubble", &CefPluginPlaceholder::ShowPermissionBubbleCallback); diff --git a/libcef/renderer/plugins/cef_plugin_placeholder.h b/libcef/renderer/plugins/cef_plugin_placeholder.h index 170e586e8..6a7653eb0 100644 --- a/libcef/renderer/plugins/cef_plugin_placeholder.h +++ b/libcef/renderer/plugins/cef_plugin_placeholder.h @@ -72,9 +72,6 @@ class CefPluginPlaceholder final void OnMenuAction(int request_id, unsigned action) override; void OnMenuClosed(int request_id) override; - // Javascript callbacks: - // Open chrome://plugins in a new tab. - void OpenAboutPluginsCallback(); // Show the Plugins permission bubble. void ShowPermissionBubbleCallback(); diff --git a/libcef/renderer/plugins/plugin_preroller.h b/libcef/renderer/plugins/plugin_preroller.h index 86ec614d6..7dd8fe3ce 100644 --- a/libcef/renderer/plugins/plugin_preroller.h +++ b/libcef/renderer/plugins/plugin_preroller.h @@ -14,7 +14,6 @@ namespace blink { class WebLocalFrame; -class WebPlugin; } class SkBitmap; diff --git a/libcef/renderer/render_frame_observer.cc b/libcef/renderer/render_frame_observer.cc index 84f96a5aa..5cdc7d82d 100644 --- a/libcef/renderer/render_frame_observer.cc +++ b/libcef/renderer/render_frame_observer.cc @@ -35,7 +35,6 @@ CefRenderFrameObserver::~CefRenderFrameObserver() { void CefRenderFrameObserver::DidCreateScriptContext( v8::Handle context, - int extension_group, int world_id) { blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); diff --git a/libcef/renderer/render_frame_observer.h b/libcef/renderer/render_frame_observer.h index 84f0a413f..9f3e48f6f 100644 --- a/libcef/renderer/render_frame_observer.h +++ b/libcef/renderer/render_frame_observer.h @@ -17,7 +17,6 @@ class CefRenderFrameObserver : public content::RenderFrameObserver { ~CefRenderFrameObserver() override; void DidCreateScriptContext(v8::Handle context, - int extension_group, int world_id) override; void WillReleaseScriptContext(v8::Handle context, int world_id) override; diff --git a/libcef/renderer/render_urlrequest_impl.cc b/libcef/renderer/render_urlrequest_impl.cc index 08e32b4fa..104be5bfe 100644 --- a/libcef/renderer/render_urlrequest_impl.cc +++ b/libcef/renderer/render_urlrequest_impl.cc @@ -38,32 +38,25 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient { // blink::WebURLLoaderClient methods. bool willFollowRedirect( - WebURLLoader* loader, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) override; void didSendData( - WebURLLoader* loader, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; void didReceiveResponse( - WebURLLoader* loader, const WebURLResponse& response) override; - void didDownloadData(WebURLLoader* loader, - int dataLength, + void didDownloadData(int dataLength, int encodedDataLength) override; - void didReceiveData(WebURLLoader* loader, - const char* data, - int dataLength, - int encodedDataLength, - int encodedBodyLength) override; - void didReceiveCachedMetadata(WebURLLoader* loader, - const char* data, + void didReceiveData(const char* data, + int dataLength) override; + void didReceiveCachedMetadata(const char* data, int dataLength) override; - void didFinishLoading(WebURLLoader* loader, - double finishTime, - int64_t totalEncodedDataLength) override; - void didFail(WebURLLoader* loader, - const WebURLError& error) override; + void didFinishLoading(double finishTime, + int64_t totalEncodedDataLength, + int64_t totalEncodedBodyLength) override; + void didFail(const WebURLError& error, + int64_t totalEncodedDataLength, + int64_t totalEncodedBodyLength) override; protected: // The context_ pointer will outlive this object. @@ -252,14 +245,12 @@ CefWebURLLoaderClient::~CefWebURLLoaderClient() { } bool CefWebURLLoaderClient::willFollowRedirect( - WebURLLoader* loader, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) { return true; } void CefWebURLLoaderClient::didSendData( - WebURLLoader* loader, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { if (request_flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS) @@ -267,40 +258,35 @@ void CefWebURLLoaderClient::didSendData( } void CefWebURLLoaderClient::didReceiveResponse( - WebURLLoader* loader, const WebURLResponse& response) { context_->OnResponse(response); } -void CefWebURLLoaderClient::didDownloadData(WebURLLoader* loader, - int dataLength, +void CefWebURLLoaderClient::didDownloadData(int dataLength, int encodedDataLength) { } -void CefWebURLLoaderClient::didReceiveData(WebURLLoader* loader, - const char* data, - int dataLength, - int encodedDataLength, - int encodedBodyLength) { +void CefWebURLLoaderClient::didReceiveData(const char* data, + int dataLength) { context_->OnDownloadProgress(dataLength); if (!(request_flags_ & UR_FLAG_NO_DOWNLOAD_DATA)) context_->OnDownloadData(data, dataLength); } -void CefWebURLLoaderClient::didReceiveCachedMetadata(WebURLLoader* loader, - const char* data, +void CefWebURLLoaderClient::didReceiveCachedMetadata(const char* data, int dataLength) { } -void CefWebURLLoaderClient::didFinishLoading(WebURLLoader* loader, - double finishTime, - int64_t totalEncodedDataLength) { +void CefWebURLLoaderClient::didFinishLoading(double finishTime, + int64_t totalEncodedDataLength, + int64_t totalEncodedBodyLength) { context_->OnComplete(); } -void CefWebURLLoaderClient::didFail(WebURLLoader* loader, - const WebURLError& error) { +void CefWebURLLoaderClient::didFail(const WebURLError& error, + int64_t totalEncodedDataLength, + int64_t totalEncodedBodyLength) { context_->OnError(error); } diff --git a/libcef/renderer/webkit_glue.cc b/libcef/renderer/webkit_glue.cc index 5e32ad8c1..7b325c7df 100644 --- a/libcef/renderer/webkit_glue.cc +++ b/libcef/renderer/webkit_glue.cc @@ -33,6 +33,7 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "third_party/WebKit/Source/core/editing/serializers/Serialization.h" #include "third_party/WebKit/Source/core/frame/LocalFrame.h" #include "third_party/WebKit/Source/core/frame/Settings.h" +#include "third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h" #include "third_party/WebKit/Source/web/WebLocalFrameImpl.h" #include "third_party/WebKit/Source/web/WebViewImpl.h" MSVC_POP_WARNING(); @@ -221,7 +222,7 @@ v8::MaybeLocal ExecuteV8ScriptAndReturnValue( if (frame) { blink::V8CacheOptions v8CacheOptions(blink::V8CacheOptionsDefault); if (frame && frame->settings()) - v8CacheOptions = frame->settings()->v8CacheOptions(); + v8CacheOptions = frame->settings()->getV8CacheOptions(); v8::Local script; if (!blink::v8Call(blink::V8ScriptRunner::compileScript(ssc, isolate, @@ -240,4 +241,16 @@ bool IsScriptForbidden() { return blink::ScriptForbiddenScope::isScriptForbidden(); } +void registerURLSchemeAsLocal(const blink::WebString& scheme) { + blink::SchemeRegistry::registerURLSchemeAsLocal(scheme); +} + +void registerURLSchemeAsSecure(const blink::WebString& scheme) { + blink::SchemeRegistry::registerURLSchemeAsSecure(scheme); +} + +void registerURLSchemeAsCORSEnabled(const blink::WebString& scheme) { + blink::SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme); +} + } // webkit_glue diff --git a/libcef/renderer/webkit_glue.h b/libcef/renderer/webkit_glue.h index 5704874e1..8dcb4f0fb 100644 --- a/libcef/renderer/webkit_glue.h +++ b/libcef/renderer/webkit_glue.h @@ -67,6 +67,10 @@ v8::MaybeLocal ExecuteV8ScriptAndReturnValue( bool IsScriptForbidden(); +void registerURLSchemeAsLocal(const blink::WebString& scheme); +void registerURLSchemeAsSecure(const blink::WebString& scheme); +void registerURLSchemeAsCORSEnabled(const blink::WebString& scheme); + } // webkit_glue #endif // CEF_LIBCEF_RENDERER_WEBKIT_GLUE_H_ diff --git a/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc b/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc index 72ac9fa85..50e29de5d 100644 --- a/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc +++ b/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc @@ -19,7 +19,8 @@ namespace { int CEF_CALLBACK scheme_registrar_add_custom_scheme( struct _cef_scheme_registrar_t* self, const cef_string_t* scheme_name, - int is_standard, int is_local, int is_display_isolated) { + int is_standard, int is_local, int is_display_isolated, int is_secure, + int is_cors_enabled) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -35,7 +36,9 @@ int CEF_CALLBACK scheme_registrar_add_custom_scheme( CefString(scheme_name), is_standard?true:false, is_local?true:false, - is_display_isolated?true:false); + is_display_isolated?true:false, + is_secure?true:false, + is_cors_enabled?true:false); // Return type: bool return _retval; diff --git a/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc b/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc index 11873fa93..61e94a304 100644 --- a/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc +++ b/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc @@ -16,7 +16,8 @@ // VIRTUAL METHODS - Body may be edited by hand. bool CefSchemeRegistrarCToCpp::AddCustomScheme(const CefString& scheme_name, - bool is_standard, bool is_local, bool is_display_isolated) { + bool is_standard, bool is_local, bool is_display_isolated, bool is_secure, + bool is_cors_enabled) { cef_scheme_registrar_t* _struct = GetStruct(); if (CEF_MEMBER_MISSING(_struct, add_custom_scheme)) return false; @@ -33,7 +34,9 @@ bool CefSchemeRegistrarCToCpp::AddCustomScheme(const CefString& scheme_name, scheme_name.GetStruct(), is_standard, is_local, - is_display_isolated); + is_display_isolated, + is_secure, + is_cors_enabled); // Return type: bool return _retval?true:false; diff --git a/libcef_dll/ctocpp/scheme_registrar_ctocpp.h b/libcef_dll/ctocpp/scheme_registrar_ctocpp.h index 83ffc31b1..73af1dbd5 100644 --- a/libcef_dll/ctocpp/scheme_registrar_ctocpp.h +++ b/libcef_dll/ctocpp/scheme_registrar_ctocpp.h @@ -32,7 +32,8 @@ class CefSchemeRegistrarCToCpp // CefSchemeRegistrar methods. bool AddCustomScheme(const CefString& scheme_name, bool is_standard, - bool is_local, bool is_display_isolated) OVERRIDE; + bool is_local, bool is_display_isolated, bool is_secure, + bool is_cors_enabled) OVERRIDE; }; #endif // CEF_LIBCEF_DLL_CTOCPP_SCHEME_REGISTRAR_CTOCPP_H_ diff --git a/patch/patch.cfg b/patch/patch.cfg index af4cb25d7..f3842e959 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -267,10 +267,8 @@ patches = [ 'path': '../', }, { - # Fix PDF extension loading after showing the plugin placeholder. + # Fix plugin placeholder blocked message. # https://bitbucket.org/chromiumembedded/cef/issues/2020/ - # Reverts https://codereview.chromium.org/2352673003 and - # https://codereview.chromium.org/2344023002 'name': 'webview_plugin_2020', 'path': '../', }, diff --git a/patch/patches/browser_compositor_mac.patch b/patch/patches/browser_compositor_mac.patch index 1c556ca52..a33e6bc61 100644 --- a/patch/patches/browser_compositor_mac.patch +++ b/patch/patches/browser_compositor_mac.patch @@ -15,10 +15,10 @@ index 865b29f..ef44e27 100644 void SwapCompositorFrame(uint32_t compositor_frame_sink_id, diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm -index 4ff716d..aaf17b2 100644 +index bd36336..9123781 100644 --- content/browser/renderer_host/browser_compositor_view_mac.mm +++ content/browser/renderer_host/browser_compositor_view_mac.mm -@@ -199,6 +199,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { +@@ -201,6 +201,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { g_spare_recyclable_compositors.Get().clear(); } @@ -31,7 +31,7 @@ index 4ff716d..aaf17b2 100644 ui::AcceleratedWidgetMac* BrowserCompositorMac::GetAcceleratedWidgetMac() { if (recyclable_compositor_) return recyclable_compositor_->accelerated_widget_mac(); -@@ -416,8 +422,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor( +@@ -417,8 +423,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor( } gfx::Size BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP() const { diff --git a/patch/patches/browser_frame_host_guest_1687.patch b/patch/patches/browser_frame_host_guest_1687.patch index 6a4305c9f..40c1877e6 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 c628e20..3c4e008d 100644 +index abb76e3..cdf5a84d 100644 --- render_widget_host_view_guest.cc +++ render_widget_host_view_guest.cc -@@ -253,13 +253,14 @@ void RenderWidgetHostViewGuest::Destroy() { +@@ -254,13 +254,14 @@ 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 0b31a1934..c44939033 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 d4d4f14..977e24e 100644 +index 97ea047..1efbcf9 100644 --- browser/browser_plugin/browser_plugin_guest.cc +++ browser/browser_plugin/browser_plugin_guest.cc @@ -29,7 +29,7 @@ @@ -36,7 +36,7 @@ index d4d4f14..977e24e 100644 } RendererPreferences* renderer_prefs = -@@ -796,11 +795,10 @@ void BrowserPluginGuest::OnWillAttachComplete( +@@ -787,11 +786,10 @@ void BrowserPluginGuest::OnWillAttachComplete( ->GetWidget() ->Init(); GetWebContents()->GetMainFrame()->Init(); diff --git a/patch/patches/chrome_profile.patch b/patch/patches/chrome_profile.patch index 717887161..17263c30c 100644 --- a/patch/patches/chrome_profile.patch +++ b/patch/patches/chrome_profile.patch @@ -63,10 +63,10 @@ index 4b43013..169ca47 100644 content::BrowserContext* GetBrowserContextRedirectedInIncognito( content::BrowserContext* context); diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h -index f715370..fb38098 100644 +index 6554312..701cb0f 100644 --- chrome/browser/profiles/profile_manager.h +++ chrome/browser/profiles/profile_manager.h -@@ -90,7 +90,7 @@ class ProfileManager : public base::NonThreadSafe, +@@ -89,7 +89,7 @@ class ProfileManager : public base::NonThreadSafe, // acceptable. Returns null if creation of the new profile fails. // TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then // make this method private. @@ -75,7 +75,7 @@ index f715370..fb38098 100644 // Returns total number of profiles available on this machine. size_t GetNumberOfProfiles(); -@@ -118,7 +118,7 @@ class ProfileManager : public base::NonThreadSafe, +@@ -117,7 +117,7 @@ class ProfileManager : public base::NonThreadSafe, // Returns true if the profile pointer is known to point to an existing // profile. @@ -84,7 +84,7 @@ index f715370..fb38098 100644 // Returns the directory where the first created profile is stored, // relative to the user data directory currently in use. -@@ -127,7 +127,7 @@ class ProfileManager : public base::NonThreadSafe, +@@ -126,7 +126,7 @@ class ProfileManager : public base::NonThreadSafe, // Get the Profile last used (the Profile to which owns the most recently // focused window) with this Chrome build. If no signed profile has been // stored in Local State, hand back the Default profile. diff --git a/patch/patches/chrome_widevine.patch b/patch/patches/chrome_widevine.patch index 375ebbc2d..8d0de2058 100644 --- a/patch/patches/chrome_widevine.patch +++ b/patch/patches/chrome_widevine.patch @@ -1,8 +1,8 @@ diff --git chrome/common/chrome_content_client.cc chrome/common/chrome_content_client.cc -index bb7757b..532f036 100644 +index 4255c1b..f4b197c 100644 --- chrome/common/chrome_content_client.cc +++ chrome/common/chrome_content_client.cc -@@ -78,7 +78,7 @@ +@@ -80,7 +80,7 @@ #endif #if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_PEPPER_CDMS) && \ diff --git a/patch/patches/compositor_1368.patch b/patch/patches/compositor_1368.patch index 73eae93a2..486dc38de 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 7d1cf0c..a806826 100644 +index 072d500..c2cc813 100644 --- content/browser/compositor/gpu_process_transport_factory.cc +++ content/browser/compositor/gpu_process_transport_factory.cc -@@ -196,6 +196,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { +@@ -199,6 +199,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { std::unique_ptr GpuProcessTransportFactory::CreateSoftwareOutputDevice( ui::Compositor* compositor) { @@ -13,11 +13,11 @@ index 7d1cf0c..a806826 100644 + return output_device; + } + - #if defined(USE_AURA) - if (service_manager::ServiceManagerIsRemote()) { - NOTREACHED(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kHeadless)) + return base::WrapUnique(new cc::SoftwareOutputDevice); diff --git ui/compositor/compositor.h ui/compositor/compositor.h -index 76f8f38..0fdc07b 100644 +index 7ecc5e5..e77f545 100644 --- ui/compositor/compositor.h +++ ui/compositor/compositor.h @@ -18,6 +18,7 @@ @@ -28,7 +28,7 @@ index 76f8f38..0fdc07b 100644 #include "cc/surfaces/surface_sequence.h" #include "cc/trees/layer_tree_host_client.h" #include "cc/trees/layer_tree_host_single_thread_client.h" -@@ -188,6 +189,17 @@ class COMPOSITOR_EXPORT CompositorLock +@@ -194,6 +195,17 @@ class COMPOSITOR_EXPORT CompositorLock DISALLOW_COPY_AND_ASSIGN(CompositorLock); }; @@ -46,7 +46,7 @@ index 76f8f38..0fdc07b 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 -@@ -211,6 +223,9 @@ class COMPOSITOR_EXPORT Compositor +@@ -223,6 +235,9 @@ class COMPOSITOR_EXPORT Compositor // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -56,9 +56,9 @@ index 76f8f38..0fdc07b 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 -@@ -393,6 +408,8 @@ class COMPOSITOR_EXPORT Compositor - +@@ -406,6 +421,8 @@ class COMPOSITOR_EXPORT Compositor ui::ContextFactory* context_factory_; + ui::ContextFactoryPrivate* context_factory_private_; + CompositorDelegate* delegate_ = nullptr; + diff --git a/patch/patches/content_nav_1129.patch b/patch/patches/content_nav_1129.patch index 0ab513fac..b74af56a0 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 642521f..8fb647f 100644 +index cc1d049a..8490e65 100644 --- public/renderer/content_renderer_client.cc +++ public/renderer/content_renderer_client.cc -@@ -100,7 +100,6 @@ bool ContentRendererClient::AllowPopup() { +@@ -99,7 +99,6 @@ bool ContentRendererClient::AllowPopup() { return false; } @@ -10,7 +10,7 @@ index 642521f..8fb647f 100644 bool ContentRendererClient::HandleNavigation( RenderFrame* render_frame, bool is_content_initiated, -@@ -113,6 +112,7 @@ bool ContentRendererClient::HandleNavigation( +@@ -112,6 +111,7 @@ bool ContentRendererClient::HandleNavigation( return false; } @@ -19,10 +19,10 @@ index 642521f..8fb647f 100644 return false; } diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h -index f2a854f..913e30c 100644 +index 9895206..1f4626d 100644 --- public/renderer/content_renderer_client.h +++ public/renderer/content_renderer_client.h -@@ -204,7 +204,6 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -198,7 +198,6 @@ class CONTENT_EXPORT ContentRendererClient { // Returns true if a popup window should be allowed. virtual bool AllowPopup(); @@ -30,7 +30,7 @@ index f2a854f..913e30c 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 { +@@ -214,6 +213,7 @@ class CONTENT_EXPORT ContentRendererClient { blink::WebNavigationPolicy default_policy, bool is_redirect); @@ -39,18 +39,22 @@ index f2a854f..913e30c 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 2f79ac0..7e0c73b 100644 +index 2d93238..95969c4 100644 --- renderer/render_frame_impl.cc +++ renderer/render_frame_impl.cc -@@ -5112,7 +5112,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( +@@ -5259,9 +5259,8 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( (pending_navigation_params_ && !pending_navigation_params_->request_params.redirects.empty()); -#ifdef OS_ANDROID +- bool render_view_was_created_by_renderer = +- render_view_->was_created_by_renderer_; ++ // CEF doesn't use this value, so just pass false. ++ bool render_view_was_created_by_renderer = false; // The handlenavigation API is deprecated and will be removed once // crbug.com/325351 is resolved. if (GetContentClient()->renderer()->HandleNavigation( -@@ -5121,7 +5120,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( +@@ -5270,7 +5269,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( is_redirect)) { return blink::WebNavigationPolicyIgnore; } diff --git a/patch/patches/crashpad_1995.patch b/patch/patches/crashpad_1995.patch index 01c87c430..213605987 100644 --- a/patch/patches/crashpad_1995.patch +++ b/patch/patches/crashpad_1995.patch @@ -31,7 +31,7 @@ index 6cd8b9f..dfbbdc6 100644 cflags = [ "/wd4201" ] } diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc -index 800f704..e4b4063 100644 +index c099a26..6fae782 100644 --- chrome/common/crash_keys.cc +++ chrome/common/crash_keys.cc @@ -4,6 +4,8 @@ @@ -43,7 +43,7 @@ index 800f704..e4b4063 100644 #include "base/base_switches.h" #include "base/command_line.h" #include "base/format_macros.h" -@@ -94,7 +96,7 @@ const char kViewCount[] = "view-count"; +@@ -101,7 +103,7 @@ const char kViewCount[] = "view-count"; const char kZeroEncodeDetails[] = "zero-encode-details"; @@ -52,7 +52,7 @@ index 800f704..e4b4063 100644 // The following keys may be chunked by the underlying crash logging system, // but ultimately constitute a single key-value pair. // -@@ -250,10 +252,16 @@ size_t RegisterChromeCrashKeys() { +@@ -259,10 +261,16 @@ size_t RegisterChromeCrashKeys() { // This dynamic set of keys is used for sets of key value pairs when gathering // a collection of data, like command line switches or extension IDs. @@ -71,7 +71,7 @@ index 800f704..e4b4063 100644 // Register the extension IDs. { -@@ -287,7 +295,7 @@ size_t RegisterChromeCrashKeys() { +@@ -296,7 +304,7 @@ size_t RegisterChromeCrashKeys() { return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength); } @@ -80,7 +80,7 @@ index 800f704..e4b4063 100644 static const char* const kIgnoreSwitches[] = { switches::kEnableLogging, switches::kFlagSwitchesBegin, -@@ -343,7 +351,7 @@ static bool IsBoringSwitch(const std::string& flag) { +@@ -352,7 +360,7 @@ static bool IsBoringSwitch(const std::string& flag) { } void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { @@ -90,7 +90,7 @@ index 800f704..e4b4063 100644 void SetActiveExtensions(const std::set& extensions) { diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h -index 6f66031..1abcdf8 100644 +index 2b6106c..cfe4548 100644 --- chrome/common/crash_keys.h +++ chrome/common/crash_keys.h @@ -23,10 +23,18 @@ class CommandLine; @@ -112,75 +112,8 @@ index 6f66031..1abcdf8 100644 // Sets the kNumSwitches key and the set of keys named using kSwitchFormat based // on the given |command_line|. void SetCrashKeysFromCommandLine(const base::CommandLine& command_line); -diff --git chrome/install_static/install_util.cc chrome/install_static/install_util.cc -index edec76d..1db1c9c 100644 ---- chrome/install_static/install_util.cc -+++ chrome/install_static/install_util.cc -@@ -473,7 +473,9 @@ bool IsNonBrowserProcess() { - return g_process_type == ProcessType::NON_BROWSER_PROCESS; - } - --bool GetDefaultUserDataDirectory(std::wstring* result) { -+bool GetDefaultUserDataDirectory( -+ std::wstring* result, -+ const std::wstring& install_sub_directory) { - // This environment variable should be set on Windows Vista and later - // (https://msdn.microsoft.com/library/windows/desktop/dd378457.aspx). - std::wstring user_data_dir = GetEnvironmentString16(L"LOCALAPPDATA"); -@@ -493,17 +495,23 @@ bool GetDefaultUserDataDirectory(std::wstring* result) { - result->swap(user_data_dir); - if ((*result)[result->length() - 1] != L'\\') - result->push_back(L'\\'); -- AppendChromeInstallSubDirectory(result, true /* include_suffix */); -+ if (!install_sub_directory.empty()) { -+ result->append(install_sub_directory); -+ } else { -+ AppendChromeInstallSubDirectory(result, true /* include_suffix */); -+ } - result->push_back(L'\\'); - result->append(kUserDataDirname); - return true; - } - --bool GetDefaultCrashDumpLocation(std::wstring* crash_dir) { -+bool GetDefaultCrashDumpLocation( -+ std::wstring* crash_dir, -+ const std::wstring& install_sub_directory) { - // In order to be able to start crash handling very early, we do not rely on - // chrome's PathService entries (for DIR_CRASH_DUMPS) being available on - // Windows. See https://crbug.com/564398. -- if (!GetDefaultUserDataDirectory(crash_dir)) -+ if (!GetDefaultUserDataDirectory(crash_dir, install_sub_directory)) - return false; - - // We have to make sure the user data dir exists on first run. See -diff --git chrome/install_static/install_util.h chrome/install_static/install_util.h -index 4ded522..81eba43 100644 ---- chrome/install_static/install_util.h -+++ chrome/install_static/install_util.h -@@ -86,14 +86,18 @@ bool IsNonBrowserProcess(); - // TODO(ananta) - // http://crbug.com/604923 - // Unify this with the Browser Distribution code. --bool GetDefaultUserDataDirectory(std::wstring* result); -+bool GetDefaultUserDataDirectory( -+ std::wstring* result, -+ const std::wstring& install_sub_directory = std::wstring()); - - // Populates |crash_dir| with the default crash dump location regardless of - // whether DIR_USER_DATA or DIR_CRASH_DUMPS has been overridden. - // TODO(ananta) - // http://crbug.com/604923 - // Unify this with the Browser Distribution code. --bool GetDefaultCrashDumpLocation(std::wstring* crash_dir); -+bool GetDefaultCrashDumpLocation( -+ std::wstring* crash_dir, -+ const std::wstring& install_sub_directory = std::wstring()); - - // Returns the contents of the specified |variable_name| from the environment - // block of the calling process. Returns an empty string if the variable does diff --git chrome_elf/BUILD.gn chrome_elf/BUILD.gn -index 0629b6f..9c150b5 100644 +index c2861e0..7d6de6b 100644 --- chrome_elf/BUILD.gn +++ chrome_elf/BUILD.gn @@ -7,6 +7,7 @@ @@ -191,7 +124,7 @@ index 0629b6f..9c150b5 100644 import("//chrome/process_version_rc_template.gni") import("//testing/test.gni") -@@ -138,16 +139,40 @@ static_library("blacklist") { +@@ -139,16 +140,40 @@ static_library("blacklist") { static_library("crash") { sources = [ @@ -270,7 +203,7 @@ index c658fa9..8c4a145 100644 g_crash_helper_enabled = true; return true; diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc -index 9ebc33f..c013b36 100644 +index 6e5058e..3dd2b56 100644 --- components/crash/content/app/breakpad_linux.cc +++ components/crash/content/app/breakpad_linux.cc @@ -29,6 +29,7 @@ @@ -289,7 +222,7 @@ index 9ebc33f..c013b36 100644 #endif bool g_is_crash_reporter_enabled = false; -@@ -654,7 +656,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, +@@ -686,7 +688,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, info.process_type_length = 7; info.distro = base::g_linux_distro; info.distro_length = my_strlen(base::g_linux_distro); @@ -298,7 +231,7 @@ index 9ebc33f..c013b36 100644 info.process_start_time = g_process_start_time; info.oom_size = base::g_oom_size; info.pid = g_pid; -@@ -1275,7 +1277,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, +@@ -1299,7 +1301,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, header_content_encoding, header_content_type, post_file, @@ -307,7 +240,7 @@ index 9ebc33f..c013b36 100644 "--timeout=10", // Set a timeout so we don't hang forever. "--tries=1", // Don't retry if the upload fails. "-O", // output reply to fd 3 -@@ -1880,6 +1882,17 @@ void InitCrashReporter(const std::string& process_type) { +@@ -1906,6 +1908,17 @@ void InitCrashReporter(const std::string& process_type) { PostEnableBreakpadInitialization(); } @@ -326,7 +259,7 @@ index 9ebc33f..c013b36 100644 void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) { const base::CommandLine* command_line = diff --git components/crash/content/app/breakpad_linux.h components/crash/content/app/breakpad_linux.h -index 3316fa0..df90dbd 100644 +index bbeb208..74440a0 100644 --- components/crash/content/app/breakpad_linux.h +++ components/crash/content/app/breakpad_linux.h @@ -16,6 +16,9 @@ namespace breakpad { @@ -554,7 +487,7 @@ index 7df66ea..1e24110 100644 bool result = crashpad_client.StartHandler(handler_path, database_path, diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc -index a22af31..bde918e 100644 +index 1e9c06c..8ed020d 100644 --- components/crash/content/app/crashpad_win.cc +++ components/crash/content/app/crashpad_win.cc @@ -81,7 +81,7 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, @@ -594,14 +527,14 @@ index a22af31..bde918e 100644 + crash_reporter_client->GetCrashOptionalArguments(&arguments); + - g_crashpad_client.Get().StartHandler( - exe_file, database_path, metrics_path, url, process_annotations, - arguments, false, false); + if (!g_crashpad_client.Get().StartHandler( + exe_file, database_path, metrics_path, url, process_annotations, + arguments, false, true)) { diff --git content/browser/frame_host/debug_urls.cc content/browser/frame_host/debug_urls.cc -index 2e61cc1..6b8b943 100644 +index c404067..4938dfd6 100644 --- content/browser/frame_host/debug_urls.cc +++ content/browser/frame_host/debug_urls.cc -@@ -189,7 +189,9 @@ bool HandleDebugURL(const GURL& url, ui::PageTransition transition) { +@@ -190,7 +190,9 @@ bool HandleDebugURL(const GURL& url, ui::PageTransition transition) { cc::switches::kEnableGpuBenchmarking) && (PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_TYPED)); diff --git a/patch/patches/crashpad_tp_1995.patch b/patch/patches/crashpad_tp_1995.patch index 0abfaf933..70f1130af 100644 --- a/patch/patches/crashpad_tp_1995.patch +++ b/patch/patches/crashpad_tp_1995.patch @@ -26,7 +26,7 @@ index 3aaaeee..d99fcb4 100644 static const time_t kSecondsInDay = 60 * 60 * 24; diff --git crashpad/client/prune_crash_reports.h crashpad/client/prune_crash_reports.h -index b66e9349..86d1f15 100644 +index 6dac5f3..34f5ee1 100644 --- crashpad/client/prune_crash_reports.h +++ crashpad/client/prune_crash_reports.h @@ -57,7 +57,8 @@ class PruneCondition { @@ -40,7 +40,7 @@ index b66e9349..86d1f15 100644 virtual ~PruneCondition() {} diff --git crashpad/client/settings.cc crashpad/client/settings.cc -index d018e37f..47d8110 100644 +index 7757ecb..d458337 100644 --- crashpad/client/settings.cc +++ crashpad/client/settings.cc @@ -38,7 +38,7 @@ void ScopedLockedFileHandleTraits::Free(FileHandle handle) { @@ -65,8 +65,8 @@ index d018e37f..47d8110 100644 @@ -56,6 +59,9 @@ struct Settings::Data { uint32_t options; uint32_t padding_0; - uint64_t last_upload_attempt_time; // time_t -+ uint64_t next_upload_attempt_time; // time_t + int64_t last_upload_attempt_time; // time_t ++ int64_t next_upload_attempt_time; // time_t + uint32_t backoff_step; + uint32_t padding_1; UUID client_id; @@ -96,7 +96,7 @@ index d018e37f..47d8110 100644 + if (!handle.is_valid()) + return false; + -+ settings.next_upload_attempt_time = InRangeCast(time, 0); ++ settings.next_upload_attempt_time = InRangeCast(time, 0); + + return WriteSettings(handle.get(), settings); +} @@ -177,7 +177,7 @@ index a9601d1..9517730 100644 //! \brief Attempts to upload a crash report. //! diff --git crashpad/handler/handler_main.cc crashpad/handler/handler_main.cc -index 29c5ddc..7a6bad7 100644 +index 3ada8c3..ffaae42 100644 --- crashpad/handler/handler_main.cc +++ crashpad/handler/handler_main.cc @@ -29,8 +29,10 @@ @@ -202,7 +202,7 @@ index 29c5ddc..7a6bad7 100644 namespace crashpad { namespace { -@@ -168,6 +174,9 @@ int HandlerMain(int argc, char* argv[]) { +@@ -175,6 +181,9 @@ int HandlerMain(int argc, char* argv[]) { kOptionPipeName, #endif // OS_MACOSX kOptionURL, @@ -212,7 +212,7 @@ index 29c5ddc..7a6bad7 100644 // Standard options. kOptionHelp = -2, -@@ -188,11 +197,17 @@ int HandlerMain(int argc, char* argv[]) { +@@ -195,11 +204,17 @@ int HandlerMain(int argc, char* argv[]) { InitialClientData initial_client_data; #endif // OS_MACOSX bool rate_limit; @@ -230,7 +230,7 @@ index 29c5ddc..7a6bad7 100644 const option long_options[] = { {"annotation", required_argument, nullptr, kOptionAnnotation}, -@@ -222,6 +237,9 @@ int HandlerMain(int argc, char* argv[]) { +@@ -229,6 +244,9 @@ int HandlerMain(int argc, char* argv[]) { {"url", required_argument, nullptr, kOptionURL}, {"help", no_argument, nullptr, kOptionHelp}, {"version", no_argument, nullptr, kOptionVersion}, @@ -240,7 +240,7 @@ index 29c5ddc..7a6bad7 100644 {nullptr, 0, nullptr, 0}, }; -@@ -293,6 +311,27 @@ int HandlerMain(int argc, char* argv[]) { +@@ -300,6 +318,27 @@ int HandlerMain(int argc, char* argv[]) { options.url = optarg; break; } @@ -268,7 +268,7 @@ index 29c5ddc..7a6bad7 100644 case kOptionHelp: { Usage(me); return EXIT_SUCCESS; -@@ -425,12 +464,18 @@ int HandlerMain(int argc, char* argv[]) { +@@ -432,12 +471,18 @@ int HandlerMain(int argc, char* argv[]) { // TODO(scottmg): options.rate_limit should be removed when we have a // configurable database setting to control upload limiting. // See https://crashpad.chromium.org/bug/23. diff --git a/patch/patches/gn_config.patch b/patch/patches/gn_config.patch index 47e61b40a..fc4079cf9 100644 --- a/patch/patches/gn_config.patch +++ b/patch/patches/gn_config.patch @@ -1,20 +1,20 @@ diff --git .gn .gn -index e4b474a..38a41be 100644 +index f3ea8df..09d0a1e 100644 --- .gn +++ .gn -@@ -241,6 +241,7 @@ exec_script_whitelist = [ - "//build/toolchain/win/BUILD.gn", - "//build/util/branding.gni", - "//build/util/version.gni", -+ "//cef/BUILD.gn", - "//chromeos/BUILD.gn", +@@ -225,6 +225,7 @@ exec_script_whitelist = + # in the Chromium repo outside of //build. + "//android_webview/BUILD.gn", + "//build_overrides/build.gni", ++ "//cef/BUILD.gn", + "//chromeos/BUILD.gn", - # TODO(dgn): Layer violation but breaks the build otherwise, see + # TODO(dgn): Layer violation but breaks the build otherwise, see diff --git BUILD.gn BUILD.gn -index 43c7b3d..df225a1 100644 +index 0cd9629..97c284c 100644 --- BUILD.gn +++ BUILD.gn -@@ -282,6 +282,7 @@ group("both_gn_and_gyp") { +@@ -286,6 +286,7 @@ group("both_gn_and_gyp") { # and whether there should be other targets that are iOS-only and missing. deps += [ "//cc:cc_unittests", @@ -55,7 +55,7 @@ index 982fbe8..e757be46 100644 + "studio path") } diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py -index fbc201e..299156d 100644 +index fbc201e..98ad106 100644 --- build/toolchain/win/setup_toolchain.py +++ build/toolchain/win/setup_toolchain.py @@ -126,11 +126,15 @@ def _LoadToolchainEnv(cpu, sdk_dir): @@ -69,7 +69,7 @@ index fbc201e..299156d 100644 - variables = _LoadEnvFromBat(args) + if os.path.exists(script_path): + args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64', \ -+ '10.0.10586.0'] ++ '10.0.14393.0'] + variables = _LoadEnvFromBat(args) + else: + variables = [] @@ -80,7 +80,7 @@ index fbc201e..299156d 100644 diff --git build/vs_toolchain.py build/vs_toolchain.py -index c768a8a..bb91777 100755 +index 3edf1ff..66e150a 100755 --- build/vs_toolchain.py +++ build/vs_toolchain.py @@ -74,11 +74,18 @@ def SetEnvironmentAndGetRuntimeDllDirs(): @@ -103,10 +103,10 @@ index c768a8a..bb91777 100755 # directory in order to run binaries locally, but they are needed in order # to create isolates or the mini_installer. Copying them to the output diff --git chrome/chrome_paks.gni chrome/chrome_paks.gni -index c3ac484..13ae760 100644 +index 27c483c..24502e9 100644 --- chrome/chrome_paks.gni +++ chrome/chrome_paks.gni -@@ -235,7 +235,7 @@ template("chrome_paks") { +@@ -245,7 +245,7 @@ template("chrome_paks") { additional_source_patterns = invoker.additional_locale_source_patterns } input_locales = locales @@ -116,10 +116,10 @@ index c3ac484..13ae760 100644 if (is_mac) { output_locales = locales_as_mac_outputs diff --git chrome/installer/mini_installer/BUILD.gn chrome/installer/mini_installer/BUILD.gn -index 0f37e54..7b81cde 100644 +index 84be262..687ffac 100644 --- chrome/installer/mini_installer/BUILD.gn +++ chrome/installer/mini_installer/BUILD.gn -@@ -124,7 +124,7 @@ template("generate_mini_installer") { +@@ -125,7 +125,7 @@ template("generate_mini_installer") { inputs = [ "$chrome_dll_file", "$root_out_dir/chrome.exe", diff --git a/patch/patches/gritsettings.patch b/patch/patches/gritsettings.patch index 13b131106..f0313f7ce 100644 --- a/patch/patches/gritsettings.patch +++ b/patch/patches/gritsettings.patch @@ -1,8 +1,8 @@ diff --git resource_ids resource_ids -index c500512..0ac0e98 100644 +index d454de7..42e591a 100644 --- resource_ids +++ resource_ids -@@ -358,5 +358,12 @@ +@@ -355,5 +355,12 @@ # Thinking about appending to the end? # Please read the header and find the right section above instead. diff --git a/patch/patches/message_loop_443_1992243003.patch b/patch/patches/message_loop_443_1992243003.patch index 40167c1f6..0a8fbd3ea 100644 --- a/patch/patches/message_loop_443_1992243003.patch +++ b/patch/patches/message_loop_443_1992243003.patch @@ -1,5 +1,5 @@ diff --git message_loop.cc message_loop.cc -index 1581f6c..ecb3149 100644 +index 2212941..c2895af 100644 --- message_loop.cc +++ message_loop.cc @@ -96,12 +96,6 @@ MessageLoop::~MessageLoop() { @@ -26,10 +26,10 @@ index 1581f6c..ecb3149 100644 run_loop_(NULL), incoming_task_queue_(new internal::IncomingTaskQueue(this)), diff --git message_loop.h message_loop.h -index ac7a303..b39018b 100644 +index 91a7b1d..de864d4 100644 --- message_loop.h +++ message_loop.h -@@ -299,6 +299,16 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { +@@ -303,6 +303,16 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { void AddTaskObserver(TaskObserver* task_observer); void RemoveTaskObserver(TaskObserver* task_observer); @@ -46,7 +46,7 @@ index ac7a303..b39018b 100644 // Can only be called from the thread that owns the MessageLoop. bool is_running() const; -@@ -436,6 +446,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { +@@ -440,6 +450,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { // insider a (accidentally induced?) nested message pump. bool nestable_tasks_allowed_; @@ -60,7 +60,7 @@ index ac7a303..b39018b 100644 // if type_ is TYPE_CUSTOM and pump_ is null. MessagePumpFactoryCallback pump_factory_; diff --git message_pump_win.cc message_pump_win.cc -index f1ec727..4b859c0 100644 +index 30638df..a50d626 100644 --- message_pump_win.cc +++ message_pump_win.cc @@ -366,20 +366,28 @@ bool MessagePumpForUI::ProcessMessageHelper(const MSG& msg) { diff --git a/patch/patches/mime_handler_view_1565.patch b/patch/patches/mime_handler_view_1565.patch index ce8e46958..29c1f46bd 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 049af16..c5130acd 100644 +index 6e59562..69f9769 100644 --- mime_handler_view_guest.cc +++ mime_handler_view_guest.cc @@ -179,6 +179,8 @@ void MimeHandlerViewGuest::CreateWebContents( diff --git a/patch/patches/net_filter_515.patch b/patch/patches/net_filter_515.patch index ca547eda4..fbfacc4e6 100644 --- a/patch/patches/net_filter_515.patch +++ b/patch/patches/net_filter_515.patch @@ -22,10 +22,10 @@ index 0fccae1..73e33ad 100644 // This is the interface for subclasses of NetworkDelegate to implement. These // member functions will be called by the respective public notification diff --git net/url_request/url_request_job.cc net/url_request/url_request_job.cc -index b315664..55701edf 100644 +index cdf60f8..d6dd4bf 100644 --- net/url_request/url_request_job.cc +++ net/url_request/url_request_job.cc -@@ -494,6 +494,12 @@ void URLRequestJob::NotifyHeadersComplete() { +@@ -497,6 +497,12 @@ void URLRequestJob::NotifyHeadersComplete() { DCHECK(!source_stream_); source_stream_ = SetUpSourceStream(); @@ -36,5 +36,5 @@ index b315664..55701edf 100644 + } + if (!source_stream_) { - NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, - ERR_CONTENT_DECODING_INIT_FAILED)); + OnDone(URLRequestStatus(URLRequestStatus::FAILED, + ERR_CONTENT_DECODING_INIT_FAILED), diff --git a/patch/patches/net_security_expiration_1994.patch b/patch/patches/net_security_expiration_1994.patch index 03047f21b..5e3d278c1 100644 --- a/patch/patches/net_security_expiration_1994.patch +++ b/patch/patches/net_security_expiration_1994.patch @@ -33,7 +33,7 @@ index 42f631e..b02edb0 100644 + } // namespace net diff --git net/cert/ct_policy_enforcer.h net/cert/ct_policy_enforcer.h -index c732cee..1c80e81 100644 +index 7111970..f751d6c 100644 --- net/cert/ct_policy_enforcer.h +++ net/cert/ct_policy_enforcer.h @@ -101,6 +101,17 @@ class NET_EXPORT CTPolicyEnforcer { @@ -55,10 +55,10 @@ index c732cee..1c80e81 100644 } // namespace net diff --git net/http/transport_security_state.cc net/http/transport_security_state.cc -index 9b42feb..f7860be 100644 +index 5f82c28..0ebee04 100644 --- net/http/transport_security_state.cc +++ net/http/transport_security_state.cc -@@ -1362,8 +1362,10 @@ void TransportSecurityState::SetShouldRequireCTForTesting(bool* required) { +@@ -1371,8 +1371,10 @@ void TransportSecurityState::SetShouldRequireCTForTesting(bool* required) { g_ct_required_for_testing = *required ? 1 : -1; } @@ -72,7 +72,7 @@ index 9b42feb..f7860be 100644 // We consider built-in information to be timely for 10 weeks. return (base::Time::Now() - build_time).InDays() < 70 /* 10 weeks */; diff --git net/http/transport_security_state.h net/http/transport_security_state.h -index fc40b7d..c0b14a4 100644 +index a55cf62..b984474 100644 --- net/http/transport_security_state.h +++ net/http/transport_security_state.h @@ -475,6 +475,10 @@ class NET_EXPORT TransportSecurityState @@ -85,8 +85,8 @@ index fc40b7d..c0b14a4 100644 + private: friend class TransportSecurityStateTest; - FRIEND_TEST_ALL_PREFIXES(HttpSecurityHeadersTest, UpdateDynamicPKPOnly); -@@ -498,7 +502,7 @@ class NET_EXPORT TransportSecurityState + friend class TransportSecurityStateStaticFuzzer; +@@ -499,7 +503,7 @@ class NET_EXPORT TransportSecurityState // IsBuildTimely returns true if the current build is new enough ensure that // built in security information (i.e. HSTS preloading and pinning // information) is timely. @@ -95,7 +95,7 @@ index fc40b7d..c0b14a4 100644 // Helper method for actually checking pins. PKPStatus CheckPublicKeyPinsImpl( -@@ -589,6 +593,8 @@ class NET_EXPORT TransportSecurityState +@@ -590,6 +594,8 @@ class NET_EXPORT TransportSecurityState // True if public key pinning bypass is enabled for local trust anchors. bool enable_pkp_bypass_for_local_trust_anchors_; diff --git a/patch/patches/net_urlrequest_1327.patch b/patch/patches/net_urlrequest_1327.patch index 113fb0be1..d8cb2c122 100644 --- a/patch/patches/net_urlrequest_1327.patch +++ b/patch/patches/net_urlrequest_1327.patch @@ -1,8 +1,8 @@ diff --git url_request.h url_request.h -index 9ef191c..2100168 100644 +index e1406f3..ed9aa91 100644 --- url_request.h +++ url_request.h -@@ -655,10 +655,11 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), +@@ -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_; } diff --git a/patch/patches/pdfium_print_549365.patch b/patch/patches/pdfium_print_549365.patch index e3a8b8fd4..98d6f188e 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 f91ea0e..b57c692 100644 +index 4a05c56..5e1c4e8 100644 --- BUILD.gn +++ BUILD.gn -@@ -183,6 +183,10 @@ static_library("pdfium") { +@@ -194,6 +194,10 @@ static_library("pdfium") { } else { libs += [ "freetype" ] } @@ -14,7 +14,7 @@ index f91ea0e..b57c692 100644 static_library("test_support") { diff --git fpdfsdk/fpdfview.cpp fpdfsdk/fpdfview.cpp -index 334c14c..fd918f3 100644 +index ff4d46e..5d4c419 100644 --- fpdfsdk/fpdfview.cpp +++ fpdfsdk/fpdfview.cpp @@ -31,6 +31,7 @@ @@ -25,7 +25,7 @@ index 334c14c..fd918f3 100644 #include "public/fpdf_ext.h" #include "public/fpdf_progressive.h" #include "third_party/base/numerics/safe_conversions_impl.h" -@@ -263,6 +264,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() { +@@ -383,6 +384,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() { CPDF_ModuleMgr::Destroy(); CFX_GEModule::Destroy(); diff --git a/patch/patches/prefs_content_1161.patch b/patch/patches/prefs_content_1161.patch index e08acb471..15cbefe95 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 86fcd13..c695975 100644 +index ffe235a..e7bf4be 100644 --- public/common/common_param_traits_macros.h +++ public/common/common_param_traits_macros.h -@@ -201,6 +201,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 86fcd13..c695975 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 da49d44..e42e715 100644 +index 7f24f09..ab0fe0d 100644 --- public/common/web_preferences.cc +++ public/common/web_preferences.cc -@@ -173,6 +173,7 @@ WebPreferences::WebPreferences() +@@ -172,6 +172,7 @@ WebPreferences::WebPreferences() spatial_navigation_enabled(false), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), @@ -23,7 +23,7 @@ index da49d44..e42e715 100644 inert_visual_viewport(false), record_whole_document(false), diff --git public/common/web_preferences.h public/common/web_preferences.h -index b853dd3..d2324bd 100644 +index 4835144..16fa0ad 100644 --- public/common/web_preferences.h +++ public/common/web_preferences.h @@ -186,6 +186,7 @@ struct CONTENT_EXPORT WebPreferences { @@ -35,10 +35,10 @@ index b853dd3..d2324bd 100644 bool inert_visual_viewport; bool record_whole_document; diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc -index 0c11c30..c0ae0af 100644 +index 7083f7d..e307222 100644 --- renderer/render_view_impl.cc +++ renderer/render_view_impl.cc -@@ -1351,6 +1351,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( +@@ -1389,6 +1389,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 e389515d0..21e9d3b99 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 e20d4e5c..d350a14 100644 +index 72267d2..5146b39 100644 --- prefs_tab_helper.cc +++ prefs_tab_helper.cc @@ -11,8 +11,8 @@ @@ -12,7 +12,7 @@ index e20d4e5c..d350a14 100644 #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -@@ -429,12 +429,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { +@@ -431,12 +431,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { GetInstance()->GetServiceForBrowserContext(profile, true)); } @@ -27,7 +27,7 @@ index e20d4e5c..d350a14 100644 PrefWatcherFactory() : BrowserContextKeyedServiceFactory( "PrefWatcher", -@@ -455,6 +453,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { +@@ -457,6 +455,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 90130703b..19fd917a0 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 cb9d140..528091d 100644 +index 7ec0135..9f68626 100644 --- chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ chrome/browser/ui/cocoa/applescript/tab_applescript.mm @@ -9,7 +9,6 @@ @@ -24,7 +24,7 @@ index cb9d140..528091d 100644 using content::NavigationController; using content::NavigationEntry; using content::OpenURLParams; -@@ -231,11 +235,15 @@ - (void)handlesStopScriptCommand:(NSScriptCommand*)command { +@@ -231,11 +235,15 @@ void ResumeAppleEventAndSendReply(NSAppleEventManagerSuspensionID suspension_id, - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT); @@ -41,10 +41,10 @@ index cb9d140..528091d 100644 - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { diff --git components/printing/common/print_messages.cc components/printing/common/print_messages.cc -index 5820bb1..a1a8f08 100644 +index a9291a2..1a50724 100644 --- components/printing/common/print_messages.cc +++ components/printing/common/print_messages.cc -@@ -105,7 +105,6 @@ void PrintMsg_PrintPages_Params::Reset() { +@@ -107,7 +107,6 @@ void PrintMsg_PrintPages_Params::Reset() { pages = std::vector(); } @@ -52,16 +52,16 @@ index 5820bb1..a1a8f08 100644 PrintHostMsg_RequestPrintPreview_Params:: PrintHostMsg_RequestPrintPreview_Params() : is_modifiable(false), -@@ -127,4 +126,3 @@ PrintHostMsg_SetOptionsFromDocument_Params:: +@@ -129,4 +128,3 @@ PrintHostMsg_SetOptionsFromDocument_Params:: PrintHostMsg_SetOptionsFromDocument_Params:: ~PrintHostMsg_SetOptionsFromDocument_Params() { } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) diff --git components/printing/common/print_messages.h components/printing/common/print_messages.h -index 3d1e71a..a876c2a 100644 +index 3679499..b2d2544 100644 --- components/printing/common/print_messages.h +++ components/printing/common/print_messages.h -@@ -73,7 +73,6 @@ struct PrintMsg_PrintPages_Params { +@@ -74,7 +74,6 @@ struct PrintMsg_PrintPages_Params { std::vector pages; }; @@ -69,7 +69,7 @@ index 3d1e71a..a876c2a 100644 struct PrintHostMsg_RequestPrintPreview_Params { PrintHostMsg_RequestPrintPreview_Params(); ~PrintHostMsg_RequestPrintPreview_Params(); -@@ -92,7 +91,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { +@@ -93,7 +92,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { printing::DuplexMode duplex; printing::PageRanges page_ranges; }; @@ -77,7 +77,7 @@ index 3d1e71a..a876c2a 100644 #endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ -@@ -182,7 +180,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) +@@ -186,7 +184,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) IPC_STRUCT_TRAITS_MEMBER(to) IPC_STRUCT_TRAITS_END() @@ -85,7 +85,7 @@ index 3d1e71a..a876c2a 100644 IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params) IPC_STRUCT_TRAITS_MEMBER(is_modifiable) IPC_STRUCT_TRAITS_MEMBER(webnode_only) -@@ -203,7 +200,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) +@@ -207,7 +204,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) // Specifies page range to be printed. IPC_STRUCT_TRAITS_MEMBER(page_ranges) IPC_STRUCT_TRAITS_END() @@ -93,7 +93,7 @@ index 3d1e71a..a876c2a 100644 IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins) IPC_STRUCT_TRAITS_MEMBER(content_width) -@@ -223,7 +219,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) +@@ -227,7 +223,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) IPC_STRUCT_TRAITS_MEMBER(pages) IPC_STRUCT_TRAITS_END() @@ -101,7 +101,7 @@ index 3d1e71a..a876c2a 100644 // Parameters to describe a rendered document. IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) // A shared memory handle to metafile data. -@@ -280,7 +275,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params) +@@ -284,7 +279,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params) // Indicates whether the existing preview data needs to be cleared or not. IPC_STRUCT_MEMBER(bool, clear_preview_data) IPC_STRUCT_END() @@ -109,7 +109,7 @@ index 3d1e71a..a876c2a 100644 // Parameters to describe a rendered page. IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintPage_Params) -@@ -319,22 +313,20 @@ IPC_STRUCT_END() +@@ -323,22 +317,20 @@ IPC_STRUCT_END() // Messages sent from the browser to the renderer. @@ -134,7 +134,7 @@ index 3d1e71a..a876c2a 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Tells the RenderFrame to switch the CSS to print media type, renders every -@@ -352,13 +344,11 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, +@@ -356,13 +348,11 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, // Tells the RenderFrame whether printing is enabled or not. IPC_MESSAGE_ROUTED1(PrintMsg_SetPrintingEnabled, bool /* enabled */) @@ -148,15 +148,15 @@ index 3d1e71a..a876c2a 100644 // Messages sent from the renderer to the browser. -@@ -414,7 +404,6 @@ IPC_MESSAGE_CONTROL2(PrintHostMsg_TempFileForPrintingWritten, - int /* fd in browser */) // Used only by Chrome OS. +@@ -418,7 +408,6 @@ IPC_MESSAGE_CONTROL2(PrintHostMsg_TempFileForPrintingWritten, + int /* fd in browser */) #endif // defined(OS_ANDROID) -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Asks the browser to do print preview. IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview, PrintHostMsg_RequestPrintPreview_Params /* params */) -@@ -448,7 +437,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, +@@ -452,7 +441,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, // The memory handle in this message is already valid in the browser process. IPC_MESSAGE_ROUTED1(PrintHostMsg_MetafileReadyForPrinting, PrintHostMsg_DidPreviewDocument_Params /* params */) @@ -164,7 +164,7 @@ index 3d1e71a..a876c2a 100644 // This is sent when there are invalid printer settings. IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) -@@ -457,7 +445,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) +@@ -461,7 +449,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, int /* document cookie */) @@ -172,16 +172,16 @@ index 3d1e71a..a876c2a 100644 // Tell the browser print preview failed. IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, int /* document cookie */) -@@ -484,4 +471,3 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview, +@@ -488,4 +475,3 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview, // Notify the browser to set print presets based on source PDF document. IPC_MESSAGE_ROUTED1(PrintHostMsg_SetOptionsFromDocument, PrintHostMsg_SetOptionsFromDocument_Params /* params */) -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) diff --git components/printing/renderer/print_web_view_helper.cc components/printing/renderer/print_web_view_helper.cc -index e343eef..025671c 100644 +index 3144c40..8679f72 100644 --- components/printing/renderer/print_web_view_helper.cc +++ components/printing/renderer/print_web_view_helper.cc -@@ -88,6 +88,9 @@ const float kPrintingMinimumShrinkFactor = 1.333f; +@@ -89,6 +89,9 @@ const float kPrintingMinimumShrinkFactor = 1.333f; #if BUILDFLAG(ENABLE_PRINT_PREVIEW) bool g_is_preview_enabled = true; @@ -191,7 +191,7 @@ index e343eef..025671c 100644 const char kPageLoadScriptFormat[] = "document.open(); document.write(%s); document.close();"; -@@ -102,9 +105,6 @@ void ExecuteScript(blink::WebFrame* frame, +@@ -103,9 +106,6 @@ void ExecuteScript(blink::WebFrame* frame, std::string script = base::StringPrintf(script_format, json.c_str()); frame->executeScript(blink::WebString(base::UTF8ToUTF16(script))); } @@ -201,7 +201,7 @@ index e343eef..025671c 100644 int GetDPI(const PrintMsg_Print_Params* print_params) { #if defined(OS_MACOSX) -@@ -321,7 +321,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, +@@ -323,7 +323,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, return plugin && plugin->supportsPaginatedPrint(); } @@ -209,15 +209,15 @@ index e343eef..025671c 100644 // Returns true if the current destination printer is PRINT_TO_PDF. bool IsPrintToPdfRequested(const base::DictionaryValue& job_settings) { bool print_to_pdf = false; -@@ -343,7 +342,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame, +@@ -345,7 +344,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame, } return frame_has_custom_page_size_style; } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) + #if BUILDFLAG(ENABLE_PRINTING) // Disable scaling when either: - // - The PDF specifies disabling scaling. -@@ -397,7 +395,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, +@@ -401,7 +399,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, } #endif @@ -225,7 +225,7 @@ index e343eef..025671c 100644 bool FitToPageEnabled(const base::DictionaryValue& job_settings) { bool fit_to_paper_size = false; if (!job_settings.GetBoolean(kSettingFitToPageEnabled, &fit_to_paper_size)) { -@@ -440,7 +437,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( +@@ -444,7 +441,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( } return blink::WebPrintScalingOptionFitToPrintableArea; } @@ -233,7 +233,7 @@ index e343eef..025671c 100644 // Helper function to scale and round an integer value with a double valued // scaling. -@@ -559,7 +555,6 @@ blink::WebView* FrameReference::view() { +@@ -563,7 +559,6 @@ blink::WebView* FrameReference::view() { return view_; } @@ -241,7 +241,7 @@ index e343eef..025671c 100644 // static - Not anonymous so that platform implementations can use it. void PrintWebViewHelper::PrintHeaderAndFooter( blink::WebCanvas* canvas, -@@ -617,7 +612,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter( +@@ -621,7 +616,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter( web_view->close(); } @@ -249,7 +249,7 @@ index e343eef..025671c 100644 // static - Not anonymous so that platform implementations can use it. float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame, -@@ -902,6 +896,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderFrame* render_frame, +@@ -906,6 +900,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderFrame* render_frame, print_for_preview_(false), delegate_(std::move(delegate)), print_node_in_progress_(false), @@ -257,7 +257,7 @@ index e343eef..025671c 100644 is_loading_(false), is_scripted_preview_delayed_(false), ipc_nesting_level_(0), -@@ -961,10 +956,8 @@ void PrintWebViewHelper::ScriptedPrint(bool user_initiated) { +@@ -966,10 +961,8 @@ void PrintWebViewHelper::ScriptedPrint(bool user_initiated) { return; if (g_is_preview_enabled) { @@ -268,7 +268,7 @@ index e343eef..025671c 100644 } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) Print(web_frame, blink::WebNode(), true /* is_scripted? */); -@@ -988,14 +981,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { +@@ -997,14 +990,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -283,7 +283,7 @@ index e343eef..025671c 100644 IPC_MESSAGE_HANDLER(PrintMsg_SetPrintingEnabled, OnSetPrintingEnabled) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() -@@ -1033,7 +1022,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { +@@ -1048,7 +1037,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { } #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -291,7 +291,7 @@ index e343eef..025671c 100644 void PrintWebViewHelper::OnPrintForPrintPreview( const base::DictionaryValue& job_settings) { CHECK_LE(ipc_nesting_level_, 1); -@@ -1092,7 +1080,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview( +@@ -1107,7 +1095,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview( DidFinishPrinting(FAIL_PRINT); } } @@ -299,7 +299,7 @@ index e343eef..025671c 100644 void PrintWebViewHelper::GetPageSizeAndContentAreaFromPageLayout( const PageSizeMargins& page_layout_in_points, -@@ -1117,7 +1104,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( +@@ -1132,7 +1119,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( ignore_css_margins_ = (margins_type != DEFAULT_MARGINS); } @@ -307,7 +307,7 @@ index e343eef..025671c 100644 void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) { if (ipc_nesting_level_ > 1) return; -@@ -1302,7 +1288,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { +@@ -1317,7 +1303,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { return true; } @@ -316,7 +316,7 @@ index e343eef..025671c 100644 bool PrintWebViewHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -1332,7 +1318,7 @@ bool PrintWebViewHelper::RenderPreviewPage( +@@ -1347,7 +1333,7 @@ bool PrintWebViewHelper::RenderPreviewPage( } return PreviewPageRendered(page_number, draft_metafile.get()); } @@ -325,7 +325,7 @@ index e343eef..025671c 100644 bool PrintWebViewHelper::FinalizePrintReadyDocument() { DCHECK(!is_print_ready_metafile_sent_); -@@ -1362,7 +1348,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() { +@@ -1377,7 +1363,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() { Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params)); return true; } @@ -333,7 +333,7 @@ index e343eef..025671c 100644 void PrintWebViewHelper::OnPrintingDone(bool success) { if (ipc_nesting_level_ > 1) -@@ -1377,7 +1362,6 @@ void PrintWebViewHelper::OnSetPrintingEnabled(bool enabled) { +@@ -1392,7 +1377,6 @@ void PrintWebViewHelper::OnSetPrintingEnabled(bool enabled) { is_printing_enabled_ = enabled; } @@ -341,7 +341,7 @@ index e343eef..025671c 100644 void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { if (ipc_nesting_level_ > 1) return; -@@ -1388,7 +1372,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { +@@ -1403,7 +1387,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { // that instead. auto plugin = delegate_->GetPdfElement(frame); if (!plugin.isNull()) { @@ -351,7 +351,7 @@ index e343eef..025671c 100644 return; } print_preview_context_.InitWithFrame(frame); -@@ -1396,7 +1382,6 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { +@@ -1411,7 +1397,6 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { ? PRINT_PREVIEW_USER_INITIATED_SELECTION : PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); } @@ -359,10 +359,10 @@ index e343eef..025671c 100644 bool PrintWebViewHelper::IsPrintingEnabled() const { return is_printing_enabled_; -@@ -1420,11 +1405,9 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) { +@@ -1433,11 +1418,9 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) { + + print_node_in_progress_ = true; - // Make a copy of the node, in case RenderView::OnContextMenuClosed resets - // its |context_menu_node_|. - if (g_is_preview_enabled) { -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) + if (g_is_preview_enabled || force_print_preview_) { @@ -371,8 +371,8 @@ index e343eef..025671c 100644 -#endif } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) - blink::WebNode duplicate_node(node); -@@ -1490,7 +1473,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { + // Make a copy of the node, in case RenderView::OnContextMenuClosed() resets +@@ -1526,7 +1509,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { } break; @@ -380,7 +380,7 @@ index e343eef..025671c 100644 case FAIL_PREVIEW: int cookie = print_pages_params_ ? print_pages_params_->params.document_cookie : 0; -@@ -1502,7 +1484,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { +@@ -1538,7 +1520,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { } print_preview_context_.Failed(notify_browser_of_print_failure_); break; @@ -388,7 +388,7 @@ index e343eef..025671c 100644 } prep_frame_view_.reset(); print_pages_params_.reset(); -@@ -1634,7 +1615,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, +@@ -1670,7 +1651,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, return true; } @@ -396,15 +396,15 @@ index e343eef..025671c 100644 bool PrintWebViewHelper::SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options) { blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); -@@ -1743,7 +1723,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( - - return true; +@@ -1777,7 +1757,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( + print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS); + return false; } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) #if BUILDFLAG(ENABLE_BASIC_PRINTING) - bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame, -@@ -1857,7 +1836,6 @@ void PrintWebViewHelper::PrintPageInternal( + void PrintWebViewHelper::GetPrintSettingsFromUser( +@@ -1884,7 +1863,6 @@ void PrintWebViewHelper::PrintPageInternal( MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); @@ -412,7 +412,7 @@ index e343eef..025671c 100644 if (params.params.display_header_footer) { // TODO(thestig): Figure out why Linux needs this. It is almost certainly // |printingMinimumShrinkFactor| from Blink. -@@ -1872,7 +1850,6 @@ void PrintWebViewHelper::PrintPageInternal( +@@ -1899,7 +1877,6 @@ void PrintWebViewHelper::PrintPageInternal( scale_factor / fudge_factor, page_layout_in_points, params.params); } @@ -420,7 +420,7 @@ index e343eef..025671c 100644 float webkit_scale_factor = RenderPageContent(frame, params.page_number, canvas_area, content_area, -@@ -1908,7 +1885,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( +@@ -1935,7 +1912,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( return true; } @@ -428,7 +428,7 @@ index e343eef..025671c 100644 void PrintWebViewHelper::ShowScriptedPrintPreview() { if (is_scripted_preview_delayed_) { is_scripted_preview_delayed_ = false; -@@ -2036,7 +2012,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number, +@@ -2066,7 +2042,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number, Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params)); return true; } @@ -437,10 +437,10 @@ index e343eef..025671c 100644 PrintWebViewHelper::PrintPreviewContext::PrintPreviewContext() : total_page_count_(0), diff --git components/printing/renderer/print_web_view_helper.h components/printing/renderer/print_web_view_helper.h -index 2dad908..fea05fd 100644 +index e603411..ec4b7d8 100644 --- components/printing/renderer/print_web_view_helper.h +++ components/printing/renderer/print_web_view_helper.h -@@ -143,9 +143,7 @@ class PrintWebViewHelper +@@ -145,9 +145,7 @@ class PrintWebViewHelper OK, FAIL_PRINT_INIT, FAIL_PRINT, @@ -450,7 +450,7 @@ index 2dad908..fea05fd 100644 }; enum PrintPreviewErrorBuckets { -@@ -181,10 +179,8 @@ class PrintWebViewHelper +@@ -183,10 +181,8 @@ class PrintWebViewHelper void OnPrintForSystemDialog(); void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -461,7 +461,7 @@ index 2dad908..fea05fd 100644 void OnPrintingDone(bool success); // Get |page_size| and |content_area| information from -@@ -197,7 +193,6 @@ class PrintWebViewHelper +@@ -199,7 +195,6 @@ class PrintWebViewHelper // Update |ignore_css_margins_| based on settings. void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); @@ -469,7 +469,7 @@ index 2dad908..fea05fd 100644 // Prepare frame for creating preview document. void PrepareFrameForPreviewDocument(); -@@ -214,7 +209,6 @@ class PrintWebViewHelper +@@ -216,7 +211,6 @@ class PrintWebViewHelper // Finalize the print ready preview document. bool FinalizePrintReadyDocument(); @@ -477,7 +477,7 @@ index 2dad908..fea05fd 100644 // Enable/Disable printing. void OnSetPrintingEnabled(bool enabled); -@@ -242,7 +236,6 @@ class PrintWebViewHelper +@@ -246,7 +240,6 @@ class PrintWebViewHelper const blink::WebNode& node, int* number_of_pages); @@ -485,15 +485,15 @@ index 2dad908..fea05fd 100644 // Set options for print preset from source PDF document. bool SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options); -@@ -253,7 +246,6 @@ class PrintWebViewHelper +@@ -257,7 +250,6 @@ class PrintWebViewHelper bool UpdatePrintSettings(blink::WebLocalFrame* frame, const blink::WebNode& node, const base::DictionaryValue& passed_job_settings); -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) + #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Get final print settings from the user. - // Return false if the user cancels or on error. -@@ -328,7 +320,6 @@ class PrintWebViewHelper +@@ -335,7 +327,6 @@ class PrintWebViewHelper const PrintMsg_PrintPages_Params& params, int page_count); @@ -501,7 +501,7 @@ index 2dad908..fea05fd 100644 // Given the |device| and |canvas| to draw on, prints the appropriate headers // and footers using strings from |header_footer_info| on to the canvas. static void PrintHeaderAndFooter(blink::WebCanvas* canvas, -@@ -338,7 +329,6 @@ class PrintWebViewHelper +@@ -345,7 +336,6 @@ class PrintWebViewHelper float webkit_scale_factor, const PageSizeMargins& page_layout_in_points, const PrintMsg_Print_Params& params); @@ -509,15 +509,15 @@ index 2dad908..fea05fd 100644 // Script Initiated Printing ------------------------------------------------ -@@ -348,7 +338,6 @@ class PrintWebViewHelper - bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame, +@@ -355,7 +345,6 @@ class PrintWebViewHelper + bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame, bool user_initiated); -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Shows scripted print preview when options from plugin are available. void ShowScriptedPrintPreview(); -@@ -364,7 +353,6 @@ class PrintWebViewHelper +@@ -373,7 +362,6 @@ class PrintWebViewHelper // |metafile| is the rendered page. Otherwise |metafile| is NULL. // Returns true if print preview should continue, false on failure. bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile); @@ -525,7 +525,7 @@ index 2dad908..fea05fd 100644 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); -@@ -516,6 +504,7 @@ class PrintWebViewHelper +@@ -525,6 +513,7 @@ class PrintWebViewHelper ScriptingThrottler scripting_throttler_; bool print_node_in_progress_; @@ -537,7 +537,7 @@ diff --git components/printing/renderer/print_web_view_helper_mac.mm components/ index ff49472..b107439 100644 --- components/printing/renderer/print_web_view_helper_mac.mm +++ components/printing/renderer/print_web_view_helper_mac.mm -@@ -69,7 +69,6 @@ +@@ -69,7 +69,6 @@ void PrintWebViewHelper::PrintPageInternal( Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params)); } @@ -545,7 +545,7 @@ index ff49472..b107439 100644 bool PrintWebViewHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -106,7 +105,6 @@ +@@ -106,7 +105,6 @@ bool PrintWebViewHelper::RenderPreviewPage( } return PreviewPageRendered(page_number, draft_metafile.get()); } @@ -553,7 +553,7 @@ index ff49472..b107439 100644 void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, int page_number, -@@ -142,14 +140,12 @@ +@@ -142,14 +140,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); skia::SetIsPreviewMetafile(*canvas, is_preview); diff --git a/patch/patches/render_frame_message_filter_626728.patch b/patch/patches/render_frame_message_filter_626728.patch index 661b1fe19..6e54ac160 100644 --- a/patch/patches/render_frame_message_filter_626728.patch +++ b/patch/patches/render_frame_message_filter_626728.patch @@ -1,5 +1,5 @@ diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc -index 573b5d9..e61cfa0 100644 +index 93a1da4..476d7cc 100644 --- content/browser/frame_host/render_frame_message_filter.cc +++ content/browser/frame_host/render_frame_message_filter.cc @@ -491,7 +491,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( diff --git a/patch/patches/render_view_host_impl_1392.patch b/patch/patches/render_view_host_impl_1392.patch index a3ad01f16..d71fc91dd 100644 --- a/patch/patches/render_view_host_impl_1392.patch +++ b/patch/patches/render_view_host_impl_1392.patch @@ -1,8 +1,8 @@ diff --git render_view_host_impl.h render_view_host_impl.h -index e8890aa..910a25b 100644 +index a2a0359..d5d2ff7 100644 --- render_view_host_impl.h +++ render_view_host_impl.h -@@ -167,6 +167,7 @@ class CONTENT_EXPORT RenderViewHostImpl : public RenderViewHost, +@@ -158,6 +158,7 @@ class CONTENT_EXPORT RenderViewHostImpl : public RenderViewHost, void set_is_swapped_out(bool is_swapped_out) { is_swapped_out_ = is_swapped_out; } diff --git a/patch/patches/render_widget_host_1070383005.patch b/patch/patches/render_widget_host_1070383005.patch index df46f245d..9b314528f 100644 --- a/patch/patches/render_widget_host_1070383005.patch +++ b/patch/patches/render_widget_host_1070383005.patch @@ -1,5 +1,5 @@ diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm -index 689ae2c..52e405d 100644 +index 53c4808..21d741a 100644 --- render_widget_host_view_mac.mm +++ render_widget_host_view_mac.mm @@ -462,9 +462,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, diff --git a/patch/patches/render_widget_latency_2060.patch b/patch/patches/render_widget_latency_2060.patch index ad9229c80..19bd460a8 100644 --- a/patch/patches/render_widget_latency_2060.patch +++ b/patch/patches/render_widget_latency_2060.patch @@ -1,12 +1,12 @@ diff --git content/browser/renderer_host/input/render_widget_host_latency_tracker.cc content/browser/renderer_host/input/render_widget_host_latency_tracker.cc -index a8d3ac2..908d0e5d 100644 +index 02d6fe5..6d26a26 100644 --- content/browser/renderer_host/input/render_widget_host_latency_tracker.cc +++ content/browser/renderer_host/input/render_widget_host_latency_tracker.cc -@@ -96,7 +96,6 @@ void UpdateLatencyCoordinates(const WebInputEvent& event, +@@ -99,7 +99,6 @@ void UpdateLatencyCoordinates(const WebInputEvent& event, #define CONFIRM_VALID_TIMING(start, end) \ DCHECK(!start.first_event_time.is_null()); \ DCHECK(!end.last_event_time.is_null()); \ - DCHECK_GE(end.last_event_time, start.first_event_time); - // Touch/wheel to scroll latency that is mostly under 1 second. - #define UMA_HISTOGRAM_TOUCH_WHEEL_TO_SCROLL_LATENCY(name, start, end) \ + // Touch/wheel to scroll latency using Rappor. + #define RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(delegate, name, start, end) \ diff --git a/patch/patches/renderer_preferences_util_545103.patch b/patch/patches/renderer_preferences_util_545103.patch index 630d78f68..1cdb0d289 100644 --- a/patch/patches/renderer_preferences_util_545103.patch +++ b/patch/patches/renderer_preferences_util_545103.patch @@ -1,8 +1,8 @@ diff --git renderer_preferences_util.cc renderer_preferences_util.cc -index c20a01d..ceeb3eb 100644 +index 7296a04..c702d31 100644 --- renderer_preferences_util.cc +++ renderer_preferences_util.cc -@@ -31,7 +31,8 @@ +@@ -32,7 +32,8 @@ #include "ui/base/cocoa/defaults_utils.h" #endif @@ -12,7 +12,7 @@ index c20a01d..ceeb3eb 100644 #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" #include "ui/views/linux_ui/linux_ui.h" -@@ -133,7 +134,8 @@ void UpdateFromSystemSettings(content::RendererPreferences* prefs, +@@ -134,7 +135,8 @@ void UpdateFromSystemSettings(content::RendererPreferences* prefs, prefs->caret_blink_interval = interval.InSecondsF(); #endif diff --git a/patch/patches/rwh_background_color_1984.patch b/patch/patches/rwh_background_color_1984.patch index f1475e645..b1d2cc630 100644 --- a/patch/patches/rwh_background_color_1984.patch +++ b/patch/patches/rwh_background_color_1984.patch @@ -1,8 +1,8 @@ diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc -index 8a73ab8..11f2d54 100644 +index 6cd8721..2f54816 100644 --- content/browser/renderer_host/render_widget_host_view_aura.cc +++ content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -761,8 +761,10 @@ void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) { +@@ -746,8 +746,10 @@ void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) { RenderWidgetHostViewBase::SetBackgroundColor(color); bool opaque = GetBackgroundOpaque(); host_->SetBackgroundOpaque(opaque); diff --git a/patch/patches/storage_partition_1973.patch b/patch/patches/storage_partition_1973.patch index e662b5dca..6939aecfd 100644 --- a/patch/patches/storage_partition_1973.patch +++ b/patch/patches/storage_partition_1973.patch @@ -1,8 +1,8 @@ diff --git components/browsing_data/content/BUILD.gn components/browsing_data/content/BUILD.gn -index 6229e1b..176f897 100644 +index aa613cf..ee771ae 100644 --- components/browsing_data/content/BUILD.gn +++ components/browsing_data/content/BUILD.gn -@@ -15,6 +15,7 @@ static_library("content") { +@@ -17,6 +17,7 @@ static_library("content") { deps = [ "//base", "//content/public/browser", @@ -11,7 +11,7 @@ index 6229e1b..176f897 100644 ] } diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc -index 41f74ae..daca31a7 100644 +index 89913ca..db08c06 100644 --- content/browser/appcache/appcache_internals_ui.cc +++ content/browser/appcache/appcache_internals_ui.cc @@ -369,8 +369,8 @@ void AppCacheInternalsUI::CreateProxyForPartition( @@ -26,10 +26,10 @@ index 41f74ae..daca31a7 100644 } diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc -index 533d3f1..f0fc700 100644 +index 3192cd0..39b1518 100644 --- content/browser/blob_storage/chrome_blob_storage_context.cc +++ content/browser/blob_storage/chrome_blob_storage_context.cc -@@ -41,6 +41,11 @@ class BlobHandleImpl : public BlobHandle { +@@ -73,6 +73,11 @@ class BlobHandleImpl : public BlobHandle { ChromeBlobStorageContext::ChromeBlobStorageContext() {} @@ -42,10 +42,10 @@ index 533d3f1..f0fc700 100644 BrowserContext* context) { if (!context->GetUserData(kBlobStorageContextKeyName)) { diff --git content/browser/blob_storage/chrome_blob_storage_context.h content/browser/blob_storage/chrome_blob_storage_context.h -index bd02cb1..074e77f 100644 +index 4c7cfac..4d5c09c 100644 --- content/browser/blob_storage/chrome_blob_storage_context.h +++ content/browser/blob_storage/chrome_blob_storage_context.h -@@ -41,6 +41,7 @@ class CONTENT_EXPORT ChromeBlobStorageContext +@@ -43,6 +43,7 @@ class CONTENT_EXPORT ChromeBlobStorageContext public: ChromeBlobStorageContext(); @@ -54,10 +54,10 @@ index bd02cb1..074e77f 100644 BrowserContext* browser_context); diff --git content/browser/browser_context.cc content/browser/browser_context.cc -index 063b0ef..b05fd26 100644 +index 2f14933..6894773 100644 --- content/browser/browser_context.cc +++ content/browser/browser_context.cc -@@ -117,7 +117,14 @@ StoragePartition* GetStoragePartitionFromConfig( +@@ -115,7 +115,14 @@ StoragePartition* GetStoragePartitionFromConfig( if (browser_context->IsOffTheRecord()) in_memory = true; @@ -73,7 +73,7 @@ index 063b0ef..b05fd26 100644 } void SaveSessionStateOnIOThread( -@@ -516,6 +523,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( +@@ -503,6 +510,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( : nullptr; } @@ -86,10 +86,10 @@ index 063b0ef..b05fd26 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 c34d15a1..429c0e8 100644 +index 242d33e..4dfb463 100644 --- content/browser/devtools/protocol/service_worker_handler.cc +++ content/browser/devtools/protocol/service_worker_handler.cc -@@ -384,10 +384,9 @@ Response ServiceWorkerHandler::DispatchSyncEvent( +@@ -321,10 +321,9 @@ Response ServiceWorkerHandler::DispatchSyncEvent( if (!base::StringToInt64(registration_id, &id)) return CreateInvalidVersionIdErrorResponse(); @@ -103,10 +103,10 @@ index c34d15a1..429c0e8 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 43b5cf5..c387825 100644 +index 5e75c17..28fdb04 100644 --- content/browser/renderer_host/render_process_host_impl.cc +++ content/browser/renderer_host/render_process_host_impl.cc -@@ -649,7 +649,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() { +@@ -653,7 +653,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() { RenderProcessHostImpl::RenderProcessHostImpl( BrowserContext* browser_context, @@ -115,7 +115,17 @@ index 43b5cf5..c387825 100644 bool is_for_guests_only) : fast_shutdown_started_(false), deleting_soon_(false), -@@ -1001,6 +1001,22 @@ void RenderProcessHostImpl::ResetChannelProxy() { +@@ -685,7 +685,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( + indexed_db_factory_(new IndexedDBDispatcherHost( + id_, + storage_partition_impl_->GetURLRequestContext(), +- storage_partition_impl_->GetIndexedDBContext(), ++ static_cast( ++ storage_partition_impl_->GetIndexedDBContext()), + ChromeBlobStorageContext::GetFor(browser_context_))), + channel_connected_(false), + sent_render_process_ready_(false), +@@ -1010,6 +1011,22 @@ void RenderProcessHostImpl::ResetChannelProxy() { void RenderProcessHostImpl::CreateMessageFilters() { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -138,7 +148,7 @@ index 43b5cf5..c387825 100644 AddFilter(new ResourceSchedulerFilter(GetID())); MediaInternals* media_internals = MediaInternals::GetInstance(); // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages -@@ -1015,8 +1031,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1024,8 +1041,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { new RenderMessageFilter( GetID(), GetBrowserContext(), request_context.get(), widget_helper_.get(), media_internals, @@ -149,37 +159,33 @@ index 43b5cf5..c387825 100644 AddFilter(render_message_filter.get()); render_frame_message_filter_ = new RenderFrameMessageFilter( -@@ -1047,9 +1063,9 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1055,10 +1072,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { + ChromeBlobStorageContext::GetFor(browser_context); resource_message_filter_ = new ResourceMessageFilter( - GetID(), PROCESS_TYPE_RENDERER, -- storage_partition_impl_->GetAppCacheService(), blob_storage_context.get(), -+ app_cache_service, blob_storage_context.get(), +- GetID(), storage_partition_impl_->GetAppCacheService(), ++ GetID(), app_cache_service, + blob_storage_context.get(), storage_partition_impl_->GetFileSystemContext(), - storage_partition_impl_->GetServiceWorkerContext(), + service_worker_context, get_contexts_callback); AddFilter(resource_message_filter_.get()); -@@ -1072,14 +1088,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { - AddFilter(audio_renderer_host_.get()); +@@ -1082,10 +1099,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { AddFilter( - new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_manager())); -- AddFilter(new AppCacheDispatcherHost( + new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_service())); + AddFilter(new AppCacheDispatcherHost( - storage_partition_impl_->GetAppCacheService(), GetID())); -+ AddFilter(new AppCacheDispatcherHost(app_cache_service, GetID())); ++ app_cache_service, GetID())); AddFilter(new ClipboardMessageFilter(blob_storage_context)); -- AddFilter(new DOMStorageMessageFilter( + AddFilter(new DOMStorageMessageFilter( - storage_partition_impl_->GetDOMStorageContext())); -+ AddFilter(new DOMStorageMessageFilter(dom_storage_context)); - AddFilter(new IndexedDBDispatcherHost( - GetID(), storage_partition_impl_->GetURLRequestContext(), -- storage_partition_impl_->GetIndexedDBContext(), -+ indexed_db_context, - blob_storage_context.get())); ++ dom_storage_context)); - #if defined(ENABLE_WEBRTC) -@@ -1125,14 +1139,13 @@ void RenderProcessHostImpl::CreateMessageFilters() { + #if BUILDFLAG(ENABLE_WEBRTC) + peer_connection_tracker_host_ = new PeerConnectionTrackerHost( +@@ -1130,14 +1147,13 @@ void RenderProcessHostImpl::CreateMessageFilters() { scoped_refptr cache_storage_filter = new CacheStorageDispatcherHost(); @@ -196,7 +202,7 @@ index 43b5cf5..c387825 100644 AddFilter(service_worker_filter.get()); AddFilter(new SharedWorkerMessageFilter( -@@ -1140,12 +1153,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1145,12 +1161,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { WorkerStoragePartition( storage_partition_impl_->GetURLRequestContext(), storage_partition_impl_->GetMediaURLRequestContext(), @@ -211,8 +217,8 @@ index 43b5cf5..c387825 100644 + service_worker_context), message_port_message_filter_.get())); - #if defined(ENABLE_WEBRTC) -@@ -1160,11 +1173,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { + #if BUILDFLAG(ENABLE_WEBRTC) +@@ -1165,11 +1181,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { GetID(), storage_partition_impl_->GetQuotaManager(), GetContentClient()->browser()->CreateQuotaPermissionContext())); @@ -225,16 +231,16 @@ index 43b5cf5..c387825 100644 resource_context, service_worker_context, browser_context); AddFilter(notification_message_filter_.get()); -@@ -1173,7 +1183,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1177,7 +1190,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { AddFilter(new HistogramMessageFilter()); AddFilter(new MemoryMessageFilter(this)); AddFilter(new PushMessagingMessageFilter( - GetID(), storage_partition_impl_->GetServiceWorkerContext())); + GetID(), service_worker_context)); #if defined(OS_ANDROID) - AddFilter(new ScreenOrientationMessageFilterAndroid()); + AddFilter(new ScreenOrientationListenerAndroid()); synchronous_compositor_filter_ = -@@ -1186,6 +1196,11 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { +@@ -1190,6 +1203,11 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { auto registry = base::MakeUnique( service_manager::mojom::kServiceManager_ConnectorSpec); @@ -246,7 +252,7 @@ index 43b5cf5..c387825 100644 channel_->AddAssociatedInterface( base::Bind(&RenderProcessHostImpl::OnRouteProviderRequest, base::Unretained(this))); -@@ -1224,8 +1239,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { +@@ -1234,8 +1252,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { AddUIThreadInterface( registry.get(), base::Bind(&PlatformNotificationContextImpl::CreateService, @@ -256,19 +262,19 @@ index 43b5cf5..c387825 100644 GetID())); AddUIThreadInterface( registry.get(), -@@ -1399,6 +1413,7 @@ void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { +@@ -1428,6 +1445,7 @@ void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!is_worker_ref_count_disabled_); is_worker_ref_count_disabled_ = true; + browser_context_ = nullptr; - if (!worker_ref_count()) + if (!GetWorkerRefCount()) return; service_worker_ref_count_ = 0; diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h -index 93c9fd0..968b230 100644 +index 75895e1..ccc5e00 100644 --- content/browser/renderer_host/render_process_host_impl.h +++ content/browser/renderer_host/render_process_host_impl.h -@@ -66,7 +66,6 @@ class RenderWidgetHelper; +@@ -71,7 +71,6 @@ class RenderWidgetHelper; class RenderWidgetHost; class ResourceMessageFilter; class StoragePartition; @@ -276,7 +282,7 @@ index 93c9fd0..968b230 100644 namespace mojom { class StoragePartitionService; -@@ -102,7 +101,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -107,7 +106,7 @@ class CONTENT_EXPORT RenderProcessHostImpl public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) { public: RenderProcessHostImpl(BrowserContext* browser_context, @@ -285,7 +291,7 @@ index 93c9fd0..968b230 100644 bool is_for_guests_only); ~RenderProcessHostImpl() override; -@@ -493,7 +492,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -508,7 +507,7 @@ class CONTENT_EXPORT RenderProcessHostImpl BrowserContext* browser_context_; // Owned by |browser_context_|. @@ -295,10 +301,10 @@ index 93c9fd0..968b230 100644 // The observers watching our lifetime. base::ObserverList observers_; diff --git content/browser/site_instance_impl.cc content/browser/site_instance_impl.cc -index 7980783..e6d5a49 100644 +index a4c8862..2312f35 100644 --- content/browser/site_instance_impl.cc +++ content/browser/site_instance_impl.cc -@@ -116,9 +116,8 @@ RenderProcessHost* SiteInstanceImpl::GetProcess() { +@@ -198,9 +198,8 @@ RenderProcessHost* SiteInstanceImpl::GetProcess() { process_ = g_render_process_host_factory_->CreateRenderProcessHost( browser_context, this); } else { @@ -307,15 +313,15 @@ index 7980783..e6d5a49 100644 - BrowserContext::GetStoragePartition(browser_context, this)); + StoragePartition* partition = + BrowserContext::GetStoragePartition(browser_context, this); - process_ = new RenderProcessHostImpl(browser_context, - partition, - site_.SchemeIs(kGuestScheme)); + process_ = new RenderProcessHostImpl(browser_context, partition, + is_for_guests_only); + } diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h -index 34dcfa6..5459ec4 100644 +index 2c20f2e..185048e 100644 --- content/browser/storage_partition_impl.h +++ content/browser/storage_partition_impl.h -@@ -25,9 +25,7 @@ - #include "content/browser/payments/payment_app_context.h" +@@ -26,9 +26,7 @@ + #include "content/browser/push_messaging/push_messaging_context.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/common/content_export.h" -#include "content/common/storage_partition_service.mojom.h" @@ -324,16 +330,16 @@ index 34dcfa6..5459ec4 100644 #include "net/cookies/cookie_store.h" #include "storage/browser/quota/special_storage_policy.h" -@@ -73,10 +71,9 @@ class CONTENT_EXPORT StoragePartitionImpl +@@ -74,10 +72,9 @@ class CONTENT_EXPORT StoragePartitionImpl HostZoomLevelContext* GetHostZoomLevelContext() override; ZoomLevelDelegate* GetZoomLevelDelegate() override; PlatformNotificationContextImpl* GetPlatformNotificationContext() override; - - BackgroundSyncContext* GetBackgroundSyncContext(); -- PaymentAppContext* GetPaymentAppContext(); +- PaymentAppContextImpl* GetPaymentAppContext(); - BroadcastChannelProvider* GetBroadcastChannelProvider(); + BackgroundSyncContext* GetBackgroundSyncContext() override; -+ PaymentAppContext* GetPaymentAppContext() override; ++ PaymentAppContextImpl* GetPaymentAppContext() override; + BroadcastChannelProvider* GetBroadcastChannelProvider() override; // mojom::StoragePartitionService interface. @@ -377,7 +383,7 @@ index 075ae3e..57fb5fd 100644 void InitializeOnIOThread(); diff --git content/public/browser/browser_context.h content/public/browser/browser_context.h -index d69bd71..e5da59f 100644 +index f5cc21f..0a6cd2b 100644 --- content/public/browser/browser_context.h +++ content/public/browser/browser_context.h @@ -170,6 +170,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { @@ -405,7 +411,7 @@ index d69bd71..e5da59f 100644 } // namespace content diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h -index 909b370..29587b9 100644 +index 909b370..73e8a80 100644 --- content/public/browser/storage_partition.h +++ content/public/browser/storage_partition.h @@ -13,6 +13,8 @@ @@ -429,7 +435,7 @@ index 909b370..29587b9 100644 class HostZoomLevelContext; class HostZoomMap; class IndexedDBContext; -+class PaymentAppContext; ++class PaymentAppContextImpl; class PlatformNotificationContext; class ServiceWorkerContext; class ZoomLevelDelegate; @@ -438,7 +444,7 @@ index 909b370..29587b9 100644 virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0; virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0; + virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0; -+ virtual PaymentAppContext* GetPaymentAppContext() = 0; ++ virtual PaymentAppContextImpl* GetPaymentAppContext() = 0; + virtual BroadcastChannelProvider* GetBroadcastChannelProvider() = 0; enum : uint32_t { @@ -454,6 +460,26 @@ index 909b370..29587b9 100644 protected: virtual ~StoragePartition() {} }; +diff --git extensions/browser/api/socket/socket_api.cc extensions/browser/api/socket/socket_api.cc +index cbc8019..d04955c 100644 +--- extensions/browser/api/socket/socket_api.cc ++++ extensions/browser/api/socket/socket_api.cc +@@ -816,11 +816,11 @@ void SocketGetNetworkListFunction::SendResponseOnUIThread( + + std::vector create_arg; + create_arg.reserve(interface_list.size()); +- for (const net::NetworkInterface& interface : interface_list) { ++ for (const net::NetworkInterface& i : interface_list) { + api::socket::NetworkInterface info; +- info.name = interface.name; +- info.address = interface.address.ToString(); +- info.prefix_length = interface.prefix_length; ++ info.name = i.name; ++ info.address = i.address.ToString(); ++ info.prefix_length = i.prefix_length; + create_arg.push_back(std::move(info)); + } + 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 diff --git a/patch/patches/supports_user_data_1710.patch b/patch/patches/supports_user_data_1710.patch index 860cdf4bd..792a0a424 100644 --- a/patch/patches/supports_user_data_1710.patch +++ b/patch/patches/supports_user_data_1710.patch @@ -1,8 +1,8 @@ diff --git supports_user_data.h supports_user_data.h -index a9f1c93..48d88fa 100644 +index a4c7c9f..54a151b 100644 --- supports_user_data.h +++ supports_user_data.h -@@ -33,9 +33,9 @@ class BASE_EXPORT SupportsUserData { +@@ -37,9 +37,9 @@ class BASE_EXPORT SupportsUserData { // Multiple user data values can be stored under different keys. // This object will TAKE OWNERSHIP of the given data pointer, and will // delete the object if it is changed or the object is destroyed. @@ -14,4 +14,4 @@ index a9f1c93..48d88fa 100644 + virtual void RemoveUserData(const void* key); // SupportsUserData is not thread-safe, and on debug build will assert it is - // only used on one thread. Calling this method allows the caller to hand + // only used on one execution sequence. Calling this method allows the caller diff --git a/patch/patches/ui_views_test_640741.patch b/patch/patches/ui_views_test_640741.patch index 61847a769..c0fecb164 100644 --- a/patch/patches/ui_views_test_640741.patch +++ b/patch/patches/ui_views_test_640741.patch @@ -1,10 +1,10 @@ diff --git ui/views/test/ui_controls_factory_desktop_aurax11.cc ui/views/test/ui_controls_factory_desktop_aurax11.cc -index 2be0e63..343176d 100644 +index d7b41b1..6065c73 100644 --- ui/views/test/ui_controls_factory_desktop_aurax11.cc +++ ui/views/test/ui_controls_factory_desktop_aurax11.cc @@ -146,10 +146,6 @@ class UIControlsDesktopX11 : public UIControlsAura { aura::test::QueryLatestMousePositionRequestInHost(host); - host->ConvertPointFromHost(&root_current_location); + host->ConvertPixelsToDIP(&root_current_location); - auto screen = views::test::TestDesktopScreenX11::GetInstance(); - DCHECK_EQ(screen, display::Screen::GetScreen()); diff --git a/patch/patches/views_1749.patch b/patch/patches/views_1749.patch index a5bb943f4..c3b3894d5 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 e98dda7..14825f6 100644 +index c4e986b..02fb9f3 100644 --- controls/button/menu_button.cc +++ controls/button/menu_button.cc -@@ -195,7 +195,7 @@ void MenuButton::OnPaint(gfx::Canvas* canvas) { +@@ -193,7 +193,7 @@ void MenuButton::OnPaint(gfx::Canvas* canvas) { gfx::Size MenuButton::GetPreferredSize() const { gfx::Size prefsize = LabelButton::GetPreferredSize(); if (show_menu_marker_) { @@ -56,7 +56,7 @@ index c232cc1..cc207f9 100644 // The time is used for simulating menu behavior for the menu button; that // is, if the menu is shown and the button is pressed, we need to close the diff --git view.h view.h -index bb5ebdf..959645a 100644 +index 147785c..5d413a1 100644 --- view.h +++ view.h @@ -18,6 +18,7 @@ @@ -67,7 +67,7 @@ index bb5ebdf..959645a 100644 #include "build/build_config.h" #include "ui/accessibility/ax_enums.h" #include "ui/base/accelerators/accelerator.h" -@@ -112,7 +113,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, +@@ -114,7 +115,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, public ui::LayerOwner, public ui::AcceleratorTarget, public ui::EventTarget, diff --git a/patch/patches/views_widget_180_1481_1677_1749.patch b/patch/patches/views_widget_180_1481_1677_1749.patch index aa14a2669..25b3b4808 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_base.cc content/browser/renderer_host/render_widget_host_view_base.cc -index 6408c68..735a253 100644 +index 11482ff..57e8b58 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() @@ -10,7 +10,7 @@ index 6408c68..735a253 100644 renderer_frame_number_(0), weak_factory_(this) { } -@@ -327,6 +328,14 @@ void RenderWidgetHostViewBase::FocusedNodeTouched( +@@ -336,6 +337,14 @@ void RenderWidgetHostViewBase::FocusedNodeTouched( DVLOG(1) << "FocusedNodeTouched: " << editable; } @@ -26,7 +26,7 @@ index 6408c68..735a253 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 88e7a04..0e6a740 100644 +index 08aad92..c18da2d 100644 --- content/browser/renderer_host/render_widget_host_view_base.h +++ content/browser/renderer_host/render_widget_host_view_base.h @@ -107,6 +107,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, @@ -38,7 +38,7 @@ index 88e7a04..0e6a740 100644 // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. -@@ -488,6 +490,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -491,6 +493,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, // destroyed before the RWHV is destroyed. TextInputManager* text_input_manager_; @@ -50,7 +50,7 @@ index 88e7a04..0e6a740 100644 void FlushInput(); diff --git content/browser/renderer_host/render_widget_host_view_event_handler.cc content/browser/renderer_host/render_widget_host_view_event_handler.cc -index 2adb005..222ca88 100644 +index 2307c54..7944580 100644 --- content/browser/renderer_host/render_widget_host_view_event_handler.cc +++ content/browser/renderer_host/render_widget_host_view_event_handler.cc @@ -28,6 +28,10 @@ @@ -64,7 +64,7 @@ index 2adb005..222ca88 100644 #if defined(OS_WIN) #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/public/common/context_menu_params.h" -@@ -812,6 +816,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { +@@ -805,6 +809,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { } } #endif @@ -80,10 +80,10 @@ index 2adb005..222ca88 100644 if (host_ && set_focus_on_mouse_down_or_key_event_) { set_focus_on_mouse_down_or_key_event_ = false; diff --git content/public/browser/render_widget_host_view.h content/public/browser/render_widget_host_view.h -index f721d17..5b6dfa9 100644 +index 71c693b..fffee17 100644 --- content/public/browser/render_widget_host_view.h +++ content/public/browser/render_widget_host_view.h -@@ -171,6 +171,14 @@ class CONTENT_EXPORT RenderWidgetHostView { +@@ -174,6 +174,14 @@ class CONTENT_EXPORT RenderWidgetHostView { // when the value has changed. Views must initially default to false. virtual void SetNeedsBeginFrames(bool needs_begin_frames) = 0; @@ -112,10 +112,10 @@ 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 0dea5ca..b167c8a 100644 +index 5eb0d54..89c614a 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( +@@ -84,6 +84,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( should_animate_window_close_(false), pending_close_(false), has_non_client_view_(false), @@ -123,7 +123,7 @@ index 0dea5ca..b167c8a 100644 tooltip_(NULL) { } -@@ -136,8 +137,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window, +@@ -119,8 +120,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window, native_widget_delegate_); HWND parent_hwnd = NULL; @@ -137,7 +137,7 @@ index 0dea5ca..b167c8a 100644 remove_standard_frame_ = params.remove_standard_frame; has_non_client_view_ = Widget::RequiresNonClientView(params.type); -@@ -818,11 +823,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { +@@ -819,11 +824,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { } void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { @@ -156,10 +156,10 @@ index 0dea5ca..b167c8a 100644 bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) { diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index c1ee992..6591ddf 100644 +index b69a1f7..0e60fec 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -249,6 +249,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -255,6 +255,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin // True if the window should have the frame removed. bool remove_standard_frame_; @@ -171,10 +171,10 @@ index c1ee992..6591ddf 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 8550a32..9cdd035 100644 +index 3b848bc..716ab57 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc -@@ -195,6 +195,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -194,6 +194,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( use_native_frame_(false), should_maximize_after_map_(false), use_argb_visual_(false), @@ -182,7 +182,7 @@ index 8550a32..9cdd035 100644 drag_drop_client_(NULL), native_widget_delegate_(native_widget_delegate), desktop_native_widget_aura_(desktop_native_widget_aura), -@@ -208,6 +209,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -207,6 +208,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( has_window_focus_(false), has_pointer_focus_(false), modal_dialog_xid_(0), @@ -190,7 +190,16 @@ index 8550a32..9cdd035 100644 close_widget_factory_(this), weak_factory_(this) {} -@@ -545,7 +547,8 @@ void DesktopWindowTreeHostX11::CloseNow() { +@@ -242,6 +244,8 @@ std::vector DesktopWindowTreeHostX11::GetAllOpenWindows() { + } + + gfx::Rect DesktopWindowTreeHostX11::GetX11RootWindowBounds() const { ++ if (!screen_bounds_.IsEmpty()) ++ return screen_bounds_; + return bounds_in_pixels_; + } + +@@ -550,7 +554,8 @@ void DesktopWindowTreeHostX11::CloseNow() { // Actually free our native resources. if (ui::PlatformEventSource::GetInstance()) ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); @@ -200,7 +209,7 @@ index 8550a32..9cdd035 100644 xwindow_ = None; desktop_native_widget_aura_->OnHostClosed(); -@@ -686,6 +689,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( +@@ -691,6 +696,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( } gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const { @@ -209,25 +218,16 @@ index 8550a32..9cdd035 100644 return ToDIPRect(bounds_in_pixels_); } -@@ -1202,6 +1207,8 @@ void DesktopWindowTreeHostX11::HideImpl() { +@@ -1279,6 +1286,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( } - gfx::Rect DesktopWindowTreeHostX11::GetBounds() const { -+ if (!screen_bounds_.IsEmpty()) -+ return screen_bounds_; - return bounds_in_pixels_; - } - -@@ -1261,6 +1268,8 @@ void DesktopWindowTreeHostX11::SetBounds( - } - - gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const { + gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const { + if (!screen_bounds_.IsEmpty()) + return screen_bounds_.origin(); return bounds_in_pixels_.origin(); } -@@ -1386,9 +1395,15 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1405,9 +1414,15 @@ void DesktopWindowTreeHostX11::InitX11Window( attribute_mask |= CWBorderPixel; swa.border_pixel = 0; @@ -244,7 +244,7 @@ index 8550a32..9cdd035 100644 bounds_in_pixels_.y(), bounds_in_pixels_.width(), bounds_in_pixels_.height(), 0, // border width -@@ -2019,6 +2034,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( +@@ -2038,6 +2053,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( } break; } @@ -256,10 +256,10 @@ index 8550a32..9cdd035 100644 case FocusOut: OnFocusEvent(xev->type == FocusIn, event->xfocus.mode, diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -index cc2339f..949ea23 100644 +index f592e1e..6bf0f4d 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -@@ -90,6 +90,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -91,6 +91,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // there is no dialog on the host window. XID GetModalDialog(); @@ -272,7 +272,7 @@ index cc2339f..949ea23 100644 protected: // Overridden from DesktopWindowTreeHost: void Init(aura::Window* content_window, -@@ -298,6 +304,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -305,6 +311,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // The bounds of |xwindow_|. gfx::Rect bounds_in_pixels_; @@ -282,7 +282,7 @@ index cc2339f..949ea23 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 -@@ -337,6 +346,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -344,6 +353,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // Whether we used an ARGB visual for our window. bool use_argb_visual_; @@ -293,7 +293,7 @@ index cc2339f..949ea23 100644 DesktopDragDropClientAuraX11* drag_drop_client_; std::unique_ptr x11_non_client_event_filter_; -@@ -424,6 +437,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -431,6 +444,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 XID modal_dialog_xid_; @@ -304,7 +304,7 @@ index cc2339f..949ea23 100644 base::WeakPtrFactory weak_factory_; diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc -index 4c21064..ec476af 100644 +index 8b06275..45b100d 100644 --- ui/views/widget/widget.cc +++ ui/views/widget/widget.cc @@ -129,6 +129,7 @@ Widget::InitParams::InitParams(Type type) @@ -339,10 +339,10 @@ index 4c21064..ec476af 100644 // This must come after SetContentsView() or it might not be able to find // the correct NativeTheme (on Linux). See http://crbug.com/384492 diff --git ui/views/widget/widget.h ui/views/widget/widget.h -index 0c7ab33..946a67d 100644 +index 2c5ba16..87046a0 100644 --- ui/views/widget/widget.h +++ ui/views/widget/widget.h -@@ -239,6 +239,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, +@@ -250,6 +250,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // Whether the widget should be maximized or minimized. ui::WindowShowState show_state; gfx::NativeView parent; @@ -351,10 +351,10 @@ index 0c7ab33..946a67d 100644 ui::Window* parent_mus = nullptr; // Specifies the initial bounds of the Widget. Default is empty, which means diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc -index 6f80d3e..9a21157 100644 +index a58c5f7..712f1d6 100644 --- ui/views/win/hwnd_message_handler.cc +++ ui/views/win/hwnd_message_handler.cc -@@ -2508,8 +2508,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -2540,8 +2540,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, active_mouse_tracking_flags_ = 0; } else if (event.type() == ui::ET_MOUSEWHEEL) { // Reroute the mouse wheel to the window under the pointer if applicable. diff --git a/patch/patches/web_contents_1257.patch b/patch/patches/web_contents_1257.patch index c40673a28..4deee1fac 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 f50fdf9..9e59835 100644 +index 776dd0a..1a86478 100644 --- chrome/browser/extensions/api/tab_capture/offscreen_tab.cc +++ chrome/browser/extensions/api/tab_capture/offscreen_tab.cc -@@ -214,7 +214,9 @@ bool OffscreenTab::ShouldCreateWebContents( +@@ -225,7 +225,9 @@ bool OffscreenTab::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -10,14 +10,14 @@ index f50fdf9..9e59835 100644 + content::SessionStorageNamespace* session_storage_namespace, + content::WebContentsView** view, + content::RenderViewHostDelegateView** delegate_view) { - DCHECK_EQ(offscreen_tab_web_contents_.get(), contents); + DCHECK_EQ(offscreen_tab_web_contents_.get(), web_contents); // 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 e639319..5f75a9a 100644 +index 992160d..b5dcc72 100644 --- chrome/browser/extensions/api/tab_capture/offscreen_tab.h +++ chrome/browser/extensions/api/tab_capture/offscreen_tab.h -@@ -148,7 +148,9 @@ class OffscreenTab : protected content::WebContentsDelegate, +@@ -150,7 +150,9 @@ class OffscreenTab : protected content::WebContentsDelegate, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -29,10 +29,10 @@ index e639319..5f75a9a 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 c3e60e0..93365f5c 100644 +index aea147d..cac0c15 100644 --- chrome/browser/prerender/prerender_contents.cc +++ chrome/browser/prerender/prerender_contents.cc -@@ -139,7 +139,9 @@ class PrerenderContents::WebContentsDelegateImpl +@@ -142,7 +142,9 @@ class PrerenderContents::WebContentsDelegateImpl const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -44,10 +44,10 @@ index c3e60e0..93365f5c 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 bbb37ff..484eda3 100644 +index ffcba10..514c431 100644 --- chrome/browser/ui/browser.cc +++ chrome/browser/ui/browser.cc -@@ -1589,7 +1589,9 @@ bool Browser::ShouldCreateWebContents( +@@ -1600,7 +1600,9 @@ bool Browser::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -59,10 +59,10 @@ index bbb37ff..484eda3 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 6cdff54..0efcaa2 100644 +index 0860714..a011ad7 100644 --- chrome/browser/ui/browser.h +++ chrome/browser/ui/browser.h -@@ -619,7 +619,9 @@ class Browser : public TabStripModelObserver, +@@ -626,7 +626,9 @@ class Browser : public TabStripModelObserver, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -73,11 +73,41 @@ index 6cdff54..0efcaa2 100644 void WebContentsCreated(content::WebContents* source_contents, int opener_render_process_id, int opener_render_frame_id, +diff --git components/offline_pages/content/background_loader/background_loader_contents.cc components/offline_pages/content/background_loader/background_loader_contents.cc +index 5998fc7..a98eea6 100644 +--- components/offline_pages/content/background_loader/background_loader_contents.cc ++++ components/offline_pages/content/background_loader/background_loader_contents.cc +@@ -71,7 +71,9 @@ bool BackgroundLoaderContents::ShouldCreateWebContents( + const std::string& frame_name, + const GURL& target_url, + const std::string& partition_id, +- content::SessionStorageNamespace* session_storage_namespace) { ++ content::SessionStorageNamespace* session_storage_namespace, ++ content::WebContentsView** view, ++ content::RenderViewHostDelegateView** delegate_view) { + // Background pages should not create other webcontents/tabs. + return false; + } +diff --git components/offline_pages/content/background_loader/background_loader_contents.h components/offline_pages/content/background_loader/background_loader_contents.h +index 43b6cea..29b6ae2 100644 +--- components/offline_pages/content/background_loader/background_loader_contents.h ++++ components/offline_pages/content/background_loader/background_loader_contents.h +@@ -54,7 +54,9 @@ class BackgroundLoaderContents : public content::WebContentsDelegate { + const std::string& frame_name, + const GURL& target_url, + const std::string& partition_id, +- content::SessionStorageNamespace* session_storage_namespace) override; ++ content::SessionStorageNamespace* session_storage_namespace, ++ content::WebContentsView** view, ++ content::RenderViewHostDelegateView** delegate_view) override; + + void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc -index 8850f6a..1a3719e 100644 +index 35b6f47..d444e66 100644 --- content/browser/web_contents/web_contents_impl.cc +++ content/browser/web_contents/web_contents_impl.cc -@@ -1572,6 +1572,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1560,6 +1560,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::string unique_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); @@ -90,7 +120,7 @@ index 8850f6a..1a3719e 100644 WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -1602,6 +1608,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1576,6 +1582,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::move(view_), &render_view_host_delegate_view_)); } @@ -98,7 +128,7 @@ index 8850f6a..1a3719e 100644 CHECK(render_view_host_delegate_view_); CHECK(view_.get()); -@@ -2063,11 +2070,14 @@ void WebContentsImpl::CreateNewWindow( +@@ -2040,12 +2047,15 @@ void WebContentsImpl::CreateNewWindow( static_cast(session_storage_namespace); CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); @@ -107,14 +137,15 @@ index 8850f6a..1a3719e 100644 + if (delegate_ && !delegate_->ShouldCreateWebContents( - this, route_id, main_frame_route_id, main_frame_widget_route_id, - params.window_container_type, params.frame_name, params.target_url, -- partition_id, session_storage_namespace)) { -+ partition_id, session_storage_namespace, &view, &delegate_view)) { - 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 -@@ -2096,6 +2106,8 @@ void WebContentsImpl::CreateNewWindow( + this, source_site_instance, render_view_route_id, main_frame_route_id, + main_frame_widget_route_id, params.window_container_type, + params.opener_url, params.frame_name, params.target_url, partition_id, +- session_storage_namespace)) { ++ session_storage_namespace, &view, &delegate_view)) { + // Note: even though we're not creating a WebContents here, it could have + // been created by the embedder so ensure that the RenderFrameHost is + // properly initialized. +@@ -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; @@ -139,7 +170,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 af944f7..cde1d7b 100644 +index a5e2535..704c137 100644 --- content/public/browser/web_contents.h +++ content/public/browser/web_contents.h @@ -59,9 +59,11 @@ class PageState; @@ -166,10 +197,10 @@ index af944f7..cde1d7b 100644 // Creates a new WebContents. diff --git content/public/browser/web_contents_delegate.cc content/public/browser/web_contents_delegate.cc -index b86ec61..2d1ddb2 100644 +index 01c9c08..704459d 100644 --- content/public/browser/web_contents_delegate.cc +++ content/public/browser/web_contents_delegate.cc -@@ -144,7 +144,9 @@ bool WebContentsDelegate::ShouldCreateWebContents( +@@ -146,7 +146,9 @@ bool WebContentsDelegate::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -181,22 +212,24 @@ index b86ec61..2d1ddb2 100644 } diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h -index 2beb83c..b02f4f1 100644 +index 6456878..21afa0b 100644 --- content/public/browser/web_contents_delegate.h +++ content/public/browser/web_contents_delegate.h -@@ -42,9 +42,11 @@ class ColorChooser; +@@ -42,11 +42,13 @@ class ColorChooser; class JavaScriptDialogManager; class PageState; class RenderFrameHost; +class RenderViewHostDelegateView; + class RenderWidgetHost; class SessionStorageNamespace; + class SiteInstance; class WebContents; class WebContentsImpl; +class WebContentsView; struct ColorSuggestion; struct ContextMenuParams; struct DropData; -@@ -303,7 +305,9 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -323,7 +325,9 @@ class CONTENT_EXPORT WebContentsDelegate { const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -208,10 +241,10 @@ index 2beb83c..b02f4f1 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 c02aace..67b9bd8 100644 +index 12dd8f3..c358a52 100644 --- extensions/browser/guest_view/extension_options/extension_options_guest.cc +++ extensions/browser/guest_view/extension_options/extension_options_guest.cc -@@ -201,7 +201,9 @@ bool ExtensionOptionsGuest::ShouldCreateWebContents( +@@ -203,7 +203,9 @@ bool ExtensionOptionsGuest::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -223,10 +256,10 @@ index c02aace..67b9bd8 100644 // view is used for displaying embedded extension options, we want any // external links to be opened in a new tab, not in a new guest view. diff --git extensions/browser/guest_view/extension_options/extension_options_guest.h extensions/browser/guest_view/extension_options/extension_options_guest.h -index e0309f7..f6a3878 100644 +index 5b0505c..63bf100 100644 --- extensions/browser/guest_view/extension_options/extension_options_guest.h +++ extensions/browser/guest_view/extension_options/extension_options_guest.h -@@ -56,7 +56,9 @@ class ExtensionOptionsGuest +@@ -54,7 +54,9 @@ class ExtensionOptionsGuest const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -238,10 +271,10 @@ 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 d08fd23..3ec515c 100644 +index 1dba63e..0268ea3 100644 --- ui/keyboard/content/keyboard_ui_content.cc +++ ui/keyboard/content/keyboard_ui_content.cc -@@ -64,7 +64,9 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate, +@@ -67,7 +67,9 @@ class KeyboardContentsDelegate : public content::WebContentsDelegate, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -253,10 +286,10 @@ index d08fd23..3ec515c 100644 } diff --git ui/views/controls/webview/web_dialog_view.cc ui/views/controls/webview/web_dialog_view.cc -index d8afe6e..59259b7 100644 +index cd4f8ec..9b9c9a3 100644 --- ui/views/controls/webview/web_dialog_view.cc +++ ui/views/controls/webview/web_dialog_view.cc -@@ -341,7 +341,9 @@ bool WebDialogView::ShouldCreateWebContents( +@@ -343,7 +343,9 @@ bool WebDialogView::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -268,10 +301,10 @@ index d8afe6e..59259b7 100644 return delegate_->HandleShouldCreateWebContents(); return true; diff --git ui/views/controls/webview/web_dialog_view.h ui/views/controls/webview/web_dialog_view.h -index 65be6d54..7802d6d 100644 +index c5d6791..bc1eb5d 100644 --- ui/views/controls/webview/web_dialog_view.h +++ ui/views/controls/webview/web_dialog_view.h -@@ -123,7 +123,9 @@ class WEBVIEW_EXPORT WebDialogView : public views::ClientView, +@@ -125,7 +125,9 @@ class WEBVIEW_EXPORT WebDialogView : public views::ClientView, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index 29bc6b52c..01d45b270 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 1c0863b..a0f06f4 100644 +index 11d980e..a87fb7e 100644 --- Source/web/ChromeClientImpl.cpp +++ Source/web/ChromeClientImpl.cpp -@@ -893,7 +893,7 @@ bool ChromeClientImpl::hasOpenedPopup() const { +@@ -895,7 +895,7 @@ bool ChromeClientImpl::hasOpenedPopup() const { PopupMenu* ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select) { notifyPopupOpeningObservers(); @@ -12,18 +12,18 @@ index 1c0863b..a0f06f4 100644 DCHECK(RuntimeEnabledFeatures::pagePopupEnabled()); diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp -index 8e1ca8b..83589b6 100644 +index 6a7688b..7ca2fab 100644 --- Source/web/WebViewImpl.cpp +++ Source/web/WebViewImpl.cpp -@@ -379,6 +379,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, +@@ -358,6 +358,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, m_enableFakePageScaleAnimationForTesting(false), m_fakePageScaleAnimationPageScaleFactor(0), m_fakePageScaleAnimationUseAnchor(false), + m_shouldUseExternalPopupMenus(shouldUseExternalPopupMenus), - m_doingDragAndDrop(false), - m_ignoreInputEvents(false), m_compositorDeviceScaleFactorOverride(0), -@@ -3727,8 +3728,13 @@ void WebViewImpl::mainFrameScrollOffsetChanged() { + m_suppressNextKeypressEvent(false), + m_imeAcceptEvents(true), +@@ -3704,8 +3705,13 @@ void WebViewImpl::mainFrameScrollOffsetChanged() { m_devToolsEmulator->mainFrameScrollOrScaleChanged(); } @@ -37,12 +37,12 @@ index 8e1ca8b..83589b6 100644 + return m_shouldUseExternalPopupMenus; } - void WebViewImpl::setIgnoreInputEvents(bool newValue) { + void WebViewImpl::setBackgroundColorOverride(WebColor color) { diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h -index d002c0d..74cbb22 100644 +index e4ad02f..8bfaa1c 100644 --- Source/web/WebViewImpl.h +++ Source/web/WebViewImpl.h -@@ -375,7 +375,8 @@ class WEB_EXPORT WebViewImpl final +@@ -371,7 +371,8 @@ class WEB_EXPORT WebViewImpl final // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). @@ -52,20 +52,20 @@ index d002c0d..74cbb22 100644 bool shouldAutoResize() const { return m_shouldAutoResize; } -@@ -654,6 +655,8 @@ class WEB_EXPORT WebViewImpl final +@@ -651,6 +652,8 @@ class WEB_EXPORT WebViewImpl final float m_fakePageScaleAnimationPageScaleFactor; bool m_fakePageScaleAnimationUseAnchor; + bool m_shouldUseExternalPopupMenus; + - // TODO(paulmeyer): Move this to WebWidget once all drag-and-drop functions - // are there. - bool m_doingDragAndDrop; + float m_compositorDeviceScaleFactorOverride; + TransformationMatrix m_deviceEmulationTransform; + diff --git public/web/WebView.h public/web/WebView.h -index 3127234..e79f0d2 100644 +index 061f017..9fd430e 100644 --- public/web/WebView.h +++ public/web/WebView.h -@@ -408,6 +408,7 @@ class WebView : protected WebWidget { +@@ -404,6 +404,7 @@ class WebView : protected WebWidget { // Sets whether select popup menus should be rendered by the browser. BLINK_EXPORT static void setUseExternalPopupMenus(bool); diff --git a/patch/patches/webui_2037.patch b/patch/patches/webui_2037.patch index 684480628..b34af90e6 100644 --- a/patch/patches/webui_2037.patch +++ b/patch/patches/webui_2037.patch @@ -1,8 +1,25 @@ diff --git chrome/browser/ui/webui/net_internals/net_internals_ui.cc chrome/browser/ui/webui/net_internals/net_internals_ui.cc -index 1e821dc..76bc9e7 100644 +index 354238a..42f1829 100644 --- chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ chrome/browser/ui/webui/net_internals/net_internals_ui.cc -@@ -689,9 +689,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( +@@ -572,16 +572,6 @@ void NetInternalsMessageHandler::OnGetSessionNetworkStats( + const base::ListValue* list) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + std::unique_ptr session_network_info; +- Profile* profile = Profile::FromWebUI(web_ui()); +- DataReductionProxyChromeSettings* data_reduction_proxy_settings = +- DataReductionProxyChromeSettingsFactory::GetForBrowserContext(profile); +- if (data_reduction_proxy_settings) { +- data_reduction_proxy::DataReductionProxyCompressionStats* +- compression_stats = +- data_reduction_proxy_settings->data_reduction_proxy_service() +- ->compression_stats(); +- session_network_info = compression_stats->SessionNetworkStatsInfoToValue(); +- } + SendJavascriptCommand("receivedSessionNetworkStats", + std::move(session_network_info)); + } +@@ -707,9 +697,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( PrePopulateEventList(); @@ -23,29 +40,7 @@ index 1e821dc..76bc9e7 100644 } void NetInternalsMessageHandler::IOThreadImpl::OnGetNetInfo( -@@ -869,21 +877,8 @@ void NetInternalsMessageHandler::IOThreadImpl::OnHSTSDelete( - void NetInternalsMessageHandler::IOThreadImpl::OnGetSessionNetworkStats( - const base::ListValue* list) { - DCHECK(!list); -- net::URLRequestContext* context = -- main_context_getter_->GetURLRequestContext(); -- net::HttpNetworkSession* http_network_session = -- GetHttpNetworkSession(context); - - std::unique_ptr network_info; -- if (http_network_session) { -- // TODO(mmenke): This cast is ugly. Can we get rid of it, or, better, -- // remove DRP data from net-internals entirely? -- data_reduction_proxy::DataReductionProxyNetworkDelegate* net_delegate = -- static_cast( -- context->network_delegate()); -- if (net_delegate) -- network_info = net_delegate->SessionNetworkStatsInfoToValue(); -- } - SendJavascriptCommand("receivedSessionNetworkStats", std::move(network_info)); - } - -@@ -1149,8 +1144,10 @@ void NetInternalsMessageHandler::IOThreadImpl::PrePopulateEventList() { +@@ -1146,8 +1144,10 @@ void NetInternalsMessageHandler::IOThreadImpl::PrePopulateEventList() { std::set contexts; for (const auto& getter : context_getters_) contexts.insert(getter->GetURLRequestContext()); @@ -59,10 +54,10 @@ index 1e821dc..76bc9e7 100644 // Add entries for ongoing network objects. CreateNetLogEntriesForActiveObjects(contexts, this); diff --git content/browser/resource_context_impl.cc content/browser/resource_context_impl.cc -index 22c12ee..57031f3 100644 +index 93e2890..67a1029 100644 --- content/browser/resource_context_impl.cc +++ content/browser/resource_context_impl.cc -@@ -84,6 +84,10 @@ URLDataManagerBackend* GetURLDataManagerForResourceContext( +@@ -74,6 +74,10 @@ URLDataManagerBackend* GetURLDataManagerForResourceContext( context->GetUserData(kURLDataManagerBackendKeyName)); } @@ -87,10 +82,10 @@ index 903cc54..56ee4ea 100644 CONTENT_EXPORT void InitializeResourceContext(BrowserContext* browser_context); diff --git content/browser/webui/url_data_manager.cc content/browser/webui/url_data_manager.cc -index a9ec107..4a215ca 100644 +index 0a482ad..c707073 100644 --- content/browser/webui/url_data_manager.cc +++ content/browser/webui/url_data_manager.cc -@@ -123,6 +123,11 @@ void URLDataManager::AddWebUIDataSource(BrowserContext* browser_context, +@@ -151,6 +151,11 @@ void URLDataManager::UpdateWebUIDataSource( } // static @@ -103,12 +98,12 @@ index a9ec107..4a215ca 100644 const URLDataSourceImpl* data_source) { base::AutoLock lock(g_delete_lock.Get()); diff --git content/browser/webui/url_data_manager.h content/browser/webui/url_data_manager.h -index 8eca18c..97fc80ea 100644 +index 5ceb74d..0c584d6 100644 --- content/browser/webui/url_data_manager.h +++ content/browser/webui/url_data_manager.h -@@ -55,6 +55,8 @@ class CONTENT_EXPORT URLDataManager : public base::SupportsUserData::Data { - static void AddWebUIDataSource(BrowserContext* browser_context, - WebUIDataSource* source); +@@ -69,6 +69,8 @@ class CONTENT_EXPORT URLDataManager : public base::SupportsUserData::Data { + const std::string& source_name, + std::unique_ptr update); + static const void* GetUserDataKey(); + diff --git a/patch/patches/webview_plugin_2020.patch b/patch/patches/webview_plugin_2020.patch index bd2785021..bb3945f91 100644 --- a/patch/patches/webview_plugin_2020.patch +++ b/patch/patches/webview_plugin_2020.patch @@ -1,239 +1,13 @@ diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd -index 351ceb7..304c765 100644 +index 990cffa..e1099ae 100644 --- chrome/app/generated_resources.grd +++ chrome/app/generated_resources.grd -@@ -7199,7 +7199,7 @@ Keep your key file in a safe place. You will need it to create new versions of y +@@ -7137,7 +7137,7 @@ Keep your key file in a safe place. You will need it to create new versions of y - $1Flash is blocked by enterprise policy + $1Flash is not allowed - - -diff --git components/plugins/renderer/loadable_plugin_placeholder.cc components/plugins/renderer/loadable_plugin_placeholder.cc -index 1f38fdb..03e0f60 100644 ---- components/plugins/renderer/loadable_plugin_placeholder.cc -+++ components/plugins/renderer/loadable_plugin_placeholder.cc -@@ -127,11 +127,10 @@ void LoadablePluginPlaceholder::ReplacePlugin(blink::WebPlugin* new_plugin) { - // this point. - new_plugin = container->plugin(); - -+ plugin()->RestoreTitleText(); - container->invalidate(); - container->reportGeometry(); -- if (plugin()->focused()) -- new_plugin->updateFocus(true, blink::WebFocusTypeNone); -- container->element().setAttribute("title", plugin()->old_title()); -+ plugin()->ReplayReceivedData(new_plugin); - plugin()->destroy(); - } - -diff --git components/plugins/renderer/webview_plugin.cc components/plugins/renderer/webview_plugin.cc -index 8d45c42..2a2ec9a 100644 ---- components/plugins/renderer/webview_plugin.cc -+++ components/plugins/renderer/webview_plugin.cc -@@ -18,7 +18,9 @@ - #include "gin/converter.h" - #include "skia/ext/platform_canvas.h" - #include "third_party/WebKit/public/platform/WebInputEvent.h" -+#include "third_party/WebKit/public/platform/WebSize.h" - #include "third_party/WebKit/public/platform/WebURL.h" -+#include "third_party/WebKit/public/platform/WebURLRequest.h" - #include "third_party/WebKit/public/platform/WebURLResponse.h" - #include "third_party/WebKit/public/web/WebDocument.h" - #include "third_party/WebKit/public/web/WebElement.h" -@@ -40,8 +42,10 @@ using blink::WebPlugin; - using blink::WebPluginContainer; - using blink::WebPoint; - using blink::WebRect; -+using blink::WebSize; - using blink::WebString; - using blink::WebURLError; -+using blink::WebURLRequest; - using blink::WebURLResponse; - using blink::WebVector; - using blink::WebView; -@@ -54,16 +58,16 @@ WebViewPlugin::WebViewPlugin(content::RenderView* render_view, - delegate_(delegate), - container_(nullptr), - web_view_(WebView::create(this, blink::WebPageVisibilityStateVisible)), -+ finished_loading_(false), - focused_(false), - is_painting_(false), - is_resizing_(false), -- web_frame_client_(this), - weak_factory_(this) { - // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a - // consistent view of our preferences. - content::RenderView::ApplyWebPreferences(preferences, web_view_); -- WebLocalFrame* web_frame = WebLocalFrame::create( -- blink::WebTreeScopeType::Document, &web_frame_client_); -+ WebLocalFrame* web_frame = -+ WebLocalFrame::create(blink::WebTreeScopeType::Document, this); - web_view_->setMainFrame(web_frame); - // TODO(dcheng): The main frame widget currently has a special case. - // Eliminate this once WebView is no longer a WebWidget. -@@ -87,6 +91,42 @@ WebViewPlugin::~WebViewPlugin() { - web_view_->close(); - } - -+void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { -+ const WebURLResponse& response = -+ web_view_->mainFrame()->dataSource()->response(); -+ if (!response.isNull()) { -+ plugin->didReceiveResponse(response); -+ size_t total_bytes = 0; -+ for (std::list::iterator it = data_.begin(); it != data_.end(); -+ ++it) { -+ plugin->didReceiveData( -+ it->c_str(), base::checked_cast(it->length())); -+ total_bytes += it->length(); -+ } -+ UMA_HISTOGRAM_MEMORY_KB( -+ "PluginDocument.Memory", -+ (base::checked_cast(total_bytes / 1024))); -+ UMA_HISTOGRAM_COUNTS( -+ "PluginDocument.NumChunks", -+ (base::checked_cast(data_.size()))); -+ } -+ // We need to transfer the |focused_| to new plugin after it loaded. -+ if (focused_) { -+ plugin->updateFocus(true, blink::WebFocusTypeNone); -+ } -+ if (finished_loading_) { -+ plugin->didFinishLoading(); -+ } -+ if (error_) { -+ plugin->didFailLoading(*error_); -+ } -+} -+ -+void WebViewPlugin::RestoreTitleText() { -+ if (container_) -+ container_->element().setAttribute("title", old_title_); -+} -+ - WebPluginContainer* WebViewPlugin::container() const { return container_; } - - bool WebViewPlugin::initialize(WebPluginContainer* container) { -@@ -215,20 +255,18 @@ blink::WebInputEventResult WebViewPlugin::handleInputEvent( - return handled; - } - --void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) { -- NOTREACHED(); --} -- - void WebViewPlugin::didReceiveData(const char* data, int data_length) { -- NOTREACHED(); -+ data_.push_back(std::string(data, data_length)); - } - - void WebViewPlugin::didFinishLoading() { -- NOTREACHED(); -+ DCHECK(!finished_loading_); -+ finished_loading_ = true; - } - - void WebViewPlugin::didFailLoading(const WebURLError& error) { -- NOTREACHED(); -+ DCHECK(!error_.get()); -+ error_.reset(new WebURLError(error)); - } - - bool WebViewPlugin::acceptsLoadDrops() { return false; } -@@ -279,9 +317,8 @@ void WebViewPlugin::scheduleAnimation() { - } - } - --void WebViewPlugin::PluginWebFrameClient::didClearWindowObject( -- WebLocalFrame* frame) { -- if (!plugin_->delegate_) -+void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) { -+ if (!delegate_) - return; - - v8::Isolate* isolate = blink::mainThreadIsolate(); -@@ -293,7 +330,7 @@ void WebViewPlugin::PluginWebFrameClient::didClearWindowObject( - v8::Local global = context->Global(); - - global->Set(gin::StringToV8(isolate, "plugin"), -- plugin_->delegate_->GetV8Handle(isolate)); -+ delegate_->GetV8Handle(isolate)); - } - - void WebViewPlugin::OnDestruct() {} -diff --git components/plugins/renderer/webview_plugin.h components/plugins/renderer/webview_plugin.h -index fdb1cf9..97e3995 100644 ---- components/plugins/renderer/webview_plugin.h -+++ components/plugins/renderer/webview_plugin.h -@@ -42,6 +42,7 @@ class Size; - - class WebViewPlugin : public blink::WebPlugin, - public blink::WebViewClient, -+ public blink::WebFrameClient, - public content::RenderViewObserver { - public: - class Delegate { -@@ -74,8 +75,12 @@ class WebViewPlugin : public blink::WebPlugin, - - blink::WebView* web_view() { return web_view_; } - -- bool focused() const { return focused_; } -- const blink::WebString& old_title() const { return old_title_; } -+ // When loading a plugin document (i.e. a full page plugin not embedded in -+ // another page), we save all data that has been received, and replay it with -+ // this method on the actual plugin. -+ void ReplayReceivedData(blink::WebPlugin* plugin); -+ -+ void RestoreTitleText(); - - // WebPlugin methods: - blink::WebPluginContainer* container() const override; -@@ -103,7 +108,7 @@ class WebViewPlugin : public blink::WebPlugin, - const blink::WebInputEvent& event, - blink::WebCursorInfo& cursor_info) override; - -- void didReceiveResponse(const blink::WebURLResponse& response) override; -+ void didReceiveResponse(const blink::WebURLResponse& response) override {} - void didReceiveData(const char* data, int data_length) override; - void didFinishLoading() override; - void didFailLoading(const blink::WebURLError& error) override; -@@ -129,6 +134,9 @@ class WebViewPlugin : public blink::WebPlugin, - void didChangeCursor(const blink::WebCursorInfo& cursor) override; - void scheduleAnimation() override; - -+ // WebFrameClient methods: -+ void didClearWindowObject(blink::WebLocalFrame* frame) override; -+ - private: - friend class base::DeleteHelper; - WebViewPlugin(content::RenderView* render_view, -@@ -156,23 +164,14 @@ class WebViewPlugin : public blink::WebPlugin, - - gfx::Rect rect_; - -+ std::list data_; -+ std::unique_ptr error_; - blink::WebString old_title_; -+ bool finished_loading_; - bool focused_; - bool is_painting_; - bool is_resizing_; - -- // A helper needed to create a WebLocalFrame. -- class PluginWebFrameClient : public blink::WebFrameClient { -- public: -- PluginWebFrameClient(WebViewPlugin* plugin) : plugin_(plugin) {} -- ~PluginWebFrameClient() override {} -- void didClearWindowObject(blink::WebLocalFrame* frame) override; -- -- private: -- WebViewPlugin* plugin_; -- }; -- PluginWebFrameClient web_frame_client_; -- - // Should be invalidated when destroy() is called. - base::WeakPtrFactory weak_factory_; - }; + + $1Flash is blocked diff --git a/tests/cefclient/common/scheme_test_common.cc b/tests/cefclient/common/scheme_test_common.cc index e81246246..042cd2cc8 100644 --- a/tests/cefclient/common/scheme_test_common.cc +++ b/tests/cefclient/common/scheme_test_common.cc @@ -11,7 +11,7 @@ namespace scheme_test { void RegisterCustomSchemes(CefRefPtr registrar, std::vector& cookiable_schemes) { - registrar->AddCustomScheme("client", true, false, false); + registrar->AddCustomScheme("client", true, false, false, false, true); } } // namespace scheme_test diff --git a/tests/ceftests/cookie_unittest.cc b/tests/ceftests/cookie_unittest.cc index 22bf2b928..f12d6efc0 100644 --- a/tests/ceftests/cookie_unittest.cc +++ b/tests/ceftests/cookie_unittest.cc @@ -1339,5 +1339,5 @@ void RegisterCookieCustomSchemes( CefRefPtr registrar, std::vector& cookiable_schemes) { // Used by GetCookieManagerCustom test. - registrar->AddCustomScheme("ccustom", true, false, false); + registrar->AddCustomScheme("ccustom", true, false, false, false, true); } diff --git a/tests/ceftests/os_rendering_unittest.cc b/tests/ceftests/os_rendering_unittest.cc index 08e75fe63..d26f919b9 100644 --- a/tests/ceftests/os_rendering_unittest.cc +++ b/tests/ceftests/os_rendering_unittest.cc @@ -71,7 +71,7 @@ const CefRect kExpectedRectLI[] = { const CefRect kEditBoxRect(412, 245, 60, 22); const CefRect kNavigateButtonRect(360, 271, 140, 22); const CefRect kSelectRect(467, 22, 75, 20); -const CefRect kExpandedSelectRect(463, 42, 81, 342); +const CefRect kExpandedSelectRect(463, 42, 81, 334); const CefRect kDropDivRect(8, 332, 52, 52); const CefRect kDragDivRect(71, 342, 30, 30); const int kDefaultVerticalScrollbarWidth = 17; @@ -87,7 +87,7 @@ const CefRect kDragDivRect(60, 330, 52, 52); const CefRect kEditBoxRect(434, 246, 60, 20); const CefRect kNavigateButtonRect(380, 271, 140, 22); const CefRect kSelectRect(467, 22, 75, 20); -const CefRect kExpandedSelectRect(463, 42, 81, 342); +const CefRect kExpandedSelectRect(463, 42, 79, 334); const CefRect kDropDivRect(8, 332, 52, 52); const CefRect kDragDivRect(71, 342, 30, 30); const int kDefaultVerticalScrollbarWidth = 14; @@ -439,8 +439,13 @@ class OSRTestHandler : public RoutingTestHandler, case OSR_TEST_POPUP_SIZE: EXPECT_EQ(kExpandedSelectRect.x, rect.x); EXPECT_EQ(kExpandedSelectRect.y, rect.y); - EXPECT_EQ(kExpandedSelectRect.width, rect.width); - EXPECT_EQ(kExpandedSelectRect.height, rect.height); + if (ExpectComputedPopupSize()) { + EXPECT_EQ(kExpandedSelectRect.width, rect.width); + EXPECT_EQ(kExpandedSelectRect.height, rect.height); + } else { + EXPECT_GT(rect.width, kExpandedSelectRect.width); + EXPECT_GT(rect.height, kExpandedSelectRect.height); + } DestroySucceededTestSoon(); break; default: @@ -460,8 +465,13 @@ class OSRTestHandler : public RoutingTestHandler, EXPECT_EQ(GetScaledInt(kOsrHeight), height); } else if (type == PET_POPUP) { const CefRect& expanded_select_rect = GetScaledRect(kExpandedSelectRect); - EXPECT_EQ(expanded_select_rect.width, width); - EXPECT_EQ(expanded_select_rect.height, height); + if (ExpectComputedPopupSize()) { + EXPECT_EQ(expanded_select_rect.width, width); + EXPECT_EQ(expanded_select_rect.height, height); + } else { + EXPECT_GT(width, kExpandedSelectRect.width); + EXPECT_GT(height, kExpandedSelectRect.height); + } } EXPECT_TRUE(browser->GetHost()->IsWindowRenderingDisabled()); @@ -703,24 +713,31 @@ class OSRTestHandler : public RoutingTestHandler, EXPECT_EQ(dirtyRects.size(), 1U); const CefRect& expanded_select_rect = GetScaledRect(kExpandedSelectRect); - EXPECT_EQ(dirtyRects[0], - CefRect(0, 0, - expanded_select_rect.width, - expanded_select_rect.height)); + EXPECT_EQ(0, dirtyRects[0].x); + EXPECT_EQ(0, dirtyRects[0].y); + if (ExpectComputedPopupSize()) { + EXPECT_EQ(expanded_select_rect.width, dirtyRects[0].width); + EXPECT_EQ(expanded_select_rect.height, dirtyRects[0].height); + } else { + EXPECT_GT(dirtyRects[0].width, kExpandedSelectRect.width); + EXPECT_GT(dirtyRects[0].height, kExpandedSelectRect.height); + } + // first pixel of border #if defined(OS_MACOSX) EXPECT_EQ(0xff5d99d6, *(reinterpret_cast(buffer))); #elif defined(OS_LINUX) || defined(OS_WIN) - if (scale_factor_ == 1.0) { - EXPECT_EQ(0xff6497ea, *(reinterpret_cast(buffer))); - } else { - EXPECT_EQ(0xff4d90fe, *(reinterpret_cast(buffer))); - } + EXPECT_EQ(0xff6497ea, *(reinterpret_cast(buffer))); #else #error "Unsupported platform" #endif - EXPECT_EQ(expanded_select_rect.width, width); - EXPECT_EQ(expanded_select_rect.height, height); + if (ExpectComputedPopupSize()) { + EXPECT_EQ(expanded_select_rect.width, width); + EXPECT_EQ(expanded_select_rect.height, height); + } else { + EXPECT_GT(width, kExpandedSelectRect.width); + EXPECT_GT(height, kExpandedSelectRect.height); + } DestroySucceededTestSoon(); } break; @@ -743,11 +760,15 @@ class OSRTestHandler : public RoutingTestHandler, const CefRect& expanded_select_rect = GetScaledRect(kExpandedSelectRect); EXPECT_EQ(dirtyRects.size(), 1U); - EXPECT_EQ(dirtyRects[0], - CefRect(0, - 0, - expanded_select_rect.width, - expanded_select_rect.height)); + EXPECT_EQ(0, dirtyRects[0].x); + EXPECT_EQ(0, dirtyRects[0].y); + if (ExpectComputedPopupSize()) { + EXPECT_EQ(expanded_select_rect.width, dirtyRects[0].width); + EXPECT_EQ(expanded_select_rect.height, dirtyRects[0].height); + } else { + EXPECT_GT(dirtyRects[0].width, kExpandedSelectRect.width); + EXPECT_GT(dirtyRects[0].height, kExpandedSelectRect.height); + } DestroySucceededTestSoon(); } } @@ -1132,6 +1153,21 @@ class OSRTestHandler : public RoutingTestHandler, return rect.y + rect.height / 2; } + bool ExpectComputedPopupSize() const { +#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) + // On Windows the device scale factor is ignored in Blink when computing + // the default form control font size (see https://crbug.com/674663#c11). + // This results in better font size display but also means that we won't + // get the expected (scaled) width/height value for non-1.0 scale factor + // select popups. + // On both Windows and Linux the non-1.0 scale factor size is off by a few + // pixels so we can't perform an exact comparison. + return scale_factor_ == 1.0; +#else + return true; +#endif + } + void DestroySucceededTestSoon() { if (succeeded()) return; diff --git a/tests/ceftests/scheme_handler_unittest.cc b/tests/ceftests/scheme_handler_unittest.cc index 48495e372..af26c2995 100644 --- a/tests/ceftests/scheme_handler_unittest.cc +++ b/tests/ceftests/scheme_handler_unittest.cc @@ -1670,7 +1670,7 @@ void RegisterSchemeHandlerCustomSchemes( CefRefPtr registrar, std::vector& cookiable_schemes) { // Add a custom standard scheme. - registrar->AddCustomScheme("customstd", true, false, false); + registrar->AddCustomScheme("customstd", true, false, false, false, true); // Ad a custom non-standard scheme. - registrar->AddCustomScheme("customnonstd", false, false, false); + registrar->AddCustomScheme("customnonstd", false, false, false, false, false); } diff --git a/tests/ceftests/urlrequest_unittest.cc b/tests/ceftests/urlrequest_unittest.cc index e4637a677..7c55116a1 100644 --- a/tests/ceftests/urlrequest_unittest.cc +++ b/tests/ceftests/urlrequest_unittest.cc @@ -1424,7 +1424,7 @@ void CreateURLRequestRendererTests(ClientAppRenderer::DelegateSet& delegates) { void RegisterURLRequestCustomSchemes( CefRefPtr registrar, std::vector& cookiable_schemes) { - registrar->AddCustomScheme(kRequestScheme, true, false, false); + registrar->AddCustomScheme(kRequestScheme, true, false, false, false, true); cookiable_schemes.push_back(kRequestScheme); }