diff --git a/BUILD.gn b/BUILD.gn index ce91fb10c..78deca587 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -118,7 +118,6 @@ if (is_linux) { } if (is_mac) { import("//build/config/mac/rules.gni") - import("//build_overrides/v8.gni") import("//build/mac/tweak_info_plist.gni") import("//build/util/version.gni") import("//media/cdm/ppapi/cdm_paths.gni") @@ -755,7 +754,7 @@ static_library("libcef_static") { deps += [ "//build/linux:fontconfig", - "//third_party/freetype2", + "//build/linux:freetype2", ] } @@ -1025,7 +1024,7 @@ repack("pak_devtools") { # Each input pak file should also have a deps line for completeness. # Add associated .h files in the make_pack_header("resources") target. sources = [ - "$root_gen_dir/blink/devtools_resources.pak", + "$root_gen_dir/content/browser/devtools/devtools_resources.pak", ] # Use public_deps so that generated grit headers are discoverable from @@ -1163,7 +1162,6 @@ template("make_pack_header") { make_pack_header("resources") { header = "$root_out_dir/includes/include/cef_pack_resources.h" inputs = [ - "$root_gen_dir/blink/grit/devtools_resources.h", "$root_gen_dir/blink/public/resources/grit/blink_image_resources.h", "$root_gen_dir/blink/public/resources/grit/blink_resources.h", "$root_gen_dir/cef/grit/cef_resources.h", @@ -1173,6 +1171,7 @@ make_pack_header("resources") { "$root_gen_dir/chrome/grit/net_internals_resources.h", "$root_gen_dir/chrome/grit/renderer_resources.h", "$root_gen_dir/components/grit/components_resources.h", + "$root_gen_dir/content/browser/devtools/grit/devtools_resources.h", "$root_gen_dir/content/browser/tracing/grit/tracing_resources.h", "$root_gen_dir/content/grit/content_resources.h", "$root_gen_dir/extensions/grit/extensions_browser_resources.h", diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 8d77580c3..8934b103a 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,5 +7,5 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': 'ad51088c0e8776e8dcd963dbe752c4035ba6dab6', + 'chromium_checkout': '939b32ee5ba05c396eef3fd992822fcca9a2e262', } diff --git a/include/capi/cef_load_handler_capi.h b/include/capi/cef_load_handler_capi.h index 5c79aaa84..f7ddc62a6 100644 --- a/include/capi/cef_load_handler_capi.h +++ b/include/capi/cef_load_handler_capi.h @@ -70,15 +70,16 @@ typedef struct _cef_load_handler_t { int canGoForward); /// - // Called when the browser begins loading a frame. The |frame| value will - // never be NULL -- call the is_main() function to check if this frame is the - // main frame. |transition_type| provides information about the source of the - // navigation and an accurate value is only available in the browser process. - // Multiple frames may be loading at the same time. Sub-frames may start or - // continue loading after the main frame load has ended. This function will - // always be called for all frames irrespective of whether the request - // completes successfully. For notification of overall browser load status use - // OnLoadingStateChange instead. + // Called after a navigation has been committed and before the browser begins + // loading contents in the frame. The |frame| value will never be NULL -- call + // the is_main() function to check if this frame is the main frame. + // |transition_type| provides information about the source of the navigation + // and an accurate value is only available in the browser process. Multiple + // frames may be loading at the same time. Sub-frames may start or continue + // loading after the main frame load has ended. This function will not be + // called for same page navigations (fragments, history state, etc.) or for + // navigations that fail or are canceled before commit. For notification of + // overall browser load status use OnLoadingStateChange instead. /// void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self, struct _cef_browser_t* browser, struct _cef_frame_t* frame, @@ -89,19 +90,21 @@ typedef struct _cef_load_handler_t { // never be NULL -- call the is_main() function to check if this frame is the // main frame. Multiple frames may be loading at the same time. Sub-frames may // start or continue loading after the main frame load has ended. This - // function will always be called for all frames irrespective of whether the - // request completes successfully. For notification of overall browser load - // status use OnLoadingStateChange instead. + // function will not be called for same page navigations (fragments, history + // state, etc.) or for navigations that fail or are canceled before commit. + // For notification of overall browser load status use OnLoadingStateChange + // instead. /// void (CEF_CALLBACK *on_load_end)(struct _cef_load_handler_t* self, struct _cef_browser_t* browser, struct _cef_frame_t* frame, int httpStatusCode); /// - // Called when the resource load for a navigation fails or is canceled. - // |errorCode| is the error code number, |errorText| is the error text and - // |failedUrl| is the URL that failed to load. See net\base\net_error_list.h - // for complete descriptions of the error codes. + // Called when a navigation fails or is canceled. This function may be called + // by itself if before commit or in combination with OnLoadStart/OnLoadEnd if + // after commit. |errorCode| is the error code number, |errorText| is the + // error text and |failedUrl| is the URL that failed to load. See + // net\base\net_error_list.h for complete descriptions of the error codes. /// void (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self, struct _cef_browser_t* browser, struct _cef_frame_t* frame, diff --git a/include/capi/cef_scheme_capi.h b/include/capi/cef_scheme_capi.h index 8bfb50d85..de2518bb1 100644 --- a/include/capi/cef_scheme_capi.h +++ b/include/capi/cef_scheme_capi.h @@ -108,9 +108,12 @@ typedef struct _cef_scheme_registrar_t { // security rules as those applied to "https" URLs. For example, loading this // scheme from other secure schemes will not trigger mixed content warnings. // - // If |is_cors_enabled| is true (1) the scheme that can be sent CORS requests. - // This value should be true (1) in most cases where |is_standard| is true - // (1). + // If |is_cors_enabled| is true (1) the scheme can be sent CORS requests. This + // value should be true (1) in most cases where |is_standard| is true (1). + // + // If |is_csp_bypassing| is true (1) the scheme can bypass Content-Security- + // Policy (CSP) checks. This value should be false (0) in most cases where + // |is_standard| is true (1). // // This function may be called on any thread. It should only be called once // per unique |scheme_name| value. If |scheme_name| is already registered or @@ -118,7 +121,8 @@ typedef struct _cef_scheme_registrar_t { /// int (CEF_CALLBACK *add_custom_scheme)(struct _cef_scheme_registrar_t* self, const cef_string_t* scheme_name, int is_standard, int is_local, - int is_display_isolated, int is_secure, int is_cors_enabled); + int is_display_isolated, int is_secure, int is_cors_enabled, + int is_csp_bypassing); } cef_scheme_registrar_t; diff --git a/include/cef_load_handler.h b/include/cef_load_handler.h index 99696ed89..66b556732 100644 --- a/include/cef_load_handler.h +++ b/include/cef_load_handler.h @@ -67,15 +67,16 @@ class CefLoadHandler : public virtual CefBaseRefCounted { bool canGoForward) {} /// - // Called when the browser begins loading a frame. The |frame| value will - // never be empty -- call the IsMain() method to check if this frame is the - // main frame. |transition_type| provides information about the source of the - // navigation and an accurate value is only available in the browser process. - // Multiple frames may be loading at the same time. Sub-frames may start or - // continue loading after the main frame load has ended. This method will - // always be called for all frames irrespective of whether the request - // completes successfully. For notification of overall browser load status use - // OnLoadingStateChange instead. + // Called after a navigation has been committed and before the browser begins + // loading contents in the frame. The |frame| value will never be empty -- + // call the IsMain() method to check if this frame is the main frame. + // |transition_type| provides information about the source of the navigation + // and an accurate value is only available in the browser process. Multiple + // frames may be loading at the same time. Sub-frames may start or continue + // loading after the main frame load has ended. This method will not be called + // for same page navigations (fragments, history state, etc.) or for + // navigations that fail or are canceled before commit. For notification of + // overall browser load status use OnLoadingStateChange instead. /// /*--cef()--*/ virtual void OnLoadStart(CefRefPtr browser, @@ -87,9 +88,10 @@ class CefLoadHandler : public virtual CefBaseRefCounted { // never be empty -- call the IsMain() method to check if this frame is the // main frame. Multiple frames may be loading at the same time. Sub-frames may // start or continue loading after the main frame load has ended. This method - // will always be called for all frames irrespective of whether the request - // completes successfully. For notification of overall browser load status use - // OnLoadingStateChange instead. + // will not be called for same page navigations (fragments, history state, + // etc.) or for navigations that fail or are canceled before commit. For + // notification of overall browser load status use OnLoadingStateChange + // instead. /// /*--cef()--*/ virtual void OnLoadEnd(CefRefPtr browser, @@ -97,10 +99,11 @@ class CefLoadHandler : public virtual CefBaseRefCounted { int httpStatusCode) {} /// - // Called when the resource load for a navigation fails or is canceled. - // |errorCode| is the error code number, |errorText| is the error text and - // |failedUrl| is the URL that failed to load. See net\base\net_error_list.h - // for complete descriptions of the error codes. + // Called when a navigation fails or is canceled. This method may be called + // by itself if before commit or in combination with OnLoadStart/OnLoadEnd if + // after commit. |errorCode| is the error code number, |errorText| is the + // error text and |failedUrl| is the URL that failed to load. + // See net\base\net_error_list.h for complete descriptions of the error codes. /// /*--cef(optional_param=errorText)--*/ virtual void OnLoadError(CefRefPtr browser, diff --git a/include/cef_scheme.h b/include/cef_scheme.h index d4b1ac0c5..24b0c55bc 100644 --- a/include/cef_scheme.h +++ b/include/cef_scheme.h @@ -132,8 +132,12 @@ class CefSchemeRegistrar : public CefBaseScoped { // rules as those applied to "https" URLs. For example, loading this scheme // from other secure schemes will not trigger mixed content warnings. // - // If |is_cors_enabled| is true the scheme that can be sent CORS requests. - // This value should be true in most cases where |is_standard| is true. + // If |is_cors_enabled| is true the scheme can be sent CORS requests. This + // value should be true in most cases where |is_standard| is true. + // + // If |is_csp_bypassing| is true the scheme can bypass Content-Security-Policy + // (CSP) checks. This value should be false in most cases where |is_standard| + // is true. // // This function may be called on any thread. It should only be called once // per unique |scheme_name| value. If |scheme_name| is already registered or @@ -145,7 +149,8 @@ class CefSchemeRegistrar : public CefBaseScoped { bool is_local, bool is_display_isolated, bool is_secure, - bool is_cors_enabled) =0; + bool is_cors_enabled, + bool is_csp_bypassing) =0; }; diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index 47c6eb5ee..369aec913 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -1947,7 +1947,6 @@ typedef struct _cef_popup_features_t { int fullscreen; int dialog; - cef_string_list_t additionalFeatures; } cef_popup_features_t; /// diff --git a/include/internal/cef_types_wrappers.h b/include/internal/cef_types_wrappers.h index 0c125c965..e86a02fef 100644 --- a/include/internal/cef_types_wrappers.h +++ b/include/internal/cef_types_wrappers.h @@ -509,18 +509,10 @@ struct CefPopupFeaturesTraits { s->resizable = true; } - static inline void clear(struct_type* s) { - if (s->additionalFeatures) - cef_string_list_free(s->additionalFeatures); - } + static inline void clear(struct_type* s) {} static inline void set(const struct_type* src, struct_type* target, bool copy) { - if (target->additionalFeatures) - cef_string_list_free(target->additionalFeatures); - target->additionalFeatures = src->additionalFeatures ? - cef_string_list_copy(src->additionalFeatures) : NULL; - target->x = src->x; target->xSet = src->xSet; target->y = src->y; diff --git a/libcef/browser/browser_context_proxy.cc b/libcef/browser/browser_context_proxy.cc index 9117fd657..589d69ef4 100644 --- a/libcef/browser/browser_context_proxy.cc +++ b/libcef/browser/browser_context_proxy.cc @@ -98,6 +98,14 @@ void CefBrowserContextProxy::SetUserData(const void* key, Data* data) { BrowserContext::SetUserData(key, data); } +void CefBrowserContextProxy::SetUserData(const void* key, + std::unique_ptr data) { + if (ShouldProxyUserData(key)) + parent_->SetUserData(key, std::move(data)); + else + BrowserContext::SetUserData(key, std::move(data)); +} + void CefBrowserContextProxy::RemoveUserData(const void* key) { if (ShouldProxyUserData(key)) parent_->RemoveUserData(key); diff --git a/libcef/browser/browser_context_proxy.h b/libcef/browser/browser_context_proxy.h index 2e350188a..11b76a26e 100644 --- a/libcef/browser/browser_context_proxy.h +++ b/libcef/browser/browser_context_proxy.h @@ -29,6 +29,7 @@ class CefBrowserContextProxy : public CefBrowserContext { // SupportsUserData methods. Data* GetUserData(const void* key) const override; void SetUserData(const void* key, Data* data) override; + void SetUserData(const void* key, std::unique_ptr data) override; void RemoveUserData(const void* key) override; // BrowserContext methods. diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 661a6560d..42f19cfb0 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -53,6 +53,7 @@ #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" +#include "content/public/browser/navigation_handle.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" @@ -61,6 +62,7 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host.h" #include "content/public/browser/resource_request_info.h" +#include "net/base/net_errors.h" #include "third_party/WebKit/public/web/WebFindOptions.h" #include "ui/events/base_event_utils.h" @@ -2499,36 +2501,50 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) { } } -void CefBrowserHostImpl::DidCommitProvisionalLoadForFrame( - content::RenderFrameHost* render_frame_host, - const GURL& url, - ui::PageTransition transition_type) { - const bool is_main_frame = !render_frame_host->GetParent(); - CefRefPtr frame = GetOrCreateFrame( - render_frame_host->GetRoutingID(), - CefFrameHostImpl::kUnspecifiedFrameId, - is_main_frame, - base::string16(), - url); - OnLoadStart(frame, url, transition_type); - if (is_main_frame) - OnAddressChange(frame, url); -} +void CefBrowserHostImpl::DidFinishNavigation( + content::NavigationHandle* navigation_handle) { + CHECK(navigation_handle->GetRenderFrameHost()); -void CefBrowserHostImpl::DidFailProvisionalLoad( - content::RenderFrameHost* render_frame_host, - const GURL& validated_url, - int error_code, - const base::string16& error_description, - bool was_ignored_by_handler) { - const bool is_main_frame = !render_frame_host->GetParent(); - CefRefPtr frame = GetOrCreateFrame( - render_frame_host->GetRoutingID(), - CefFrameHostImpl::kUnspecifiedFrameId, - is_main_frame, - base::string16(), - GURL()); - OnLoadError(frame, validated_url, error_code, error_description); + const net::Error error_code = navigation_handle->GetNetErrorCode(); + if (error_code == net::OK) { + // The navigation has been committed. + const bool is_main_frame = navigation_handle->IsInMainFrame(); + const GURL& url = navigation_handle->GetURL(); + + // This also updates the URL associated with the frame. + CefRefPtr frame = GetOrCreateFrame( + navigation_handle->GetRenderFrameHost()->GetRoutingID(), + CefFrameHostImpl::kUnspecifiedFrameId, + is_main_frame, base::string16(), url); + + // Don't call OnLoadStart for same page navigations (fragments, + // history state). + if (!navigation_handle->IsSamePage()) + OnLoadStart(frame, navigation_handle->GetPageTransition()); + + if (is_main_frame) + OnAddressChange(frame, url); + } else { + // The navigation failed before commit. Originates from + // RenderFrameHostImpl::OnDidFailProvisionalLoadWithError. + CefRefPtr frame = GetOrCreateFrame( + navigation_handle->GetRenderFrameHost()->GetRoutingID(), + CefFrameHostImpl::kUnspecifiedFrameId, + navigation_handle->IsInMainFrame(), base::string16(), GURL()); + + // OnLoadStart/OnLoadEnd will not be called. + OnLoadError(frame, navigation_handle->GetURL(), error_code); + } + + if (!web_contents()) + return; + + CefBrowserContext* context = + static_cast(web_contents()->GetBrowserContext()); + if (!context) + return; + + context->AddVisitedURLs(navigation_handle->GetRedirectChain()); } void CefBrowserHostImpl::DocumentAvailableInMainFrame() { @@ -2542,6 +2558,8 @@ void CefBrowserHostImpl::DidFailLoad( int error_code, const base::string16& error_description, bool was_ignored_by_handler) { + // The navigation failed after commit. OnLoadStart was called so we also call + // OnLoadEnd. const bool is_main_frame = !render_frame_host->GetParent(); CefRefPtr frame = GetOrCreateFrame( render_frame_host->GetRoutingID(), @@ -2549,7 +2567,7 @@ void CefBrowserHostImpl::DidFailLoad( is_main_frame, base::string16(), validated_url); - OnLoadError(frame, validated_url, error_code, error_description); + OnLoadError(frame, validated_url, error_code); OnLoadEnd(frame, validated_url, error_code); } @@ -2570,21 +2588,6 @@ void CefBrowserHostImpl::FrameDeleted( focused_frame_id_ = CefFrameHostImpl::kInvalidFrameId; } -void CefBrowserHostImpl::DidNavigateAnyFrame( - content::RenderFrameHost* render_frame_host, - const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) { - if (!web_contents()) - return; - - CefBrowserContext* context = - static_cast(web_contents()->GetBrowserContext()); - if (!context) - return; - - context->AddVisitedURLs(params.redirects); -} - void CefBrowserHostImpl::TitleWasSet(content::NavigationEntry* entry, bool explicit_set) { // |entry| may be NULL if a popup is created via window.open and never @@ -3034,7 +3037,6 @@ void CefBrowserHostImpl::OnAddressChange(CefRefPtr frame, } void CefBrowserHostImpl::OnLoadStart(CefRefPtr frame, - const GURL& url, ui::PageTransition transition_type) { if (client_.get()) { CefRefPtr handler = client_->GetLoadHandler(); @@ -3048,8 +3050,7 @@ void CefBrowserHostImpl::OnLoadStart(CefRefPtr frame, void CefBrowserHostImpl::OnLoadError(CefRefPtr frame, const GURL& url, - int error_code, - const base::string16& error_description) { + int error_code) { if (client_.get()) { CefRefPtr handler = client_->GetLoadHandler(); if (handler.get()) { @@ -3057,7 +3058,7 @@ void CefBrowserHostImpl::OnLoadError(CefRefPtr frame, // Notify the handler that loading has failed. handler->OnLoadError(this, frame, static_cast(error_code), - CefString(error_description), + net::ErrorToShortString(error_code), url.spec()); frame_destruction_pending_ = false; } diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 77fcf9c9f..40b2b90b4 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -448,38 +448,21 @@ class CefBrowserHostImpl : public CefBrowserHost, // content::WebContentsObserver methods. using content::WebContentsObserver::BeforeUnloadFired; using content::WebContentsObserver::WasHidden; - void RenderFrameCreated( - content::RenderFrameHost* render_frame_host) override; - void RenderFrameDeleted( - content::RenderFrameHost* render_frame_host) override; - void RenderViewCreated( - content::RenderViewHost* render_view_host) override; - void RenderViewDeleted( - content::RenderViewHost* render_view_host) override; + void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; + void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; + void RenderViewCreated(content::RenderViewHost* render_view_host) override; + void RenderViewDeleted(content::RenderViewHost* render_view_host) override; void RenderViewReady() override; void RenderProcessGone(base::TerminationStatus status) override; - void DidCommitProvisionalLoadForFrame( - content::RenderFrameHost* render_frame_host, - const GURL& url, - ui::PageTransition transition_type) override; - void DidFailProvisionalLoad( - content::RenderFrameHost* render_frame_host, - const GURL& validated_url, - int error_code, - const base::string16& error_description, - bool was_ignored_by_handler) override; + void DidFinishNavigation( + content::NavigationHandle* navigation_handle) override; void DocumentAvailableInMainFrame() override; void DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description, bool was_ignored_by_handler) override; - void FrameDeleted( - content::RenderFrameHost* render_frame_host) override; - void DidNavigateAnyFrame( - content::RenderFrameHost* render_frame_host, - const content::LoadCommittedDetails& details, - const content::FrameNavigateParams& params) override; + void FrameDeleted(content::RenderFrameHost* render_frame_host) override; void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override; void PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) override; @@ -554,12 +537,10 @@ class CefBrowserHostImpl : public CefBrowserHost, void OnAddressChange(CefRefPtr frame, const GURL& url); void OnLoadStart(CefRefPtr frame, - const GURL& url, ui::PageTransition transition_type); void OnLoadError(CefRefPtr frame, const GURL& url, - int error_code, - const base::string16& error_description); + int error_code); void OnLoadEnd(CefRefPtr frame, const GURL& url, int http_status_code); diff --git a/libcef/browser/browser_info_manager.cc b/libcef/browser/browser_info_manager.cc index 2e34b2d17..619fbc203 100644 --- a/libcef/browser/browser_info_manager.cc +++ b/libcef/browser/browser_info_manager.cc @@ -23,35 +23,26 @@ namespace { -void TranslatePopupFeatures(const blink::WebWindowFeatures& webKitFeatures, +void TranslatePopupFeatures(const blink::mojom::WindowFeatures& webKitFeatures, CefPopupFeatures& features) { features.x = static_cast(webKitFeatures.x); - features.xSet = webKitFeatures.xSet; + features.xSet = webKitFeatures.has_x; features.y = static_cast(webKitFeatures.y); - features.ySet = webKitFeatures.ySet; + features.ySet = webKitFeatures.has_y; features.width = static_cast(webKitFeatures.width); - features.widthSet = webKitFeatures.widthSet; + features.widthSet = webKitFeatures.has_width; features.height = static_cast(webKitFeatures.height); - features.heightSet = webKitFeatures.heightSet; + features.heightSet = webKitFeatures.has_height; - features.menuBarVisible = webKitFeatures.menuBarVisible; - features.statusBarVisible = webKitFeatures.statusBarVisible; - features.toolBarVisible = webKitFeatures.toolBarVisible; - features.locationBarVisible = webKitFeatures.locationBarVisible; - features.scrollbarsVisible = webKitFeatures.scrollbarsVisible; + features.menuBarVisible = webKitFeatures.menu_bar_visible; + features.statusBarVisible = webKitFeatures.status_bar_visible; + features.toolBarVisible = webKitFeatures.tool_bar_visible; + features.locationBarVisible = webKitFeatures.location_bar_visible; + features.scrollbarsVisible = webKitFeatures.scrollbars_visible; features.resizable = webKitFeatures.resizable; features.fullscreen = webKitFeatures.fullscreen; features.dialog = webKitFeatures.dialog; - features.additionalFeatures = NULL; - if (webKitFeatures.additionalFeatures.size() > 0) - features.additionalFeatures = cef_string_list_alloc(); - - CefString str; - for (unsigned int i = 0; i < webKitFeatures.additionalFeatures.size(); ++i) { - str = base::string16(webKitFeatures.additionalFeatures[i]); - cef_string_list_append(features.additionalFeatures, str.GetStruct()); - } } CefBrowserInfoManager* g_info_manager = nullptr; @@ -142,7 +133,7 @@ bool CefBrowserInfoManager::CanCreateWindow( const content::Referrer& referrer, const std::string& frame_name, WindowOpenDisposition disposition, - const blink::WebWindowFeatures& features, + const blink::mojom::WindowFeatures& features, bool user_gesture, bool opener_suppressed, int opener_render_process_id, diff --git a/libcef/browser/browser_info_manager.h b/libcef/browser/browser_info_manager.h index df79319da..7ab343529 100644 --- a/libcef/browser/browser_info_manager.h +++ b/libcef/browser/browser_info_manager.h @@ -15,6 +15,7 @@ #include "base/memory/scoped_vector.h" #include "base/synchronization/lock.h" #include "content/public/browser/render_process_host_observer.h" +#include "third_party/WebKit/public/web/window_features.mojom.h" #include "ui/base/window_open_disposition.h" #include "url/gurl.h" @@ -64,7 +65,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { const content::Referrer& referrer, const std::string& frame_name, WindowOpenDisposition disposition, - const blink::WebWindowFeatures& features, + const blink::mojom::WindowFeatures& features, bool user_gesture, bool opener_suppressed, int opener_render_process_id, diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index dfa91eaa0..c17112828 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -112,6 +112,11 @@ WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() { return NULL; } +ukm::UkmService* ChromeBrowserProcessStub::ukm_service() { + NOTREACHED(); + return NULL; +} + ProfileManager* ChromeBrowserProcessStub::profile_manager() { DCHECK(context_initialized_); return profile_manager_.get(); diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index a83a882e3..0a3f75c94 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -47,6 +47,7 @@ class ChromeBrowserProcessStub : public BrowserProcess, rappor::RapporServiceImpl* rappor_service() override; IOThread* io_thread() override; WatchDogThread* watchdog_thread() override; + ukm::UkmService* ukm_service() override; ProfileManager* profile_manager() override; PrefService* local_state() override; net::URLRequestContextGetter* system_request_context() override; diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index a45aae486..e1639aa86 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -829,12 +829,12 @@ bool CefContentBrowserClient::CanCreateWindow( const GURL& opener_url, const GURL& opener_top_level_frame_url, const GURL& source_origin, - WindowContainerType container_type, + content::mojom::WindowContainerType container_type, const GURL& target_url, const content::Referrer& referrer, const std::string& frame_name, WindowOpenDisposition disposition, - const blink::WebWindowFeatures& features, + const blink::mojom::WindowFeatures& features, bool user_gesture, bool opener_suppressed, content::ResourceContext* context, diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h index 2b2de1cdf..97095783f 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/content_browser_client.h @@ -79,12 +79,12 @@ class CefContentBrowserClient : public content::ContentBrowserClient { const GURL& opener_url, const GURL& opener_top_level_frame_url, const GURL& source_origin, - WindowContainerType container_type, + content::mojom::WindowContainerType container_type, const GURL& target_url, const content::Referrer& referrer, const std::string& frame_name, WindowOpenDisposition disposition, - const blink::WebWindowFeatures& features, + const blink::mojom::WindowFeatures& features, bool user_gesture, bool opener_suppressed, content::ResourceContext* context, diff --git a/libcef/browser/cookie_manager_impl.cc b/libcef/browser/cookie_manager_impl.cc index 13f5a4699..ca3555efd 100644 --- a/libcef/browser/cookie_manager_impl.cc +++ b/libcef/browser/cookie_manager_impl.cc @@ -587,7 +587,6 @@ void CefCookieManagerImpl::SetCookieInternal( cookie.secure ? true : false, cookie.httponly ? true : false, net::CookieSameSite::DEFAULT_MODE, - CefNetworkDelegate::AreStrictSecureCookiesEnabled(), net::COOKIE_PRIORITY_DEFAULT, base::Bind(SetCookieCallbackImpl, callback)); } diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index 4766345b7..fbf45ffd3 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -81,7 +81,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer, if (!base::IsStringUTF8(chunk)) return num_bytes; - base::FundamentalValue* id = new base::FundamentalValue(stream_id_); + base::Value* id = new base::Value(stream_id_); base::StringValue* chunkValue = new base::StringValue(chunk); content::BrowserThread::PostTask( @@ -322,6 +322,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend( } else if (method == "requestFileSystems") { web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);")); + } else if (method == "reattach") { + agent_host_->DetachClient(this); + agent_host_->AttachClient(this); } else { return; } @@ -404,7 +407,7 @@ void CefDevToolsFrontend::CallClientFunction( void CefDevToolsFrontend::SendMessageAck(int request_id, const base::Value* arg) { - base::FundamentalValue id_value(request_id); + base::Value id_value(request_id); CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr); } diff --git a/libcef/browser/extensions/pdf_web_contents_helper_client.cc b/libcef/browser/extensions/pdf_web_contents_helper_client.cc index 17f89b3ec..fb3a951fd 100644 --- a/libcef/browser/extensions/pdf_web_contents_helper_client.cc +++ b/libcef/browser/extensions/pdf_web_contents_helper_client.cc @@ -12,10 +12,6 @@ CefPDFWebContentsHelperClient::CefPDFWebContentsHelperClient() { CefPDFWebContentsHelperClient::~CefPDFWebContentsHelperClient() { } -void CefPDFWebContentsHelperClient::UpdateLocationBar( - content::WebContents* contents) { -} - void CefPDFWebContentsHelperClient::UpdateContentRestrictions( content::WebContents* contents, int content_restrictions) { diff --git a/libcef/browser/extensions/pdf_web_contents_helper_client.h b/libcef/browser/extensions/pdf_web_contents_helper_client.h index 89e7ea00d..642792606 100644 --- a/libcef/browser/extensions/pdf_web_contents_helper_client.h +++ b/libcef/browser/extensions/pdf_web_contents_helper_client.h @@ -18,13 +18,9 @@ class CefPDFWebContentsHelperClient private: // pdf::PDFWebContentsHelperClient: - void UpdateLocationBar(content::WebContents* contents) override; - void UpdateContentRestrictions(content::WebContents* contents, int content_restrictions) override; - void OnPDFHasUnsupportedFeature(content::WebContents* contents) override; - void OnSaveURL(content::WebContents* contents) override; DISALLOW_COPY_AND_ASSIGN(CefPDFWebContentsHelperClient); diff --git a/libcef/browser/file_dialog_manager.cc b/libcef/browser/file_dialog_manager.cc index c94e011a9..dff2b4984 100644 --- a/libcef/browser/file_dialog_manager.cc +++ b/libcef/browser/file_dialog_manager.cc @@ -11,7 +11,6 @@ #include "libcef/browser/browser_host_impl.h" #include "libcef/browser/thread_util.h" -#include "base/threading/worker_pool.h" #include "content/public/browser/render_frame_host.h" #include "content/public/common/file_chooser_file_info.h" #include "net/base/directory_lister.h" @@ -363,7 +362,7 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback( new UploadFolderHelper( base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback, weak_ptr_factory_.GetWeakPtr(), mode)))); - lister_->Start(base::WorkerPool::GetTaskRunner(true).get()); + lister_->Start(); } } diff --git a/libcef/browser/javascript_dialog_manager.cc b/libcef/browser/javascript_dialog_manager.cc index 9f1f5092a..cedce7e6f 100644 --- a/libcef/browser/javascript_dialog_manager.cc +++ b/libcef/browser/javascript_dialog_manager.cc @@ -90,7 +90,7 @@ void CefJavaScriptDialogManager::Destroy() { void CefJavaScriptDialogManager::RunJavaScriptDialog( content::WebContents* web_contents, const GURL& origin_url, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType message_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback, @@ -187,7 +187,7 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog( dialog_running_ = true; runner_->Run(browser_, - content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, + content::JAVASCRIPT_DIALOG_TYPE_CONFIRM, base::string16(), // display_url message_text, base::string16(), // default_prompt_text @@ -197,7 +197,6 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog( void CefJavaScriptDialogManager::CancelDialogs( content::WebContents* web_contents, - bool suppress_callbacks, bool reset_state) { CefRefPtr client = browser_->GetClient(); if (client.get()) { diff --git a/libcef/browser/javascript_dialog_manager.h b/libcef/browser/javascript_dialog_manager.h index a5aa51b19..683e47aa3 100644 --- a/libcef/browser/javascript_dialog_manager.h +++ b/libcef/browser/javascript_dialog_manager.h @@ -32,7 +32,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager { void RunJavaScriptDialog( content::WebContents* web_contents, const GURL& origin_url, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType message_type, const base::string16& message_text, const base::string16& default_prompt_text, const DialogClosedCallback& callback, @@ -42,7 +42,6 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager { bool is_reload, const DialogClosedCallback& callback) override; void CancelDialogs(content::WebContents* web_contents, - bool suppress_callbacks, bool reset_state) override; private: diff --git a/libcef/browser/javascript_dialog_runner.h b/libcef/browser/javascript_dialog_runner.h index 5994ee5d5..f6a58c6e5 100644 --- a/libcef/browser/javascript_dialog_runner.h +++ b/libcef/browser/javascript_dialog_runner.h @@ -9,7 +9,7 @@ #include "base/callback.h" #include "base/strings/string16.h" -#include "content/public/common/javascript_message_type.h" +#include "content/public/common/javascript_dialog_type.h" class CefBrowserHostImpl; @@ -22,7 +22,7 @@ class CefJavaScriptDialogRunner { // Run the dialog. Execute |callback| on completion. virtual void Run( CefBrowserHostImpl* browser, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, const base::string16& default_prompt_text, diff --git a/libcef/browser/menu_model_impl.cc b/libcef/browser/menu_model_impl.cc index 9dc455211..d319329a9 100644 --- a/libcef/browser/menu_model_impl.cc +++ b/libcef/browser/menu_model_impl.cc @@ -160,15 +160,10 @@ class CefSimpleMenuModel : public ui::MenuModel { } bool GetTextColor(int index, + bool is_minor, bool is_hovered, SkColor* override_color) const override { - return impl_->GetTextColor(index, false, is_hovered, override_color); - } - - bool GetMinorTextColor(int index, - bool is_hovered, - SkColor* override_color) const override { - return impl_->GetTextColor(index, true, is_hovered, override_color); + return impl_->GetTextColor(index, is_minor, is_hovered, override_color); } bool GetBackgroundColor(int index, diff --git a/libcef/browser/native/javascript_dialog_runner_mac.h b/libcef/browser/native/javascript_dialog_runner_mac.h index b1ca59968..cf7ac0bf9 100644 --- a/libcef/browser/native/javascript_dialog_runner_mac.h +++ b/libcef/browser/native/javascript_dialog_runner_mac.h @@ -26,7 +26,7 @@ class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner { // CefJavaScriptDialogRunner methods: void Run( CefBrowserHostImpl* browser, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, const base::string16& default_prompt_text, diff --git a/libcef/browser/native/javascript_dialog_runner_mac.mm b/libcef/browser/native/javascript_dialog_runner_mac.mm index 815c9c501..cbf02428d 100644 --- a/libcef/browser/native/javascript_dialog_runner_mac.mm +++ b/libcef/browser/native/javascript_dialog_runner_mac.mm @@ -89,7 +89,7 @@ CefJavaScriptDialogRunnerMac::~CefJavaScriptDialogRunnerMac() { void CefJavaScriptDialogRunnerMac::Run( CefBrowserHostImpl* browser, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, const base::string16& default_prompt_text, @@ -98,9 +98,9 @@ void CefJavaScriptDialogRunnerMac::Run( callback_ = callback; bool text_field = - message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT; + message_type == content::JAVASCRIPT_DIALOG_TYPE_PROMPT; bool one_button = - message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT; + message_type == content::JAVASCRIPT_DIALOG_TYPE_ALERT; helper_.reset( [[CefJavaScriptDialogHelper alloc] initHelperWithCallback: @@ -119,13 +119,13 @@ void CefJavaScriptDialogRunnerMac::Run( base::string16 label; switch (message_type) { - case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: + case content::JAVASCRIPT_DIALOG_TYPE_ALERT: label = base::ASCIIToUTF16("JavaScript Alert"); break; - case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: + case content::JAVASCRIPT_DIALOG_TYPE_PROMPT: label = base::ASCIIToUTF16("JavaScript Prompt"); break; - case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: + case content::JAVASCRIPT_DIALOG_TYPE_CONFIRM: label = base::ASCIIToUTF16("JavaScript Confirm"); break; } diff --git a/libcef/browser/native/javascript_dialog_runner_win.cc b/libcef/browser/native/javascript_dialog_runner_win.cc index 7dcecc6d4..f5e50c4d2 100644 --- a/libcef/browser/native/javascript_dialog_runner_win.cc +++ b/libcef/browser/native/javascript_dialog_runner_win.cc @@ -27,7 +27,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc( reinterpret_cast(lparam); owner->dialog_win_ = dialog; SetDlgItemText(dialog, IDC_DIALOGTEXT, owner->message_text_.c_str()); - if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) + if (owner->message_type_ == content::JAVASCRIPT_DIALOG_TYPE_PROMPT) SetDlgItemText(dialog, IDC_PROMPTEDIT, owner->default_prompt_text_.c_str()); break; @@ -57,7 +57,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc( case IDOK: finish = true; result = true; - if (owner->message_type_ == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) { + if (owner->message_type_ == content::JAVASCRIPT_DIALOG_TYPE_PROMPT) { size_t length = GetWindowTextLength(GetDlgItem(dialog, IDC_PROMPTEDIT)) + 1; if (length > 1) { @@ -95,7 +95,7 @@ CefJavaScriptDialogRunnerWin::~CefJavaScriptDialogRunnerWin() { void CefJavaScriptDialogRunnerWin::Run( CefBrowserHostImpl* browser, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, const base::string16& default_prompt_text, @@ -111,11 +111,11 @@ void CefJavaScriptDialogRunnerWin::Run( hook_installed_ = true; int dialog_type; - if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_ALERT) + if (message_type == content::JAVASCRIPT_DIALOG_TYPE_ALERT) dialog_type = IDD_ALERT; - else if (message_type == content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM) + else if (message_type == content::JAVASCRIPT_DIALOG_TYPE_CONFIRM) dialog_type = IDD_CONFIRM; - else // JAVASCRIPT_MESSAGE_TYPE_PROMPT + else // JAVASCRIPT_DIALOG_TYPE_PROMPT dialog_type = IDD_PROMPT; base::FilePath file_path; diff --git a/libcef/browser/native/javascript_dialog_runner_win.h b/libcef/browser/native/javascript_dialog_runner_win.h index 88afc9954..833795a3a 100644 --- a/libcef/browser/native/javascript_dialog_runner_win.h +++ b/libcef/browser/native/javascript_dialog_runner_win.h @@ -17,7 +17,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner { // CefJavaScriptDialogRunner methods: void Run( CefBrowserHostImpl* browser, - content::JavaScriptMessageType message_type, + content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, const base::string16& default_prompt_text, @@ -28,7 +28,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner { HWND dialog_win_; HWND parent_win_; - content::JavaScriptMessageType message_type_; + content::JavaScriptDialogType message_type_; base::string16 message_text_; base::string16 default_prompt_text_; DialogClosedCallback callback_; diff --git a/libcef/browser/native/native_menu_win.cc b/libcef/browser/native/native_menu_win.cc index 8e627f695..ad45e450f 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/platform_canvas.h" #include "skia/ext/skia_utils_win.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/l10n/l10n_util.h" diff --git a/libcef/browser/native/window_x11.cc b/libcef/browser/native/window_x11.cc index 9482cf9b9..53a342c64 100644 --- a/libcef/browser/native/window_x11.cc +++ b/libcef/browser/native/window_x11.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include "ui/base/x/x11_util.h" diff --git a/libcef/browser/native/window_x11.h b/libcef/browser/native/window_x11.h index a8776609c..4d8c31cf6 100644 --- a/libcef/browser/native/window_x11.h +++ b/libcef/browser/native/window_x11.h @@ -7,7 +7,10 @@ #define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_X11_H_ #pragma once -#include +// Avoid including +typedef unsigned long Window; +struct _XDisplay; +typedef struct _XDisplay Display; #include "libcef/browser/browser_host_impl.h" diff --git a/libcef/browser/net/cookie_store_proxy.cc b/libcef/browser/net/cookie_store_proxy.cc index 555e17eea..b0e6130c3 100644 --- a/libcef/browser/net/cookie_store_proxy.cc +++ b/libcef/browser/net/cookie_store_proxy.cc @@ -49,7 +49,6 @@ void CefCookieStoreProxy::SetCookieWithDetailsAsync( bool secure, bool http_only, net::CookieSameSite same_site, - bool enforce_strict_secure, net::CookiePriority priority, const SetCookiesCallback& callback) { net::CookieStore* cookie_store = GetCookieStore(); @@ -57,8 +56,7 @@ void CefCookieStoreProxy::SetCookieWithDetailsAsync( cookie_store->SetCookieWithDetailsAsync(url, name, value, domain, path, creation_time, expiration_time, last_access_time, secure, http_only, - same_site, enforce_strict_secure, - priority, callback); + same_site, priority, callback); } } diff --git a/libcef/browser/net/cookie_store_proxy.h b/libcef/browser/net/cookie_store_proxy.h index 7b48bceb0..cc39d8145 100644 --- a/libcef/browser/net/cookie_store_proxy.h +++ b/libcef/browser/net/cookie_store_proxy.h @@ -39,7 +39,6 @@ class CefCookieStoreProxy : public net::CookieStore { bool secure, bool http_only, net::CookieSameSite same_site, - bool enforce_strict_secure, net::CookiePriority priority, const SetCookiesCallback& callback) override; void GetCookiesWithOptionsAsync( diff --git a/libcef/browser/net/devtools_scheme_handler.cc b/libcef/browser/net/devtools_scheme_handler.cc index 61d5920bc..45ec23639 100644 --- a/libcef/browser/net/devtools_scheme_handler.cc +++ b/libcef/browser/net/devtools_scheme_handler.cc @@ -11,7 +11,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/string_util.h" -#include "blink/grit/devtools_resources_map.h" +#include "content/browser/devtools/grit/devtools_resources_map.h" #include "content/public/common/url_constants.h" namespace scheme { diff --git a/libcef/browser/net/network_delegate.cc b/libcef/browser/net/network_delegate.cc index 846d146e9..bc61e4084 100644 --- a/libcef/browser/net/network_delegate.cc +++ b/libcef/browser/net/network_delegate.cc @@ -252,15 +252,6 @@ bool CefNetworkDelegate::AreExperimentalCookieFeaturesEnabled() { return enabled; } -// static -bool CefNetworkDelegate::AreStrictSecureCookiesEnabled() { - const std::string enforce_strict_secure_group = - base::FieldTrialList::FindFullName("StrictSecureCookies"); - return AreExperimentalCookieFeaturesEnabled() || - base::StartsWith(enforce_strict_secure_group, "Enabled", - base::CompareCase::INSENSITIVE_ASCII); -} - std::unique_ptr CefNetworkDelegate::CreateSourceStream( net::URLRequest* request, std::unique_ptr upstream) { @@ -468,7 +459,3 @@ bool CefNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, bool CefNetworkDelegate::OnAreExperimentalCookieFeaturesEnabled() const { return AreExperimentalCookieFeaturesEnabled(); } - -bool CefNetworkDelegate::OnAreStrictSecureCookiesEnabled() const { - return AreStrictSecureCookiesEnabled(); -} diff --git a/libcef/browser/net/network_delegate.h b/libcef/browser/net/network_delegate.h index fcb2dac74..57c3f2918 100644 --- a/libcef/browser/net/network_delegate.h +++ b/libcef/browser/net/network_delegate.h @@ -22,7 +22,6 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl { // Match the logic from ChromeNetworkDelegate and // RenderFrameMessageFilter::OnSetCookie. static bool AreExperimentalCookieFeaturesEnabled(); - static bool AreStrictSecureCookiesEnabled(); void set_force_google_safesearch( BooleanPrefMember* force_google_safesearch) { @@ -46,7 +45,6 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl { bool OnCanAccessFile(const net::URLRequest& request, const base::FilePath& path) const override; bool OnAreExperimentalCookieFeaturesEnabled() const override; - bool OnAreStrictSecureCookiesEnabled() const override; // Weak, owned by our owner (CefURLRequestContextGetterImpl). BooleanPrefMember* force_google_safesearch_; diff --git a/libcef/browser/osr/browser_platform_delegate_osr.cc b/libcef/browser/osr/browser_platform_delegate_osr.cc index 2cf44f6dc..148ef49ca 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.cc +++ b/libcef/browser/osr/browser_platform_delegate_osr.cc @@ -171,7 +171,8 @@ std::unique_ptr return native_delegate_->CreateJavaScriptDialogRunner(); } -std::unique_ptr CefBrowserPlatformDelegateOsr::CreateMenuRunner() { +std::unique_ptr +CefBrowserPlatformDelegateOsr::CreateMenuRunner() { return native_delegate_->CreateMenuRunner(); } @@ -302,6 +303,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver( return; const gfx::Point client_pt(event.x, event.y); + const gfx::Point& screen_pt = GetScreenPoint(client_pt); + gfx::Point transformed_pt; content::RenderWidgetHostImpl* target_rwh = web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint( @@ -309,15 +312,32 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver( client_pt, &transformed_pt); if (target_rwh != current_rwh_for_drag_.get()) { - if (current_rwh_for_drag_) - current_rwh_for_drag_->DragTargetDragLeave(); + if (current_rwh_for_drag_) { + gfx::Point transformed_leave_point = client_pt; + gfx::Point transformed_screen_point = screen_pt; + static_cast( + web_contents->GetRenderWidgetHostView()) + ->TransformPointToCoordSpaceForView( + client_pt, + static_cast( + current_rwh_for_drag_->GetView()), + &transformed_leave_point); + static_cast( + web_contents->GetRenderWidgetHostView()) + ->TransformPointToCoordSpaceForView( + screen_pt, + static_cast( + current_rwh_for_drag_->GetView()), + &transformed_screen_point); + current_rwh_for_drag_->DragTargetDragLeave(transformed_leave_point, + transformed_screen_point); + } DragTargetDragEnter(drag_data_, event, drag_allowed_ops_); } if (!drag_data_) return; - const gfx::Point& screen_pt = GetScreenPoint(client_pt); blink::WebDragOperationsMask ops = static_cast(allowed_ops); int modifiers = TranslateModifiers(event.modifiers); @@ -332,7 +352,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() { } if (current_rwh_for_drag_) { - current_rwh_for_drag_->DragTargetDragLeave(); + current_rwh_for_drag_->DragTargetDragLeave(gfx::Point(), gfx::Point()); current_rwh_for_drag_.reset(); } @@ -349,6 +369,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) { return; gfx::Point client_pt(event.x, event.y); + const gfx::Point& screen_pt = GetScreenPoint(client_pt); + gfx::Point transformed_pt; content::RenderWidgetHostImpl* target_rwh = web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint( @@ -356,8 +378,26 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) { client_pt, &transformed_pt); if (target_rwh != current_rwh_for_drag_.get()) { - if (current_rwh_for_drag_) - current_rwh_for_drag_->DragTargetDragLeave(); + if (current_rwh_for_drag_) { + gfx::Point transformed_leave_point = client_pt; + gfx::Point transformed_screen_point = screen_pt; + static_cast( + web_contents->GetRenderWidgetHostView()) + ->TransformPointToCoordSpaceForView( + client_pt, + static_cast( + current_rwh_for_drag_->GetView()), + &transformed_leave_point); + static_cast( + web_contents->GetRenderWidgetHostView()) + ->TransformPointToCoordSpaceForView( + screen_pt, + static_cast( + current_rwh_for_drag_->GetView()), + &transformed_screen_point); + current_rwh_for_drag_->DragTargetDragLeave(transformed_leave_point, + transformed_screen_point); + } DragTargetDragEnter(drag_data_, event, drag_allowed_ops_); } @@ -369,7 +409,6 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) { static_cast(drag_data_.get()); base::AutoLock lock_scope(data_impl->lock()); content::DropData* drop_data = data_impl->drop_data(); - const gfx::Point& screen_pt = GetScreenPoint(client_pt); int modifiers = TranslateModifiers(event.modifiers); target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt, @@ -430,11 +469,36 @@ void CefBrowserPlatformDelegateOsr::DragSourceEndedAt( if (!web_contents) return; - const gfx::Point& screen_pt = GetScreenPoint(gfx::Point(x, y)); + content::RenderWidgetHostImpl* source_rwh = drag_start_rwh_.get(); + const gfx::Point client_loc(gfx::Point(x, y)); + const gfx::Point& screen_loc = GetScreenPoint(client_loc); blink::WebDragOperation drag_op = static_cast(op); - web_contents->DragSourceEndedAt(x, y, screen_pt.x(), screen_pt.y(), drag_op, - drag_start_rwh_.get()); + // |client_loc| and |screen_loc| are in the root coordinate space, for + // non-root RenderWidgetHosts they need to be transformed. + gfx::Point transformed_point = client_loc; + gfx::Point transformed_screen_point = screen_loc; + if (source_rwh && web_contents->GetRenderWidgetHostView()) { + static_cast( + web_contents->GetRenderWidgetHostView()) + ->TransformPointToCoordSpaceForView( + client_loc, + static_cast( + source_rwh->GetView()), + &transformed_point); + static_cast( + web_contents->GetRenderWidgetHostView()) + ->TransformPointToCoordSpaceForView( + screen_loc, + static_cast( + source_rwh->GetView()), + &transformed_screen_point); + } + + web_contents->DragSourceEndedAt(transformed_point.x(), transformed_point.y(), + transformed_screen_point.x(), + transformed_screen_point.y(), drag_op, + source_rwh); } void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() { diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index e64c09256..a72af6a3c 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -26,6 +26,7 @@ #include "content/browser/frame_host/render_widget_host_view_guest.h" #include "content/browser/renderer_host/dip_util.h" #include "content/browser/renderer_host/render_widget_host_delegate.h" +#include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/resize_lock.h" #include "content/common/input_messages.h" @@ -33,8 +34,8 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/context_factory.h" #include "content/public/browser/render_view_host.h" -#include "content/public/browser/render_widget_host_view_frame_subscriber.h" #include "content/public/common/content_switches.h" +#include "media/base/video_frame.h" #include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/image/image_skia_operations.h" @@ -451,7 +452,8 @@ class CefBeginFrameTimer : public cc::DelayBasedTimeSourceClient { CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( bool transparent, content::RenderWidgetHost* widget, - CefRenderWidgetHostViewOSR* parent_host_view) + CefRenderWidgetHostViewOSR* parent_host_view, + bool is_guest_view_hack) : transparent_(transparent), scale_factor_(kDefaultScaleFactor), frame_rate_threshold_ms_(0), @@ -483,20 +485,20 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( } #if !defined(OS_MACOSX) - content::ImageTransportFactory* factory = - content::ImageTransportFactory::GetInstance(); - ui::ContextFactoryPrivate* context_factory_private = - factory->GetContextFactoryPrivate(); delegated_frame_host_ = base::MakeUnique( - context_factory_private->AllocateFrameSinkId(), this); + AllocateFrameSinkId(is_guest_view_hack), this); root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); #endif - PlatformCreateCompositorWidget(); + PlatformCreateCompositorWidget(is_guest_view_hack); #if !defined(OS_MACOSX) - // On OS X the ui::Compositor is created/owned by the platform view. + // On macOS the ui::Compositor is created/owned by the platform view. + content::ImageTransportFactory* factory = + content::ImageTransportFactory::GetInstance(); + ui::ContextFactoryPrivate* context_factory_private = + factory->GetContextFactoryPrivate(); compositor_.reset( new ui::Compositor(context_factory_private->AllocateFrameSinkId(), content::GetContextFactory(), context_factory_private, @@ -593,7 +595,7 @@ bool CefRenderWidgetHostViewOSR::HasFocus() const { } bool CefRenderWidgetHostViewOSR::IsSurfaceAvailableForCopy() const { - return GetDelegatedFrameHost()->CanCopyToBitmap(); + return GetDelegatedFrameHost()->CanCopyFromCompositingSurface(); } void CefRenderWidgetHostViewOSR::Show() { @@ -697,17 +699,12 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( // The compositor will draw directly to the SoftwareOutputDevice which // then calls OnPaint. -#if defined(OS_MACOSX) - // We would normally call BrowserCompositorMac::SwapCompositorFrame, - // however it contains compositor resize logic that we don't want. + // We would normally call BrowserCompositorMac::SwapCompositorFrame on + // macOS, however it contains compositor resize logic that we don't want. // Consequently we instead call the SwapDelegatedFrame method directly. - browser_compositor_->GetDelegatedFrameHost()->SwapDelegatedFrame( - output_surface_id, std::move(frame)); -#else - delegated_frame_host_->SwapDelegatedFrame(output_surface_id, - std::move(frame)); -#endif - } else { + GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id, + std::move(frame)); + } else { if (!copy_frame_generator_.get()) { copy_frame_generator_.reset( new CefCopyFrameGenerator(frame_rate_threshold_ms_, this)); @@ -721,16 +718,11 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( gfx::ToEnclosingRect(gfx::RectF(root_pass->damage_rect)); damage_rect.Intersect(gfx::Rect(frame_size)); -#if defined(OS_MACOSX) - // We would normally call BrowserCompositorMac::SwapCompositorFrame, - // however it contains compositor resize logic that we don't want. + // We would normally call BrowserCompositorMac::SwapCompositorFrame on + // macOS, however it contains compositor resize logic that we don't want. // Consequently we instead call the SwapDelegatedFrame method directly. - browser_compositor_->GetDelegatedFrameHost()->SwapDelegatedFrame( - output_surface_id, std::move(frame)); -#else - delegated_frame_host_->SwapDelegatedFrame(output_surface_id, - std::move(frame)); -#endif + GetDelegatedFrameHost()->SwapDelegatedFrame(output_surface_id, + std::move(frame)); // Request a copy of the last compositor frame which will eventually call // OnPaint asynchronously. @@ -892,7 +884,7 @@ gfx::Size CefRenderWidgetHostViewOSR::GetPhysicalBackingSize() const { return gfx::ConvertSizeToPixel(scale_factor_, GetRequestedRendererSize()); } -void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface( +void CefRenderWidgetHostViewOSR::CopyFromSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const content::ReadbackRequestCallback& callback, @@ -901,18 +893,14 @@ void CefRenderWidgetHostViewOSR::CopyFromCompositingSurface( src_subrect, dst_size, callback, color_type); } -void CefRenderWidgetHostViewOSR::CopyFromCompositingSurfaceToVideoFrame( +void CefRenderWidgetHostViewOSR::CopyFromSurfaceToVideoFrame( const gfx::Rect& src_subrect, - const scoped_refptr& target, + scoped_refptr target, const base::Callback& callback) { GetDelegatedFrameHost()->CopyFromCompositingSurfaceToVideoFrame( src_subrect, target, callback); } -bool CefRenderWidgetHostViewOSR::CanCopyToVideoFrame() const { - return GetDelegatedFrameHost()->CanCopyToVideoFrame(); -} - void CefRenderWidgetHostViewOSR::BeginFrameSubscription( std::unique_ptr subscriber) { GetDelegatedFrameHost()->BeginFrameSubscription(std::move(subscriber)); @@ -950,14 +938,6 @@ content::BrowserAccessibilityManager* return NULL; } -void CefRenderWidgetHostViewOSR::LockCompositingSurface() { - NOTIMPLEMENTED(); -} - -void CefRenderWidgetHostViewOSR::UnlockCompositingSurface() { - NOTIMPLEMENTED(); -} - #if defined(TOOLKIT_VIEWS) || defined(USE_AURA) void CefRenderWidgetHostViewOSR::ShowDisambiguationPopup( const gfx::Rect& rect_pixels, @@ -1046,6 +1026,40 @@ void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) { } } +bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace( + const gfx::Point& point, + const cc::SurfaceId& original_surface, + gfx::Point* transformed_point) { + // Transformations use physical pixels rather than DIP, so conversion + // is necessary. + gfx::Point point_in_pixels = + gfx::ConvertPointToPixel(scale_factor_, point); + if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace( + point_in_pixels, original_surface, transformed_point)) { + return false; + } + + *transformed_point = + gfx::ConvertPointToDIP(scale_factor_, *transformed_point); + return true; +} + +bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView( + const gfx::Point& point, + RenderWidgetHostViewBase* target_view, + gfx::Point* transformed_point) { + if (target_view == this) { + *transformed_point = point; + return true; + } + + // In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion, + // but it is not necessary here because the final target view is responsible + // for converting before computing the final transform. + return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView( + point, target_view, transformed_point); +} + std::unique_ptr CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice( ui::Compositor* compositor) { @@ -1613,3 +1627,20 @@ void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged( } } } + +cc::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId( + bool is_guest_view_hack) { + // GuestViews have two RenderWidgetHostViews and so we need to make sure + // we don't have FrameSinkId collisions. + // The FrameSinkId generated here must be unique with FrameSinkId allocated + // in ContextFactoryPrivate. + content::ImageTransportFactory* factory = + content::ImageTransportFactory::GetInstance(); + return is_guest_view_hack + ? factory->GetContextFactoryPrivate()->AllocateFrameSinkId() + : cc::FrameSinkId(base::checked_cast( + render_widget_host_->GetProcess()->GetID()), + base::checked_cast( + render_widget_host_->GetRoutingID())); +} + diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index 36a6f2b93..d902b8436 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -91,7 +91,8 @@ class CefRenderWidgetHostViewOSR public: CefRenderWidgetHostViewOSR(const bool transparent, content::RenderWidgetHost* widget, - CefRenderWidgetHostViewOSR* parent_host_view); + CefRenderWidgetHostViewOSR* parent_host_view, + bool is_guest_view_hack); ~CefRenderWidgetHostViewOSR() override; // RenderWidgetHostView implementation. @@ -142,16 +143,15 @@ class CefRenderWidgetHostViewOSR gfx::Size GetRequestedRendererSize() const override; gfx::Size GetPhysicalBackingSize() const override; - void CopyFromCompositingSurface( + void CopyFromSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const content::ReadbackRequestCallback& callback, const SkColorType color_type) override; - void CopyFromCompositingSurfaceToVideoFrame( + void CopyFromSurfaceToVideoFrame( const gfx::Rect& src_subrect, - const scoped_refptr& target, + scoped_refptr target, const base::Callback& callback) override; - bool CanCopyToVideoFrame() const override; void BeginFrameSubscription( std::unique_ptr subscriber) override; @@ -162,8 +162,6 @@ class CefRenderWidgetHostViewOSR CreateBrowserAccessibilityManager( content::BrowserAccessibilityDelegate* delegate, bool for_root_frame) override; - void LockCompositingSurface() override; - void UnlockCompositingSurface() override; #if defined(TOOLKIT_VIEWS) || defined(USE_AURA) void ShowDisambiguationPopup(const gfx::Rect& rect_pixels, @@ -175,6 +173,15 @@ class CefRenderWidgetHostViewOSR void SetNeedsBeginFrames(bool enabled) override; + bool TransformPointToLocalCoordSpace( + const gfx::Point& point, + const cc::SurfaceId& original_surface, + gfx::Point* transformed_point) override; + bool TransformPointToCoordSpaceForView( + const gfx::Point& point, + RenderWidgetHostViewBase* target_view, + gfx::Point* transformed_point) override; + // ui::CompositorDelegate implementation. std::unique_ptr CreateSoftwareOutputDevice( ui::Compositor* compositor) override; @@ -280,10 +287,12 @@ class CefRenderWidgetHostViewOSR void RequestImeCompositionUpdate(bool start_monitoring); + cc::FrameSinkId AllocateFrameSinkId(bool is_guest_view_hack); + #if defined(OS_MACOSX) friend class MacHelper; #endif - void PlatformCreateCompositorWidget(); + void PlatformCreateCompositorWidget(bool is_guest_view_hack); void PlatformResizeCompositorWidget(const gfx::Size& size); void PlatformDestroyCompositorWidget(); 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 b0fef43d3..80acf7d05 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_linux.cc +++ b/libcef/browser/osr/render_widget_host_view_osr_linux.cc @@ -7,8 +7,8 @@ #include #include +#undef Status // Avoid conflicts with url_request_status.h -#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/native/window_x11.h" #include "third_party/WebKit/public/platform/WebCursorInfo.h" @@ -166,13 +166,15 @@ XCursorCache* cursor_cache = nullptr; } // namespace -void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() { +void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget( + bool is_guest_view_hack) { // Create a hidden 1x1 window. It will delete itself on close. window_ = new CefWindowX11(NULL, None, gfx::Rect(0, 0, 1, 1)); compositor_widget_ = window_->xwindow(); } -void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) { +void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget( + const gfx::Size&) { } void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() { diff --git a/libcef/browser/osr/render_widget_host_view_osr_mac.mm b/libcef/browser/osr/render_widget_host_view_osr_mac.mm index c5dc92088..85a773852 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_mac.mm +++ b/libcef/browser/osr/render_widget_host_view_osr_mac.mm @@ -128,7 +128,8 @@ content::DelegatedFrameHost* CefRenderWidgetHostViewOSR::GetDelegatedFrameHost() return browser_compositor_->GetDelegatedFrameHost(); } -void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() { +void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget( + bool is_guest_view_hack) { // Create a borderless non-visible 1x1 window. window_ = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 1, 1) styleMask:NSBorderlessWindowMask @@ -144,7 +145,8 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() { mac_helper_ = new MacHelper(this); browser_compositor_.reset(new content::BrowserCompositorMac( - mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true)); + mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true, + AllocateFrameSinkId(is_guest_view_hack))); } void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size&) { diff --git a/libcef/browser/osr/render_widget_host_view_osr_win.cc b/libcef/browser/osr/render_widget_host_view_osr_win.cc index 01e1a32bd..f2b5c77e2 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_win.cc +++ b/libcef/browser/osr/render_widget_host_view_osr_win.cc @@ -143,13 +143,15 @@ bool IsSystemCursorID(LPCWSTR cursor_id) { } // namespace -void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget() { +void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget( + bool is_guest_view_hack) { DCHECK(!window_); window_.reset(new CefCompositorHostWin()); compositor_widget_ = window_->hwnd(); } -void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(const gfx::Size& size) { +void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget( + const gfx::Size& size) { DCHECK(window_); SetWindowPos(window_->hwnd(), NULL, 0, 0, size.width(), size.height(), SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE); diff --git a/libcef/browser/osr/software_output_device_osr.cc b/libcef/browser/osr/software_output_device_osr.cc index 8b4968b56..70ae96422 100644 --- a/libcef/browser/osr/software_output_device_osr.cc +++ b/libcef/browser/osr/software_output_device_osr.cc @@ -9,7 +9,7 @@ #include "libcef/browser/osr/render_widget_host_view_osr.h" #include "libcef/browser/thread_util.h" -#include "third_party/skia/include/core/SkDevice.h" +#include "third_party/skia/src/core/SkDevice.h" #include "ui/compositor/compositor.h" #include "ui/gfx/skia_util.h" diff --git a/libcef/browser/osr/web_contents_view_osr.cc b/libcef/browser/osr/web_contents_view_osr.cc index 05e82bf99..69ca980b7 100644 --- a/libcef/browser/osr/web_contents_view_osr.cc +++ b/libcef/browser/osr/web_contents_view_osr.cc @@ -99,8 +99,10 @@ content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget( embedder_render_widget_host->GetView()); } + const bool is_guest_view_hack = !!embedder_render_widget_host; return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, - embedder_host_view); + embedder_host_view, + is_guest_view_hack); } // Called for popup and fullscreen widgets. @@ -110,7 +112,8 @@ content::RenderWidgetHostViewBase* CefRenderWidgetHostViewOSR* view = GetView(); CHECK(view); - return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, view); + return new CefRenderWidgetHostViewOSR(transparent_, render_widget_host, view, + false); } void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) { diff --git a/libcef/browser/permissions/permission_context.cc b/libcef/browser/permissions/permission_context.cc index 16836e0dd..0cf5e0c2b 100644 --- a/libcef/browser/permissions/permission_context.cc +++ b/libcef/browser/permissions/permission_context.cc @@ -159,12 +159,11 @@ void CefPermissionContext::DecidePermission( } ContentSetting content_setting = - profile_->GetHostContentSettingsMap()-> - GetContentSettingAndMaybeUpdateLastUsage( - requesting_origin, - embedding_origin, - permission_util::PermissionTypeToContentSetting(permission), - std::string()); + profile_->GetHostContentSettingsMap()->GetContentSetting( + requesting_origin, + embedding_origin, + permission_util::PermissionTypeToContentSetting(permission), + std::string()); if (content_setting == CONTENT_SETTING_ALLOW || content_setting == CONTENT_SETTING_BLOCK) { diff --git a/libcef/browser/permissions/permission_manager.cc b/libcef/browser/permissions/permission_manager.cc index 86909880a..437682835 100644 --- a/libcef/browser/permissions/permission_manager.cc +++ b/libcef/browser/permissions/permission_manager.cc @@ -294,21 +294,6 @@ PermissionStatus CefPermissionManager::GetPermissionStatus( embedding_origin)); } -void CefPermissionManager::RegisterPermissionUsage( - PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) { - // This is required because constant permissions don't have a - // ContentSettingsType. - if (IsConstantPermission(permission)) - return; - - profile_->GetHostContentSettingsMap()->UpdateLastUsage( - requesting_origin, - embedding_origin, - permission_util::PermissionTypeToContentSetting(permission)); -} - int CefPermissionManager::SubscribePermissionStatusChange( PermissionType permission, const GURL& requesting_origin, diff --git a/libcef/browser/permissions/permission_manager.h b/libcef/browser/permissions/permission_manager.h index 4e73d2fac..a43bdd398 100644 --- a/libcef/browser/permissions/permission_manager.h +++ b/libcef/browser/permissions/permission_manager.h @@ -55,9 +55,6 @@ class CefPermissionManager : public KeyedService, content::PermissionType permission, const GURL& requesting_origin, const GURL& embedding_origin) override; - void RegisterPermissionUsage(content::PermissionType permission, - const GURL& requesting_origin, - const GURL& embedding_origin) override; int SubscribePermissionStatusChange( content::PermissionType permission, const GURL& requesting_origin, diff --git a/libcef/browser/prefs/renderer_prefs.cc b/libcef/browser/prefs/renderer_prefs.cc index 9d82de6c1..169f4b355 100644 --- a/libcef/browser/prefs/renderer_prefs.cc +++ b/libcef/browser/prefs/renderer_prefs.cc @@ -280,7 +280,7 @@ void SetBool(CommandLinePrefStore* prefs, const std::string& key, bool value) { prefs->SetValue(key, - base::WrapUnique(new base::FundamentalValue(value)), + base::WrapUnique(new base::Value(value)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } diff --git a/libcef/browser/printing/print_view_manager_base.cc b/libcef/browser/printing/print_view_manager_base.cc index d3962e18c..21a604c7d 100644 --- a/libcef/browser/printing/print_view_manager_base.cc +++ b/libcef/browser/printing/print_view_manager_base.cc @@ -9,6 +9,7 @@ #include "base/auto_reset.h" #include "base/bind.h" +#include "base/feature_list.h" #include "base/location.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" @@ -23,6 +24,7 @@ #include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/printer_query.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "components/prefs/pref_service.h" @@ -163,24 +165,40 @@ void CefPrintViewManagerBase::OnDidPrintPage( #if defined(OS_WIN) print_job_->AppendPrintedPage(params.page_number); if (metafile_must_be_valid) { - // TODO(thestig): Figure out why rendering text with GDI results in random - // missing characters for some users. https://crbug.com/658606 - bool print_text_with_gdi = - document->settings().print_text_with_gdi() && - !document->settings().printer_is_xps() && - switches::GDITextPrintingEnabled(); scoped_refptr bytes = new base::RefCountedBytes( reinterpret_cast(shared_buf->memory()), params.data_size); document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); - print_job_->StartPdfToEmfConversion( - bytes, params.page_size, params.content_area, - print_text_with_gdi); + + const auto& settings = document->settings(); + if ((settings.printer_is_ps2() || settings.printer_is_ps3()) && + base::FeatureList::IsEnabled(features::kPostScriptPrinting)) { + print_job_->StartPdfToPostScriptConversion(bytes, params.content_area, + params.physical_offsets, + settings.printer_is_ps2()); + } else { + // TODO(thestig): Figure out why rendering text with GDI results in random + // missing characters for some users. https://crbug.com/658606 + // Update : The missing letters seem to have been caused by the same + // problem as https://crbug.com/659604 which was resolved. GDI printing + // seems to work with the fix for this bug applied. + bool print_text_with_gdi = settings.print_text_with_gdi() && + !settings.printer_is_xps() && + base::FeatureList::IsEnabled( + features::kGdiTextPrinting); + print_job_->StartPdfToEmfConversion( + bytes, params.page_size, params.content_area, print_text_with_gdi); + } } #else // Update the rendered document. It will send notifications to the listener. - document->SetPage(params.page_number, std::move(metafile), params.page_size, + document->SetPage(params.page_number, + std::move(metafile), +#if defined(OS_WIN) + 0.0f /* dummy shrink_factor */, +#endif + params.page_size, params.content_area); ShouldQuitFromInnerMessageLoop(); diff --git a/libcef/browser/resource_context.cc b/libcef/browser/resource_context.cc index e0105e204..b30a90e4a 100644 --- a/libcef/browser/resource_context.cc +++ b/libcef/browser/resource_context.cc @@ -73,6 +73,14 @@ void CefResourceContext::SetUserData(const void* key, Data* data) { content::ResourceContext::SetUserData(key, data); } +void CefResourceContext::SetUserData(const void* key, + std::unique_ptr data) { + if (parent_ && ShouldProxyUserData(key)) + parent_->SetUserData(key, std::move(data)); + else + content::ResourceContext::SetUserData(key, std::move(data)); +} + void CefResourceContext::RemoveUserData(const void* key) { if (parent_ && ShouldProxyUserData(key)) parent_->RemoveUserData(key); diff --git a/libcef/browser/resource_context.h b/libcef/browser/resource_context.h index a211004dc..15feaabc2 100644 --- a/libcef/browser/resource_context.h +++ b/libcef/browser/resource_context.h @@ -35,6 +35,7 @@ class CefResourceContext : public content::ResourceContext { // SupportsUserData implementation. Data* GetUserData(const void* key) const override; void SetUserData(const void* key, Data* data) override; + void SetUserData(const void* key, std::unique_ptr data) override; void RemoveUserData(const void* key) override; // ResourceContext implementation. diff --git a/libcef/browser/storage_partition_proxy.cc b/libcef/browser/storage_partition_proxy.cc index e7c8d213e..8e151c699 100644 --- a/libcef/browser/storage_partition_proxy.cc +++ b/libcef/browser/storage_partition_proxy.cc @@ -91,6 +91,11 @@ CefStoragePartitionProxy::GetBroadcastChannelProvider() { return parent_->GetBroadcastChannelProvider(); } +content::BluetoothAllowedDevicesMap* +CefStoragePartitionProxy::GetBluetoothAllowedDevicesMap() { + return parent_->GetBluetoothAllowedDevicesMap(); +} + void CefStoragePartitionProxy::ClearDataForOrigin( uint32_t remove_mask, uint32_t quota_storage_remove_mask, @@ -129,6 +134,10 @@ void CefStoragePartitionProxy::Flush() { parent_->Flush(); } +void CefStoragePartitionProxy::ClearBluetoothAllowedDevicesMapForTesting() { + parent_->ClearBluetoothAllowedDevicesMapForTesting(); +} + void CefStoragePartitionProxy::Bind( mojo::InterfaceRequest request) { parent_->Bind(std::move(request)); diff --git a/libcef/browser/storage_partition_proxy.h b/libcef/browser/storage_partition_proxy.h index 3ef8f299c..b863e54f4 100644 --- a/libcef/browser/storage_partition_proxy.h +++ b/libcef/browser/storage_partition_proxy.h @@ -39,6 +39,7 @@ class CefStoragePartitionProxy : public content::StoragePartition { content::BackgroundSyncContext* GetBackgroundSyncContext() override; content::PaymentAppContextImpl* GetPaymentAppContext() override; content::BroadcastChannelProvider* GetBroadcastChannelProvider() override; + content::BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override; void ClearDataForOrigin(uint32_t remove_mask, uint32_t quota_storage_remove_mask, const GURL& storage_origin, @@ -59,6 +60,7 @@ class CefStoragePartitionProxy : public content::StoragePartition { const base::Time end, const base::Closure& callback) override; void Flush() override; + void ClearBluetoothAllowedDevicesMapForTesting() override; void Bind( mojo::InterfaceRequest request) override; diff --git a/libcef/browser/views/button_view.h b/libcef/browser/views/button_view.h index b64c015e0..01b10f7b9 100644 --- a/libcef/browser/views/button_view.h +++ b/libcef/browser/views/button_view.h @@ -41,14 +41,15 @@ CEF_BUTTON_VIEW_T class CefButtonView : public CEF_VIEW_VIEW_D { } // views::CustomButton methods: - void StateChanged() override; + void StateChanged(views::CustomButton::ButtonState old_state) override; // views::ButtonListener methods: void ButtonPressed(views::Button* sender, const ui::Event& event) override; }; -CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::StateChanged() { - ParentClass::StateChanged(); +CEF_BUTTON_VIEW_T void CEF_BUTTON_VIEW_D::StateChanged( + views::CustomButton::ButtonState old_state) { + ParentClass::StateChanged(old_state); if (ParentClass::cef_delegate()) ParentClass::cef_delegate()->OnButtonStateChanged(GetCefButton()); } diff --git a/libcef/common/cef_crash_report_upload_thread.cc b/libcef/common/cef_crash_report_upload_thread.cc index d9145cf50..242874c3e 100644 --- a/libcef/common/cef_crash_report_upload_thread.cc +++ b/libcef/common/cef_crash_report_upload_thread.cc @@ -50,8 +50,9 @@ CefCrashReportUploadThread::CefCrashReportUploadThread( CrashReportDatabase* database, const std::string& url, bool rate_limit, + bool upload_gzip, int max_uploads) - : CrashReportUploadThread(database, url, rate_limit), + : CrashReportUploadThread(database, url, rate_limit, upload_gzip), max_uploads_(max_uploads) { } diff --git a/libcef/common/cef_crash_report_upload_thread.h b/libcef/common/cef_crash_report_upload_thread.h index 2c6f0ddbe..5c99ba85a 100644 --- a/libcef/common/cef_crash_report_upload_thread.h +++ b/libcef/common/cef_crash_report_upload_thread.h @@ -12,6 +12,7 @@ class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread { CefCrashReportUploadThread(crashpad::CrashReportDatabase* database, const std::string& url, bool rate_limit, + bool upload_gzip, int max_uploads); ~CefCrashReportUploadThread(); diff --git a/libcef/common/content_client.h b/libcef/common/content_client.h index 92817b4b4..657167388 100644 --- a/libcef/common/content_client.h +++ b/libcef/common/content_client.h @@ -76,6 +76,10 @@ class CefContentClient : public content::ContentClient, // A scheme that can be sent CORS requests. This value should be true in // most cases where |is_standard| is true. bool is_cors_enabled; + + // A scheme that can bypass Content-Security-Policy (CSP) checks. This value + // should be false in most cases where |is_standard| is true. + bool is_csp_bypassing; }; typedef std::list SchemeInfoList; diff --git a/libcef/common/drag_data_impl.cc b/libcef/common/drag_data_impl.cc index 6b632ab27..a8e2c8e1c 100644 --- a/libcef/common/drag_data_impl.cc +++ b/libcef/common/drag_data_impl.cc @@ -7,7 +7,6 @@ #include "libcef/browser/stream_impl.h" #include "libcef/common/drag_data_impl.h" #include "base/files/file_path.h" -#include "net/base/filename_util.h" #define CHECK_READONLY_RETURN_VOID() \ if (read_only_) { \ @@ -44,18 +43,21 @@ bool CefDragDataImpl::IsReadOnly() { bool CefDragDataImpl::IsLink() { base::AutoLock lock_scope(lock_); - return (data_.url.is_valid() && data_.file_description_filename.empty()); + return (data_.url.is_valid() && + data_.file_contents_content_disposition.empty()); } bool CefDragDataImpl::IsFragment() { base::AutoLock lock_scope(lock_); - return (!data_.url.is_valid() && data_.file_description_filename.empty() && + return (!data_.url.is_valid() && + data_.file_contents_content_disposition.empty() && data_.filenames.empty()); } bool CefDragDataImpl::IsFile() { base::AutoLock lock_scope(lock_); - return (!data_.file_description_filename.empty() || !data_.filenames.empty()); + return (!data_.file_contents_content_disposition.empty() || + !data_.filenames.empty()); } CefString CefDragDataImpl::GetLinkURL() { @@ -90,20 +92,12 @@ CefString CefDragDataImpl::GetFragmentBaseURL() { CefString CefDragDataImpl::GetFileName() { base::AutoLock lock_scope(lock_); - if (data_.file_description_filename.empty()) + if (data_.file_contents_content_disposition.empty()) return CefString(); - base::FilePath file_name(CefString(data_.file_description_filename)); - // Images without ALT text will only have a file extension so we need to - // synthesize one from the provided extension and URL. - if (file_name.BaseName().RemoveExtension().empty()) { - base::FilePath::StringType extension = file_name.Extension(); - // Retrieve the name from the URL. - CefString suggested_file_name = - net::GetSuggestedFilename(data_.url, "", "", "", "", ""); - file_name = base::FilePath(suggested_file_name).ReplaceExtension(extension); - } - return file_name.value(); + base::Optional filename = + data_.GetSafeFilenameForImageFileContents(); + return filename ? CefString(filename->value()) : CefString(); } size_t CefDragDataImpl::GetFileContents(CefRefPtr writer) { @@ -173,7 +167,9 @@ void CefDragDataImpl::ResetFileContents() { base::AutoLock lock_scope(lock_); CHECK_READONLY_RETURN_VOID(); data_.file_contents.erase(); - data_.file_description_filename.erase(); + data_.file_contents_source_url = GURL(); + data_.file_contents_filename_extension.erase(); + data_.file_contents_content_disposition.erase(); } void CefDragDataImpl::AddFile(const CefString& path, diff --git a/libcef/common/extensions/api/_api_features.json b/libcef/common/extensions/api/_api_features.json index 984936886..74724b5c4 100644 --- a/libcef/common/extensions/api/_api_features.json +++ b/libcef/common/extensions/api/_api_features.json @@ -4,7 +4,7 @@ // This file defines extension APIs implemented in CEF. // See extensions/common/features/* to understand this file, in particular -// feature.h, simple_feature.h, and base_feature_provider.h. +// feature.h, simple_feature.h, and feature_provider.h. // If APIs are defined in chrome then entries must also be added in // libcef/browser/extensions/chrome_api_registration.cc. diff --git a/libcef/common/extensions/api/_permission_features.json b/libcef/common/extensions/api/_permission_features.json index 44da3ca5c..e5a310010 100644 --- a/libcef/common/extensions/api/_permission_features.json +++ b/libcef/common/extensions/api/_permission_features.json @@ -4,7 +4,7 @@ // This file defines permissions for extension APIs implemented by CEF. // See extensions/common/features/* to understand this file, in particular -// feature.h, simple_feature.h, and base_feature_provider.h. +// feature.h, simple_feature.h, and feature_provider.h. // If APIs are defined in chrome then entries must also be added in // libcef/browser/extensions/chrome_api_registration.cc. diff --git a/libcef/common/net/scheme_registration.cc b/libcef/common/net/scheme_registration.cc index 7fdc30e6d..9d778f103 100644 --- a/libcef/common/net/scheme_registration.cc +++ b/libcef/common/net/scheme_registration.cc @@ -25,7 +25,8 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) { false, /* is_local */ false, /* is_display_isolated */ true, /* is_secure */ - true /* is_cors_enabled */ + true, /* is_cors_enabled */ + true, /* is_csp_bypassing */ }, }; @@ -42,6 +43,8 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) { schemes->secure_schemes.push_back(internal_schemes[i].scheme_name); if (internal_schemes[i].is_cors_enabled) schemes->cors_enabled_schemes.push_back(internal_schemes[i].scheme_name); + if (internal_schemes[i].is_csp_bypassing) + schemes->csp_bypassing_schemes.push_back(internal_schemes[i].scheme_name); client->AddCustomScheme(internal_schemes[i]); } } diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 8cee8dbb2..5381ab6de 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -16,7 +16,6 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/strings/string_util.h" -#include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/navigation_interception/navigation_params.h" #include "content/public/browser/browser_thread.h" @@ -139,9 +138,9 @@ std::string GetURLRequestReferrer(const GURL& referrer_url) { blink::WebString FilePathStringToWebString( const base::FilePath::StringType& str) { #if defined(OS_POSIX) - return base::WideToUTF16(base::SysNativeMBToWide(str)); + return blink::WebString::fromUTF8(str); #elif defined(OS_WIN) - return base::WideToUTF16(str); + return blink::WebString::fromUTF16(str); #endif } @@ -179,8 +178,8 @@ void GetHeaderMap(const blink::WebURLRequest& request, void visitHeader(const blink::WebString& name, const blink::WebString& value) override { - const base::string16& nameStr = name; - const base::string16& valueStr = value; + const base::string16& nameStr = name.utf16(); + const base::string16& valueStr = value.utf16(); if (base::LowerCaseEqualsASCII(nameStr, kReferrerLowerCase)) *referrer_ = GURL(valueStr); else @@ -216,8 +215,8 @@ void SetHeaderMap(const CefRequest::HeaderMap& map, blink::WebURLRequest& request) { CefRequest::HeaderMap::const_iterator it = map.begin(); for (; it != map.end(); ++it) { - request.setHTTPHeaderField(base::string16(it->first), - base::string16(it->second)); + request.setHTTPHeaderField(blink::WebString::fromUTF16(it->first), + blink::WebString::fromUTF16(it->second)); } } @@ -620,7 +619,7 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params, blink::WebURLRequest& request) { request.setURL(params.url); if (!params.method.empty()) - request.setHTTPMethod(base::ASCIIToUTF16(params.method)); + request.setHTTPMethod(blink::WebString::fromASCII(params.method)); if (params.referrer.is_valid()) { const blink::WebString& referrer = @@ -645,18 +644,18 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params, } if (params.upload_data.get()) { - const base::string16& method = request.httpMethod(); + const base::string16& method = request.httpMethod().utf16(); if (method == base::ASCIIToUTF16("GET") || method == base::ASCIIToUTF16("HEAD")) { - request.setHTTPMethod(base::ASCIIToUTF16("POST")); + request.setHTTPMethod(blink::WebString::fromASCII("POST")); } // The comparison performed by httpHeaderField() is case insensitive. - if (request.httpHeaderField(base::ASCIIToUTF16( + if (request.httpHeaderField(blink::WebString::fromASCII( net::HttpRequestHeaders::kContentType)).length()== 0) { request.setHTTPHeaderField( - base::ASCIIToUTF16(net::HttpRequestHeaders::kContentType), - base::ASCIIToUTF16(kApplicationFormURLEncoded)); + blink::WebString::fromASCII(net::HttpRequestHeaders::kContentType), + blink::WebString::fromASCII(kApplicationFormURLEncoded)); } blink::WebHTTPBody body; @@ -1314,7 +1313,7 @@ void CefPostDataElementImpl::Set(const blink::WebHTTPBody::Element& element) { SetToBytes(element.data.size(), static_cast(element.data.data())); } else if (element.type == blink::WebHTTPBody::Element::TypeFile) { - SetToFile(base::string16(element.filePath)); + SetToFile(element.filePath.utf16()); } else { NOTREACHED(); } @@ -1329,7 +1328,8 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const { static_cast(data_.bytes.bytes), data_.bytes.size); } else if (type_ == PDE_TYPE_FILE) { element.type = blink::WebHTTPBody::Element::TypeFile; - element.filePath.assign(base::string16(CefString(&data_.filename))); + element.filePath.assign( + blink::WebString::fromUTF16(CefString(&data_.filename))); } else { NOTREACHED(); } diff --git a/libcef/common/response_impl.cc b/libcef/common/response_impl.cc index 56ff9555a..adf6dc1e3 100644 --- a/libcef/common/response_impl.cc +++ b/libcef/common/response_impl.cc @@ -193,9 +193,9 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) { blink::WebString str; status_code_ = response.httpStatusCode(); str = response.httpStatusText(); - status_text_ = CefString(str); + status_text_ = str.utf16(); str = response.mimeType(); - mime_type_ = CefString(str); + mime_type_ = str.utf16(); class HeaderVisitor : public blink::WebHTTPHeaderVisitor { public: @@ -203,8 +203,7 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) { void visitHeader(const blink::WebString& name, const blink::WebString& value) override { - map_->insert(std::make_pair(base::string16(name), - base::string16(value))); + map_->insert(std::make_pair(name.utf16(), value.utf16())); } private: diff --git a/libcef/common/scheme_registrar_impl.cc b/libcef/common/scheme_registrar_impl.cc index 00b8daa0c..62a6e3e3f 100644 --- a/libcef/common/scheme_registrar_impl.cc +++ b/libcef/common/scheme_registrar_impl.cc @@ -33,7 +33,8 @@ bool CefSchemeRegistrarImpl::AddCustomScheme( bool is_local, bool is_display_isolated, bool is_secure, - bool is_cors_enabled) { + bool is_cors_enabled, + bool is_csp_bypassing) { const std::string& scheme = base::ToLowerASCII(scheme_name.ToString()); if (scheme::IsInternalHandledScheme(scheme) || registered_schemes_.find(scheme) != registered_schemes_.end()) { @@ -52,10 +53,12 @@ bool CefSchemeRegistrarImpl::AddCustomScheme( schemes_.secure_schemes.push_back(scheme); if (is_cors_enabled) schemes_.cors_enabled_schemes.push_back(scheme); + if (is_csp_bypassing) + schemes_.csp_bypassing_schemes.push_back(scheme); CefContentClient::SchemeInfo scheme_info = { scheme, is_standard, is_local, is_display_isolated, is_secure, - is_cors_enabled + is_cors_enabled, is_csp_bypassing }; CefContentClient::Get()->AddCustomScheme(scheme_info); @@ -68,4 +71,5 @@ void CefSchemeRegistrarImpl::GetSchemes( AppendArray(schemes_.local_schemes, &schemes->local_schemes); AppendArray(schemes_.secure_schemes, &schemes->secure_schemes); AppendArray(schemes_.cors_enabled_schemes, &schemes->cors_enabled_schemes); + AppendArray(schemes_.csp_bypassing_schemes, &schemes->csp_bypassing_schemes); } diff --git a/libcef/common/scheme_registrar_impl.h b/libcef/common/scheme_registrar_impl.h index 1567df442..a78d4fb49 100644 --- a/libcef/common/scheme_registrar_impl.h +++ b/libcef/common/scheme_registrar_impl.h @@ -23,14 +23,12 @@ class CefSchemeRegistrarImpl : public CefSchemeRegistrar { bool is_local, bool is_display_isolated, bool is_secure, - bool is_cors_enabled) override; + bool is_cors_enabled, + bool is_csp_bypassing) override; void GetSchemes(content::ContentClient::Schemes* schemes); private: - // Verify that the object is being accessed from the correct thread. - bool VerifyContext(); - content::ContentClient::Schemes schemes_; std::set registered_schemes_; diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index 8a4b6fe1a..0d2341087 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -297,17 +297,17 @@ bool CefValueImpl::SetNull() { } bool CefValueImpl::SetBool(bool value) { - SetValue(new base::FundamentalValue(value)); + SetValue(new base::Value(value)); return true; } bool CefValueImpl::SetInt(int value) { - SetValue(new base::FundamentalValue(value)); + SetValue(new base::Value(value)); return true; } bool CefValueImpl::SetDouble(double value) { - SetValue(new base::FundamentalValue(value)); + SetValue(new base::Value(value)); return true; } @@ -425,7 +425,7 @@ CefRefPtr CefBinaryValue::Create(const void* data, return NULL; return new CefBinaryValueImpl(static_cast(const_cast(data)), - data_size, true); + data_size); } // static @@ -453,12 +453,9 @@ CefBinaryValueImpl::CefBinaryValueImpl(base::BinaryValue* value, } CefBinaryValueImpl::CefBinaryValueImpl(char* data, - size_t data_size, - bool copy) + size_t data_size) : CefValueBase( - copy ? base::BinaryValue::CreateWithCopiedBuffer(data, - data_size).release() : - new base::BinaryValue(std::unique_ptr(data), data_size), + new base::BinaryValue(std::vector(data, data + data_size)), NULL, kOwnerWillDelete, true, NULL) { } @@ -898,19 +895,19 @@ bool CefDictionaryValueImpl::SetNull(const CefString& key) { bool CefDictionaryValueImpl::SetBool(const CefString& key, bool value) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(key, new base::FundamentalValue(value)); + SetInternal(key, new base::Value(value)); return true; } bool CefDictionaryValueImpl::SetInt(const CefString& key, int value) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(key, new base::FundamentalValue(value)); + SetInternal(key, new base::Value(value)); return true; } bool CefDictionaryValueImpl::SetDouble(const CefString& key, double value) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(key, new base::FundamentalValue(value)); + SetInternal(key, new base::Value(value)); return true; } @@ -1301,19 +1298,19 @@ bool CefListValueImpl::SetNull(size_t index) { bool CefListValueImpl::SetBool(size_t index, bool value) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(index, new base::FundamentalValue(value)); + SetInternal(index, new base::Value(value)); return true; } bool CefListValueImpl::SetInt(size_t index, int value) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(index, new base::FundamentalValue(value)); + SetInternal(index, new base::Value(value)); return true; } bool CefListValueImpl::SetDouble(size_t index, double value) { CEF_VALUE_VERIFY_RETURN(true, false); - SetInternal(index, new base::FundamentalValue(value)); + SetInternal(index, new base::Value(value)); return true; } diff --git a/libcef/common/values_impl.h b/libcef/common/values_impl.h index 85f8bdb7d..48b68fcc8 100644 --- a/libcef/common/values_impl.h +++ b/libcef/common/values_impl.h @@ -143,11 +143,9 @@ class CefBinaryValueImpl CefBinaryValueImpl(base::BinaryValue* value, bool will_delete); - // If |copy| is false this object will take ownership of the specified |data| - // buffer instead of copying it. + // The data will always be copied. CefBinaryValueImpl(char* data, - size_t data_size, - bool copy); + size_t data_size); // Return a copy of the value. base::BinaryValue* CopyValue(); diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index 9fa58240d..2764e6653 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -187,7 +187,7 @@ CefRefPtr CefBrowserImpl::GetFrame(const CefString& name) { blink::WebView* web_view = render_view()->GetWebView(); if (web_view) { - const blink::WebString& frame_name = name.ToString16(); + const blink::WebString& frame_name = blink::WebString::fromUTF16(name); // Search by assigned frame name (Frame::name). WebFrame* frame = web_view->findFrameByName(frame_name, web_view->mainFrame()); @@ -325,7 +325,7 @@ CefRefPtr CefBrowserImpl::GetWebFrameImpl( int64_t parent_id = frame->parent() == NULL ? webkit_glue::kInvalidFrameId : webkit_glue::GetIdentifier(frame->parent()); - base::string16 name = frame->uniqueName(); + base::string16 name = frame->uniqueName().utf16(); // Notify the browser that the frame has been identified. Send(new CefHostMsg_FrameIdentified(routing_id(), frame_id, parent_id, name)); @@ -562,7 +562,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { if (is_javascript) { web_frame->executeScript( - WebScriptSource(base::UTF8ToUTF16(code), + WebScriptSource(blink::WebString::fromUTF8(code), GURL(script_url), script_start_line)); success = true; @@ -596,7 +596,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { success = true; } else if (web_frame->isWebLocalFrame() && web_frame->toWebLocalFrame()->executeCommand( - base::UTF8ToUTF16(command))) { + blink::WebString::fromUTF8(command))) { success = true; } } diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index 2a29c9d81..9570e76e1 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -151,8 +151,9 @@ void AppendParams(const std::vector& additional_names, } for (size_t i = 0; i < additional_names.size(); ++i) { - names[existing_size + i] = additional_names[i]; - values[existing_size + i] = additional_values[i]; + names[existing_size + i] = blink::WebString::fromUTF16(additional_names[i]); + values[existing_size + i] = + blink::WebString::fromUTF16(additional_values[i]); } existing_names->swap(names); diff --git a/libcef/renderer/dom_document_impl.cc b/libcef/renderer/dom_document_impl.cc index d7815d437..3b8516fcb 100644 --- a/libcef/renderer/dom_document_impl.cc +++ b/libcef/renderer/dom_document_impl.cc @@ -77,14 +77,14 @@ CefString CefDOMDocumentImpl::GetTitle() { const WebDocument& document = frame_->document(); const WebString& title = document.title(); if (!title.isNull()) - str = title; + str = title.utf16(); return str; } CefRefPtr CefDOMDocumentImpl::GetElementById(const CefString& id) { const WebDocument& document = frame_->document(); - return GetOrCreateNode(document.getElementById(base::string16(id))); + return GetOrCreateNode(document.getElementById(WebString::fromUTF16(id))); } CefRefPtr CefDOMDocumentImpl::GetFocusedNode() { @@ -140,7 +140,7 @@ CefString CefDOMDocumentImpl::GetSelectionAsMarkup() { const WebString& markup = local_frame->selectionAsMarkup(); if (!markup.isNull()) - str = markup; + str = markup.utf16(); return str; } @@ -156,7 +156,7 @@ CefString CefDOMDocumentImpl::GetSelectionAsText() { const WebString& text = local_frame->selectionAsText(); if (!text.isNull()) - str = text; + str = text.utf16(); return str; } @@ -182,7 +182,7 @@ CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL) { return str; const WebDocument& document = frame_->document(); - const WebURL& url = document.completeURL(base::string16(partialURL)); + const WebURL& url = document.completeURL(WebString::fromUTF16(partialURL)); if (!url.isNull()) { GURL gurl = url; str = gurl.spec(); diff --git a/libcef/renderer/dom_node_impl.cc b/libcef/renderer/dom_node_impl.cc index e1af86d2b..6ccba64cc 100644 --- a/libcef/renderer/dom_node_impl.cc +++ b/libcef/renderer/dom_node_impl.cc @@ -121,7 +121,8 @@ CefString CefDOMNodeImpl::GetFormControlElementType() { const WebFormControlElement& formElement = node_.toConst(); - const base::string16& form_control_type = formElement.formControlType(); + const base::string16& form_control_type = + formElement.formControlType().utf16(); str = form_control_type; } } @@ -147,7 +148,7 @@ CefString CefDOMNodeImpl::GetName() { const WebString& name = webkit_glue::GetNodeName(node_); if (!name.isNull()) - str = name; + str = name.utf16(); return str; } @@ -165,15 +166,16 @@ CefString CefDOMNodeImpl::GetValue() { node_.toConst(); base::string16 value; - const base::string16& form_control_type = formElement.formControlType(); + const base::string16& form_control_type = + formElement.formControlType().utf16(); if (form_control_type == base::ASCIIToUTF16("text")) { const WebInputElement& input_element = formElement.toConst(); - value = input_element.value(); + value = input_element.value().utf16(); } else if (form_control_type == base::ASCIIToUTF16("select-one")) { const WebSelectElement& select_element = formElement.toConst(); - value = select_element.value(); + value = select_element.value().utf16(); } base::TrimWhitespace(value, base::TRIM_LEADING, &value); @@ -184,7 +186,7 @@ CefString CefDOMNodeImpl::GetValue() { if (str.empty()) { const WebString& value = node_.nodeValue(); if (!value.isNull()) - str = value; + str = value.utf16(); } return str; @@ -197,7 +199,7 @@ bool CefDOMNodeImpl::SetValue(const CefString& value) { if (node_.isElementNode()) return false; - return webkit_glue::SetNodeValue(node_, base::string16(value)); + return webkit_glue::SetNodeValue(node_, WebString::fromUTF16(value)); } CefString CefDOMNodeImpl::GetAsMarkup() { @@ -207,7 +209,7 @@ CefString CefDOMNodeImpl::GetAsMarkup() { const WebString& markup = webkit_glue::CreateNodeMarkup(node_); if (!markup.isNull()) - str = markup; + str = markup.utf16(); return str; } @@ -274,7 +276,7 @@ CefString CefDOMNodeImpl::GetElementTagName() { const WebElement& element = node_.toConst(); const WebString& tagname = element.tagName(); if (!tagname.isNull()) - str = tagname; + str = tagname.utf16(); return str; } @@ -302,7 +304,7 @@ bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) { } const WebElement& element = node_.toConst(); - return element.hasAttribute(base::string16(attrName)); + return element.hasAttribute(WebString::fromUTF16(attrName)); } CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) { @@ -316,9 +318,9 @@ CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) { } const WebElement& element = node_.toConst(); - const WebString& attr = element.getAttribute(base::string16(attrName)); + const WebString& attr = element.getAttribute(WebString::fromUTF16(attrName)); if (!attr.isNull()) - str = attr; + str = attr.utf16(); return str; } @@ -338,8 +340,8 @@ void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap) { return; for (unsigned int i = 0; i < len; ++i) { - base::string16 name = element.attributeLocalName(i); - base::string16 value = element.attributeValue(i); + base::string16 name = element.attributeLocalName(i).utf16(); + base::string16 value = element.attributeValue(i).utf16(); attrMap.insert(std::make_pair(name, value)); } } @@ -355,8 +357,8 @@ bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName, } WebElement element = node_.to(); - element.setAttribute(base::string16(attrName), - base::string16(value)); + element.setAttribute(WebString::fromUTF16(attrName), + WebString::fromUTF16(value)); return true; } @@ -373,7 +375,7 @@ CefString CefDOMNodeImpl::GetElementInnerText() { WebElement element = node_.to(); const WebString& text = element.textContent(); if (!text.isNull()) - str = text; + str = text.utf16(); return str; } diff --git a/libcef/renderer/frame_impl.cc b/libcef/renderer/frame_impl.cc index 694c0419a..b79fda8d2 100644 --- a/libcef/renderer/frame_impl.cc +++ b/libcef/renderer/frame_impl.cc @@ -168,7 +168,8 @@ void CefFrameImpl::ExecuteJavaScript(const CefString& jsCode, if (frame_) { GURL gurl = GURL(scriptUrl.ToString()); frame_->executeScript( - blink::WebScriptSource(jsCode.ToString16(), gurl, startLine)); + blink::WebScriptSource(WebString::fromUTF16(jsCode.ToString16()), gurl, + startLine)); } } @@ -193,7 +194,7 @@ CefString CefFrameImpl::GetName() { CEF_REQUIRE_RT_RETURN(name); if (frame_) - name = frame_->uniqueName(); + name = frame_->uniqueName().utf16(); return name; } diff --git a/libcef/renderer/media/cef_key_systems.cc b/libcef/renderer/media/cef_key_systems.cc index 9c420fa20..c87959d25 100644 --- a/libcef/renderer/media/cef_key_systems.cc +++ b/libcef/renderer/media/cef_key_systems.cc @@ -16,6 +16,7 @@ #include "libcef/common/cef_messages.h" #include "media/base/eme_constants.h" #include "media/base/key_system_properties.h" +#include "media/media_features.h" #include "ppapi/features/features.h" #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. @@ -107,21 +108,21 @@ void AddPepperBasedWidevine( // as those may offer a higher level of protection. supported_codecs |= media::EME_CODEC_WEBM_OPUS; supported_codecs |= media::EME_CODEC_WEBM_VORBIS; -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) supported_codecs |= media::EME_CODEC_MP4_AAC; -#endif // defined(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) for (size_t i = 0; i < codecs.size(); ++i) { if (codecs[i] == kCdmSupportedCodecVp8) supported_codecs |= media::EME_CODEC_WEBM_VP8; if (codecs[i] == kCdmSupportedCodecVp9) supported_codecs |= media::EME_CODEC_WEBM_VP9; -#if defined(USE_PROPRIETARY_CODECS) +#if BUILDFLAG(USE_PROPRIETARY_CODECS) if (codecs[i] == kCdmSupportedCodecAvc1) supported_codecs |= media::EME_CODEC_MP4_AVC1; if (codecs[i] == kCdmSupportedCodecVp9) supported_codecs |= media::EME_CODEC_MP4_VP9; -#endif // defined(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) } using Robustness = cdm::WidevineKeySystemProperties::Robustness; diff --git a/libcef/renderer/plugins/cef_plugin_placeholder.cc b/libcef/renderer/plugins/cef_plugin_placeholder.cc index 8dc7b2ce1..eb1b5e15c 100644 --- a/libcef/renderer/plugins/cef_plugin_placeholder.cc +++ b/libcef/renderer/plugins/cef_plugin_placeholder.cc @@ -87,7 +87,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateLoadableMissingPlugin( // Will destroy itself when its WebViewPlugin is going away. return new CefPluginPlaceholder(render_frame, frame, params, html_data, - params.mimeType); + params.mimeType.utf16()); } // static diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index 32c4d6d86..3b9a31886 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -1116,8 +1116,8 @@ bool CefV8ContextImpl::Eval(const CefString& code, v8::Local context = GetV8Context(); v8::Context::Scope context_scope(context); - const blink::WebString& source = code.ToString16(); - const blink::WebString& source_url = script_url.ToString16(); + const blink::WebString& source = blink::WebString::fromUTF16(code); + const blink::WebString& source_url = blink::WebString::fromUTF16(script_url); v8::TryCatch try_catch(isolate); try_catch.SetVerbose(true); diff --git a/libcef/renderer/webkit_glue.cc b/libcef/renderer/webkit_glue.cc index 7b325c7df..cb03e6be4 100644 --- a/libcef/renderer/webkit_glue.cc +++ b/libcef/renderer/webkit_glue.cc @@ -179,7 +179,7 @@ v8::MaybeLocal CallV8Function(v8::Local context, toLocalFrame(blink::toFrameIfNotDetached(context)); DCHECK(frame); if (frame && - frame->script().canExecuteScripts(blink::AboutToExecuteScript)) { + frame->document()->canExecuteScripts(blink::AboutToExecuteScript)) { func_rv = blink::V8ScriptRunner::callFunction( function, frame->document(), receiver, argc, args, isolate); } diff --git a/libcef/renderer/webkit_glue.h b/libcef/renderer/webkit_glue.h index 8dcb4f0fb..2c20a7632 100644 --- a/libcef/renderer/webkit_glue.h +++ b/libcef/renderer/webkit_glue.h @@ -11,7 +11,7 @@ #include #include "include/internal/cef_types.h" -#include "third_party/WebKit/Source/core/fetch/AccessControlStatus.h" +#include "third_party/WebKit/Source/platform/loader/fetch/AccessControlStatus.h" #include "v8/include/v8.h" namespace blink { diff --git a/libcef/resources/cef_strings.grd b/libcef/resources/cef_strings.grd index 22e0e280f..3bd509cfe 100644 --- a/libcef/resources/cef_strings.grd +++ b/libcef/resources/cef_strings.grd @@ -115,6 +115,9 @@ need to be translated for each locale.--> Text Files + + &No spelling suggestions + diff --git a/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc b/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc index 95f68042c..465c62dec 100644 --- a/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc +++ b/libcef_dll/cpptoc/scheme_registrar_cpptoc.cc @@ -20,7 +20,7 @@ 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_secure, - int is_cors_enabled) { + int is_cors_enabled, int is_csp_bypassing) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING DCHECK(self); @@ -38,7 +38,8 @@ int CEF_CALLBACK scheme_registrar_add_custom_scheme( is_local?true:false, is_display_isolated?true:false, is_secure?true:false, - is_cors_enabled?true:false); + is_cors_enabled?true:false, + is_csp_bypassing?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 860a0c165..ed9fd9c9d 100644 --- a/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc +++ b/libcef_dll/ctocpp/scheme_registrar_ctocpp.cc @@ -17,7 +17,7 @@ bool CefSchemeRegistrarCToCpp::AddCustomScheme(const CefString& scheme_name, bool is_standard, bool is_local, bool is_display_isolated, bool is_secure, - bool is_cors_enabled) { + bool is_cors_enabled, bool is_csp_bypassing) { cef_scheme_registrar_t* _struct = GetStruct(); if (CEF_MEMBER_MISSING(_struct, add_custom_scheme)) return false; @@ -36,7 +36,8 @@ bool CefSchemeRegistrarCToCpp::AddCustomScheme(const CefString& scheme_name, is_local, is_display_isolated, is_secure, - is_cors_enabled); + is_cors_enabled, + is_csp_bypassing); // 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 70cea5431..c73725fec 100644 --- a/libcef_dll/ctocpp/scheme_registrar_ctocpp.h +++ b/libcef_dll/ctocpp/scheme_registrar_ctocpp.h @@ -33,7 +33,7 @@ class CefSchemeRegistrarCToCpp // CefSchemeRegistrar methods. bool AddCustomScheme(const CefString& scheme_name, bool is_standard, bool is_local, bool is_display_isolated, bool is_secure, - bool is_cors_enabled) OVERRIDE; + bool is_cors_enabled, bool is_csp_bypassing) OVERRIDE; }; #endif // CEF_LIBCEF_DLL_CTOCPP_SCHEME_REGISTRAR_CTOCPP_H_ diff --git a/patch/patch.cfg b/patch/patch.cfg index 042ef2ce8..a9e57b12f 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -327,4 +327,11 @@ patches = [ 'name': 'views_menu_2102', 'path': '../', }, + { + # Expose RFH via NavigationHandle for retrieval in DidFinishNavigation on + # network error. + # https://groups.google.com/a/chromium.org/d/msg/chromium-dev/6iAQPx_hwh8/gaTR5f1GAQAJ + 'name': 'navigation_handle', + 'path': '../', + }, ] diff --git a/patch/patches/browser_compositor_mac.patch b/patch/patches/browser_compositor_mac.patch index a33e6bc61..bfd780c34 100644 --- a/patch/patches/browser_compositor_mac.patch +++ b/patch/patches/browser_compositor_mac.patch @@ -1,8 +1,8 @@ diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h -index 865b29f..ef44e27 100644 +index d0ecb71..84c20b4 100644 --- content/browser/renderer_host/browser_compositor_view_mac.h +++ content/browser/renderer_host/browser_compositor_view_mac.h -@@ -55,9 +55,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver, +@@ -56,9 +56,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver, // These will not return nullptr until Destroy is called. DelegatedFrameHost* GetDelegatedFrameHost(); @@ -15,7 +15,7 @@ index 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 bd36336..9123781 100644 +index e4c25e73..e2f789e 100644 --- content/browser/renderer_host/browser_compositor_view_mac.mm +++ content/browser/renderer_host/browser_compositor_view_mac.mm @@ -201,6 +201,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { diff --git a/patch/patches/browser_frame_host_guest_1687.patch b/patch/patches/browser_frame_host_guest_1687.patch index 40c1877e6..af5a8a8e0 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 abb76e3..cdf5a84d 100644 +index 2197f73a..ab100b6 100644 --- render_widget_host_view_guest.cc +++ render_widget_host_view_guest.cc -@@ -254,13 +254,14 @@ void RenderWidgetHostViewGuest::Destroy() { +@@ -247,13 +247,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 47796fb46..52fb636f4 100644 --- a/patch/patches/browser_plugin_guest_1565.patch +++ b/patch/patches/browser_plugin_guest_1565.patch @@ -1,8 +1,8 @@ diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc -index 97ea047..8a4e4d4 100644 +index 7b85e54..5afa575 100644 --- content/browser/browser_plugin/browser_plugin_guest.cc +++ content/browser/browser_plugin/browser_plugin_guest.cc -@@ -316,14 +316,20 @@ void BrowserPluginGuest::InitInternal( +@@ -318,14 +318,20 @@ void BrowserPluginGuest::InitInternal( static_cast(GetWebContents()->GetView()); } @@ -25,7 +25,7 @@ index 97ea047..8a4e4d4 100644 } RendererPreferences* renderer_prefs = -@@ -791,7 +797,8 @@ void BrowserPluginGuest::OnWillAttachComplete( +@@ -800,7 +806,8 @@ void BrowserPluginGuest::OnWillAttachComplete( static_cast(GetWebContents()->GetView()); if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { web_contents_view->CreateViewForWidget( @@ -36,18 +36,18 @@ index 97ea047..8a4e4d4 100644 } diff --git content/browser/frame_host/interstitial_page_impl.cc content/browser/frame_host/interstitial_page_impl.cc -index 66aab6f..1305f14 100644 +index 1a04a52..4cfe9aa 100644 --- content/browser/frame_host/interstitial_page_impl.cc +++ content/browser/frame_host/interstitial_page_impl.cc -@@ -589,7 +589,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { +@@ -594,7 +594,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { WebContentsView* wcv = static_cast(web_contents())->GetView(); RenderWidgetHostViewBase* view = - wcv->CreateViewForWidget(render_view_host_->GetWidget(), false); + wcv->CreateViewForWidget(render_view_host_->GetWidget(), nullptr); RenderWidgetHostImpl::From(render_view_host_->GetWidget())->SetView(view); - render_view_host_->AllowBindings(BINDINGS_POLICY_DOM_AUTOMATION); - + render_view_host_->GetMainFrame()->AllowBindings( + BINDINGS_POLICY_DOM_AUTOMATION); diff --git content/browser/web_contents/web_contents_view.h content/browser/web_contents/web_contents_view.h index e4401f8..f2fdb9b 100644 --- content/browser/web_contents/web_contents_view.h @@ -69,10 +69,10 @@ index e4401f8..f2fdb9b 100644 // Creates a new View that holds a popup and receives messages for it. virtual RenderWidgetHostViewBase* CreateViewForPopupWidget( diff --git content/browser/web_contents/web_contents_view_aura.cc content/browser/web_contents/web_contents_view_aura.cc -index ab62938..d1aeb67 100644 +index 1bfef2c..7555040 100644 --- content/browser/web_contents/web_contents_view_aura.cc +++ content/browser/web_contents/web_contents_view_aura.cc -@@ -823,7 +823,8 @@ void WebContentsViewAura::CreateView( +@@ -843,7 +843,8 @@ void WebContentsViewAura::CreateView( } RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( @@ -82,21 +82,19 @@ index ab62938..d1aeb67 100644 if (render_widget_host->GetView()) { // During testing, the view will already be set up in most cases to the // test view, so we don't want to clobber it with a real one. To verify that -@@ -836,7 +837,8 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( +@@ -855,6 +856,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( + render_widget_host->GetView()); } ++ const bool is_guest_view_hack = !!embedder_render_widget_host; RenderWidgetHostViewAura* view = -- new RenderWidgetHostViewAura(render_widget_host, is_guest_view_hack); -+ new RenderWidgetHostViewAura(render_widget_host, -+ !!embedder_render_widget_host); - view->InitAsChild(GetRenderWidgetHostViewParent()); - - RenderWidgetHostImpl* host_impl = + g_create_render_widget_host_view + ? g_create_render_widget_host_view(render_widget_host, diff --git content/browser/web_contents/web_contents_view_aura.h content/browser/web_contents/web_contents_view_aura.h -index 2e7beab..a62b593 100644 +index ed3641c..f8816357 100644 --- content/browser/web_contents/web_contents_view_aura.h +++ content/browser/web_contents/web_contents_view_aura.h -@@ -110,7 +110,7 @@ class CONTENT_EXPORT WebContentsViewAura +@@ -117,7 +117,7 @@ class CONTENT_EXPORT WebContentsViewAura gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -106,10 +104,10 @@ index 2e7beab..a62b593 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_child_frame.cc content/browser/web_contents/web_contents_view_child_frame.cc -index 17d39e9..f591959 100644 +index 74a587a..9f02836 100644 --- content/browser/web_contents/web_contents_view_child_frame.cc +++ content/browser/web_contents/web_contents_view_child_frame.cc -@@ -93,7 +93,7 @@ void WebContentsViewChildFrame::CreateView(const gfx::Size& initial_size, +@@ -94,7 +94,7 @@ void WebContentsViewChildFrame::CreateView(const gfx::Size& initial_size, RenderWidgetHostViewBase* WebContentsViewChildFrame::CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -132,7 +130,7 @@ index 86ce68b..fd21e5a 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_guest.cc content/browser/web_contents/web_contents_view_guest.cc -index b2b86fa..00c9126 100644 +index a93bc37..18fed2e 100644 --- content/browser/web_contents/web_contents_view_guest.cc +++ content/browser/web_contents/web_contents_view_guest.cc @@ -72,6 +72,8 @@ void WebContentsViewGuest::GetScreenInfo(ScreenInfo* screen_info) const { @@ -153,7 +151,7 @@ index b2b86fa..00c9126 100644 old_parent_view->GetNativeView()->RemoveChild( platform_view_->GetNativeView()); #endif // defined(USE_AURA) -@@ -133,7 +137,8 @@ void WebContentsViewGuest::CreateView(const gfx::Size& initial_size, +@@ -134,7 +138,8 @@ void WebContentsViewGuest::CreateView(const gfx::Size& initial_size, } RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( @@ -163,7 +161,7 @@ index b2b86fa..00c9126 100644 if (render_widget_host->GetView()) { // During testing, the view will already be set up in most cases to the // test view, so we don't want to clobber it with a real one. To verify that -@@ -145,11 +150,19 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( +@@ -146,11 +151,19 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( render_widget_host->GetView()); } @@ -200,10 +198,10 @@ index 0102d7e..b89d66c 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_mac.h content/browser/web_contents/web_contents_view_mac.h -index 3b34cbd..a22e22e 100644 +index 4141b7f..921bc79 100644 --- content/browser/web_contents/web_contents_view_mac.h +++ content/browser/web_contents/web_contents_view_mac.h -@@ -89,7 +89,7 @@ class WebContentsViewMac : public WebContentsView, +@@ -90,7 +90,7 @@ class WebContentsViewMac : public WebContentsView, gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -213,10 +211,10 @@ index 3b34cbd..a22e22e 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_mac.mm content/browser/web_contents/web_contents_view_mac.mm -index 1d01ac8..36f2dce 100644 +index b236639..167f973 100644 --- content/browser/web_contents/web_contents_view_mac.mm +++ content/browser/web_contents/web_contents_view_mac.mm -@@ -338,7 +338,8 @@ void WebContentsViewMac::CreateView( +@@ -348,7 +348,8 @@ void WebContentsViewMac::CreateView( } RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( @@ -226,15 +224,14 @@ index 1d01ac8..36f2dce 100644 if (render_widget_host->GetView()) { // During testing, the view will already be set up in most cases to the // test view, so we don't want to clobber it with a real one. To verify that -@@ -351,7 +352,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( +@@ -360,6 +361,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( + render_widget_host->GetView()); } - RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac( -- render_widget_host, is_guest_view_hack); -+ render_widget_host, !!embedder_render_widget_host); - if (delegate()) { - base::scoped_nsobject > - rw_delegate( ++ const bool is_guest_view_hack = !!embedder_render_widget_host; + RenderWidgetHostViewMac* view = + g_create_render_widget_host_view + ? g_create_render_widget_host_view(render_widget_host, diff --git content/public/browser/browser_plugin_guest_delegate.h content/public/browser/browser_plugin_guest_delegate.h index a32205c..49f3c35 100644 --- content/public/browser/browser_plugin_guest_delegate.h diff --git a/patch/patches/chrome_widevine.patch b/patch/patches/chrome_widevine.patch index 8d0de2058..0cc6c50c9 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 4255c1b..f4b197c 100644 +index 91acb7d..d4f57cd 100644 --- chrome/common/chrome_content_client.cc +++ chrome/common/chrome_content_client.cc -@@ -80,7 +80,7 @@ +@@ -81,7 +81,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 486dc38de..cbafbfdb7 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 072d500..c2cc813 100644 +index 50a66bb..4daaadf 100644 --- content/browser/compositor/gpu_process_transport_factory.cc +++ content/browser/compositor/gpu_process_transport_factory.cc -@@ -199,6 +199,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { +@@ -220,6 +220,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { std::unique_ptr GpuProcessTransportFactory::CreateSoftwareOutputDevice( ui::Compositor* compositor) { @@ -17,7 +17,7 @@ index 072d500..c2cc813 100644 if (command_line->HasSwitch(switches::kHeadless)) return base::WrapUnique(new cc::SoftwareOutputDevice); diff --git ui/compositor/compositor.h ui/compositor/compositor.h -index 7ecc5e5..e77f545 100644 +index 92696ad..50aa222 100644 --- ui/compositor/compositor.h +++ ui/compositor/compositor.h @@ -18,6 +18,7 @@ @@ -28,7 +28,7 @@ index 7ecc5e5..e77f545 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" -@@ -194,6 +195,17 @@ class COMPOSITOR_EXPORT CompositorLock +@@ -190,6 +191,17 @@ class COMPOSITOR_EXPORT CompositorLock DISALLOW_COPY_AND_ASSIGN(CompositorLock); }; @@ -46,7 +46,7 @@ index 7ecc5e5..e77f545 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 -@@ -223,6 +235,9 @@ class COMPOSITOR_EXPORT Compositor +@@ -219,6 +231,9 @@ class COMPOSITOR_EXPORT Compositor // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -56,7 +56,7 @@ index 7ecc5e5..e77f545 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 -@@ -406,6 +421,8 @@ class COMPOSITOR_EXPORT Compositor +@@ -398,6 +413,8 @@ class COMPOSITOR_EXPORT Compositor ui::ContextFactory* context_factory_; ui::ContextFactoryPrivate* context_factory_private_; diff --git a/patch/patches/content_nav_1129.patch b/patch/patches/content_nav_1129.patch index 1f6a05d06..04330e1df 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 cc1d049a..8490e65 100644 +index 3cab7f9..98a151f 100644 --- public/renderer/content_renderer_client.cc +++ public/renderer/content_renderer_client.cc -@@ -99,7 +99,6 @@ bool ContentRendererClient::AllowPopup() { +@@ -97,7 +97,6 @@ bool ContentRendererClient::AllowPopup() { return false; } @@ -10,7 +10,7 @@ index cc1d049a..8490e65 100644 bool ContentRendererClient::HandleNavigation( RenderFrame* render_frame, bool is_content_initiated, -@@ -112,6 +111,7 @@ bool ContentRendererClient::HandleNavigation( +@@ -110,6 +109,7 @@ bool ContentRendererClient::HandleNavigation( return false; } @@ -19,10 +19,10 @@ index cc1d049a..8490e65 100644 return false; } diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h -index 9895206..1f4626d 100644 +index 0764782..6a12636 100644 --- public/renderer/content_renderer_client.h +++ public/renderer/content_renderer_client.h -@@ -198,7 +198,6 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -197,7 +197,6 @@ class CONTENT_EXPORT ContentRendererClient { // Returns true if a popup window should be allowed. virtual bool AllowPopup(); @@ -30,7 +30,7 @@ index 9895206..1f4626d 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 -@@ -214,6 +213,7 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -213,6 +212,7 @@ class CONTENT_EXPORT ContentRendererClient { blink::WebNavigationPolicy default_policy, bool is_redirect); diff --git a/patch/patches/crashpad_1995.patch b/patch/patches/crashpad_1995.patch index a74d0b705..4bcea0d54 100644 --- a/patch/patches/crashpad_1995.patch +++ b/patch/patches/crashpad_1995.patch @@ -1,5 +1,5 @@ diff --git build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn -index 6cd8b9f..dfbbdc6 100644 +index d2ce8b9..e4fc7c6 100644 --- build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn +++ build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn @@ -2,6 +2,8 @@ @@ -31,7 +31,7 @@ index 6cd8b9f..dfbbdc6 100644 cflags = [ "/wd4201" ] } diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc -index c099a26..6fae782 100644 +index 4750471..a341ac0 100644 --- chrome/common/crash_keys.cc +++ chrome/common/crash_keys.cc @@ -4,6 +4,8 @@ @@ -43,7 +43,7 @@ index c099a26..6fae782 100644 #include "base/base_switches.h" #include "base/command_line.h" #include "base/format_macros.h" -@@ -101,7 +103,7 @@ const char kViewCount[] = "view-count"; +@@ -96,7 +98,7 @@ const char kViewCount[] = "view-count"; const char kZeroEncodeDetails[] = "zero-encode-details"; @@ -52,7 +52,7 @@ index c099a26..6fae782 100644 // The following keys may be chunked by the underlying crash logging system, // but ultimately constitute a single key-value pair. // -@@ -259,10 +261,16 @@ size_t RegisterChromeCrashKeys() { +@@ -252,10 +254,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 c099a26..6fae782 100644 // Register the extension IDs. { -@@ -296,7 +304,7 @@ size_t RegisterChromeCrashKeys() { +@@ -289,7 +297,7 @@ size_t RegisterChromeCrashKeys() { return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength); } @@ -80,7 +80,7 @@ index c099a26..6fae782 100644 static const char* const kIgnoreSwitches[] = { switches::kEnableLogging, switches::kFlagSwitchesBegin, -@@ -352,7 +360,7 @@ static bool IsBoringSwitch(const std::string& flag) { +@@ -345,7 +353,7 @@ static bool IsBoringSwitch(const std::string& flag) { } void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { @@ -90,10 +90,10 @@ index c099a26..6fae782 100644 void SetActiveExtensions(const std::set& extensions) { diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h -index 2b6106c..cfe4548 100644 +index e7c9bc3..c97f667 100644 --- chrome/common/crash_keys.h +++ chrome/common/crash_keys.h -@@ -23,10 +23,18 @@ class CommandLine; +@@ -22,10 +22,18 @@ class CommandLine; namespace crash_keys { @@ -113,7 +113,7 @@ index 2b6106c..cfe4548 100644 // on the given |command_line|. void SetCrashKeysFromCommandLine(const base::CommandLine& command_line); diff --git chrome_elf/BUILD.gn chrome_elf/BUILD.gn -index c2861e0..7d6de6b 100644 +index 53a29c8..9d0ee4c 100644 --- chrome_elf/BUILD.gn +++ chrome_elf/BUILD.gn @@ -7,6 +7,7 @@ @@ -124,7 +124,7 @@ index c2861e0..7d6de6b 100644 import("//chrome/process_version_rc_template.gni") import("//testing/test.gni") -@@ -139,16 +140,40 @@ static_library("blacklist") { +@@ -136,16 +137,40 @@ static_library("blacklist") { static_library("crash") { sources = [ @@ -203,7 +203,7 @@ index c658fa9..8c4a145 100644 g_crash_helper_enabled = true; return true; diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc -index 6e5058e..f2309ad 100644 +index 3c31d76..26a2602 100644 --- components/crash/content/app/breakpad_linux.cc +++ components/crash/content/app/breakpad_linux.cc @@ -29,6 +29,7 @@ @@ -222,7 +222,7 @@ index 6e5058e..f2309ad 100644 #endif bool g_is_crash_reporter_enabled = false; -@@ -686,7 +688,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, +@@ -685,7 +687,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, info.process_type_length = 7; info.distro = base::g_linux_distro; info.distro_length = my_strlen(base::g_linux_distro); @@ -231,7 +231,7 @@ index 6e5058e..f2309ad 100644 info.process_start_time = g_process_start_time; info.oom_size = base::g_oom_size; info.pid = g_pid; -@@ -1299,7 +1301,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, +@@ -1341,7 +1343,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, header_content_encoding, header_content_type, post_file, @@ -239,8 +239,8 @@ index 6e5058e..f2309ad 100644 + g_crash_server_url, "--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 -@@ -1612,10 +1614,19 @@ void HandleCrashDump(const BreakpadInfo& info) { + "-O", // Output reply to the file descriptor path. +@@ -1680,10 +1682,19 @@ void HandleCrashDump(const BreakpadInfo& info) { GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version); writer.AddBoundary(); @@ -262,7 +262,7 @@ index 6e5058e..f2309ad 100644 if (info.pid > 0) { char pid_value_buf[kUint64StringSize]; uint64_t pid_value_len = my_uint64_len(info.pid); -@@ -1906,6 +1917,17 @@ void InitCrashReporter(const std::string& process_type) { +@@ -1977,6 +1988,17 @@ void InitCrashReporter(const std::string& process_type) { PostEnableBreakpadInitialization(); } @@ -279,9 +279,9 @@ index 6e5058e..f2309ad 100644 + #if defined(OS_ANDROID) void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) { - const base::CommandLine* command_line = + SanitizationInfo sanitization_info; diff --git components/crash/content/app/breakpad_linux.h components/crash/content/app/breakpad_linux.h -index bbeb208..74440a0 100644 +index 3ef4e8a..d0a4b12 100644 --- components/crash/content/app/breakpad_linux.h +++ components/crash/content/app/breakpad_linux.h @@ -16,6 +16,9 @@ namespace breakpad { @@ -292,10 +292,10 @@ index bbeb208..74440a0 100644 +void SetCrashServerURL(const std::string& url); + #if defined(OS_ANDROID) - - const char kWebViewSingleProcessType[] = "webview"; + struct SanitizationInfo { + bool should_sanitize_dumps = false; diff --git components/crash/content/app/crash_reporter_client.cc components/crash/content/app/crash_reporter_client.cc -index 3dfbd99..cb9344b 100644 +index fd88348..cbb9533 100644 --- components/crash/content/app/crash_reporter_client.cc +++ components/crash/content/app/crash_reporter_client.cc @@ -88,11 +88,12 @@ int CrashReporterClient::GetResultCodeRespawnFailed() { @@ -364,7 +364,7 @@ index 3dfbd99..cb9344b 100644 - } // namespace crash_reporter diff --git components/crash/content/app/crash_reporter_client.h components/crash/content/app/crash_reporter_client.h -index 25ae505..f563761 100644 +index 513727c..aef4590 100644 --- components/crash/content/app/crash_reporter_client.h +++ components/crash/content/app/crash_reporter_client.h @@ -8,6 +8,7 @@ @@ -455,7 +455,7 @@ index 7df66ea..4ee709a 100644 #include "third_party/crashpad/crashpad/client/crash_report_database.h" #include "third_party/crashpad/crashpad/client/crashpad_client.h" #include "third_party/crashpad/crashpad/client/crashpad_info.h" -@@ -40,9 +43,10 @@ +@@ -40,9 +43,10 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, if (initial_client) { @autoreleasepool { @@ -469,7 +469,7 @@ index 7df66ea..4ee709a 100644 // Is there a way to recover if this fails? CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); -@@ -54,16 +58,27 @@ +@@ -54,16 +58,27 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, // crash server won't have symbols for any other build types. std::string url = "https://clients2.google.com/cr/report"; #else @@ -502,7 +502,7 @@ index 7df66ea..4ee709a 100644 #if defined(GOOGLE_CHROME_BUILD) NSString* channel = base::mac::ObjCCast( -@@ -73,12 +88,16 @@ +@@ -73,12 +88,16 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, } #endif @@ -524,7 +524,7 @@ index 7df66ea..4ee709a 100644 std::vector arguments; if (!browser_process) { -@@ -90,6 +109,12 @@ +@@ -90,6 +109,12 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, "--reset-own-crash-exception-port-to-system-default"); } @@ -538,7 +538,7 @@ index 7df66ea..4ee709a 100644 bool result = crashpad_client.StartHandler(handler_path, database_path, diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc -index 1e9c06c..92ad937 100644 +index 3ad5f8d..77a0fe6 100644 --- components/crash/content/app/crashpad_win.cc +++ components/crash/content/app/crashpad_win.cc @@ -41,15 +41,15 @@ void GetPlatformCrashpadAnnotations( @@ -570,7 +570,7 @@ index 1e9c06c..92ad937 100644 #endif // Allow the crash server to be overridden for testing. If the variable -@@ -103,21 +103,25 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, +@@ -101,21 +101,25 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, crashpad::TriState::kEnabled, kIndirectMemoryLimit); } @@ -602,10 +602,10 @@ index 1e9c06c..92ad937 100644 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 c404067..4938dfd6 100644 +index c693078..e58465b 100644 --- content/browser/frame_host/debug_urls.cc +++ content/browser/frame_host/debug_urls.cc -@@ -190,7 +190,9 @@ bool HandleDebugURL(const GURL& url, ui::PageTransition transition) { +@@ -139,7 +139,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 742b9d7ad..44e434a8d 100644 --- a/patch/patches/crashpad_tp_1995.patch +++ b/patch/patches/crashpad_tp_1995.patch @@ -146,10 +146,10 @@ index b64f74f..0c3c22e 100644 struct Data; diff --git crashpad/handler/crash_report_upload_thread.h crashpad/handler/crash_report_upload_thread.h -index a9601d1..9517730 100644 +index 14debac..c25c653 100644 --- crashpad/handler/crash_report_upload_thread.h +++ crashpad/handler/crash_report_upload_thread.h -@@ -76,7 +76,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { +@@ -78,7 +78,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { //! This method may be called from any thread. void ReportPending(); @@ -158,7 +158,7 @@ index a9601d1..9517730 100644 //! \brief The result code from UploadReport(). enum class UploadResult { //! \brief The crash report was uploaded successfully. -@@ -99,7 +99,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { +@@ -101,7 +101,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { //! \brief Obtains all pending reports from the database, and calls //! ProcessPendingReport() to process each one. @@ -167,7 +167,7 @@ index a9601d1..9517730 100644 //! \brief Processes a single pending report from the database. //! -@@ -113,7 +113,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { +@@ -115,7 +115,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { //! remain in the “pending” state. If the upload fails and no more retries are //! desired, or report upload is disabled, it will be marked as “completed” in //! the database without ever having been uploaded. @@ -177,10 +177,10 @@ index a9601d1..9517730 100644 //! \brief Attempts to upload a crash report. //! diff --git crashpad/handler/handler_main.cc crashpad/handler/handler_main.cc -index 3ada8c3..ffaae42 100644 +index 5006cf6..26b3b6a 100644 --- crashpad/handler/handler_main.cc +++ crashpad/handler/handler_main.cc -@@ -29,8 +29,10 @@ +@@ -33,8 +33,10 @@ #include "base/logging.h" #include "base/metrics/persistent_histogram_allocator.h" #include "base/scoped_generic.h" @@ -191,8 +191,8 @@ index 3ada8c3..ffaae42 100644 #include "client/crash_report_database.h" #include "client/crashpad_client.h" #include "client/prune_crash_reports.h" -@@ -62,6 +64,10 @@ - #include "util/win/initial_client_data.h" +@@ -69,6 +71,10 @@ + #include "util/win/session_end_watcher.h" #endif // OS_MACOSX +#if BUILDFLAG(ENABLE_CEF) @@ -202,7 +202,7 @@ index 3ada8c3..ffaae42 100644 namespace crashpad { namespace { -@@ -175,6 +181,9 @@ int HandlerMain(int argc, char* argv[]) { +@@ -403,6 +409,9 @@ int HandlerMain(int argc, char* argv[]) { kOptionPipeName, #endif // OS_MACOSX kOptionURL, @@ -212,10 +212,10 @@ index 3ada8c3..ffaae42 100644 // Standard options. kOptionHelp = -2, -@@ -195,11 +204,17 @@ int HandlerMain(int argc, char* argv[]) { - InitialClientData initial_client_data; +@@ -424,12 +433,18 @@ int HandlerMain(int argc, char* argv[]) { #endif // OS_MACOSX bool rate_limit; + bool upload_gzip; + int max_uploads; + int max_database_size; + int max_database_age; @@ -224,13 +224,14 @@ index 3ada8c3..ffaae42 100644 options.handshake_fd = -1; #endif options.rate_limit = true; + options.upload_gzip = true; + options.max_uploads = 0; + options.max_database_size = 0; + options.max_database_age = 0; const option long_options[] = { {"annotation", required_argument, nullptr, kOptionAnnotation}, -@@ -229,6 +244,9 @@ int HandlerMain(int argc, char* argv[]) { +@@ -460,6 +475,9 @@ int HandlerMain(int argc, char* argv[]) { {"url", required_argument, nullptr, kOptionURL}, {"help", no_argument, nullptr, kOptionHelp}, {"version", no_argument, nullptr, kOptionVersion}, @@ -240,7 +241,7 @@ index 3ada8c3..ffaae42 100644 {nullptr, 0, nullptr, 0}, }; -@@ -300,6 +318,27 @@ int HandlerMain(int argc, char* argv[]) { +@@ -535,6 +553,27 @@ int HandlerMain(int argc, char* argv[]) { options.url = optarg; break; } @@ -267,17 +268,18 @@ index 3ada8c3..ffaae42 100644 + } case kOptionHelp: { Usage(me); - return EXIT_SUCCESS; -@@ -432,12 +471,18 @@ int HandlerMain(int argc, char* argv[]) { + MetricsRecordExit(Metrics::LifetimeMilestone::kExitedEarly); +@@ -672,12 +711,19 @@ 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. +#if BUILDFLAG(ENABLE_CEF) + CefCrashReportUploadThread upload_thread( -+ database.get(), options.url, options.rate_limit, options.max_uploads); ++ database.get(), options.url, options.rate_limit, options.upload_gzip, ++ options.max_uploads); +#else CrashReportUploadThread upload_thread( - database.get(), options.url, options.rate_limit); + database.get(), options.url, options.rate_limit, options.upload_gzip); +#endif upload_thread.Start(); @@ -289,10 +291,10 @@ index 3ada8c3..ffaae42 100644 CrashReportExceptionHandler exception_handler( diff --git crashpad/util/net/http_transport_win.cc crashpad/util/net/http_transport_win.cc -index 58ecc47..8c1c16d 100644 +index 294048a..e87e47e 100644 --- crashpad/util/net/http_transport_win.cc +++ crashpad/util/net/http_transport_win.cc -@@ -143,7 +143,7 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) { +@@ -146,7 +146,7 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) { ScopedHINTERNET request(WinHttpOpenRequest( connect.get(), base::UTF8ToUTF16(method()).c_str(), diff --git a/patch/patches/gn_config.patch b/patch/patches/gn_config.patch index fc4079cf9..16d5727ab 100644 --- a/patch/patches/gn_config.patch +++ b/patch/patches/gn_config.patch @@ -1,8 +1,8 @@ diff --git .gn .gn -index f3ea8df..09d0a1e 100644 +index b0565e5..4fd1771 100644 --- .gn +++ .gn -@@ -225,6 +225,7 @@ exec_script_whitelist = +@@ -259,6 +259,7 @@ exec_script_whitelist = # in the Chromium repo outside of //build. "//android_webview/BUILD.gn", "//build_overrides/build.gni", @@ -11,10 +11,10 @@ index f3ea8df..09d0a1e 100644 # TODO(dgn): Layer violation but breaks the build otherwise, see diff --git BUILD.gn BUILD.gn -index 0cd9629..97c284c 100644 +index d783ebe..ae5e8d1 100644 --- BUILD.gn +++ BUILD.gn -@@ -286,6 +286,7 @@ group("both_gn_and_gyp") { +@@ -282,6 +282,7 @@ group("both_gn_and_gyp") { # and whether there should be other targets that are iOS-only and missing. deps += [ "//cc:cc_unittests", @@ -55,21 +55,25 @@ index 982fbe8..e757be46 100644 + "studio path") } diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py -index fbc201e..98ad106 100644 +index 43a7e09..2af18e9 100644 --- build/toolchain/win/setup_toolchain.py +++ build/toolchain/win/setup_toolchain.py -@@ -126,11 +126,15 @@ def _LoadToolchainEnv(cpu, sdk_dir): - script_path = os.path.normpath(os.path.join( +@@ -127,15 +127,17 @@ def _LoadToolchainEnv(cpu, sdk_dir): os.environ['GYP_MSVS_OVERRIDE_PATH'], 'VC/vcvarsall.bat')) -- if not os.path.exists(script_path): -- raise Exception('%s is missing - make sure VC++ tools are installed.' % -- script_path) + if not os.path.exists(script_path): +- other_path = os.path.normpath(os.path.join( ++ script_path = os.path.normpath(os.path.join( + os.environ['GYP_MSVS_OVERRIDE_PATH'], + 'VC/Auxiliary/Build/vcvarsall.bat')) +- if not os.path.exists(other_path): +- raise Exception('%s is missing - make sure VC++ tools are installed.' % +- script_path) +- script_path = other_path - args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] - variables = _LoadEnvFromBat(args) + if os.path.exists(script_path): -+ args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64', \ -+ '10.0.14393.0'] ++ args = [script_path, 'amd64_x86' if cpu == 'x86' else 'amd64'] + variables = _LoadEnvFromBat(args) + else: + variables = [] @@ -80,7 +84,7 @@ index fbc201e..98ad106 100644 diff --git build/vs_toolchain.py build/vs_toolchain.py -index 3edf1ff..66e150a 100755 +index c5db1b24..e4f5839 100755 --- build/vs_toolchain.py +++ build/vs_toolchain.py @@ -74,11 +74,18 @@ def SetEnvironmentAndGetRuntimeDllDirs(): @@ -103,10 +107,10 @@ index 3edf1ff..66e150a 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 27c483c..24502e9 100644 +index 811afda..8d21b5f 100644 --- chrome/chrome_paks.gni +++ chrome/chrome_paks.gni -@@ -245,7 +245,7 @@ template("chrome_paks") { +@@ -249,7 +249,7 @@ template("chrome_paks") { additional_source_patterns = invoker.additional_locale_source_patterns } input_locales = locales @@ -116,10 +120,10 @@ index 27c483c..24502e9 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 84be262..687ffac 100644 +index 5d2fe25..dd08482 100644 --- chrome/installer/mini_installer/BUILD.gn +++ chrome/installer/mini_installer/BUILD.gn -@@ -125,7 +125,7 @@ template("generate_mini_installer") { +@@ -128,7 +128,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 f0313f7ce..1ebd89c7b 100644 --- a/patch/patches/gritsettings.patch +++ b/patch/patches/gritsettings.patch @@ -1,8 +1,8 @@ diff --git resource_ids resource_ids -index d454de7..42e591a 100644 +index 4e3fd2d..447c1f5 100644 --- resource_ids +++ resource_ids -@@ -355,5 +355,12 @@ +@@ -361,5 +361,12 @@ # Thinking about appending to the end? # Please read the header and find the right section above instead. diff --git a/patch/patches/ime_1610.patch b/patch/patches/ime_1610.patch index e44906e4f..f2021a41c 100644 --- a/patch/patches/ime_1610.patch +++ b/patch/patches/ime_1610.patch @@ -1,8 +1,8 @@ diff --git input_method_win.cc input_method_win.cc -index 49efa46..c9eb806 100644 +index e2bb528..3e851e5 100644 --- input_method_win.cc +++ input_method_win.cc -@@ -664,8 +664,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { +@@ -682,8 +682,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { // receiving keyboard input as long as it is an active window. This works well // even when the |attached_window_handle| becomes active but has not received // WM_FOCUS yet. diff --git a/patch/patches/message_loop_443_1992243003.patch b/patch/patches/message_loop_443_1992243003.patch index 0a8fbd3ea..574354114 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 2212941..c2895af 100644 +index 3d55920..721aca1 100644 --- message_loop.cc +++ message_loop.cc @@ -96,12 +96,6 @@ MessageLoop::~MessageLoop() { @@ -23,10 +23,10 @@ index 2212941..c2895af 100644 + os_modal_loop_(false), +#endif // OS_WIN pump_factory_(pump_factory), - run_loop_(NULL), - incoming_task_queue_(new internal::IncomingTaskQueue(this)), + run_loop_(nullptr), + current_pending_task_(nullptr), diff --git message_loop.h message_loop.h -index 91a7b1d..de864d4 100644 +index 8417ce4..ee253a9 100644 --- message_loop.h +++ message_loop.h @@ -303,6 +303,16 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { @@ -46,7 +46,7 @@ index 91a7b1d..de864d4 100644 // Can only be called from the thread that owns the MessageLoop. bool is_running() const; -@@ -440,6 +450,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { +@@ -442,6 +452,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate { // insider a (accidentally induced?) nested message pump. bool nestable_tasks_allowed_; @@ -60,7 +60,7 @@ index 91a7b1d..de864d4 100644 // if type_ is TYPE_CUSTOM and pump_ is null. MessagePumpFactoryCallback pump_factory_; diff --git message_pump_win.cc message_pump_win.cc -index 30638df..a50d626 100644 +index d52c785..a43b5b3 100644 --- message_pump_win.cc +++ message_pump_win.cc @@ -366,20 +366,28 @@ bool MessagePumpForUI::ProcessMessageHelper(const MSG& msg) { diff --git a/patch/patches/navigation_handle.patch b/patch/patches/navigation_handle.patch new file mode 100644 index 000000000..d1a03e13b --- /dev/null +++ b/patch/patches/navigation_handle.patch @@ -0,0 +1,29 @@ +diff --git content/browser/frame_host/navigation_handle_impl.cc content/browser/frame_host/navigation_handle_impl.cc +index 2e525bb..646b81b 100644 +--- content/browser/frame_host/navigation_handle_impl.cc ++++ content/browser/frame_host/navigation_handle_impl.cc +@@ -256,12 +256,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { + } + + RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { +- // TODO(mkwst): Change this to check against 'READY_TO_COMMIT' once +- // ReadyToCommitNavigation is available whether or not PlzNavigate is +- // enabled. https://crbug.com/621856 +- CHECK_GE(state_, WILL_PROCESS_RESPONSE) +- << "This accessor should only be called after a response has been " +- "delivered for processing."; + return render_frame_host_; + } + +diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc +index ff676db..63f862d 100644 +--- content/browser/frame_host/render_frame_host_impl.cc ++++ content/browser/frame_host/render_frame_host_impl.cc +@@ -1133,6 +1133,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( + if (navigation_handle_) { + navigation_handle_->set_net_error_code( + static_cast(params.error_code)); ++ navigation_handle_->set_render_frame_host(this); + } + + frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); diff --git a/patch/patches/net_filter_515.patch b/patch/patches/net_filter_515.patch index fbfacc4e6..d1eb9dd04 100644 --- a/patch/patches/net_filter_515.patch +++ b/patch/patches/net_filter_515.patch @@ -1,5 +1,5 @@ diff --git net/base/network_delegate.h net/base/network_delegate.h -index 0fccae1..73e33ad 100644 +index f602f3c..091f53e 100644 --- net/base/network_delegate.h +++ net/base/network_delegate.h @@ -16,6 +16,7 @@ @@ -10,7 +10,7 @@ index 0fccae1..73e33ad 100644 #include "net/proxy/proxy_retry_info.h" class GURL; -@@ -116,6 +117,10 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { +@@ -112,6 +113,10 @@ class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { const GURL& target_url, const GURL& referrer_url) const; @@ -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 cdf60f8..d6dd4bf 100644 +index 464e920..9c729b3 100644 --- net/url_request/url_request_job.cc +++ net/url_request/url_request_job.cc -@@ -497,6 +497,12 @@ void URLRequestJob::NotifyHeadersComplete() { +@@ -500,6 +500,12 @@ void URLRequestJob::NotifyHeadersComplete() { DCHECK(!source_stream_); source_stream_ = SetUpSourceStream(); diff --git a/patch/patches/pdfium_print_549365.patch b/patch/patches/pdfium_print_549365.patch index 98d6f188e..dd70c96c9 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 4a05c56..5e1c4e8 100644 +index de7f21b..cb3dcb1 100644 --- BUILD.gn +++ BUILD.gn -@@ -194,6 +194,10 @@ static_library("pdfium") { +@@ -208,6 +208,10 @@ static_library("pdfium") { } else { libs += [ "freetype" ] } @@ -14,7 +14,7 @@ index 4a05c56..5e1c4e8 100644 static_library("test_support") { diff --git fpdfsdk/fpdfview.cpp fpdfsdk/fpdfview.cpp -index ff4d46e..5d4c419 100644 +index 1e7a651..9523c7e 100644 --- fpdfsdk/fpdfview.cpp +++ fpdfsdk/fpdfview.cpp @@ -31,6 +31,7 @@ @@ -25,7 +25,7 @@ index ff4d46e..5d4c419 100644 #include "public/fpdf_ext.h" #include "public/fpdf_progressive.h" #include "third_party/base/numerics/safe_conversions_impl.h" -@@ -383,6 +384,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() { +@@ -419,6 +420,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() { CPDF_ModuleMgr::Destroy(); CFX_GEModule::Destroy(); diff --git a/patch/patches/plugin_info_2015.patch b/patch/patches/plugin_info_2015.patch index 9104958a3..14f913663 100644 --- a/patch/patches/plugin_info_2015.patch +++ b/patch/patches/plugin_info_2015.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc -index 8949f08..45a0640 100644 +index 9320803..9b5d328 100644 --- chrome/browser/download/download_target_determiner.cc +++ chrome/browser/download/download_target_determiner.cc -@@ -478,8 +478,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, +@@ -483,8 +483,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, content::PluginService* plugin_service = content::PluginService::GetInstance(); bool plugin_found = plugin_service->GetPluginInfo( @@ -53,10 +53,10 @@ index 75a6fda..84cfc9f 100644 } } diff --git chrome/browser/ui/cocoa/drag_util.mm chrome/browser/ui/cocoa/drag_util.mm -index 4a3e00e..aca7f98 100644 +index 0ce31db0..58c4633 100644 --- chrome/browser/ui/cocoa/drag_util.mm +++ chrome/browser/ui/cocoa/drag_util.mm -@@ -52,7 +52,7 @@ BOOL IsSupportedFileURL(Profile* profile, const GURL& url) { +@@ -54,7 +54,7 @@ BOOL IsSupportedFileURL(Profile* profile, const GURL& url) { return PluginService::GetInstance()->GetPluginInfo( -1, // process ID MSG_ROUTING_NONE, // routing ID @@ -66,10 +66,10 @@ index 4a3e00e..aca7f98 100644 } diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc -index 59d15a7..7831a36 100644 +index b4b700b..46acc35 100644 --- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc -@@ -592,6 +592,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted( +@@ -591,6 +591,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted( content::PluginService::GetInstance()->GetPluginInfo( -1, // process ID MSG_ROUTING_NONE, // routing ID @@ -78,10 +78,10 @@ index 59d15a7..7831a36 100644 mime_type, false, NULL, &plugin, NULL)); } diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc -index 93a1da4..79ac197 100644 +index 5b8f571..958ebfb1 100644 --- content/browser/frame_host/render_frame_message_filter.cc +++ content/browser/frame_host/render_frame_message_filter.cc -@@ -459,6 +459,7 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id, +@@ -446,6 +446,7 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id, void RenderFrameMessageFilter::OnGetPlugins( bool refresh, @@ -89,7 +89,7 @@ index 93a1da4..79ac197 100644 const url::Origin& main_frame_origin, IPC::Message* reply_msg) { // Don't refresh if the specified threshold has not been passed. Note that -@@ -480,18 +481,19 @@ void RenderFrameMessageFilter::OnGetPlugins( +@@ -467,18 +468,19 @@ void RenderFrameMessageFilter::OnGetPlugins( PluginServiceImpl::GetInstance()->GetPlugins( base::Bind(&RenderFrameMessageFilter::GetPluginsCallback, this, reply_msg, @@ -111,7 +111,7 @@ index 93a1da4..79ac197 100644 int routing_id = MSG_ROUTING_NONE; // In this loop, copy the WebPluginInfo (and do not use a reference) because // the filter might mutate it. -@@ -500,7 +502,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( +@@ -487,7 +489,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( if (!filter || filter->IsPluginAvailable(child_process_id, routing_id, resource_context_, main_frame_origin.GetURL(), @@ -120,7 +120,7 @@ index 93a1da4..79ac197 100644 plugins.push_back(plugin); } } -@@ -512,6 +514,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( +@@ -499,6 +501,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( void RenderFrameMessageFilter::OnGetPluginInfo( int render_frame_id, const GURL& url, @@ -128,7 +128,7 @@ index 93a1da4..79ac197 100644 const url::Origin& main_frame_origin, const std::string& mime_type, bool* found, -@@ -520,8 +523,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo( +@@ -507,8 +510,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo( bool allow_wildcard = true; *found = plugin_service_->GetPluginInfo( render_process_id_, render_frame_id, resource_context_, url, @@ -161,10 +161,10 @@ index 05500b4..cd00c4c 100644 const std::string& mime_type, bool* found, diff --git content/browser/loader/mime_sniffing_resource_handler.cc content/browser/loader/mime_sniffing_resource_handler.cc -index 6c13e04..556e43d 100644 +index e90fa81..dc3e20d 100644 --- content/browser/loader/mime_sniffing_resource_handler.cc +++ content/browser/loader/mime_sniffing_resource_handler.cc -@@ -426,8 +426,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( +@@ -469,8 +469,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( WebPluginInfo plugin; bool has_plugin = plugin_service_->GetPluginInfo( info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), @@ -210,10 +210,10 @@ index 3e92d37..ecd8493 100644 const std::string& mime_type, bool allow_wildcard, diff --git content/common/frame_messages.h content/common/frame_messages.h -index 9092344..efcdb7f 100644 +index 774d9cb..c74223f 100644 --- content/common/frame_messages.h +++ content/common/frame_messages.h -@@ -1187,8 +1187,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, +@@ -1244,8 +1244,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, // Used to get the list of plugins. |main_frame_origin| is used to handle // exceptions for plugin content settings. @@ -224,7 +224,7 @@ index 9092344..efcdb7f 100644 url::Origin /* main_frame_origin */, std::vector /* plugins */) -@@ -1196,9 +1197,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, +@@ -1253,9 +1254,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, // type. If there is no matching plugin, |found| is false. // |actual_mime_type| is the actual mime type supported by the // found plugin. @@ -237,7 +237,7 @@ index 9092344..efcdb7f 100644 std::string /* mime_type */, bool /* found */, diff --git content/ppapi_plugin/ppapi_blink_platform_impl.cc content/ppapi_plugin/ppapi_blink_platform_impl.cc -index c4dc0cf..4fe3e1b 100644 +index 92f31e7..fccf0b9 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.cc +++ content/ppapi_plugin/ppapi_blink_platform_impl.cc @@ -210,6 +210,7 @@ blink::WebURLLoader* PpapiBlinkPlatformImpl::createURLLoader() { @@ -285,10 +285,10 @@ index 3b610b1..7c439e0 100644 WebPluginInfo* plugin) = 0; diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc -index 2d93238..d511e99 100644 +index 4af9b67..d73ac0b 100644 --- content/renderer/render_frame_impl.cc +++ content/renderer/render_frame_impl.cc -@@ -2749,7 +2749,8 @@ blink::WebPlugin* RenderFrameImpl::createPlugin( +@@ -2752,7 +2752,8 @@ blink::WebPlugin* RenderFrameImpl::createPlugin( std::string mime_type; bool found = false; Send(new FrameHostMsg_GetPluginInfo( @@ -298,7 +298,7 @@ index 2d93238..d511e99 100644 params.mimeType.utf8(), &found, &info, &mime_type)); if (!found) return NULL; -@@ -5259,9 +5260,8 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( +@@ -5246,9 +5247,8 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( (pending_navigation_params_ && !pending_navigation_params_->request_params.redirects.empty()); @@ -310,7 +310,7 @@ index 2d93238..d511e99 100644 // The handlenavigation API is deprecated and will be removed once // crbug.com/325351 is resolved. if (GetContentClient()->renderer()->HandleNavigation( -@@ -5270,7 +5270,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( +@@ -5257,7 +5257,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( is_redirect)) { return blink::WebNavigationPolicyIgnore; } @@ -319,10 +319,10 @@ index 2d93238..d511e99 100644 Referrer referrer( RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest)); diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc -index 462b144..e44983c 100644 +index ed2baee..19f294b 100644 --- content/renderer/renderer_blink_platform_impl.cc +++ content/renderer/renderer_blink_platform_impl.cc -@@ -750,6 +750,7 @@ blink::WebMIDIAccessor* RendererBlinkPlatformImpl::createMIDIAccessor( +@@ -712,6 +712,7 @@ blink::WebMIDIAccessor* RendererBlinkPlatformImpl::createMIDIAccessor( void RendererBlinkPlatformImpl::getPluginList( bool refresh, @@ -330,7 +330,7 @@ index 462b144..e44983c 100644 const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) { #if BUILDFLAG(ENABLE_PLUGINS) -@@ -757,7 +758,8 @@ void RendererBlinkPlatformImpl::getPluginList( +@@ -719,7 +720,8 @@ void RendererBlinkPlatformImpl::getPluginList( if (!plugin_refresh_allowed_) refresh = false; RenderThread::Get()->Send( @@ -338,10 +338,10 @@ index 462b144..e44983c 100644 + new FrameHostMsg_GetPlugins(refresh, isMainFrame, mainFrameOrigin, + &plugins)); for (const WebPluginInfo& plugin : plugins) { - builder->addPlugin( - plugin.name, plugin.desc, + builder->addPlugin(WebString::fromUTF16(plugin.name), + WebString::fromUTF16(plugin.desc), diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h -index 6c9ac66..f53f26e 100644 +index df62a99..992fa6e 100644 --- content/renderer/renderer_blink_platform_impl.h +++ content/renderer/renderer_blink_platform_impl.h @@ -117,6 +117,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { diff --git a/patch/patches/plugin_info_webkit_2015.patch b/patch/patches/plugin_info_webkit_2015.patch index 1fa0cfe6b..eab1c781f 100644 --- a/patch/patches/plugin_info_webkit_2015.patch +++ b/patch/patches/plugin_info_webkit_2015.patch @@ -15,10 +15,10 @@ index 2b04a24..85653cf 100644 } } diff --git Source/core/frame/LocalFrame.cpp Source/core/frame/LocalFrame.cpp -index 03edc5d..b9a91db 100644 +index 6fa75cf..20cba50 100644 --- Source/core/frame/LocalFrame.cpp +++ Source/core/frame/LocalFrame.cpp -@@ -920,6 +920,7 @@ PluginData* LocalFrame::pluginData() const { +@@ -898,6 +898,7 @@ PluginData* LocalFrame::pluginData() const { if (!loader().allowPlugins(NotAboutToInstantiatePlugin)) return nullptr; return page()->pluginData( @@ -27,10 +27,10 @@ index 03edc5d..b9a91db 100644 } diff --git Source/core/page/Page.cpp Source/core/page/Page.cpp -index 671df37..27c7d6b 100644 +index cb46ff7..7c63196 100644 --- Source/core/page/Page.cpp +++ Source/core/page/Page.cpp -@@ -239,16 +239,26 @@ void Page::refreshPlugins() { +@@ -226,16 +226,26 @@ void Page::refreshPlugins() { for (const Page* page : allPages()) { // Clear out the page's plugin data. @@ -65,10 +65,10 @@ index 671df37..27c7d6b 100644 void Page::setValidationMessageClient(ValidationMessageClient* client) { diff --git Source/core/page/Page.h Source/core/page/Page.h -index 133260a..0aef9f2 100644 +index 9c429bd..667207e 100644 --- Source/core/page/Page.h +++ Source/core/page/Page.h -@@ -127,7 +127,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, +@@ -130,7 +130,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, ViewportDescription viewportDescription() const; static void refreshPlugins(); @@ -78,7 +78,7 @@ index 133260a..0aef9f2 100644 EditorClient& editorClient() const { return *m_editorClient; } SpellCheckerClient& spellCheckerClient() const { -@@ -268,7 +269,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, +@@ -285,7 +286,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, // longer needed. Member m_mainFrame; @@ -150,7 +150,7 @@ index 0edfd70..a81c128 100644 }; diff --git public/platform/Platform.h public/platform/Platform.h -index d623c5a..e28e617 100644 +index 2cd7334..7541a5e 100644 --- public/platform/Platform.h +++ public/platform/Platform.h @@ -357,6 +357,7 @@ class BLINK_PLATFORM_EXPORT Platform { diff --git a/patch/patches/prefs_content_1161.patch b/patch/patches/prefs_content_1161.patch index 15cbefe95..b55fef435 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 ffe235a..e7bf4be 100644 +index a7d48d0..15df86a 100644 --- public/common/common_param_traits_macros.h +++ public/common/common_param_traits_macros.h -@@ -202,6 +202,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) +@@ -203,6 +203,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 ffe235a..e7bf4be 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 7f24f09..ab0fe0d 100644 +index d44ff10..eba4758 100644 --- public/common/web_preferences.cc +++ public/common/web_preferences.cc -@@ -172,6 +172,7 @@ WebPreferences::WebPreferences() +@@ -173,6 +173,7 @@ WebPreferences::WebPreferences() spatial_navigation_enabled(false), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), @@ -23,10 +23,10 @@ index 7f24f09..ab0fe0d 100644 inert_visual_viewport(false), record_whole_document(false), diff --git public/common/web_preferences.h public/common/web_preferences.h -index 4835144..16fa0ad 100644 +index ba18988..42a0296 100644 --- public/common/web_preferences.h +++ public/common/web_preferences.h -@@ -186,6 +186,7 @@ struct CONTENT_EXPORT WebPreferences { +@@ -187,6 +187,7 @@ struct CONTENT_EXPORT WebPreferences { bool spatial_navigation_enabled; bool use_solid_color_scrollbars; bool navigate_on_drag_drop; @@ -35,10 +35,10 @@ index 4835144..16fa0ad 100644 bool inert_visual_viewport; bool record_whole_document; diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc -index 7083f7d..e307222 100644 +index 85a9fa9..3df9583 100644 --- renderer/render_view_impl.cc +++ renderer/render_view_impl.cc -@@ -1389,6 +1389,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( +@@ -1401,6 +1401,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( blink::WebView* web_view, CompositorDependencies* compositor_deps) { ApplyWebPreferences(prefs, web_view); diff --git a/patch/patches/print_header_footer_1478_1565.patch b/patch/patches/print_header_footer_1478_1565.patch index 19fd917a0..bed799c9e 100644 --- a/patch/patches/print_header_footer_1478_1565.patch +++ b/patch/patches/print_header_footer_1478_1565.patch @@ -40,6 +40,26 @@ index 7ec0135..9f68626 100644 } - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { +diff --git chrome/common/chrome_utility_printing_messages.h chrome/common/chrome_utility_printing_messages.h +index f5712a7..11c0366 100644 +--- chrome/common/chrome_utility_printing_messages.h ++++ chrome/common/chrome_utility_printing_messages.h +@@ -26,7 +26,6 @@ + #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart + + // Preview and Cloud Print messages. +-#if BUILDFLAG(ENABLE_PRINT_PREVIEW) + IPC_ENUM_TRAITS_MAX_VALUE(printing::PdfRenderSettings::Mode, + printing::PdfRenderSettings::Mode::LAST) + +@@ -38,6 +37,7 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PdfRenderSettings) + IPC_STRUCT_TRAITS_MEMBER(mode) + IPC_STRUCT_TRAITS_END() + ++#if BUILDFLAG(ENABLE_PRINT_PREVIEW) + IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults) + IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) + IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) diff --git components/printing/common/print_messages.cc components/printing/common/print_messages.cc index a9291a2..1a50724 100644 --- components/printing/common/print_messages.cc @@ -58,10 +78,10 @@ index a9291a2..1a50724 100644 } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) diff --git components/printing/common/print_messages.h components/printing/common/print_messages.h -index 3679499..b2d2544 100644 +index 9a90bc1..046262f 100644 --- components/printing/common/print_messages.h +++ components/printing/common/print_messages.h -@@ -74,7 +74,6 @@ struct PrintMsg_PrintPages_Params { +@@ -75,7 +75,6 @@ struct PrintMsg_PrintPages_Params { std::vector pages; }; @@ -69,7 +89,7 @@ index 3679499..b2d2544 100644 struct PrintHostMsg_RequestPrintPreview_Params { PrintHostMsg_RequestPrintPreview_Params(); ~PrintHostMsg_RequestPrintPreview_Params(); -@@ -93,7 +92,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { +@@ -94,7 +93,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { printing::DuplexMode duplex; printing::PageRanges page_ranges; }; @@ -77,7 +97,7 @@ index 3679499..b2d2544 100644 #endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ -@@ -186,7 +184,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) +@@ -187,7 +185,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) IPC_STRUCT_TRAITS_MEMBER(to) IPC_STRUCT_TRAITS_END() @@ -85,7 +105,7 @@ index 3679499..b2d2544 100644 IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params) IPC_STRUCT_TRAITS_MEMBER(is_modifiable) IPC_STRUCT_TRAITS_MEMBER(webnode_only) -@@ -207,7 +204,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) +@@ -208,7 +205,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 +113,7 @@ index 3679499..b2d2544 100644 IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins) IPC_STRUCT_TRAITS_MEMBER(content_width) -@@ -227,7 +223,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) +@@ -228,7 +224,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) IPC_STRUCT_TRAITS_MEMBER(pages) IPC_STRUCT_TRAITS_END() @@ -101,7 +121,7 @@ index 3679499..b2d2544 100644 // Parameters to describe a rendered document. IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) // A shared memory handle to metafile data. -@@ -284,7 +279,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params) +@@ -285,7 +280,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 +129,7 @@ index 3679499..b2d2544 100644 // Parameters to describe a rendered page. IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintPage_Params) -@@ -323,22 +317,20 @@ IPC_STRUCT_END() +@@ -328,22 +322,20 @@ IPC_STRUCT_END() // Messages sent from the browser to the renderer. @@ -134,7 +154,7 @@ index 3679499..b2d2544 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Tells the RenderFrame to switch the CSS to print media type, renders every -@@ -356,13 +348,11 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, +@@ -361,13 +353,11 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, // Tells the RenderFrame whether printing is enabled or not. IPC_MESSAGE_ROUTED1(PrintMsg_SetPrintingEnabled, bool /* enabled */) @@ -148,7 +168,7 @@ index 3679499..b2d2544 100644 // Messages sent from the renderer to the browser. -@@ -418,7 +408,6 @@ IPC_MESSAGE_CONTROL2(PrintHostMsg_TempFileForPrintingWritten, +@@ -423,7 +413,6 @@ IPC_MESSAGE_CONTROL2(PrintHostMsg_TempFileForPrintingWritten, int /* fd in browser */) #endif // defined(OS_ANDROID) @@ -156,7 +176,7 @@ index 3679499..b2d2544 100644 // Asks the browser to do print preview. IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview, PrintHostMsg_RequestPrintPreview_Params /* params */) -@@ -452,7 +441,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, +@@ -457,7 +446,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 +184,7 @@ index 3679499..b2d2544 100644 // This is sent when there are invalid printer settings. IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) -@@ -461,7 +449,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) +@@ -466,7 +454,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, int /* document cookie */) @@ -172,13 +192,13 @@ index 3679499..b2d2544 100644 // Tell the browser print preview failed. IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, int /* document cookie */) -@@ -488,4 +475,3 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview, +@@ -493,4 +480,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 3144c40..8679f72 100644 +index eaa294d..6dd6482 100644 --- components/printing/renderer/print_web_view_helper.cc +++ components/printing/renderer/print_web_view_helper.cc @@ -89,6 +89,9 @@ const float kPrintingMinimumShrinkFactor = 1.333f; @@ -193,7 +213,7 @@ index 3144c40..8679f72 100644 "document.open(); document.write(%s); document.close();"; @@ -103,9 +106,6 @@ void ExecuteScript(blink::WebFrame* frame, std::string script = base::StringPrintf(script_format, json.c_str()); - frame->executeScript(blink::WebString(base::UTF8ToUTF16(script))); + frame->executeScript(blink::WebString::fromUTF8(script)); } -#else -bool g_is_preview_enabled = false; @@ -249,7 +269,7 @@ index 3144c40..8679f72 100644 // static - Not anonymous so that platform implementations can use it. float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame, -@@ -906,6 +900,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderFrame* render_frame, +@@ -907,6 +901,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderFrame* render_frame, print_for_preview_(false), delegate_(std::move(delegate)), print_node_in_progress_(false), @@ -257,7 +277,7 @@ index 3144c40..8679f72 100644 is_loading_(false), is_scripted_preview_delayed_(false), ipc_nesting_level_(0), -@@ -966,10 +961,8 @@ void PrintWebViewHelper::ScriptedPrint(bool user_initiated) { +@@ -968,10 +963,8 @@ void PrintWebViewHelper::ScriptedPrint(bool user_initiated) { return; if (g_is_preview_enabled) { @@ -268,7 +288,7 @@ index 3144c40..8679f72 100644 } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) Print(web_frame, blink::WebNode(), true /* is_scripted? */); -@@ -997,14 +990,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { +@@ -999,14 +992,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 +303,7 @@ index 3144c40..8679f72 100644 IPC_MESSAGE_HANDLER(PrintMsg_SetPrintingEnabled, OnSetPrintingEnabled) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() -@@ -1048,7 +1037,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { +@@ -1050,7 +1039,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() { } #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -291,7 +311,7 @@ index 3144c40..8679f72 100644 void PrintWebViewHelper::OnPrintForPrintPreview( const base::DictionaryValue& job_settings) { CHECK_LE(ipc_nesting_level_, 1); -@@ -1107,7 +1095,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview( +@@ -1110,7 +1098,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview( DidFinishPrinting(FAIL_PRINT); } } @@ -299,7 +319,7 @@ index 3144c40..8679f72 100644 void PrintWebViewHelper::GetPageSizeAndContentAreaFromPageLayout( const PageSizeMargins& page_layout_in_points, -@@ -1132,7 +1119,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( +@@ -1135,7 +1122,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo( ignore_css_margins_ = (margins_type != DEFAULT_MARGINS); } @@ -307,7 +327,7 @@ index 3144c40..8679f72 100644 void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) { if (ipc_nesting_level_ > 1) return; -@@ -1317,7 +1303,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { +@@ -1331,7 +1317,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { return true; } @@ -316,7 +336,7 @@ index 3144c40..8679f72 100644 bool PrintWebViewHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -1347,7 +1333,7 @@ bool PrintWebViewHelper::RenderPreviewPage( +@@ -1361,7 +1347,7 @@ bool PrintWebViewHelper::RenderPreviewPage( } return PreviewPageRendered(page_number, draft_metafile.get()); } @@ -325,7 +345,7 @@ index 3144c40..8679f72 100644 bool PrintWebViewHelper::FinalizePrintReadyDocument() { DCHECK(!is_print_ready_metafile_sent_); -@@ -1377,7 +1363,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() { +@@ -1391,7 +1377,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() { Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params)); return true; } @@ -333,7 +353,7 @@ index 3144c40..8679f72 100644 void PrintWebViewHelper::OnPrintingDone(bool success) { if (ipc_nesting_level_ > 1) -@@ -1392,7 +1377,6 @@ void PrintWebViewHelper::OnSetPrintingEnabled(bool enabled) { +@@ -1406,7 +1391,6 @@ void PrintWebViewHelper::OnSetPrintingEnabled(bool enabled) { is_printing_enabled_ = enabled; } @@ -341,7 +361,7 @@ index 3144c40..8679f72 100644 void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { if (ipc_nesting_level_ > 1) return; -@@ -1403,7 +1387,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { +@@ -1417,7 +1401,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { // that instead. auto plugin = delegate_->GetPdfElement(frame); if (!plugin.isNull()) { @@ -351,7 +371,7 @@ index 3144c40..8679f72 100644 return; } print_preview_context_.InitWithFrame(frame); -@@ -1411,7 +1397,6 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { +@@ -1425,7 +1411,6 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool has_selection) { ? PRINT_PREVIEW_USER_INITIATED_SELECTION : PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); } @@ -359,7 +379,7 @@ index 3144c40..8679f72 100644 bool PrintWebViewHelper::IsPrintingEnabled() const { return is_printing_enabled_; -@@ -1433,11 +1418,9 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) { +@@ -1447,11 +1432,9 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) { print_node_in_progress_ = true; @@ -372,7 +392,7 @@ index 3144c40..8679f72 100644 } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Make a copy of the node, in case RenderView::OnContextMenuClosed() resets -@@ -1526,7 +1509,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { +@@ -1540,7 +1523,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { } break; @@ -380,7 +400,7 @@ index 3144c40..8679f72 100644 case FAIL_PREVIEW: int cookie = print_pages_params_ ? print_pages_params_->params.document_cookie : 0; -@@ -1538,7 +1520,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { +@@ -1552,7 +1534,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) { } print_preview_context_.Failed(notify_browser_of_print_failure_); break; @@ -388,7 +408,7 @@ index 3144c40..8679f72 100644 } prep_frame_view_.reset(); print_pages_params_.reset(); -@@ -1670,7 +1651,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, +@@ -1684,7 +1665,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, return true; } @@ -396,7 +416,7 @@ index 3144c40..8679f72 100644 bool PrintWebViewHelper::SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options) { blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); -@@ -1777,7 +1757,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( +@@ -1791,7 +1771,6 @@ bool PrintWebViewHelper::UpdatePrintSettings( print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS); return false; } @@ -404,15 +424,15 @@ index 3144c40..8679f72 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) void PrintWebViewHelper::GetPrintSettingsFromUser( -@@ -1884,7 +1863,6 @@ void PrintWebViewHelper::PrintPageInternal( +@@ -1904,7 +1883,6 @@ void PrintWebViewHelper::PrintPageInternal( - MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); + MetafileSkiaWrapper::SetMetafileOnCanvas(canvas, metafile); -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) if (params.params.display_header_footer) { // TODO(thestig): Figure out why Linux needs this. It is almost certainly // |printingMinimumShrinkFactor| from Blink. -@@ -1899,7 +1877,6 @@ void PrintWebViewHelper::PrintPageInternal( +@@ -1919,7 +1897,6 @@ void PrintWebViewHelper::PrintPageInternal( scale_factor / fudge_factor, page_layout_in_points, params.params); } @@ -420,7 +440,7 @@ index 3144c40..8679f72 100644 float webkit_scale_factor = RenderPageContent(frame, params.page_number, canvas_area, content_area, -@@ -1935,7 +1912,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( +@@ -1955,7 +1932,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem( return true; } @@ -428,7 +448,7 @@ index 3144c40..8679f72 100644 void PrintWebViewHelper::ShowScriptedPrintPreview() { if (is_scripted_preview_delayed_) { is_scripted_preview_delayed_ = false; -@@ -2066,7 +2042,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number, +@@ -2086,7 +2062,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number, Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params)); return true; } @@ -437,7 +457,7 @@ index 3144c40..8679f72 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 e603411..ec4b7d8 100644 +index d979333..8786274 100644 --- components/printing/renderer/print_web_view_helper.h +++ components/printing/renderer/print_web_view_helper.h @@ -145,9 +145,7 @@ class PrintWebViewHelper @@ -493,7 +513,7 @@ index e603411..ec4b7d8 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Get final print settings from the user. -@@ -335,7 +327,6 @@ class PrintWebViewHelper +@@ -336,7 +328,6 @@ class PrintWebViewHelper const PrintMsg_PrintPages_Params& params, int page_count); @@ -501,7 +521,7 @@ index e603411..ec4b7d8 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, -@@ -345,7 +336,6 @@ class PrintWebViewHelper +@@ -346,7 +337,6 @@ class PrintWebViewHelper float webkit_scale_factor, const PageSizeMargins& page_layout_in_points, const PrintMsg_Print_Params& params); @@ -509,7 +529,7 @@ index e603411..ec4b7d8 100644 // Script Initiated Printing ------------------------------------------------ -@@ -355,7 +345,6 @@ class PrintWebViewHelper +@@ -356,7 +346,6 @@ class PrintWebViewHelper bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame, bool user_initiated); @@ -517,7 +537,7 @@ index e603411..ec4b7d8 100644 // Shows scripted print preview when options from plugin are available. void ShowScriptedPrintPreview(); -@@ -373,7 +362,6 @@ class PrintWebViewHelper +@@ -374,7 +363,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 +545,7 @@ index e603411..ec4b7d8 100644 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); -@@ -525,6 +513,7 @@ class PrintWebViewHelper +@@ -527,6 +515,7 @@ class PrintWebViewHelper ScriptingThrottler scripting_throttler_; bool print_node_in_progress_; @@ -534,10 +554,10 @@ index e603411..ec4b7d8 100644 bool is_loading_; bool is_scripted_preview_delayed_; diff --git components/printing/renderer/print_web_view_helper_mac.mm components/printing/renderer/print_web_view_helper_mac.mm -index ff49472..b107439 100644 +index 6de15ad..95190ae 100644 --- components/printing/renderer/print_web_view_helper_mac.mm +++ components/printing/renderer/print_web_view_helper_mac.mm -@@ -69,7 +69,6 @@ void PrintWebViewHelper::PrintPageInternal( +@@ -68,7 +68,6 @@ void PrintWebViewHelper::PrintPageInternal( Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params)); } @@ -545,7 +565,7 @@ index ff49472..b107439 100644 bool PrintWebViewHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -106,7 +105,6 @@ bool PrintWebViewHelper::RenderPreviewPage( +@@ -105,7 +104,6 @@ bool PrintWebViewHelper::RenderPreviewPage( } return PreviewPageRendered(page_number, draft_metafile.get()); } @@ -553,10 +573,10 @@ index ff49472..b107439 100644 void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, int page_number, -@@ -142,14 +140,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, +@@ -141,14 +139,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, - MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); - skia::SetIsPreviewMetafile(*canvas, is_preview); + MetafileSkiaWrapper::SetMetafileOnCanvas(canvas, metafile); + cc::SetIsPreviewMetafile(canvas, is_preview); -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) if (params.display_header_footer) { PrintHeaderAndFooter(static_cast(canvas), diff --git a/patch/patches/render_view_host_impl_1392.patch b/patch/patches/render_view_host_impl_1392.patch index d71fc91dd..07cff8adf 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 a2a0359..d5d2ff7 100644 +index fece1e0..9c54a78 100644 --- render_view_host_impl.h +++ render_view_host_impl.h -@@ -158,6 +158,7 @@ class CONTENT_EXPORT RenderViewHostImpl : public RenderViewHost, +@@ -153,6 +153,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 9b314528f..0c4e37e78 100644 --- a/patch/patches/render_widget_host_1070383005.patch +++ b/patch/patches/render_widget_host_1070383005.patch @@ -1,8 +1,8 @@ diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm -index 53c4808..21d741a 100644 +index b67a5f3..edf32a4 100644 --- render_widget_host_view_mac.mm +++ render_widget_host_view_mac.mm -@@ -462,9 +462,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, +@@ -463,9 +463,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget, // Paint this view host with |background_color_| when there is no content // ready to draw. background_layer_.reset([[CALayer alloc] init]); diff --git a/patch/patches/render_widget_latency_2060.patch b/patch/patches/render_widget_latency_2060.patch index 19bd460a8..b12f7ce8b 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 02d6fe5..6d26a26 100644 +index f809926..3635113 100644 --- content/browser/renderer_host/input/render_widget_host_latency_tracker.cc +++ content/browser/renderer_host/input/render_widget_host_latency_tracker.cc -@@ -99,7 +99,6 @@ void UpdateLatencyCoordinates(const WebInputEvent& event, +@@ -80,7 +80,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 using Rappor. - #define RAPPOR_TOUCH_WHEEL_TO_SCROLL_LATENCY(delegate, name, start, end) \ + // Long scroll latency component that is mostly under 200ms. + #define UMA_HISTOGRAM_SCROLL_LATENCY_LONG(name, start, end) \ diff --git a/patch/patches/rwh_background_color_1984.patch b/patch/patches/rwh_background_color_1984.patch index b1d2cc630..f68eee875 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 6cd8721..2f54816 100644 +index 204d1ae..0768d71 100644 --- content/browser/renderer_host/render_widget_host_view_aura.cc +++ content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -746,8 +746,10 @@ void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) { +@@ -757,8 +757,10 @@ void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) { RenderWidgetHostViewBase::SetBackgroundColor(color); bool opaque = GetBackgroundOpaque(); host_->SetBackgroundOpaque(opaque); diff --git a/patch/patches/service_factory_1680.patch b/patch/patches/service_factory_1680.patch index ce433d7e2..65fa8303d 100644 --- a/patch/patches/service_factory_1680.patch +++ b/patch/patches/service_factory_1680.patch @@ -97,7 +97,7 @@ index 2907619..c7a36ea 100644 SupervisedUserSettingsServiceFactory(); diff --git chrome/browser/ui/prefs/prefs_tab_helper.cc chrome/browser/ui/prefs/prefs_tab_helper.cc -index 72267d2..5146b39 100644 +index a46d449..0650084 100644 --- chrome/browser/ui/prefs/prefs_tab_helper.cc +++ chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -11,8 +11,8 @@ @@ -110,7 +110,7 @@ index 72267d2..5146b39 100644 #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -@@ -431,12 +431,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { +@@ -434,12 +434,10 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { GetInstance()->GetServiceForBrowserContext(profile, true)); } @@ -125,7 +125,7 @@ index 72267d2..5146b39 100644 PrefWatcherFactory() : BrowserContextKeyedServiceFactory( "PrefWatcher", -@@ -457,6 +455,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { +@@ -460,6 +458,18 @@ class PrefWatcherFactory : public BrowserContextKeyedServiceFactory { } }; diff --git a/patch/patches/storage_partition_1973.patch b/patch/patches/storage_partition_1973.patch index 70ea6f068..0a2544a81 100644 --- a/patch/patches/storage_partition_1973.patch +++ b/patch/patches/storage_partition_1973.patch @@ -1,5 +1,5 @@ diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc -index 89913ca..db08c06 100644 +index 28f33e7..9b0d352 100644 --- content/browser/appcache/appcache_internals_ui.cc +++ content/browser/appcache/appcache_internals_ui.cc @@ -369,8 +369,8 @@ void AppCacheInternalsUI::CreateProxyForPartition( @@ -91,10 +91,10 @@ index 242d33e..4dfb463 100644 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc -index 5e75c17..25d62a8 100644 +index 7346efe..20560c7 100644 --- content/browser/renderer_host/render_process_host_impl.cc +++ content/browser/renderer_host/render_process_host_impl.cc -@@ -653,7 +653,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() { +@@ -669,7 +669,7 @@ void RenderProcessHostImpl::EarlyZygoteLaunch() { RenderProcessHostImpl::RenderProcessHostImpl( BrowserContext* browser_context, @@ -103,7 +103,7 @@ index 5e75c17..25d62a8 100644 bool is_for_guests_only) : fast_shutdown_started_(false), deleting_soon_(false), -@@ -685,7 +685,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( +@@ -699,7 +699,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( indexed_db_factory_(new IndexedDBDispatcherHost( id_, storage_partition_impl_->GetURLRequestContext(), @@ -113,7 +113,17 @@ index 5e75c17..25d62a8 100644 ChromeBlobStorageContext::GetFor(browser_context_))), channel_connected_(false), sent_render_process_ready_(false), -@@ -914,7 +915,7 @@ bool RenderProcessHostImpl::Init() { +@@ -729,7 +730,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( + } + + push_messaging_manager_.reset(new PushMessagingManager( +- GetID(), storage_partition_impl_->GetServiceWorkerContext())); ++ GetID(), static_cast( ++ storage_partition_impl_->GetServiceWorkerContext()))); + + #if defined(OS_MACOSX) + if (BootstrapSandboxManager::ShouldEnable()) +@@ -932,7 +934,7 @@ bool RenderProcessHostImpl::Init() { } void RenderProcessHostImpl::EnableSendQueue() { @@ -122,7 +132,7 @@ index 5e75c17..25d62a8 100644 InitializeChannelProxy(); } -@@ -1010,6 +1011,22 @@ void RenderProcessHostImpl::ResetChannelProxy() { +@@ -1026,6 +1028,22 @@ void RenderProcessHostImpl::ResetChannelProxy() { void RenderProcessHostImpl::CreateMessageFilters() { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -145,7 +155,7 @@ index 5e75c17..25d62a8 100644 AddFilter(new ResourceSchedulerFilter(GetID())); MediaInternals* media_internals = MediaInternals::GetInstance(); // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages -@@ -1024,8 +1041,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1040,8 +1058,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { new RenderMessageFilter( GetID(), GetBrowserContext(), request_context.get(), widget_helper_.get(), media_internals, @@ -156,7 +166,7 @@ index 5e75c17..25d62a8 100644 AddFilter(render_message_filter.get()); render_frame_message_filter_ = new RenderFrameMessageFilter( -@@ -1055,10 +1072,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1071,10 +1089,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { ChromeBlobStorageContext::GetFor(browser_context); resource_message_filter_ = new ResourceMessageFilter( @@ -169,7 +179,7 @@ index 5e75c17..25d62a8 100644 get_contexts_callback); AddFilter(resource_message_filter_.get()); -@@ -1082,10 +1099,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1098,10 +1116,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { AddFilter( new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_service())); AddFilter(new AppCacheDispatcherHost( @@ -182,7 +192,7 @@ index 5e75c17..25d62a8 100644 #if BUILDFLAG(ENABLE_WEBRTC) peer_connection_tracker_host_ = new PeerConnectionTrackerHost( -@@ -1130,14 +1147,13 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1141,13 +1159,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { scoped_refptr cache_storage_filter = new CacheStorageDispatcherHost(); @@ -191,15 +201,14 @@ index 5e75c17..25d62a8 100644 AddFilter(cache_storage_filter.get()); scoped_refptr service_worker_filter = - new ServiceWorkerDispatcherHost( - GetID(), message_port_message_filter_.get(), resource_context); + new ServiceWorkerDispatcherHost(GetID(), resource_context); - service_worker_filter->Init( - storage_partition_impl_->GetServiceWorkerContext()); + service_worker_filter->Init(service_worker_context); AddFilter(service_worker_filter.get()); AddFilter(new SharedWorkerMessageFilter( -@@ -1145,12 +1161,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1155,12 +1172,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { WorkerStoragePartition( storage_partition_impl_->GetURLRequestContext(), storage_partition_impl_->GetMediaURLRequestContext(), @@ -212,10 +221,10 @@ index 5e75c17..25d62a8 100644 - storage_partition_impl_->GetServiceWorkerContext()), + indexed_db_context, + service_worker_context), - message_port_message_filter_.get())); + base::Bind(&RenderWidgetHelper::GetNextRoutingID, + base::Unretained(widget_helper_.get())))); - #if BUILDFLAG(ENABLE_WEBRTC) -@@ -1165,11 +1181,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1176,11 +1193,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { GetID(), storage_partition_impl_->GetQuotaManager(), GetContentClient()->browser()->CreateQuotaPermissionContext())); @@ -228,28 +237,19 @@ index 5e75c17..25d62a8 100644 resource_context, service_worker_context, browser_context); AddFilter(notification_message_filter_.get()); -@@ -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 ScreenOrientationListenerAndroid()); - synchronous_compositor_filter_ = -@@ -1190,6 +1203,11 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { +@@ -1199,6 +1213,11 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { auto registry = base::MakeUnique( service_manager::mojom::kServiceManager_ConnectorSpec); -+ // Cast to the derived type from StoragePartitionImpl. ++ // Cast to the derived type from StoragePartitionImpl. + auto platform_notification_context = + static_cast( + storage_partition_impl_->GetPlatformNotificationContext()); + - channel_->AddAssociatedInterface( - base::Bind(&RenderProcessHostImpl::OnRouteProviderRequest, - base::Unretained(this))); -@@ -1234,8 +1252,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { + channel_->AddAssociatedInterfaceForIOThread( + base::Bind(&IndexedDBDispatcherHost::AddBinding, indexed_db_factory_)); + +@@ -1259,8 +1278,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { AddUIThreadInterface( registry.get(), base::Bind(&PlatformNotificationContextImpl::CreateService, @@ -259,7 +259,7 @@ index 5e75c17..25d62a8 100644 GetID())); AddUIThreadInterface( registry.get(), -@@ -1428,6 +1445,7 @@ void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { +@@ -1460,6 +1478,7 @@ void RenderProcessHostImpl::ForceReleaseWorkerRefCounts() { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!is_worker_ref_count_disabled_); is_worker_ref_count_disabled_ = true; @@ -268,10 +268,10 @@ index 5e75c17..25d62a8 100644 return; service_worker_ref_count_ = 0; diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h -index 75895e1..ccc5e00 100644 +index 1eac862..84c87a5 100644 --- content/browser/renderer_host/render_process_host_impl.h +++ content/browser/renderer_host/render_process_host_impl.h -@@ -71,7 +71,6 @@ class RenderWidgetHelper; +@@ -72,7 +72,6 @@ class RenderWidgetHelper; class RenderWidgetHost; class ResourceMessageFilter; class StoragePartition; @@ -279,7 +279,7 @@ index 75895e1..ccc5e00 100644 namespace mojom { class StoragePartitionService; -@@ -107,7 +106,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -108,7 +107,7 @@ class CONTENT_EXPORT RenderProcessHostImpl public NON_EXPORTED_BASE(mojom::AssociatedInterfaceProvider) { public: RenderProcessHostImpl(BrowserContext* browser_context, @@ -314,24 +314,26 @@ index a4c8862..2312f35 100644 is_for_guests_only); } diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h -index 2c20f2e..67491fc 100644 +index 92b46dd..45f372c 100644 --- content/browser/storage_partition_impl.h +++ content/browser/storage_partition_impl.h -@@ -74,10 +74,9 @@ class CONTENT_EXPORT StoragePartitionImpl - HostZoomLevelContext* GetHostZoomLevelContext() override; +@@ -77,11 +77,10 @@ class CONTENT_EXPORT StoragePartitionImpl ZoomLevelDelegate* GetZoomLevelDelegate() override; PlatformNotificationContextImpl* GetPlatformNotificationContext() override; + void ClearBluetoothAllowedDevicesMapForTesting() override; - - BackgroundSyncContext* GetBackgroundSyncContext(); - PaymentAppContextImpl* GetPaymentAppContext(); - BroadcastChannelProvider* GetBroadcastChannelProvider(); +- BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap(); + BackgroundSyncContext* GetBackgroundSyncContext() override; + PaymentAppContextImpl* GetPaymentAppContext() override; + BroadcastChannelProvider* GetBroadcastChannelProvider() override; ++ BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override; // mojom::StoragePartitionService interface. void OpenLocalStorage( -@@ -111,7 +110,8 @@ class CONTENT_EXPORT StoragePartitionImpl +@@ -115,7 +114,8 @@ class CONTENT_EXPORT StoragePartitionImpl BrowserContext* browser_context() const; // Called by each renderer process once. @@ -398,7 +400,7 @@ index f5cc21f..0a6cd2b 100644 } // namespace content diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h -index 909b370..0e37211 100644 +index ae4ba1e..f595bcf 100644 --- content/public/browser/storage_partition.h +++ content/public/browser/storage_partition.h @@ -13,6 +13,7 @@ @@ -409,11 +411,12 @@ index 909b370..0e37211 100644 #include "net/cookies/cookie_store.h" class GURL; -@@ -41,16 +42,23 @@ class DatabaseTracker; +@@ -41,16 +42,24 @@ class DatabaseTracker; namespace content { class AppCacheService; +class BackgroundSyncContext; ++class BluetoothAllowedDevicesMap; +class BroadcastChannelProvider; class BrowserContext; class CacheStorageContext; @@ -433,19 +436,20 @@ index 909b370..0e37211 100644 // Defines what persistent state a child process can access. // // The StoragePartition defines the view each child process has of the -@@ -74,6 +82,9 @@ class CONTENT_EXPORT StoragePartition { +@@ -74,6 +83,10 @@ class CONTENT_EXPORT StoragePartition { virtual HostZoomLevelContext* GetHostZoomLevelContext() = 0; virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0; virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0; + virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0; + virtual PaymentAppContextImpl* GetPaymentAppContext() = 0; + virtual BroadcastChannelProvider* GetBroadcastChannelProvider() = 0; ++ virtual BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() = 0; enum : uint32_t { REMOVE_DATA_MASK_APPCACHE = 1 << 0, -@@ -166,6 +177,10 @@ class CONTENT_EXPORT StoragePartition { - // unwritten data has been written out to the filesystem. - virtual void Flush() = 0; +@@ -169,6 +182,10 @@ class CONTENT_EXPORT StoragePartition { + // Clear the bluetooth allowed devices map. For test use only. + virtual void ClearBluetoothAllowedDevicesMapForTesting() = 0; + // Called by each renderer process once. + virtual void Bind( diff --git a/patch/patches/supports_user_data_1710.patch b/patch/patches/supports_user_data_1710.patch index 792a0a424..7b6b9c09b 100644 --- a/patch/patches/supports_user_data_1710.patch +++ b/patch/patches/supports_user_data_1710.patch @@ -1,16 +1,18 @@ diff --git supports_user_data.h supports_user_data.h -index a4c7c9f..54a151b 100644 +index 233ce38..02e690b 100644 --- supports_user_data.h +++ supports_user_data.h -@@ -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 +@@ -39,10 +39,10 @@ class BASE_EXPORT SupportsUserData { // delete the object if it is changed or the object is destroyed. + // TODO: remove the raw ptr version of SetUserData once everything uses + // the unique_ptr version, see crbug.com/690937. - Data* GetUserData(const void* key) const; - void SetUserData(const void* key, Data* data); +- void SetUserData(const void* key, std::unique_ptr data); - void RemoveUserData(const void* key); + virtual Data* GetUserData(const void* key) const; + virtual void SetUserData(const void* key, Data* data); ++ virtual void SetUserData(const void* key, std::unique_ptr data); + virtual void RemoveUserData(const void* key); // SupportsUserData is not thread-safe, and on debug build will assert it is diff --git a/patch/patches/ui_views_test_640741.patch b/patch/patches/ui_views_test_640741.patch index c0fecb164..5306d82b5 100644 --- a/patch/patches/ui_views_test_640741.patch +++ b/patch/patches/ui_views_test_640741.patch @@ -1,12 +1,12 @@ diff --git ui/views/test/ui_controls_factory_desktop_aurax11.cc ui/views/test/ui_controls_factory_desktop_aurax11.cc -index d7b41b1..6065c73 100644 +index 117a268..6065c73 100644 --- ui/views/test/ui_controls_factory_desktop_aurax11.cc +++ ui/views/test/ui_controls_factory_desktop_aurax11.cc @@ -146,10 +146,6 @@ class UIControlsDesktopX11 : public UIControlsAura { aura::test::QueryLatestMousePositionRequestInHost(host); host->ConvertPixelsToDIP(&root_current_location); -- auto screen = views::test::TestDesktopScreenX11::GetInstance(); +- auto* screen = views::test::TestDesktopScreenX11::GetInstance(); - DCHECK_EQ(screen, display::Screen::GetScreen()); - screen->set_cursor_screen_point(gfx::Point(screen_x, screen_y)); - diff --git a/patch/patches/views_1749.patch b/patch/patches/views_1749.patch index c3b3894d5..7628375f9 100644 --- a/patch/patches/views_1749.patch +++ b/patch/patches/views_1749.patch @@ -1,5 +1,5 @@ diff --git controls/button/menu_button.cc controls/button/menu_button.cc -index c4e986b..02fb9f3 100644 +index 173194b..8bb4f6e 100644 --- controls/button/menu_button.cc +++ controls/button/menu_button.cc @@ -193,7 +193,7 @@ void MenuButton::OnPaint(gfx::Canvas* canvas) { @@ -32,7 +32,7 @@ index c4e986b..02fb9f3 100644 + } // namespace views diff --git controls/button/menu_button.h controls/button/menu_button.h -index c232cc1..cc207f9 100644 +index b0ddf331..4d573ed 100644 --- controls/button/menu_button.h +++ controls/button/menu_button.h @@ -54,6 +54,9 @@ class VIEWS_EXPORT MenuButton : public LabelButton { @@ -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 147785c..5d413a1 100644 +index fcbee85..8ba4fd0 100644 --- view.h +++ view.h @@ -18,6 +18,7 @@ @@ -75,5 +75,5 @@ index 147785c..5d413a1 100644 + public ui::EventHandler, + public base::SupportsUserData { public: - typedef std::vector Views; + using Views = std::vector; diff --git a/patch/patches/views_menu_2102.patch b/patch/patches/views_menu_2102.patch index 086def634..f77dc70b9 100644 --- a/patch/patches/views_menu_2102.patch +++ b/patch/patches/views_menu_2102.patch @@ -1,5 +1,5 @@ diff --git ui/base/models/menu_model.h ui/base/models/menu_model.h -index 0755f27..76ad6d6 100644 +index 0755f27..0322b8c 100644 --- ui/base/models/menu_model.h +++ ui/base/models/menu_model.h @@ -15,6 +15,7 @@ @@ -10,7 +10,7 @@ index 0755f27..76ad6d6 100644 } namespace ui { -@@ -115,6 +116,30 @@ class UI_BASE_EXPORT MenuModel { +@@ -115,6 +116,27 @@ class UI_BASE_EXPORT MenuModel { // |event_flags| is a bit mask of ui::EventFlags. virtual void ActivatedAt(int index, int event_flags); @@ -24,15 +24,12 @@ index 0755f27..76ad6d6 100644 + virtual void UnhandledCloseSubmenu(bool is_rtl) {} + + // Override the text/background color of a given menu item dependent on the -+ // |index| and its |is_hovered| state. Returns true if it chooses to override -+ // the color. ++ // |index| and its |is_hovered| state. |is_minor| will be true for accelerator ++ // text. Returns true if it chooses to override the color. + virtual bool GetTextColor(int index, ++ bool is_minor, + bool is_hovered, + SkColor* override_color) const { return false; } -+ virtual bool GetMinorTextColor(int index, -+ bool is_hovered, -+ SkColor* override_color) const -+ { return false; } + virtual bool GetBackgroundColor(int index, + bool is_hovered, + SkColor* override_color) const @@ -42,10 +39,10 @@ index 0755f27..76ad6d6 100644 virtual void MenuWillShow() {} diff --git ui/gfx/render_text.cc ui/gfx/render_text.cc -index 78bc651..50a0231 100644 +index e3a15e6..5fae563 100644 --- ui/gfx/render_text.cc +++ ui/gfx/render_text.cc -@@ -592,6 +592,14 @@ void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { +@@ -595,6 +595,14 @@ void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { } } @@ -60,7 +57,7 @@ index 78bc651..50a0231 100644 void RenderText::SetDisplayRect(const Rect& r) { if (r != display_rect_) { display_rect_ = r; -@@ -1462,6 +1470,19 @@ void RenderText::OnTextAttributeChanged() { +@@ -1472,6 +1480,19 @@ void RenderText::OnTextAttributeChanged() { if (!multiline_ && replace_newline_chars_with_symbols_) base::ReplaceChars(layout_text_, kNewline, kNewlineSymbol, &layout_text_); @@ -81,10 +78,10 @@ index 78bc651..50a0231 100644 } diff --git ui/gfx/render_text.h ui/gfx/render_text.h -index 44ec077..5be1247 100644 +index bcb7314..4063073 100644 --- ui/gfx/render_text.h +++ ui/gfx/render_text.h -@@ -319,6 +319,10 @@ class GFX_EXPORT RenderText { +@@ -313,6 +313,10 @@ class GFX_EXPORT RenderText { void SetElideBehavior(ElideBehavior elide_behavior); ElideBehavior elide_behavior() const { return elide_behavior_; } @@ -95,7 +92,7 @@ index 44ec077..5be1247 100644 const Rect& display_rect() const { return display_rect_; } void SetDisplayRect(const Rect& r); -@@ -871,6 +875,8 @@ class GFX_EXPORT RenderText { +@@ -861,6 +865,8 @@ class GFX_EXPORT RenderText { // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. std::vector lines_; @@ -105,7 +102,7 @@ index 44ec077..5be1247 100644 }; diff --git ui/views/controls/button/label_button.cc ui/views/controls/button/label_button.cc -index 21891fc..97f148c 100644 +index 4a7cfd9..750a6ca 100644 --- ui/views/controls/button/label_button.cc +++ ui/views/controls/button/label_button.cc @@ -239,6 +239,7 @@ gfx::Size LabelButton::GetPreferredSize() const { @@ -117,7 +114,7 @@ index 21891fc..97f148c 100644 if (style_ == STYLE_BUTTON && PlatformStyle::kDefaultLabelButtonHasBoldFont) { // Some text appears wider when rendered normally than when rendered bold. diff --git ui/views/controls/label.cc ui/views/controls/label.cc -index 9b04c09..58066c14 100644 +index 2d16942..dc60700 100644 --- ui/views/controls/label.cc +++ ui/views/controls/label.cc @@ -28,6 +28,7 @@ @@ -127,8 +124,8 @@ index 9b04c09..58066c14 100644 +#include "ui/gfx/text_utils.h" #include "ui/native_theme/native_theme.h" #include "ui/strings/grit/ui_strings.h" - #include "ui/views/controls/menu/menu_runner.h" -@@ -36,6 +37,25 @@ + #include "ui/views/background.h" +@@ -37,6 +38,25 @@ #include "ui/views/selection_controller.h" namespace views { @@ -154,7 +151,7 @@ index 9b04c09..58066c14 100644 // static const char Label::kViewClassName[] = "Label"; const int Label::kFocusBorderPadding = 1; -@@ -210,6 +230,15 @@ void Label::SetElideBehavior(gfx::ElideBehavior elide_behavior) { +@@ -211,6 +231,15 @@ void Label::SetElideBehavior(gfx::ElideBehavior elide_behavior) { ResetLayout(); } @@ -170,7 +167,7 @@ index 9b04c09..58066c14 100644 void Label::SetTooltipText(const base::string16& tooltip_text) { DCHECK(handles_tooltips_); tooltip_text_ = tooltip_text; -@@ -440,7 +469,19 @@ std::unique_ptr Label::CreateRenderText( +@@ -445,7 +474,19 @@ std::unique_ptr Label::CreateRenderText( render_text->SetFontList(font_list()); render_text->set_shadows(shadows()); render_text->SetCursorEnabled(false); @@ -192,10 +189,10 @@ index 9b04c09..58066c14 100644 } diff --git ui/views/controls/label.h ui/views/controls/label.h -index 6293cff..d0a5a8f 100644 +index 516368e..22c597a 100644 --- ui/views/controls/label.h +++ ui/views/controls/label.h -@@ -117,6 +117,10 @@ class VIEWS_EXPORT Label : public View, +@@ -120,6 +120,10 @@ class VIEWS_EXPORT Label : public View, void SetElideBehavior(gfx::ElideBehavior elide_behavior); gfx::ElideBehavior elide_behavior() const { return elide_behavior_; } @@ -206,7 +203,7 @@ index 6293cff..d0a5a8f 100644 // Sets the tooltip text. Default behavior for a label (single-line) is to // show the full text if it is wider than its bounds. Calling this overrides // the default behavior and lets you set a custom tooltip. To revert to -@@ -333,6 +337,7 @@ class VIEWS_EXPORT Label : public View, +@@ -340,6 +344,7 @@ class VIEWS_EXPORT Label : public View, bool collapse_when_hidden_; int fixed_width_; int max_width_; @@ -215,10 +212,10 @@ index 6293cff..d0a5a8f 100644 // TODO(ckocagil): Remove is_first_paint_text_ before crbug.com/441028 is // closed. diff --git ui/views/controls/menu/menu_controller.cc ui/views/controls/menu/menu_controller.cc -index 79ff77c..a0582c0 100644 +index 335945f..99ad0d9 100644 --- ui/views/controls/menu/menu_controller.cc +++ ui/views/controls/menu/menu_controller.cc -@@ -2254,8 +2254,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( +@@ -2270,8 +2270,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( void MenuController::OpenSubmenuChangeSelectionIfCan() { MenuItemView* item = pending_state_.item; @@ -233,7 +230,7 @@ index 79ff77c..a0582c0 100644 MenuItemView* to_select = NULL; if (item->GetSubmenu()->GetMenuItemCount() > 0) to_select = FindInitialSelectableMenuItem(item, INCREMENT_SELECTION_DOWN); -@@ -2270,8 +2275,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() { +@@ -2286,8 +2291,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() { void MenuController::CloseSubmenu() { MenuItemView* item = state_.item; DCHECK(item); @@ -246,25 +243,41 @@ index 79ff77c..a0582c0 100644 SetSelection(item, SELECTION_UPDATE_IMMEDIATELY); else if (item->GetParentMenuItem()->GetParentMenuItem()) diff --git ui/views/controls/menu/menu_delegate.h ui/views/controls/menu/menu_delegate.h -index 3b7cb7f..7481553 100644 +index db99e54..7c67a04 100644 --- ui/views/controls/menu/menu_delegate.h +++ ui/views/controls/menu/menu_delegate.h -@@ -87,6 +87,14 @@ class VIEWS_EXPORT MenuDelegate { - bool is_hovered, - SkColor* override_color) const; +@@ -10,6 +10,7 @@ -+ // Override the minor text color of a given menu item dependent on the + #include "base/logging.h" + #include "base/strings/string16.h" ++#include "third_party/skia/include/core/SkColor.h" + #include "ui/base/dragdrop/drag_drop_types.h" + #include "ui/base/dragdrop/os_exchange_data.h" + #include "ui/base/ui_base_types.h" +@@ -75,6 +76,22 @@ class VIEWS_EXPORT MenuDelegate { + // Whether this item should be displayed with the normal text color, even if + // it's disabled. + virtual bool GetShouldUseNormalForegroundColor(int command_id) const; ++ ++ // Override the text color of a given menu item dependent on the |command_id| ++ // and its |is_hovered| state. |is_minor| will be true for accelerator text. ++ // Returns true if it chooses to override the color. ++ virtual bool GetTextColor(int command_id, ++ bool is_minor, ++ bool is_hovered, ++ SkColor* override_color) const { return false; } ++ ++ // Override the background color of a given menu item dependent on the + // |command_id| and its |is_hovered| state. Returns true if it chooses to + // override the color. -+ virtual bool GetMinorTextColor(int command_id, -+ bool is_hovered, -+ SkColor* override_color) const -+ { return false; } -+ - // Override the background color of a given menu item dependent on the - // |command_id| and its |is_hovered| state. Returns true if it chooses to - // override the color. -@@ -229,6 +237,11 @@ class VIEWS_EXPORT MenuDelegate { ++ virtual bool GetBackgroundColor(int command_id, ++ bool is_hovered, ++ SkColor* override_color) const ++ { return false; } + + // The tooltip shown for the menu item. This is invoked when the user + // hovers over the item, and no tooltip text has been set for that item. +@@ -208,6 +225,11 @@ class VIEWS_EXPORT MenuDelegate { bool* has_mnemonics, MenuButton** button); @@ -277,43 +290,42 @@ index 3b7cb7f..7481553 100644 virtual int GetMaxWidthForMenu(MenuItemView* menu); diff --git ui/views/controls/menu/menu_item_view.cc ui/views/controls/menu/menu_item_view.cc -index b4129049..a23670a 100644 +index 450cf5a..2a0cbcf 100644 --- ui/views/controls/menu/menu_item_view.cc +++ ui/views/controls/menu/menu_item_view.cc -@@ -871,6 +871,17 @@ void MenuItemView::PaintMinorText(gfx::Canvas* canvas, - if (minor_text.empty()) - return; +@@ -759,7 +759,12 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { + // only need the background when we want it to look different, as when we're + // selected. + ui::NativeTheme* native_theme = GetNativeTheme(); +- if (render_selection) { ++ SkColor override_color; ++ if (delegate && delegate->GetBackgroundColor(GetCommand(), ++ render_selection, ++ &override_color)) { ++ canvas->DrawColor(override_color); ++ } else if (render_selection) { + gfx::Rect item_bounds(0, 0, width(), height()); + AdjustBoundsForRTLUI(&item_bounds); +@@ -871,6 +876,13 @@ void MenuItemView::PaintMinorText(gfx::Canvas* canvas, SkColor color) { + SkColor MenuItemView::GetTextColor(bool minor, + bool render_selection, + bool emphasized) const { + SkColor text_color; -+ -+ MenuDelegate *delegate = GetDelegate(); -+ if (!delegate || !delegate->GetMinorTextColor(GetCommand(), -+ render_selection, -+ &text_color)) { -+ text_color = GetNativeTheme()->GetSystemColor(render_selection ? -+ ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor : -+ ui::NativeTheme::kColorId_MenuItemSubtitleColor); ++ const MenuDelegate *delegate = GetDelegate(); ++ if (delegate && delegate->GetTextColor(GetCommand(), minor, render_selection, ++ &text_color)) { ++ return text_color; + } + - int available_height = height() - GetTopMargin() - GetBottomMargin(); - int max_accel_width = - parent_menu_item_->GetSubmenu()->max_minor_text_width(); -@@ -889,9 +900,7 @@ void MenuItemView::PaintMinorText(gfx::Canvas* canvas, - canvas->DrawStringRectWithFlags( - minor_text, - GetFontList(), -- GetNativeTheme()->GetSystemColor(render_selection ? -- ui::NativeTheme::kColorId_SelectedMenuItemForegroundColor : -- ui::NativeTheme::kColorId_MenuItemSubtitleColor), -+ text_color, - accel_bounds, - flags); - } + ui::NativeTheme::ColorId color_id = + minor ? ui::NativeTheme::kColorId_MenuItemSubtitleColor + : ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor; diff --git ui/views/controls/menu/menu_model_adapter.cc ui/views/controls/menu/menu_model_adapter.cc -index bc04dcb..d786a0b 100644 +index bc04dcb..1f821d9 100644 --- ui/views/controls/menu/menu_model_adapter.cc +++ ui/views/controls/menu/menu_model_adapter.cc -@@ -245,6 +245,88 @@ void MenuModelAdapter::SelectionChanged(MenuItemView* menu) { +@@ -245,6 +245,77 @@ void MenuModelAdapter::SelectionChanged(MenuItemView* menu) { NOTREACHED(); } @@ -360,25 +372,14 @@ index bc04dcb..d786a0b 100644 + NOTREACHED(); +} + -+bool MenuModelAdapter::GetForegroundColor(int command_id, -+ bool is_hovered, -+ SkColor* override_color) const { ++bool MenuModelAdapter::GetTextColor(int command_id, ++ bool is_minor, ++ bool is_hovered, ++ SkColor* override_color) const { + ui::MenuModel* model = menu_model_; + int index = 0; + if (ui::MenuModel::GetModelAndIndexForCommandId(command_id, &model, &index)) -+ return model->GetTextColor(index, is_hovered, override_color); -+ -+ NOTREACHED(); -+ return false; -+} -+ -+bool MenuModelAdapter::GetMinorTextColor(int command_id, -+ bool is_hovered, -+ SkColor* override_color) const { -+ ui::MenuModel* model = menu_model_; -+ int index = 0; -+ if (ui::MenuModel::GetModelAndIndexForCommandId(command_id, &model, &index)) -+ return model->GetMinorTextColor(index, is_hovered, override_color); ++ return model->GetTextColor(index, is_minor, is_hovered, override_color); + + NOTREACHED(); + return false; @@ -403,10 +404,10 @@ index bc04dcb..d786a0b 100644 // Look up the menu model for this menu. const std::map::const_iterator map_iterator = diff --git ui/views/controls/menu/menu_model_adapter.h ui/views/controls/menu/menu_model_adapter.h -index c9799da..827f786 100644 +index c9799da..401e7a7 100644 --- ui/views/controls/menu/menu_model_adapter.h +++ ui/views/controls/menu/menu_model_adapter.h -@@ -76,6 +76,22 @@ class VIEWS_EXPORT MenuModelAdapter : public MenuDelegate { +@@ -76,6 +76,20 @@ class VIEWS_EXPORT MenuModelAdapter : public MenuDelegate { bool IsCommandVisible(int id) const override; bool IsItemChecked(int id) const override; void SelectionChanged(MenuItemView* menu) override; @@ -417,12 +418,10 @@ index c9799da..827f786 100644 + MenuButton** button) override; + void OnUnhandledOpenSubmenu(MenuItemView* menu, bool is_rtl) override; + void OnUnhandledCloseSubmenu(MenuItemView* menu, bool is_rtl) override; -+ bool GetForegroundColor(int command_id, -+ bool is_hovered, -+ SkColor* override_color) const override; -+ bool GetMinorTextColor(int command_id, -+ bool is_hovered, -+ SkColor* override_color) const override; ++ bool GetTextColor(int command_id, ++ bool is_minor, ++ bool is_hovered, ++ SkColor* override_color) const override; + bool GetBackgroundColor(int command_id, + bool is_hovered, + SkColor* override_color) const override; @@ -430,7 +429,7 @@ index c9799da..827f786 100644 void WillHideMenu(MenuItemView* menu) override; void OnMenuClosed(MenuItemView* menu, MenuRunner::RunResult result) override; diff --git ui/views/controls/menu/menu_scroll_view_container.cc ui/views/controls/menu/menu_scroll_view_container.cc -index 455d289..f5f7419 100644 +index 124442a..c5cfe8b 100644 --- ui/views/controls/menu/menu_scroll_view_container.cc +++ ui/views/controls/menu/menu_scroll_view_container.cc @@ -184,6 +184,11 @@ MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) diff --git a/patch/patches/views_widget_180_1481_1565_1677_1749.patch b/patch/patches/views_widget_180_1481_1565_1677_1749.patch index 5022c7edc..077ebd4cf 100644 --- a/patch/patches/views_widget_180_1481_1565_1677_1749.patch +++ b/patch/patches/views_widget_180_1481_1565_1677_1749.patch @@ -1,8 +1,8 @@ diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc -index 11482ff..57e8b58 100644 +index 029e72d..07d574d 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() +@@ -41,6 +41,7 @@ RenderWidgetHostViewBase::RenderWidgetHostViewBase() current_device_scale_factor_(0), current_display_rotation_(display::Display::ROTATE_0), text_input_manager_(nullptr), @@ -10,7 +10,7 @@ index 11482ff..57e8b58 100644 renderer_frame_number_(0), weak_factory_(this) { } -@@ -336,6 +337,14 @@ void RenderWidgetHostViewBase::FocusedNodeTouched( +@@ -325,6 +326,14 @@ void RenderWidgetHostViewBase::FocusedNodeTouched( DVLOG(1) << "FocusedNodeTouched: " << editable; } @@ -26,10 +26,10 @@ index 11482ff..57e8b58 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 08aad92..d6fa32c0 100644 +index 657ad20..fcd514a 100644 --- content/browser/renderer_host/render_widget_host_view_base.h +++ content/browser/renderer_host/render_widget_host_view_base.h -@@ -67,6 +67,7 @@ class BrowserAccessibilityDelegate; +@@ -66,6 +66,7 @@ class BrowserAccessibilityDelegate; class BrowserAccessibilityManager; class RenderWidgetHostImpl; class RenderWidgetHostViewBaseObserver; @@ -37,7 +37,7 @@ index 08aad92..d6fa32c0 100644 class SyntheticGestureTarget; class TextInputManager; class WebCursor; -@@ -107,6 +108,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -115,6 +116,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, void EndFrameSubscription() override; void FocusedNodeTouched(const gfx::Point& location_dips_screen, bool editable) override; @@ -46,7 +46,7 @@ index 08aad92..d6fa32c0 100644 // This only needs to be overridden by RenderWidgetHostViewBase subclasses // that handle content embedded within other RenderWidgetHostViews. -@@ -330,6 +333,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -338,6 +341,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, // helps to position the full screen widget on the correct monitor. virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0; @@ -59,7 +59,7 @@ index 08aad92..d6fa32c0 100644 // Sets the cursor to the one associated with the specified cursor_type virtual void UpdateCursor(const WebCursor& cursor) = 0; -@@ -491,6 +500,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -442,6 +451,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, // destroyed before the RWHV is destroyed. TextInputManager* text_input_manager_; @@ -71,7 +71,7 @@ index 08aad92..d6fa32c0 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 2307c54..7944580 100644 +index 628aa29..f2098f9 100644 --- content/browser/renderer_host/render_widget_host_view_event_handler.cc +++ content/browser/renderer_host/render_widget_host_view_event_handler.cc @@ -28,6 +28,10 @@ @@ -85,7 +85,7 @@ index 2307c54..7944580 100644 #if defined(OS_WIN) #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/public/common/context_menu_params.h" -@@ -805,6 +809,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { +@@ -817,6 +821,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { } } #endif @@ -101,10 +101,10 @@ index 2307c54..7944580 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 71c693b..fffee17 100644 +index 8d52b0f..eda7104 100644 --- content/public/browser/render_widget_host_view.h +++ content/public/browser/render_widget_host_view.h -@@ -174,6 +174,14 @@ class CONTENT_EXPORT RenderWidgetHostView { +@@ -233,6 +233,14 @@ class CONTENT_EXPORT RenderWidgetHostView { // when the value has changed. Views must initially default to false. virtual void SetNeedsBeginFrames(bool needs_begin_frames) = 0; @@ -133,10 +133,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 5eb0d54..89c614a 100644 +index 2756595..6385de1 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -84,6 +84,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( +@@ -85,6 +85,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( should_animate_window_close_(false), pending_close_(false), has_non_client_view_(false), @@ -144,7 +144,7 @@ index 5eb0d54..89c614a 100644 tooltip_(NULL) { } -@@ -119,8 +120,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window, +@@ -120,8 +121,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window, native_widget_delegate_); HWND parent_hwnd = NULL; @@ -158,7 +158,7 @@ index 5eb0d54..89c614a 100644 remove_standard_frame_ = params.remove_standard_frame; has_non_client_view_ = Widget::RequiresNonClientView(params.type); -@@ -819,11 +824,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { +@@ -824,11 +829,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { } void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { @@ -177,10 +177,10 @@ index 5eb0d54..89c614a 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 b69a1f7..0e60fec 100644 +index 12d0616..ec5742a 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -255,6 +255,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -256,6 +256,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin // True if the window should have the frame removed. bool remove_standard_frame_; @@ -192,7 +192,7 @@ index b69a1f7..0e60fec 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 3b848bc..716ab57 100644 +index 448baf89..0bebfd8 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc @@ -194,6 +194,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( @@ -206,7 +206,7 @@ index 3b848bc..716ab57 100644 @@ -207,6 +208,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( has_window_focus_(false), has_pointer_focus_(false), - modal_dialog_xid_(0), + modal_dialog_counter_(0), + xwindow_destroyed_(false), close_widget_factory_(this), weak_factory_(this) {} @@ -239,7 +239,7 @@ index 3b848bc..716ab57 100644 return ToDIPRect(bounds_in_pixels_); } -@@ -1279,6 +1286,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( +@@ -1289,6 +1296,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( } gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const { @@ -248,7 +248,7 @@ index 3b848bc..716ab57 100644 return bounds_in_pixels_.origin(); } -@@ -1405,9 +1414,15 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1415,9 +1424,15 @@ void DesktopWindowTreeHostX11::InitX11Window( attribute_mask |= CWBorderPixel; swa.border_pixel = 0; @@ -265,7 +265,7 @@ index 3b848bc..716ab57 100644 bounds_in_pixels_.y(), bounds_in_pixels_.width(), bounds_in_pixels_.height(), 0, // border width -@@ -2038,6 +2053,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( +@@ -2048,6 +2063,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( } break; } @@ -277,12 +277,12 @@ index 3b848bc..716ab57 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 f592e1e..6bf0f4d 100644 +index 544f086..0e81c59 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -@@ -91,6 +91,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 - // there is no dialog on the host window. - XID GetModalDialog(); +@@ -87,6 +87,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 + // Disables event listening to make |dialog| modal. + std::unique_ptr DisableEventListening(); + void set_screen_bounds(const gfx::Rect& bounds) { screen_bounds_ = bounds; } + @@ -293,7 +293,7 @@ index f592e1e..6bf0f4d 100644 protected: // Overridden from DesktopWindowTreeHost: void Init(aura::Window* content_window, -@@ -305,6 +311,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -302,6 +308,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // The bounds of |xwindow_|. gfx::Rect bounds_in_pixels_; @@ -303,7 +303,7 @@ index f592e1e..6bf0f4d 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 -@@ -344,6 +353,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -341,6 +350,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // Whether we used an ARGB visual for our window. bool use_argb_visual_; @@ -314,9 +314,9 @@ index f592e1e..6bf0f4d 100644 DesktopDragDropClientAuraX11* drag_drop_client_; std::unique_ptr x11_non_client_event_filter_; -@@ -431,6 +444,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -428,6 +441,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 - XID modal_dialog_xid_; + uint32_t modal_dialog_counter_; + // True if the xwindow has already been destroyed. + bool xwindow_destroyed_; @@ -325,10 +325,10 @@ index f592e1e..6bf0f4d 100644 base::WeakPtrFactory weak_factory_; diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc -index 8b06275..45b100d 100644 +index 38ade37..e66b0cd 100644 --- ui/views/widget/widget.cc +++ ui/views/widget/widget.cc -@@ -129,6 +129,7 @@ Widget::InitParams::InitParams(Type type) +@@ -131,6 +131,7 @@ Widget::InitParams::InitParams(Type type) use_system_default_icon(false), show_state(ui::SHOW_STATE_DEFAULT), parent(nullptr), @@ -336,7 +336,7 @@ index 8b06275..45b100d 100644 native_widget(nullptr), desktop_window_tree_host(nullptr), layer_type(ui::LAYER_TEXTURED), -@@ -296,7 +297,7 @@ void Widget::Init(const InitParams& in_params) { +@@ -306,7 +307,7 @@ void Widget::Init(const InitParams& in_params) { params.name = params.delegate->GetContentsView()->GetClassName(); params.child |= (params.type == InitParams::TYPE_CONTROL); @@ -345,7 +345,7 @@ index 8b06275..45b100d 100644 if (params.opacity == views::Widget::InitParams::INFER_OPACITY && params.type != views::Widget::InitParams::TYPE_WINDOW && -@@ -360,7 +361,12 @@ void Widget::Init(const InitParams& in_params) { +@@ -370,7 +371,12 @@ void Widget::Init(const InitParams& in_params) { } } else if (params.delegate) { SetContentsView(params.delegate->GetContentsView()); @@ -360,22 +360,22 @@ index 8b06275..45b100d 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 2c5ba16..87046a0 100644 +index 2a239c4..3d02b48 100644 --- ui/views/widget/widget.h +++ ui/views/widget/widget.h -@@ -250,6 +250,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, +@@ -253,6 +253,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // Whether the widget should be maximized or minimized. ui::WindowShowState show_state; gfx::NativeView parent; + gfx::AcceleratedWidget parent_widget; - // Used only by mus and is necessitated by mus not being a NativeView. - ui::Window* parent_mus = nullptr; // Specifies the initial bounds of the Widget. Default is empty, which means + // the NativeWidget may specify a default size. If the parent is specified, + // |bounds| is in the parent's coordinate system. If the parent is not diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc -index a58c5f7..712f1d6 100644 +index 810b9cb..fc339da 100644 --- ui/views/win/hwnd_message_handler.cc +++ ui/views/win/hwnd_message_handler.cc -@@ -2540,8 +2540,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -2539,8 +2539,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, active_mouse_tracking_flags_ = 0; } else if (event.type() == ui::ET_MOUSEWHEEL) { // Reroute the mouse wheel to the window under the pointer if applicable. diff --git a/patch/patches/web_contents_1257_1565.patch b/patch/patches/web_contents_1257_1565.patch index 88f1acc36..e0d8d7cd5 100644 --- a/patch/patches/web_contents_1257_1565.patch +++ b/patch/patches/web_contents_1257_1565.patch @@ -1,8 +1,8 @@ diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc -index 35b6f47..932fe44 100644 +index 8800f75..edbd8eb 100644 --- content/browser/web_contents/web_contents_impl.cc +++ content/browser/web_contents/web_contents_impl.cc -@@ -1560,6 +1560,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1571,6 +1571,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::string unique_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); @@ -15,7 +15,7 @@ index 35b6f47..932fe44 100644 WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -1570,6 +1576,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1581,6 +1587,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { view_.reset(CreateWebContentsView(this, delegate, &render_view_host_delegate_view_)); } @@ -23,7 +23,7 @@ index 35b6f47..932fe44 100644 if (browser_plugin_guest_ && !GuestMode::IsCrossProcessFrameGuest(this)) { view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), -@@ -2075,6 +2082,12 @@ void WebContentsImpl::CreateNewWindow( +@@ -2093,6 +2100,12 @@ void WebContentsImpl::CreateNewWindow( create_params.renderer_initiated_creation = main_frame_route_id != MSG_ROUTING_NONE; @@ -36,7 +36,7 @@ index 35b6f47..932fe44 100644 WebContentsImpl* new_contents = NULL; if (!is_guest) { create_params.context = view_->GetNativeView(); -@@ -2104,7 +2117,7 @@ void WebContentsImpl::CreateNewWindow( +@@ -2122,7 +2135,7 @@ void WebContentsImpl::CreateNewWindow( // TODO(brettw): It seems bogus that we have to call this function on the // newly created object and give it one of its own member variables. new_view->CreateViewForWidget( @@ -45,7 +45,7 @@ index 35b6f47..932fe44 100644 } // Save the created window associated with the route so we can show it // later. -@@ -4989,7 +5002,7 @@ NavigationEntry* +@@ -4985,7 +4998,7 @@ NavigationEntry* void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager( RenderViewHost* render_view_host) { RenderWidgetHostViewBase* rwh_view = @@ -70,10 +70,10 @@ 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 a5e2535..704c137 100644 +index 5a509ef..981a0a5 100644 --- content/public/browser/web_contents.h +++ content/public/browser/web_contents.h -@@ -59,9 +59,11 @@ class PageState; +@@ -60,9 +60,11 @@ class PageState; class RenderFrameHost; class RenderProcessHost; class RenderViewHost; @@ -85,7 +85,7 @@ index a5e2535..704c137 100644 struct CustomContextMenuContext; struct DropData; struct Manifest; -@@ -162,6 +164,10 @@ class WebContents : public PageNavigator, +@@ -163,6 +165,10 @@ class WebContents : public PageNavigator, // Note that the pre-created renderer process may not be used if the first // navigation requires a dedicated or privileged process, such as a WebUI. bool initialize_renderer; @@ -97,7 +97,7 @@ index a5e2535..704c137 100644 // Creates a new WebContents. diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h -index 6456878..339f9b8 100644 +index 6f966c7..71f2f2e 100644 --- content/public/browser/web_contents_delegate.h +++ content/public/browser/web_contents_delegate.h @@ -42,11 +42,13 @@ class ColorChooser; @@ -114,7 +114,7 @@ index 6456878..339f9b8 100644 struct ColorSuggestion; struct ContextMenuParams; struct DropData; -@@ -325,6 +327,12 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -329,6 +331,12 @@ class CONTENT_EXPORT WebContentsDelegate { const std::string& partition_id, SessionStorageNamespace* session_storage_namespace); diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index 01d45b270..07e055584 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 11d980e..a87fb7e 100644 +index a5721cf..d89dcff 100644 --- Source/web/ChromeClientImpl.cpp +++ Source/web/ChromeClientImpl.cpp -@@ -895,7 +895,7 @@ bool ChromeClientImpl::hasOpenedPopup() const { +@@ -898,7 +898,7 @@ bool ChromeClientImpl::hasOpenedPopup() const { PopupMenu* ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select) { notifyPopupOpeningObservers(); @@ -12,10 +12,10 @@ index 11d980e..a87fb7e 100644 DCHECK(RuntimeEnabledFeatures::pagePopupEnabled()); diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp -index 6a7688b..7ca2fab 100644 +index 8a38208..90784a8 100644 --- Source/web/WebViewImpl.cpp +++ Source/web/WebViewImpl.cpp -@@ -358,6 +358,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, +@@ -357,6 +357,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, m_enableFakePageScaleAnimationForTesting(false), m_fakePageScaleAnimationPageScaleFactor(0), m_fakePageScaleAnimationUseAnchor(false), @@ -39,10 +39,10 @@ index 6a7688b..7ca2fab 100644 void WebViewImpl::setBackgroundColorOverride(WebColor color) { diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h -index e4ad02f..8bfaa1c 100644 +index f94b695..4828185 100644 --- Source/web/WebViewImpl.h +++ Source/web/WebViewImpl.h -@@ -371,7 +371,8 @@ class WEB_EXPORT WebViewImpl final +@@ -369,7 +369,8 @@ class WEB_EXPORT WebViewImpl final // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). @@ -52,7 +52,7 @@ index e4ad02f..8bfaa1c 100644 bool shouldAutoResize() const { return m_shouldAutoResize; } -@@ -651,6 +652,8 @@ class WEB_EXPORT WebViewImpl final +@@ -652,6 +653,8 @@ class WEB_EXPORT WebViewImpl final float m_fakePageScaleAnimationPageScaleFactor; bool m_fakePageScaleAnimationUseAnchor; @@ -62,10 +62,10 @@ index e4ad02f..8bfaa1c 100644 TransformationMatrix m_deviceEmulationTransform; diff --git public/web/WebView.h public/web/WebView.h -index 061f017..9fd430e 100644 +index 92bdf07..1a813a9 100644 --- public/web/WebView.h +++ public/web/WebView.h -@@ -404,6 +404,7 @@ class WebView : protected WebWidget { +@@ -402,6 +402,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 b34af90e6..c68e6cacf 100644 --- a/patch/patches/webui_2037.patch +++ b/patch/patches/webui_2037.patch @@ -1,25 +1,18 @@ diff --git chrome/browser/ui/webui/net_internals/net_internals_ui.cc chrome/browser/ui/webui/net_internals/net_internals_ui.cc -index 354238a..42f1829 100644 +index 268d526..607f7e3 100644 --- chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ chrome/browser/ui/webui/net_internals/net_internals_ui.cc -@@ -572,16 +572,6 @@ void NetInternalsMessageHandler::OnGetSessionNetworkStats( +@@ -530,8 +530,7 @@ 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)); + SendJavascriptCommand( +- "receivedSessionNetworkStats", +- chrome_browser_net::GetSessionNetworkStats(Profile::FromWebUI(web_ui()))); ++ "receivedSessionNetworkStats", nullptr); } -@@ -707,9 +697,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( + + void NetInternalsMessageHandler::OnGetExtensionInfo( +@@ -627,9 +626,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( PrePopulateEventList(); @@ -40,7 +33,7 @@ index 354238a..42f1829 100644 } void NetInternalsMessageHandler::IOThreadImpl::OnGetNetInfo( -@@ -1146,8 +1144,10 @@ void NetInternalsMessageHandler::IOThreadImpl::PrePopulateEventList() { +@@ -1032,8 +1039,10 @@ void NetInternalsMessageHandler::IOThreadImpl::PrePopulateEventList() { std::set contexts; for (const auto& getter : context_getters_) contexts.insert(getter->GetURLRequestContext()); diff --git a/patch/patches/webview_plugin_2020.patch b/patch/patches/webview_plugin_2020.patch index bb3945f91..b2cbe5cdc 100644 --- a/patch/patches/webview_plugin_2020.patch +++ b/patch/patches/webview_plugin_2020.patch @@ -1,8 +1,8 @@ diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd -index 990cffa..e1099ae 100644 +index c10c883..a03df69 100644 --- chrome/app/generated_resources.grd +++ chrome/app/generated_resources.grd -@@ -7137,7 +7137,7 @@ Keep your key file in a safe place. You will need it to create new versions of y +@@ -6771,7 +6771,7 @@ Keep your key file in a safe place. You will need it to create new versions of y diff --git a/patch/patches/zlib.patch b/patch/patches/zlib.patch index 9165c63a8..94e9f3a07 100644 --- a/patch/patches/zlib.patch +++ b/patch/patches/zlib.patch @@ -1,5 +1,5 @@ diff --git contrib/minizip/unzip.c contrib/minizip/unzip.c -index 2d5f0b1..d3d5476 100644 +index 199b472..be42478 100644 --- contrib/minizip/unzip.c +++ contrib/minizip/unzip.c @@ -69,7 +69,7 @@ diff --git a/tests/cefclient/common/scheme_test_common.cc b/tests/cefclient/common/scheme_test_common.cc index 674799ac6..2c0410e65 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(CefRawPtr registrar, std::vector& cookiable_schemes) { - registrar->AddCustomScheme("client", true, false, false, false, true); + registrar->AddCustomScheme("client", true, false, false, false, true, false); } } // namespace scheme_test diff --git a/tests/ceftests/cookie_unittest.cc b/tests/ceftests/cookie_unittest.cc index df95ce1f2..dcd78b7dc 100644 --- a/tests/ceftests/cookie_unittest.cc +++ b/tests/ceftests/cookie_unittest.cc @@ -1339,5 +1339,5 @@ void RegisterCookieCustomSchemes( CefRawPtr registrar, std::vector& cookiable_schemes) { // Used by GetCookieManagerCustom test. - registrar->AddCustomScheme("ccustom", true, false, false, false, true); + registrar->AddCustomScheme("ccustom", true, false, false, false, true, false); } diff --git a/tests/ceftests/message_router_unittest.cc b/tests/ceftests/message_router_unittest.cc index 28ff3c067..7be243296 100644 --- a/tests/ceftests/message_router_unittest.cc +++ b/tests/ceftests/message_router_unittest.cc @@ -1058,6 +1058,8 @@ class MultiQueryManager : public CefMessageRouterBrowserSide::Handler { virtual ~MultiQueryManager() {} + std::string label() const { return label_; } + void AddObserver(Observer* observer) { EXPECT_FALSE(running_); observer_set_.insert(observer); @@ -2274,15 +2276,12 @@ class MultiQueryManagerMap : MultiQueryManager* CreateManager(const std::string& url, bool synchronous) { EXPECT_FALSE(finalized_); - // The sub-frame resource should not already exist. - URLManagerMap::const_iterator it = manager_map_.find(url); - EXPECT_EQ(it, manager_map_.end()); - MultiQueryManager* manager = new MultiQueryManager(url, synchronous, static_cast(manager_map_.size()) * 1000); manager->AddObserver(this); - manager_map_.insert(std::make_pair(url, manager)); + all_managers_.push_back(manager); + pending_managers_.push_back(manager); return manager; } @@ -2298,11 +2297,10 @@ class MultiQueryManagerMap : std::string html = "\n"; - URLManagerMap::const_iterator it = manager_map_.begin(); - for (; it != manager_map_.end(); ++it) { - const std::string& name = GetNameForURL(it->first); - html += "\n"; + for (size_t i = 0; i < all_managers_.size(); ++i) { + const std::string& url = all_managers_[i]->label(); + const std::string& name = GetNameForURL(url); + html += "\n"; } html += ""; @@ -2347,7 +2345,7 @@ class MultiQueryManagerMap : } void OnManualQueriesCompleted(MultiQueryManager* manager) override { - const int size = static_cast(manager_map_.size()); + const int size = static_cast(all_managers_.size()); EXPECT_LT(manual_complete_count_, size); if (++manual_complete_count_ == size) { running_ = false; @@ -2367,7 +2365,7 @@ class MultiQueryManagerMap : } void OnAllQueriesCompleted(MultiQueryManager* manager) override { - const int size = static_cast(manager_map_.size()); + const int size = static_cast(all_managers_.size()); EXPECT_LT(total_complete_count_, size); if (++total_complete_count_ == size) { running_ = false; @@ -2389,9 +2387,8 @@ class MultiQueryManagerMap : bool AllComplete() const { EXPECT_TRUE(finalized_); - URLManagerMap::const_iterator it = manager_map_.begin(); - for (; it != manager_map_.end(); ++it) { - if (!it->second->IsAllComplete()) + for (size_t i = 0; i < all_managers_.size(); ++i) { + if (!all_managers_[i]->IsAllComplete()) return false; } return true; @@ -2399,53 +2396,82 @@ class MultiQueryManagerMap : void AssertAllComplete() const { EXPECT_TRUE(finalized_); + EXPECT_TRUE(pending_managers_.empty()); EXPECT_FALSE(running_); - URLManagerMap::const_iterator it = manager_map_.begin(); - for (; it != manager_map_.end(); ++it) - it->second->AssertAllComplete(); + for (size_t i = 0; i < all_managers_.size(); ++i) { + all_managers_[i]->AssertAllComplete(); + } } bool HasAutoQueries() const { - if (manager_map_.empty()) - return false; - - URLManagerMap::const_iterator it = manager_map_.begin(); - for (; it != manager_map_.end(); ++it) { - if (it->second->HasAutoQueries()) + for (size_t i = 0; i < all_managers_.size(); ++i) { + if (all_managers_[i]->HasAutoQueries()) return true; } return false; } + void OnLoadStart(CefRefPtr browser, + CefRefPtr frame) { + if (pending_managers_.empty()) + return; + + const std::string& expected_url = frame->GetURL(); + MultiQueryManager* next_manager = nullptr; + + // Find the pending manager that matches the expected URL. + ManagerList::iterator it = pending_managers_.begin(); + for (; it != pending_managers_.end(); ++it) { + if ((*it)->label() == expected_url) { + next_manager = *it; + pending_managers_.erase(it); + break; + } + } + + EXPECT_TRUE(next_manager); + + const int browser_id = browser->GetIdentifier(); + // Always use the same ID for the main frame. + const int64 frame_id = frame->IsMain() ? -1 : frame->GetIdentifier(); + + const std::pair& id = std::make_pair(browser_id, frame_id); + + // Remove the currently active manager, if any. + ManagerMap::iterator it2 = manager_map_.find(id); + if (it2 != manager_map_.end()) + manager_map_.erase(it2); + + // Add the next manager to the active map. + manager_map_.insert(std::make_pair(id, next_manager)); + } + MultiQueryManager* GetManager(CefRefPtr browser, CefRefPtr frame) const { - const std::string& url = frame->GetURL(); - URLManagerMap::const_iterator it = manager_map_.find(url); - EXPECT_NE(it, manager_map_.end()); + const int browser_id = browser->GetIdentifier(); + // Always use the same ID for the main frame. + const int64 frame_id = frame->IsMain() ? -1 : frame->GetIdentifier(); + + // Find the manager in the active map. + ManagerMap::const_iterator it = + manager_map_.find(std::make_pair(browser_id, frame_id)); + EXPECT_NE(it, manager_map_.end()) << + "browser_id = " << browser_id << ", frame_id = " << frame_id; return it->second; } void RemoveAllManagers() { - if (manager_map_.empty()) + EXPECT_TRUE(pending_managers_.empty()); + if (all_managers_.empty()) return; - URLManagerMap::const_iterator it = manager_map_.begin(); - for (; it != manager_map_.end(); ++it) - delete it->second; - manager_map_.clear(); - } - - std::string GetURLForManager(MultiQueryManager* manager) const { - if (!manager_map_.empty()) { - URLManagerMap::const_iterator it = manager_map_.begin(); - for (; it != manager_map_.end(); ++it) { - if (it->second == manager) - return it->first; - } + for (size_t i = 0; i < all_managers_.size(); ++i) { + delete all_managers_[i]; } - return std::string(); + all_managers_.clear(); + manager_map_.clear(); } static std::string GetNameForURL(const std::string& url) { @@ -2457,9 +2483,16 @@ class MultiQueryManagerMap : } private: - // Map of page URL to MultiQueryManager instance. - typedef std::map URLManagerMap; - URLManagerMap manager_map_; + typedef std::vector ManagerList; + // Map of (browser ID, frame ID) to manager. + typedef std::map, MultiQueryManager*> ManagerMap; + + // All managers that have been created. + ManagerList all_managers_; + // Managers that have not yet associated with a frame. + ManagerList pending_managers_; + // Managers that are currently active. + ManagerMap manager_map_; typedef std::set ObserverSet; ObserverSet observer_set_; @@ -2501,6 +2534,14 @@ class MultiQueryMultiFrameTestHandler : return manager_map_.GetMainHTML(); } + void OnLoadStart(CefRefPtr browser, + CefRefPtr frame, + TransitionType transition_type) override { + AssertMainBrowser(browser); + if (!frame->IsMain()) + manager_map_.OnLoadStart(browser, frame); + } + void OnNotify(CefRefPtr browser, CefRefPtr frame, const std::string& message) override { @@ -2637,6 +2678,12 @@ class MultiQueryMultiLoadTestHandler : manager_map_.AddObserver(this); } + void OnLoadStart(CefRefPtr browser, + CefRefPtr frame, + TransitionType transition_type) override { + manager_map_.OnLoadStart(browser, frame); + } + void OnNotify(CefRefPtr browser, CefRefPtr frame, const std::string& message) override { @@ -2797,7 +2844,7 @@ class MultiQueryMultiNavigateTestHandler : public MultiQueryMultiLoadTestHandler } void OnManualQueriesCompleted(MultiQueryManager* manager) override { - const std::string& url = manager_map_.GetURLForManager(manager); + const std::string& url = manager->label(); if (url == url1_) // 2. Load the 2nd url. GetBrowser()->GetMainFrame()->LoadURL(url2_); else if (url == url2_) // 3. Load the 3rd url. diff --git a/tests/ceftests/navigation_unittest.cc b/tests/ceftests/navigation_unittest.cc index 21b8eb014..c3c4fc101 100644 --- a/tests/ceftests/navigation_unittest.cc +++ b/tests/ceftests/navigation_unittest.cc @@ -2325,6 +2325,23 @@ class PopupNavTestHandler : public TestHandler { } } + void OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) override { + if (failedUrl == kPopupNavPageUrl) { + EXPECT_FALSE(got_load_error_); + got_load_error_.yes(); + } else if (failedUrl == kPopupNavPopupUrl) { + EXPECT_FALSE(got_popup_load_error_); + got_popup_load_error_.yes(); + } else if (failedUrl == kPopupNavPopupUrl2) { + EXPECT_FALSE(got_popup_load_error2_); + got_popup_load_error2_.yes(); + } + } + void OnLoadEnd(CefRefPtr browser, CefRefPtr frame, int httpStatusCode) override { @@ -2370,22 +2387,29 @@ class PopupNavTestHandler : public TestHandler { private: void DestroyTest() override { EXPECT_TRUE(got_load_start_); + EXPECT_FALSE(got_load_error_); EXPECT_TRUE(got_load_end_); EXPECT_TRUE(got_on_before_popup_); if (mode_ == ALLOW) { EXPECT_TRUE(got_popup_load_start_); + EXPECT_FALSE(got_popup_load_error_); EXPECT_TRUE(got_popup_load_end_); EXPECT_FALSE(got_popup_load_start2_); + EXPECT_FALSE(got_popup_load_error2_); EXPECT_FALSE(got_popup_load_end2_); } else if (mode_ == DENY) { EXPECT_FALSE(got_popup_load_start_); + EXPECT_FALSE(got_popup_load_error_); EXPECT_FALSE(got_popup_load_end_); EXPECT_FALSE(got_popup_load_start2_); + EXPECT_FALSE(got_popup_load_error2_); EXPECT_FALSE(got_popup_load_end2_); } else if (mode_ == NAVIGATE_AFTER_CREATION) { EXPECT_FALSE(got_popup_load_start_); + EXPECT_TRUE(got_popup_load_error_); EXPECT_FALSE(got_popup_load_end_); EXPECT_TRUE(got_popup_load_start2_); + EXPECT_FALSE(got_popup_load_error2_); EXPECT_TRUE(got_popup_load_end2_); } @@ -2396,10 +2420,13 @@ class PopupNavTestHandler : public TestHandler { TrackCallback got_on_before_popup_; TrackCallback got_load_start_; + TrackCallback got_load_error_; TrackCallback got_load_end_; TrackCallback got_popup_load_start_; + TrackCallback got_popup_load_error_; TrackCallback got_popup_load_end_; TrackCallback got_popup_load_start2_; + TrackCallback got_popup_load_error2_; TrackCallback got_popup_load_end2_; IMPLEMENT_REFCOUNTING(PopupNavTestHandler); @@ -2865,6 +2892,671 @@ TEST(NavigationTest, BrowseDeny) { ReleaseAndWaitForDestructor(handler); } +namespace { + +const char kSameNavPageUrl[] = "http://tests-samenav/nav.html"; + +// Browser side. +class SameNavTestHandler : public TestHandler { + public: + SameNavTestHandler() + : destroyed_(false), + step_(0) {} + + void RunTest() override { + AddResource(kSameNavPageUrl, "Test", "text/html"); + + // Create the browser. + expected_url_ = kSameNavPageUrl; + CreateBrowser(kSameNavPageUrl); + + // Time out the test after a reasonable period of time. + SetTestTimeout(); + } + + bool OnBeforeBrowse(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request, + bool is_redirect) override { + const std::string& url = request->GetURL(); + EXPECT_STREQ(expected_url_.c_str(), url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_before_browse_.yes(); + + return false; + } + + void OnLoadStart(CefRefPtr browser, + CefRefPtr frame, + TransitionType transition_type) override { + const std::string& url = frame->GetURL(); + EXPECT_STREQ(expected_url_.c_str(), url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_load_start_.yes(); + } + + void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) override { + const std::string& url = frame->GetURL(); + EXPECT_STREQ(expected_url_.c_str(), url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_load_end_.yes(); + ContinueTestIfDone(); + } + + void OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) override { + got_load_error_.yes(); + } + + void OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) override { + const std::string& url = browser->GetMainFrame()->GetURL(); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + + if (isLoading) { + // Verify the previous URL. + if (step_ == 0) + EXPECT_TRUE(url.empty()); + else + EXPECT_STREQ(kSameNavPageUrl, url.c_str()); + + got_loading_state_changed_start_.yes(); + } else { + EXPECT_STREQ(expected_url_.c_str(), url.c_str()); + + got_loading_state_changed_end_.yes(); + ContinueTestIfDone(); + } + } + + private: + void ContinueTestIfDone() { + if (step_ == 0) { + // First navigation should trigger all callbacks except OnLoadError. + if (got_loading_state_changed_end_ && got_load_end_) { + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_load_start_); + EXPECT_FALSE(got_load_error_); + + got_before_browse_.reset(); + got_loading_state_changed_start_.reset(); + got_loading_state_changed_end_.reset(); + got_load_start_.reset(); + got_load_end_.reset(); + + step_++; + expected_url_ = kSameNavPageUrl + std::string("#fragment"); + GetBrowser()->GetMainFrame()->LoadURL(expected_url_); + } + } else if (step_ == 1) { + step_++; + DestroyTest(); + } else { + EXPECT_TRUE(false); // Not reached. + } + } + + void DestroyTest() override { + if (destroyed_) + return; + destroyed_ = true; + + EXPECT_EQ(2, step_); + + // Second (fragment) navigation should only trigger OnLoadingStateChange. + EXPECT_FALSE(got_before_browse_); + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_loading_state_changed_end_); + EXPECT_FALSE(got_load_start_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_load_error_); + + TestHandler::DestroyTest(); + } + + bool destroyed_; + int step_; + std::string expected_url_; + + TrackCallback got_before_browse_; + TrackCallback got_load_start_; + TrackCallback got_load_end_; + TrackCallback got_load_error_; + TrackCallback got_loading_state_changed_start_; + TrackCallback got_loading_state_changed_end_; + + IMPLEMENT_REFCOUNTING(SameNavTestHandler); +}; + +} // namespace + +// Test that same page navigation does not call OnLoadStart/OnLoadEnd. +TEST(NavigationTest, SamePage) { + CefRefPtr handler = new SameNavTestHandler(); + handler->ExecuteTest(); + ReleaseAndWaitForDestructor(handler); +} + +namespace { + +const char kCancelPageUrl[] = "http://tests-cancelnav/nav.html"; + +// A scheme handler that never starts sending data. +class UnstartedSchemeHandler : public CefResourceHandler { + public: + UnstartedSchemeHandler() {} + + bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) override { + callback->Continue(); + return true; + } + + void GetResponseHeaders(CefRefPtr response, + int64& response_length, + CefString& redirectUrl) override { + response->SetStatus(200); + response->SetMimeType("text/html"); + response_length = 100; + } + + void Cancel() override { + callback_ = nullptr; + } + + bool ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) override { + callback_ = callback; + + // Pretend that we'll provide the data later. + bytes_read = 0; + return true; + } + + protected: + CefRefPtr callback_; + + IMPLEMENT_REFCOUNTING(UnstartedSchemeHandler); +}; + +// Browser side. +class CancelBeforeNavTestHandler : public TestHandler { + public: + CancelBeforeNavTestHandler() + : destroyed_(false) {} + + void RunTest() override { + // Create the browser. + CreateBrowser(kCancelPageUrl); + + // Time out the test after a reasonable period of time. + SetTestTimeout(); + } + + bool OnBeforeBrowse(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request, + bool is_redirect) override { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_FALSE(got_before_browse_); + EXPECT_FALSE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_FALSE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + const std::string& url = request->GetURL(); + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_before_browse_.yes(); + + return false; + } + + CefRefPtr GetResourceHandler( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) override { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_FALSE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_FALSE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + const std::string& url = request->GetURL(); + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_get_resource_handler_.yes(); + + CefPostDelayedTask(TID_UI, + base::Bind(&CancelBeforeNavTestHandler::CancelLoad, this), 100); + + return new UnstartedSchemeHandler(); + } + + void OnLoadStart(CefRefPtr browser, + CefRefPtr frame, + TransitionType transition_type) override { + EXPECT_TRUE(false); // Not reached. + got_load_start_.yes(); + } + + void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) override { + EXPECT_TRUE(false); // Not reached. + got_load_end_.yes(); + } + + void OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) override { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_TRUE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + const std::string& url = failedUrl; + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_load_error_.yes(); + } + + void OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) override { + const std::string& url = browser->GetMainFrame()->GetURL(); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(url.empty()); + + if (isLoading) { + EXPECT_FALSE(got_loading_state_changed_start_); + EXPECT_FALSE(got_before_browse_); + EXPECT_FALSE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_FALSE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + got_loading_state_changed_start_.yes(); + } else { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_TRUE(got_cancel_load_); + EXPECT_TRUE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + got_loading_state_changed_end_.yes(); + + DestroyTest(); + } + } + + private: + void CancelLoad() { + got_cancel_load_.yes(); + GetBrowser()->StopLoad(); + } + + void DestroyTest() override { + if (destroyed_) + return; + destroyed_ = true; + + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_TRUE(got_cancel_load_); + EXPECT_TRUE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_TRUE(got_loading_state_changed_end_); + + TestHandler::DestroyTest(); + } + + bool destroyed_; + + TrackCallback got_loading_state_changed_start_; + TrackCallback got_before_browse_; + TrackCallback got_get_resource_handler_; + TrackCallback got_load_start_; + TrackCallback got_cancel_load_; + TrackCallback got_load_error_; + TrackCallback got_load_end_; + TrackCallback got_loading_state_changed_end_; + + IMPLEMENT_REFCOUNTING(CancelBeforeNavTestHandler); +}; + +} // namespace + +// Test that navigation canceled before commit does not call +// OnLoadStart/OnLoadEnd. +TEST(NavigationTest, CancelBeforeCommit) { + CefRefPtr handler = + new CancelBeforeNavTestHandler(); + handler->ExecuteTest(); + ReleaseAndWaitForDestructor(handler); +} + + +namespace { + +// A scheme handler that stalls after writing some data. +class StalledSchemeHandler : public CefResourceHandler { + public: + StalledSchemeHandler() : offset_(0), write_size_(0) {} + + bool ProcessRequest(CefRefPtr request, + CefRefPtr callback) override { + callback->Continue(); + return true; + } + + void GetResponseHeaders(CefRefPtr response, + int64& response_length, + CefString& redirectUrl) override { + response->SetStatus(200); + response->SetMimeType("text/html"); + content_ = "Test"; + // Write this number of bytes and then stall. + write_size_ = content_.size() / 2U; + response_length = content_.size(); + } + + void Cancel() override { + callback_ = nullptr; + } + + bool ReadResponse(void* data_out, + int bytes_to_read, + int& bytes_read, + CefRefPtr callback) override { + size_t size = content_.size(); + if (offset_ >= write_size_) { + // Now stall. + bytes_read = 0; + callback_ = callback; + return true; + } + + if (offset_ < size) { + // Write up to |write_size_| bytes. + int transfer_size = + std::min(bytes_to_read, std::min(static_cast(write_size_), + static_cast(size - offset_))); + memcpy(data_out, content_.c_str() + offset_, transfer_size); + offset_ += transfer_size; + + bytes_read = transfer_size; + return true; + } + + return false; + } + + protected: + std::string content_; + size_t offset_; + size_t write_size_; + CefRefPtr callback_; + + IMPLEMENT_REFCOUNTING(StalledSchemeHandler); +}; + +// Browser side. +class CancelAfterNavTestHandler : public TestHandler { + public: + CancelAfterNavTestHandler() + : destroyed_(false) {} + + void RunTest() override { + // Create the browser. + CreateBrowser(kCancelPageUrl); + + // Time out the test after a reasonable period of time. + SetTestTimeout(); + } + + bool OnBeforeBrowse(CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request, + bool is_redirect) override { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_FALSE(got_before_browse_); + EXPECT_FALSE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_FALSE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + const std::string& url = request->GetURL(); + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_before_browse_.yes(); + + return false; + } + + CefRefPtr GetResourceHandler( + CefRefPtr browser, + CefRefPtr frame, + CefRefPtr request) override { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_FALSE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_FALSE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + const std::string& url = request->GetURL(); + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_get_resource_handler_.yes(); + + CefPostDelayedTask(TID_UI, + base::Bind(&CancelAfterNavTestHandler::CancelLoad, this), 100); + + return new StalledSchemeHandler(); + } + + void OnLoadStart(CefRefPtr browser, + CefRefPtr frame, + TransitionType transition_type) override { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_FALSE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + const std::string& url = frame->GetURL(); + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_load_start_.yes(); + } + + void OnLoadEnd(CefRefPtr browser, + CefRefPtr frame, + int httpStatusCode) override { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_get_resource_handler_); + EXPECT_TRUE(got_load_start_); + EXPECT_TRUE(got_cancel_load_); + EXPECT_TRUE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + const std::string& url = frame->GetURL(); + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_load_end_.yes(); + DestroyTestIfDone(); + } + + void OnLoadError(CefRefPtr browser, + CefRefPtr frame, + ErrorCode errorCode, + const CefString& errorText, + const CefString& failedUrl) override { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_get_resource_handler_); + EXPECT_TRUE(got_load_start_); + EXPECT_TRUE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + const std::string& url = failedUrl; + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + EXPECT_TRUE(frame->IsMain()); + + got_load_error_.yes(); + } + + void OnLoadingStateChange(CefRefPtr browser, + bool isLoading, + bool canGoBack, + bool canGoForward) override { + const std::string& url = browser->GetMainFrame()->GetURL(); + EXPECT_EQ(GetBrowserId(), browser->GetIdentifier()); + + if (isLoading) { + EXPECT_FALSE(got_loading_state_changed_start_); + EXPECT_FALSE(got_before_browse_); + EXPECT_FALSE(got_get_resource_handler_); + EXPECT_FALSE(got_load_start_); + EXPECT_FALSE(got_cancel_load_); + EXPECT_FALSE(got_load_error_); + EXPECT_FALSE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + EXPECT_TRUE(url.empty()); + + got_loading_state_changed_start_.yes(); + } else { + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_get_resource_handler_); + EXPECT_TRUE(got_load_start_); + EXPECT_TRUE(got_cancel_load_); + EXPECT_TRUE(got_load_error_); + EXPECT_TRUE(got_load_end_); + EXPECT_FALSE(got_loading_state_changed_end_); + + EXPECT_STREQ(kCancelPageUrl, url.c_str()); + + got_loading_state_changed_end_.yes(); + DestroyTestIfDone(); + } + } + + private: + void CancelLoad() { + got_cancel_load_.yes(); + GetBrowser()->StopLoad(); + } + + void DestroyTestIfDone() { + if (got_loading_state_changed_end_ && got_load_end_) + DestroyTest(); + } + + void DestroyTest() override { + if (destroyed_) + return; + destroyed_ = true; + + EXPECT_TRUE(got_loading_state_changed_start_); + EXPECT_TRUE(got_before_browse_); + EXPECT_TRUE(got_get_resource_handler_); + EXPECT_TRUE(got_load_start_); + EXPECT_TRUE(got_cancel_load_); + EXPECT_TRUE(got_load_error_); + EXPECT_TRUE(got_load_end_); + EXPECT_TRUE(got_loading_state_changed_end_); + + TestHandler::DestroyTest(); + } + + bool destroyed_; + + TrackCallback got_loading_state_changed_start_; + TrackCallback got_before_browse_; + TrackCallback got_get_resource_handler_; + TrackCallback got_load_start_; + TrackCallback got_cancel_load_; + TrackCallback got_load_error_; + TrackCallback got_load_end_; + TrackCallback got_loading_state_changed_end_; + + IMPLEMENT_REFCOUNTING(CancelAfterNavTestHandler); +}; + +} // namespace + +// Test that navigation canceled after commit calls everything. +TEST(NavigationTest, CancelAfterCommit) { + CefRefPtr handler = + new CancelAfterNavTestHandler(); + handler->ExecuteTest(); + ReleaseAndWaitForDestructor(handler); +} + // Entry point for creating navigation browser test objects. // Called from client_app_delegates.cc. diff --git a/tests/ceftests/os_rendering_unittest.cc b/tests/ceftests/os_rendering_unittest.cc index d26f919b9..8fa110fa1 100644 --- a/tests/ceftests/os_rendering_unittest.cc +++ b/tests/ceftests/os_rendering_unittest.cc @@ -492,7 +492,7 @@ class OSRTestHandler : public RoutingTestHandler, EXPECT_EQ(dirtyRects.size(), 1U); EXPECT_TRUE(IsFullRepaint(dirtyRects[0], GetScaledInt(kOsrWidth), GetScaledInt(kOsrHeight))); - EXPECT_EQ(*(reinterpret_cast(buffer)), 0xffff8080); + EXPECT_EQ(0xffff7f7fU, *(reinterpret_cast(buffer))); DestroySucceededTestSoon(); } break; @@ -502,7 +502,7 @@ class OSRTestHandler : public RoutingTestHandler, EXPECT_EQ(dirtyRects.size(), 1U); EXPECT_TRUE(IsFullRepaint(dirtyRects[0], GetScaledInt(kOsrWidth), GetScaledInt(kOsrHeight))); - EXPECT_EQ(*(reinterpret_cast(buffer)), 0x7f7f0000U); + EXPECT_EQ(0x80800000U, *(reinterpret_cast(buffer))); DestroySucceededTestSoon(); } break; diff --git a/tests/ceftests/scheme_handler_unittest.cc b/tests/ceftests/scheme_handler_unittest.cc index 12eb46f93..f0a711c59 100644 --- a/tests/ceftests/scheme_handler_unittest.cc +++ b/tests/ceftests/scheme_handler_unittest.cc @@ -173,7 +173,7 @@ class TestSchemeHandler : public TestHandler { const CefString& failedUrl) override { test_results_->got_error.yes(); // Check that the error code matches the expectation. - EXPECT_EQ(errorCode, test_results_->expected_error_code); + EXPECT_EQ(test_results_->expected_error_code, errorCode); DestroyTest(); } @@ -1670,7 +1670,9 @@ void RegisterSchemeHandlerCustomSchemes( CefRawPtr registrar, std::vector& cookiable_schemes) { // Add a custom standard scheme. - registrar->AddCustomScheme("customstd", true, false, false, false, true); + registrar->AddCustomScheme("customstd", true, false, false, false, true, + false); // Ad a custom non-standard scheme. - registrar->AddCustomScheme("customnonstd", false, false, false, false, false); + registrar->AddCustomScheme("customnonstd", false, false, false, false, false, + false); } diff --git a/tests/ceftests/urlrequest_unittest.cc b/tests/ceftests/urlrequest_unittest.cc index 52e007b2b..f39c73236 100644 --- a/tests/ceftests/urlrequest_unittest.cc +++ b/tests/ceftests/urlrequest_unittest.cc @@ -1424,7 +1424,8 @@ void CreateURLRequestRendererTests(ClientAppRenderer::DelegateSet& delegates) { void RegisterURLRequestCustomSchemes( CefRawPtr registrar, std::vector& cookiable_schemes) { - registrar->AddCustomScheme(kRequestScheme, true, false, false, false, true); + registrar->AddCustomScheme(kRequestScheme, true, false, false, false, true, + false); cookiable_schemes.push_back(kRequestScheme); }