From a63d646e3b7da39b9162845e1fbca8d6478063ad Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 14 Aug 2015 10:41:08 -0400 Subject: [PATCH] Update to Chromium revision fc6ad471 (#342568) --- CHROMIUM_BUILD_COMPATIBILITY.txt | 2 +- cef.gyp | 14 +- libcef/browser/browser_host_impl.cc | 45 ++-- libcef/browser/browser_host_impl.h | 2 + libcef/browser/chrome_browser_process_stub.cc | 6 + libcef/browser/chrome_browser_process_stub.h | 2 + libcef/browser/chrome_scheme_handler.cc | 3 +- libcef/browser/content_browser_client.cc | 14 +- libcef/browser/content_browser_client.h | 1 + libcef/browser/devtools_frontend.cc | 8 +- .../streams_private/streams_private_api.cc | 9 +- .../extensions/event_router_forwarder.cc | 40 ++-- .../extensions/event_router_forwarder.h | 11 +- libcef/browser/extensions/extension_system.cc | 33 ++- libcef/browser/extensions/extension_system.h | 14 +- .../extensions/extensions_browser_client.cc | 12 +- .../extensions/extensions_browser_client.h | 4 +- libcef/browser/javascript_dialog_manager.cc | 4 +- .../printing/print_view_manager_base.cc | 29 +-- .../printing/print_view_manager_base.h | 18 +- .../printing/printing_message_filter.cc | 198 +----------------- .../printing/printing_message_filter.h | 23 -- libcef/browser/render_widget_host_view_osr.cc | 22 +- libcef/browser/render_widget_host_view_osr.h | 6 +- .../render_widget_host_view_osr_mac.mm | 6 +- .../resource_dispatcher_host_delegate.cc | 68 +++--- .../resource_dispatcher_host_delegate.h | 1 + libcef/browser/software_output_device_osr.cc | 5 +- libcef/browser/software_output_device_osr.h | 2 +- libcef/browser/text_input_client_osr_mac.mm | 2 +- libcef/common/cef_switches.cc | 4 + libcef/common/cef_switches.h | 1 + libcef/common/content_client.cc | 50 +---- libcef/common/content_client.h | 15 ++ libcef/common/extensions/api/schemas.gypi | 3 +- libcef/common/extensions/extensions_client.cc | 30 +-- libcef/common/main_delegate.cc | 28 +-- libcef/common/scheme_registration.cc | 8 +- libcef/renderer/content_renderer_client.cc | 8 +- libcef/renderer/dom_node_impl.cc | 7 +- .../extensions_dispatcher_delegate.cc | 36 ++++ .../extensions_dispatcher_delegate.h | 28 +++ patch/patches/aura_window_1677.patch | 6 +- patch/patches/browser_plugin_guest_1565.patch | 11 +- patch/patches/browser_web_contents_1257.patch | 29 ++- patch/patches/build.patch | 2 +- patch/patches/chrome_browser_1257.patch | 8 +- patch/patches/chrome_pepper_flash_1586.patch | 2 +- patch/patches/compositor_1368.patch | 4 +- patch/patches/content_nav_1129.patch | 90 ++++---- patch/patches/extensions_1257.patch | 2 +- patch/patches/gritsettings.patch | 2 +- patch/patches/hwnd_message_handler_1481.patch | 4 +- patch/patches/ime_1610.patch | 6 +- patch/patches/message_loop_443.patch | 4 +- patch/patches/prefs_content_1161.patch | 16 +- patch/patches/process_title_1639.patch | 2 +- patch/patches/public_browser_1257.patch | 2 +- patch/patches/ui_dragdrop_355390.patch | 2 +- patch/patches/views_widget_180_1677.patch | 24 +-- patch/patches/webkit_popups.patch | 22 +- 61 files changed, 460 insertions(+), 600 deletions(-) create mode 100644 libcef/renderer/extensions/extensions_dispatcher_delegate.cc create mode 100644 libcef/renderer/extensions/extensions_dispatcher_delegate.h diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 1cd0cac05..002b3a62f 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,5 +7,5 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': '12bfc3360892ec53cd00fc239a47e5298beb063b', + 'chromium_checkout': 'fc6ad471b796214148d81208b38601de0c86bc9f', } diff --git a/cef.gyp b/cef.gyp index 7b75759c6..6e8e5d9b8 100644 --- a/cef.gyp +++ b/cef.gyp @@ -947,12 +947,14 @@ '<(DEPTH)/components/components.gyp:pdf_renderer', '<(DEPTH)/components/components.gyp:plugins_renderer', '<(DEPTH)/components/components.gyp:pref_registry', + '<(DEPTH)/components/components.gyp:printing_browser', '<(DEPTH)/components/components.gyp:printing_common', '<(DEPTH)/components/components.gyp:printing_renderer', '<(DEPTH)/components/components.gyp:proxy_config', '<(DEPTH)/components/components.gyp:update_client', '<(DEPTH)/components/components.gyp:user_prefs', '<(DEPTH)/components/components.gyp:web_cache_renderer', + '<(DEPTH)/components/url_formatter/url_formatter.gyp:url_formatter', '<(DEPTH)/content/content.gyp:content_app_both', '<(DEPTH)/content/content.gyp:content_browser', '<(DEPTH)/content/content.gyp:content_common', @@ -1236,6 +1238,8 @@ 'libcef/renderer/dom_document_impl.h', 'libcef/renderer/dom_node_impl.cc', 'libcef/renderer/dom_node_impl.h', + 'libcef/renderer/extensions/extensions_dispatcher_delegate.cc', + 'libcef/renderer/extensions/extensions_dispatcher_delegate.h', 'libcef/renderer/extensions/extensions_renderer_client.cc', 'libcef/renderer/extensions/extensions_renderer_client.h', 'libcef/renderer/extensions/print_web_view_helper_delegate.cc', @@ -1417,12 +1421,12 @@ 'libcef/common/util_mac.h', 'libcef/common/util_mac.mm', # Include sources for spell checking support. - '<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_mac.cc', - '<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_mac.h', - '<(DEPTH)/chrome/browser/spellchecker/spellcheck_platform_mac.h', + '<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_platform.h', + '<(DEPTH)/chrome/browser/spellchecker/spellcheck_message_filter_platform_mac.cc', + '<(DEPTH)/chrome/browser/spellchecker/spellcheck_platform.h', '<(DEPTH)/chrome/browser/spellchecker/spellcheck_platform_mac.mm', - '<(DEPTH)/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.cc', - '<(DEPTH)/chrome/renderer/spellchecker/cocoa_spelling_engine_mac.h', + '<(DEPTH)/chrome/renderer/spellchecker/platform_spelling_engine.cc', + '<(DEPTH)/chrome/renderer/spellchecker/platform_spelling_engine.h', # Include sources for pepper flash support. '<(DEPTH)/chrome/browser/renderer_host/pepper/monitor_finder_mac.h', '<(DEPTH)/chrome/browser/renderer_host/pepper/monitor_finder_mac.mm', diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index eb66a894b..0e6427bfc 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -66,7 +66,7 @@ #endif #if defined(OS_MACOSX) -#include "chrome/browser/spellchecker/spellcheck_platform_mac.h" +#include "chrome/browser/spellchecker/spellcheck_platform.h" #endif #if defined(USE_AURA) @@ -1080,7 +1080,7 @@ void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) { spellcheck->GetCustomDictionary()->AddWord(word); } #if defined(OS_MACOSX) - spellcheck_mac::AddWord(word); + spellcheck_platform::AddWord(word); #endif } @@ -2796,6 +2796,11 @@ void CefBrowserHostImpl::FrameDeleted( focused_frame_id_ = CefFrameHostImpl::kInvalidFrameId; } +void CefBrowserHostImpl::TitleWasSet(content::NavigationEntry* entry, + bool explicit_set) { + OnTitleChange(entry->GetTitle()); +} + void CefBrowserHostImpl::PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) { if (client_.get()) { @@ -2960,28 +2965,12 @@ void CefBrowserHostImpl::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK(type == content::NOTIFICATION_LOAD_STOP || - type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE || - type == content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED); + type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE); - if (type == content::NOTIFICATION_LOAD_STOP || - type == content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED) { - base::string16 title; - - if (type == content::NOTIFICATION_LOAD_STOP) { - content::NavigationController* controller = - content::Source(source).ptr(); - title = controller->GetWebContents()->GetTitle(); - } else { - content::WebContents* web_contents = - content::Source(source).ptr(); - title = web_contents->GetTitle(); - } - - if (client_.get()) { - CefRefPtr handler = client_->GetDisplayHandler(); - if (handler.get()) - handler->OnTitleChange(this, title); - } + if (type == content::NOTIFICATION_LOAD_STOP) { + content::NavigationController* controller = + content::Source(source).ptr(); + OnTitleChange(controller->GetWebContents()->GetTitle()); } else if (type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE) { focus_on_editable_field_ = *content::Details(details).ptr(); } @@ -3040,8 +3029,6 @@ CefBrowserHostImpl::CefBrowserHostImpl( g_manager.Get().AddImpl(this); registrar_.reset(new content::NotificationRegistrar); - registrar_->Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, - content::Source(web_contents)); // When navigating through the history, the restored NavigationEntry's title // will be used. If the entry ends up having the same title after we return @@ -3230,6 +3217,14 @@ void CefBrowserHostImpl::OnFullscreenModeChange(bool fullscreen) { } } +void CefBrowserHostImpl::OnTitleChange(const base::string16& title) { + if (client_.get()) { + CefRefPtr handler = client_->GetDisplayHandler(); + if (handler.get()) + handler->OnTitleChange(this, title); + } +} + void CefBrowserHostImpl::RunFileChooserOnUIThread( const FileChooserParams& params, const RunFileChooserCallback& callback) { diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index e5cf09fd5..fa7ad0877 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -471,6 +471,7 @@ class CefBrowserHostImpl : public CefBrowserHost, bool was_ignored_by_handler) 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; void DidUpdateFaviconURL( @@ -596,6 +597,7 @@ class CefBrowserHostImpl : public CefBrowserHost, const GURL& url, int http_status_code); void OnFullscreenModeChange(bool fullscreen); + void OnTitleChange(const base::string16& title); // Continuation from RunFileChooser. void RunFileChooserOnUIThread(const FileChooserParams& params, diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index 7bb00dccc..166432024 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -278,3 +278,9 @@ memory::OomPriorityManager* ChromeBrowserProcessStub::GetOomPriorityManager() { NOTIMPLEMENTED(); return NULL; } + +ShellIntegration::DefaultWebClientState +ChromeBrowserProcessStub::CachedDefaultWebClientState() { + NOTIMPLEMENTED(); + return ShellIntegration::UNKNOWN_DEFAULT; +} diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index b33d147e3..79c6c13d7 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -97,6 +97,8 @@ class ChromeBrowserProcessStub : public BrowserProcess { network_time::NetworkTimeTracker* network_time_tracker() override; gcm::GCMDriver* gcm_driver() override; memory::OomPriorityManager* GetOomPriorityManager() override; + ShellIntegration::DefaultWebClientState + CachedDefaultWebClientState() override; private: std::string locale_; diff --git a/libcef/browser/chrome_scheme_handler.cc b/libcef/browser/chrome_scheme_handler.cc index 69ef08c31..b311b3a1f 100644 --- a/libcef/browser/chrome_scheme_handler.cc +++ b/libcef/browser/chrome_scheme_handler.cc @@ -209,7 +209,8 @@ const ResourcesMap* CreateResourcesMap() { const int resource_id = kWebuiResources[i].value; AddResource(resource_name, resource_id, result); for (const char* (&alias)[2]: kPathAliases) { - if (base::StartsWithASCII(resource_name, alias[0], true)) { + if (base::StartsWith(resource_name, alias[0], + base::CompareCase::SENSITIVE)) { AddResource(alias[1] + resource_name.substr(strlen(alias[0])), resource_id, result); } diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index 004b47fcd..cb28b25bd 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -63,7 +63,7 @@ #include "url/gurl.h" #if defined(OS_MACOSX) -#include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" +#include "chrome/browser/spellchecker/spellcheck_message_filter_platform.h" #endif #if defined(OS_POSIX) && !defined(OS_MACOSX) @@ -568,7 +568,7 @@ void CefContentBrowserClient::RenderProcessWillLaunch( if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { host->AddFilter(new SpellCheckMessageFilter(id)); #if defined(OS_MACOSX) - host->AddFilter(new SpellCheckMessageFilterMac(id)); + host->AddFilter(new SpellCheckMessageFilterPlatform(id)); #endif } @@ -668,6 +668,16 @@ bool CefContentBrowserClient::IsHandledURL(const GURL& url) { return CefContentClient::Get()->HasCustomScheme(scheme); } +bool CefContentBrowserClient::IsNPAPIEnabled() { +#if defined(OS_WIN) || defined(OS_MACOSX) + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); + return command_line->HasSwitch(switches::kEnableNPAPI); +#else + return false; +#endif +} + void CefContentBrowserClient::AppendExtraCommandLineSwitches( base::CommandLine* command_line, int child_process_id) { const base::CommandLine* browser_cmd = diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h index dd2f2b4d4..35dfe4a72 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/content_browser_client.h @@ -89,6 +89,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient { content::URLRequestInterceptorScopedVector request_interceptors) override; bool IsHandledURL(const GURL& url) override; + bool IsNPAPIEnabled() override; void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) override; content::QuotaPermissionContext* diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index f0c0c2d6f..7d0f947b7 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -225,7 +225,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend( params->GetSize() == 1 && params->GetString(0, &browser_message)) { agent_host_->DispatchProtocolMessage(browser_message); } else if (method == "loadCompleted") { - web_contents()->GetMainFrame()->ExecuteJavaScript( + web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);")); } else if (method == "loadNetworkResource" && params->GetSize() == 3) { // TODO(pfeldman): handle some of the embedder messages in content. @@ -292,7 +292,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage( if (message.length() < kMaxMessageChunkSize) { base::string16 javascript = base::UTF8ToUTF16( "DevToolsAPI.dispatchMessage(" + message + ");"); - web_contents()->GetMainFrame()->ExecuteJavaScript(javascript); + web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(javascript); return; } @@ -303,7 +303,7 @@ void CefDevToolsFrontend::DispatchProtocolMessage( base::StringValue(message.substr(pos, kMaxMessageChunkSize)), ¶m); std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + ");"; base::string16 javascript = base::UTF8ToUTF16(code); - web_contents()->GetMainFrame()->ExecuteJavaScript(javascript); + web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(javascript); } } @@ -351,7 +351,7 @@ void CefDevToolsFrontend::CallClientFunction( } } javascript.append(");"); - web_contents()->GetMainFrame()->ExecuteJavaScript( + web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( base::UTF8ToUTF16(javascript)); } diff --git a/libcef/browser/extensions/api/streams_private/streams_private_api.cc b/libcef/browser/extensions/api/streams_private/streams_private_api.cc index 13157bada..3ac05efbd 100644 --- a/libcef/browser/extensions/api/streams_private/streams_private_api.cc +++ b/libcef/browser/extensions/api/streams_private/streams_private_api.cc @@ -78,7 +78,7 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler( // If the mime handler uses MimeHandlerViewGuest, the MimeHandlerViewGuest // will take ownership of the stream. Otherwise, store the stream handle in // |streams_| and fire an event notifying the extension. - if (!handler->handler_url().empty()) { + if (handler->HasPlugin()) { GURL handler_url(Extension::GetBaseURLFromExtensionId(extension_id).spec() + handler->handler_url()); scoped_ptr stream_container(new StreamContainer( @@ -108,9 +108,10 @@ void StreamsPrivateAPI::ExecuteMimeTypeHandler( CreateResponseHeadersDictionary(stream->response_headers.get(), &info.response_headers.additional_properties); - scoped_ptr event(new Event( - events::UNKNOWN, streams_private::OnExecuteMimeTypeHandler::kEventName, - streams_private::OnExecuteMimeTypeHandler::Create(info))); + scoped_ptr event( + new Event(events::STREAMS_PRIVATE_ON_EXECUTE_MIME_TYPE_HANDLER, + streams_private::OnExecuteMimeTypeHandler::kEventName, + streams_private::OnExecuteMimeTypeHandler::Create(info))); EventRouter::Get(browser_context_) ->DispatchEventToExtension(extension_id, event.Pass()); diff --git a/libcef/browser/extensions/event_router_forwarder.cc b/libcef/browser/extensions/event_router_forwarder.cc index 845d13ac3..3fa166ce4 100644 --- a/libcef/browser/extensions/event_router_forwarder.cc +++ b/libcef/browser/extensions/event_router_forwarder.cc @@ -23,13 +23,16 @@ EventRouterForwarder::~EventRouterForwarder() { } void EventRouterForwarder::BroadcastEventToRenderers( + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, const GURL& event_url) { - HandleEvent(std::string(), event_name, event_args.Pass(), 0, true, event_url); + HandleEvent(std::string(), histogram_value, event_name, event_args.Pass(), 0, + true, event_url); } void EventRouterForwarder::DispatchEventToRenderers( + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, void* profile, @@ -37,24 +40,23 @@ void EventRouterForwarder::DispatchEventToRenderers( const GURL& event_url) { if (!profile) return; - HandleEvent(std::string(), - event_name, - event_args.Pass(), - profile, - use_profile_to_restrict_events, - event_url); + HandleEvent(std::string(), histogram_value, event_name, event_args.Pass(), + profile, use_profile_to_restrict_events, event_url); } void EventRouterForwarder::BroadcastEventToExtension( const std::string& extension_id, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, const GURL& event_url) { - HandleEvent(extension_id, event_name, event_args.Pass(), 0, true, event_url); + HandleEvent(extension_id, histogram_value, event_name, event_args.Pass(), 0, + true, event_url); } void EventRouterForwarder::DispatchEventToExtension( const std::string& extension_id, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, void* profile, @@ -62,11 +64,12 @@ void EventRouterForwarder::DispatchEventToExtension( const GURL& event_url) { if (!profile) return; - HandleEvent(extension_id, event_name, event_args.Pass(), profile, - use_profile_to_restrict_events, event_url); + HandleEvent(extension_id, histogram_value, event_name, event_args.Pass(), + profile, use_profile_to_restrict_events, event_url); } void EventRouterForwarder::HandleEvent(const std::string& extension_id, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, void* profile_ptr, @@ -75,8 +78,8 @@ void EventRouterForwarder::HandleEvent(const std::string& extension_id, if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(&EventRouterForwarder::HandleEvent, this, - extension_id, event_name, base::Passed(&event_args), + base::Bind(&EventRouterForwarder::HandleEvent, this, extension_id, + histogram_value, event_name, base::Passed(&event_args), profile_ptr, use_profile_to_restrict_events, event_url)); return; } @@ -88,7 +91,8 @@ void EventRouterForwarder::HandleEvent(const std::string& extension_id, return; } if (profile) { - CallEventRouter(profile, extension_id, event_name, event_args.Pass(), + CallEventRouter(profile, extension_id, histogram_value, event_name, + event_args.Pass(), use_profile_to_restrict_events ? profile : NULL, event_url); } else { std::vector profiles( @@ -96,9 +100,10 @@ void EventRouterForwarder::HandleEvent(const std::string& extension_id, for (size_t i = 0; i < profiles.size(); ++i) { scoped_ptr per_profile_event_args( event_args->DeepCopy()); - CallEventRouter( - profiles[i], extension_id, event_name, per_profile_event_args.Pass(), - use_profile_to_restrict_events ? profiles[i] : NULL, event_url); + CallEventRouter(profiles[i], extension_id, histogram_value, event_name, + per_profile_event_args.Pass(), + use_profile_to_restrict_events ? profiles[i] : NULL, + event_url); } } } @@ -106,12 +111,13 @@ void EventRouterForwarder::HandleEvent(const std::string& extension_id, void EventRouterForwarder::CallEventRouter( content::BrowserContext* profile, const std::string& extension_id, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, content::BrowserContext* restrict_to_profile, const GURL& event_url) { scoped_ptr event( - new Event(events::UNKNOWN, event_name, event_args.Pass())); + new Event(histogram_value, event_name, event_args.Pass())); event->restrict_to_browser_context = restrict_to_profile; event->event_url = event_url; if (extension_id.empty()) { diff --git a/libcef/browser/extensions/event_router_forwarder.h b/libcef/browser/extensions/event_router_forwarder.h index 3795d5899..e9d4fadf8 100644 --- a/libcef/browser/extensions/event_router_forwarder.h +++ b/libcef/browser/extensions/event_router_forwarder.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" #include "base/values.h" +#include "extensions/browser/extension_event_histogram_value.h" class GURL; @@ -37,7 +38,8 @@ class EventRouterForwarder // DispatchEventToRenderers(event_name, event_args, profile, event_url) // on all (original) profiles' EventRouters. // May be called on any thread. - void BroadcastEventToRenderers(const std::string& event_name, + void BroadcastEventToRenderers(events::HistogramValue histogram_value, + const std::string& event_name, scoped_ptr event_args, const GURL& event_url); @@ -47,6 +49,7 @@ class EventRouterForwarder // on all (original) profiles' EventRouters. // May be called on any thread. void BroadcastEventToExtension(const std::string& extension_id, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, const GURL& event_url); @@ -55,7 +58,8 @@ class EventRouterForwarder // DispatchEventToRenderers(event_name, event_args, // use_profile_to_restrict_events ? profile : NULL, event_url) // on |profile|'s EventRouter. May be called on any thread. - void DispatchEventToRenderers(const std::string& event_name, + void DispatchEventToRenderers(events::HistogramValue histogram_value, + const std::string& event_name, scoped_ptr event_args, void* profile, bool use_profile_to_restrict_events, @@ -66,6 +70,7 @@ class EventRouterForwarder // use_profile_to_restrict_events ? profile : NULL, event_url) // on |profile|'s EventRouter. May be called on any thread. void DispatchEventToExtension(const std::string& extension_id, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, void* profile, @@ -79,6 +84,7 @@ class EventRouterForwarder // Helper function for {Broadcast,Dispatch}EventTo{Extension,Renderers}. // Virtual for testing. virtual void HandleEvent(const std::string& extension_id, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, void* profile, @@ -91,6 +97,7 @@ class EventRouterForwarder // Virtual for testing. virtual void CallEventRouter(content::BrowserContext* profile, const std::string& extension_id, + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr event_args, content::BrowserContext* restrict_to_profile, diff --git a/libcef/browser/extensions/extension_system.cc b/libcef/browser/extensions/extension_system.cc index 356036b95..39c324d8c 100644 --- a/libcef/browser/extensions/extension_system.cc +++ b/libcef/browser/extensions/extension_system.cc @@ -32,6 +32,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/info_map.h" #include "extensions/browser/notification_types.h" +#include "extensions/browser/null_app_sorting.h" #include "extensions/browser/quota_service.h" #include "extensions/browser/runtime_data.h" #include "extensions/common/constants.h" @@ -77,7 +78,8 @@ base::DictionaryValue* ParseManifest( CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context) : browser_context_(browser_context), - registry_(ExtensionRegistry::Get(browser_context)) { + registry_(ExtensionRegistry::Get(browser_context)), + weak_ptr_factory_(this) { } CefExtensionSystem::~CefExtensionSystem() { @@ -128,6 +130,9 @@ void CefExtensionSystem::Init() { // kPDFPluginOutOfProcessMimeType which loads the PDF PPAPI plugin. // 10.Routing of print-related commands are handled by ChromePDFPrintClient // and CefPrintWebViewHelperDelegate in the renderer process. + // 11.The PDF extension is granted access to chrome://resources via + // CefExtensionsDispatcherDelegate::InitOriginPermissions in the renderer + // process. if (PdfExtensionEnabled()) { AddExtension(pdf_extension_util::GetManifest(), base::FilePath(FILE_PATH_LITERAL("pdf"))); @@ -166,6 +171,7 @@ void CefExtensionSystem::Shutdown() { void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) { runtime_data_.reset(new RuntimeData(registry_)); quota_service_.reset(new QuotaService); + app_sorting_.reset(new NullAppSorting); } ExtensionService* CefExtensionSystem::extension_service() { @@ -202,13 +208,18 @@ QuotaService* CefExtensionSystem::quota_service() { return quota_service_.get(); } +AppSorting* CefExtensionSystem::app_sorting() { + return app_sorting_.get(); +} + // Implementation based on // ExtensionSystemImpl::RegisterExtensionWithRequestContexts. void CefExtensionSystem::RegisterExtensionWithRequestContexts( - const Extension* extension) { + const Extension* extension, + const base::Closure& callback) { // TODO(extensions): The |incognito_enabled| value should be set based on // manifest settings. - BrowserThread::PostTask( + BrowserThread::PostTaskAndReply( BrowserThread::IO, FROM_HERE, base::Bind(&InfoMap::AddExtension, @@ -216,7 +227,8 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts( make_scoped_refptr(extension), base::Time::Now(), true, // incognito_enabled - false)); // notifications_disabled + false), // notifications_disabled + callback); } // Implementation based on @@ -336,7 +348,11 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) { // that the request context doesn't yet know about. The profile is responsible // for ensuring its URLRequestContexts appropriately discover the loaded // extension. - RegisterExtensionWithRequestContexts(extension); + RegisterExtensionWithRequestContexts( + extension, + base::Bind(&CefExtensionSystem::OnExtensionRegisteredWithRequestContexts, + weak_ptr_factory_.GetWeakPtr(), + make_scoped_refptr(extension))); // Tell renderers about the new extension, unless it's a theme (renderers // don't need to know about themes). @@ -400,6 +416,13 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) { content::Details(extension)); } +void CefExtensionSystem::OnExtensionRegisteredWithRequestContexts( + scoped_refptr extension) { + registry_->AddReady(extension); + if (registry_->enabled_extensions().Contains(extension->id())) + registry_->TriggerOnReady(extension.get()); +} + // Implementation based on ExtensionService::NotifyExtensionUnloaded. void CefExtensionSystem::NotifyExtensionUnloaded( const Extension* extension, diff --git a/libcef/browser/extensions/extension_system.h b/libcef/browser/extensions/extension_system.h index 266a7a022..077414571 100644 --- a/libcef/browser/extensions/extension_system.h +++ b/libcef/browser/extensions/extension_system.h @@ -9,6 +9,7 @@ #include #include "base/compiler_specific.h" +#include "base/memory/weak_ptr.h" #include "extensions/browser/extension_system.h" #include "extensions/common/one_shot_event.h" @@ -60,8 +61,10 @@ class CefExtensionSystem : public ExtensionSystem { StateStore* rules_store() override; InfoMap* info_map() override; QuotaService* quota_service() override; + AppSorting* app_sorting() override; void RegisterExtensionWithRequestContexts( - const Extension* extension) override; + const Extension* extension, + const base::Closure& callback) override; void UnregisterExtensionWithRequestContexts( const std::string& extension_id, const UnloadedExtensionInfo::Reason reason) override; @@ -105,6 +108,11 @@ class CefExtensionSystem : public ExtensionSystem { const Extension* extension, UnloadedExtensionInfo::Reason reason); + // Completes extension loading after URLRequestContexts have been updated + // on the IO thread. + void OnExtensionRegisteredWithRequestContexts( + scoped_refptr extension); + content::BrowserContext* browser_context_; // Not owned. // Data to be accessed on the IO thread. Must outlive process_manager_. @@ -112,6 +120,7 @@ class CefExtensionSystem : public ExtensionSystem { scoped_ptr runtime_data_; scoped_ptr quota_service_; + scoped_ptr app_sorting_; // Signaled when the extension system has completed its startup tasks. OneShotEvent ready_; @@ -119,6 +128,9 @@ class CefExtensionSystem : public ExtensionSystem { // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. ExtensionRegistry* registry_; + // Must be the last member. + base::WeakPtrFactory weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(CefExtensionSystem); }; diff --git a/libcef/browser/extensions/extensions_browser_client.cc b/libcef/browser/extensions/extensions_browser_client.cc index e20fd3fb9..d41a3ab06 100644 --- a/libcef/browser/extensions/extensions_browser_client.cc +++ b/libcef/browser/extensions/extensions_browser_client.cc @@ -24,7 +24,6 @@ #include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_host_delegate.h" #include "extensions/browser/mojo/service_registration.h" -#include "extensions/browser/null_app_sorting.h" #include "extensions/browser/url_request_util.h" using content::BrowserContext; @@ -154,10 +153,6 @@ bool CefExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) { void CefExtensionsBrowserClient::PermitExternalProtocolHandler() { } -scoped_ptr CefExtensionsBrowserClient::CreateAppSorting() { - return scoped_ptr(new NullAppSorting); -} - bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; } @@ -176,10 +171,10 @@ CefExtensionsBrowserClient::GetExtensionSystemFactory() { void CefExtensionsBrowserClient::RegisterExtensionFunctions( ExtensionFunctionRegistry* registry) const { // Register core extension-system APIs. - core_api::GeneratedFunctionRegistry::RegisterAll(registry); + api::GeneratedFunctionRegistry::RegisterAll(registry); // CEF-only APIs. - api::GeneratedFunctionRegistry::RegisterAll(registry); + api::ChromeGeneratedFunctionRegistry::RegisterAll(registry); } void CefExtensionsBrowserClient::RegisterMojoServices( @@ -202,10 +197,11 @@ CefExtensionsBrowserClient::GetComponentExtensionResourceManager() { } void CefExtensionsBrowserClient::BroadcastEventToRenderers( + events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr args) { event_router_forwarder_->BroadcastEventToRenderers( - event_name, args.Pass(), GURL()); + histogram_value, event_name, args.Pass(), GURL()); } net::NetLog* CefExtensionsBrowserClient::GetNetLog() { diff --git a/libcef/browser/extensions/extensions_browser_client.h b/libcef/browser/extensions/extensions_browser_client.h index 166719f52..503125d27 100644 --- a/libcef/browser/extensions/extensions_browser_client.h +++ b/libcef/browser/extensions/extensions_browser_client.h @@ -62,7 +62,6 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient { CreateExtensionHostDelegate() override; bool DidVersionUpdate(content::BrowserContext* context) override; void PermitExternalProtocolHandler() override; - scoped_ptr CreateAppSorting() override; bool IsRunningInForcedAppMode() override; ApiActivityMonitor* GetApiActivityMonitor( content::BrowserContext* context) override; @@ -75,7 +74,8 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient { content::BrowserContext* context) const override; const ComponentExtensionResourceManager* GetComponentExtensionResourceManager() override; - void BroadcastEventToRenderers(const std::string& event_name, + void BroadcastEventToRenderers(events::HistogramValue histogram_value, + const std::string& event_name, scoped_ptr args) override; net::NetLog* GetNetLog() override; ExtensionCache* GetExtensionCache() override; diff --git a/libcef/browser/javascript_dialog_manager.cc b/libcef/browser/javascript_dialog_manager.cc index 83e360188..ee7122dad 100644 --- a/libcef/browser/javascript_dialog_manager.cc +++ b/libcef/browser/javascript_dialog_manager.cc @@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" +#include "components/url_formatter/url_formatter.h" #include "net/base/net_util.h" namespace { @@ -119,7 +120,8 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog( return; } - base::string16 display_url = net::FormatUrl(origin_url, accept_lang); + base::string16 display_url = + url_formatter::FormatUrl(origin_url, accept_lang); dialog_.reset(new CefJavaScriptDialog(this, message_type, diff --git a/libcef/browser/printing/print_view_manager_base.cc b/libcef/browser/printing/print_view_manager_base.cc index 5bd680027..6409cf650 100644 --- a/libcef/browser/printing/print_view_manager_base.cc +++ b/libcef/browser/printing/print_view_manager_base.cc @@ -6,10 +6,14 @@ #include "libcef/browser/content_browser_client.h" +#include "base/auto_reset.h" #include "base/bind.h" +#include "base/location.h" #include "base/memory/scoped_ptr.h" #include "base/prefs/pref_service.h" +#include "base/single_thread_task_runner.h" #include "base/strings/utf_string_conversions.h" +#include "base/thread_task_runner_handle.h" #include "base/timer/timer.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" @@ -35,11 +39,9 @@ using content::BrowserThread; namespace printing { PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents) - : content::WebContentsObserver(web_contents), - number_pages_(0), + : PrintManager(web_contents), printing_succeeded_(false), inside_inner_message_loop_(false), - cookie_(0), queue_(g_browser_process->print_job_manager()->queue()) { DCHECK(queue_.get()); #if !defined(OS_MACOSX) @@ -75,6 +77,7 @@ void PrintViewManagerBase::NavigationStopped() { } void PrintViewManagerBase::RenderProcessGone(base::TerminationStatus status) { + PrintManager::RenderProcessGone(status); ReleasePrinterQuery(); if (!print_job_.get()) @@ -98,16 +101,10 @@ base::string16 PrintViewManagerBase::RenderSourceName() { void PrintViewManagerBase::OnDidGetPrintedPagesCount(int cookie, int number_pages) { - DCHECK_GT(cookie, 0); - DCHECK_GT(number_pages, 0); - number_pages_ = number_pages; + PrintManager::OnDidGetPrintedPagesCount(cookie, number_pages); OpportunisticallyCreatePrintJob(cookie); } -void PrintViewManagerBase::OnDidGetDocumentCookie(int cookie) { - cookie_ = cookie; -} - void PrintViewManagerBase::OnDidPrintPage( const PrintHostMsg_DidPrintPage_Params& params) { if (!OpportunisticallyCreatePrintJob(params.document_cookie)) @@ -167,10 +164,7 @@ void PrintViewManagerBase::OnDidPrintPage( } void PrintViewManagerBase::OnPrintingFailed(int cookie) { - if (cookie != cookie_) { - NOTREACHED(); - return; - } + PrintManager::OnPrintingFailed(cookie); ReleasePrinterQuery(); @@ -190,17 +184,12 @@ void PrintViewManagerBase::DidStartLoading() { bool PrintViewManagerBase::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PrintViewManagerBase, message) - IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPrintedPagesCount, - OnDidGetPrintedPagesCount) - IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetDocumentCookie, - OnDidGetDocumentCookie) IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintPage, OnDidPrintPage) - IPC_MESSAGE_HANDLER(PrintHostMsg_PrintingFailed, OnPrintingFailed) IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError, OnShowInvalidPrinterSettingsError); IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() - return handled; + return handled || PrintManager::OnMessageReceived(message); } void PrintViewManagerBase::Observe( diff --git a/libcef/browser/printing/print_view_manager_base.h b/libcef/browser/printing/print_view_manager_base.h index 8ee805bac..101a4588b 100644 --- a/libcef/browser/printing/print_view_manager_base.h +++ b/libcef/browser/printing/print_view_manager_base.h @@ -8,10 +8,9 @@ #include "base/memory/ref_counted.h" #include "base/prefs/pref_member.h" #include "base/strings/string16.h" +#include "components/printing/browser/print_manager.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -#include "content/public/browser/web_contents_observer.h" -#include "content/public/browser/web_contents_user_data.h" #include "printing/printed_pages_source.h" struct PrintHostMsg_DidPrintPage_Params; @@ -31,7 +30,7 @@ class PrintQueriesQueue; // Base class for managing the print commands for a WebContents. class PrintViewManagerBase : public content::NotificationObserver, public PrintedPagesSource, - public content::WebContentsObserver { + public PrintManager { public: ~PrintViewManagerBase() override; @@ -63,9 +62,6 @@ class PrintViewManagerBase : public content::NotificationObserver, // content::WebContentsObserver implementation. bool OnMessageReceived(const IPC::Message& message) override; - // IPC Message handlers. - virtual void OnPrintingFailed(int cookie); - private: // content::NotificationObserver implementation. void Observe(int type, @@ -76,9 +72,9 @@ class PrintViewManagerBase : public content::NotificationObserver, void DidStartLoading() override; // IPC Message handlers. - void OnDidGetPrintedPagesCount(int cookie, int number_pages); - void OnDidGetDocumentCookie(int cookie); + void OnDidGetPrintedPagesCount(int cookie, int number_pages) override; void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); + void OnPrintingFailed(int cookie) override; void OnShowInvalidPrinterSettingsError(); // Processes a NOTIFY_PRINT_JOB_EVENT notification. @@ -137,9 +133,6 @@ class PrintViewManagerBase : public content::NotificationObserver, // Manages the low-level talk to the printer. scoped_refptr print_job_; - // Number of pages to print in the print job. - int number_pages_; - // Indication of success of the print job. bool printing_succeeded_; @@ -153,9 +146,6 @@ class PrintViewManagerBase : public content::NotificationObserver, bool expecting_first_page_; #endif // OS_MACOSX - // The document cookie of the current PrinterQuery. - int cookie_; - // Whether printing is enabled. BooleanPrefMember printing_enabled_; diff --git a/libcef/browser/printing/printing_message_filter.cc b/libcef/browser/printing/printing_message_filter.cc index 3d8cf75eb..677d669fb 100644 --- a/libcef/browser/printing/printing_message_filter.cc +++ b/libcef/browser/printing/printing_message_filter.cc @@ -10,79 +10,17 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/printer_query.h" +#include "components/printing/browser/print_manager_utils.h" #include "components/printing/common/print_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/common/child_process_host.h" -#if defined(OS_CHROMEOS) -#include - -#include - -#include "base/files/file_util.h" -#include "base/lazy_instance.h" -#include "chrome/browser/printing/print_dialog_cloud.h" -#endif - -#if defined(OS_ANDROID) -#include "base/strings/string_number_conversions.h" -#include "chrome/browser/printing/print_view_manager_basic.h" -#include "printing/printing_context_android.h" -#endif - using content::BrowserThread; namespace printing { -namespace { - -#if defined(OS_CHROMEOS) -typedef std::map SequenceToPathMap; - -struct PrintingSequencePathMap { - SequenceToPathMap map; - int sequence; -}; - -// No locking, only access on the FILE thread. -static base::LazyInstance - g_printing_file_descriptor_map = LAZY_INSTANCE_INITIALIZER; -#endif - -void RenderParamsFromPrintSettings(const PrintSettings& settings, - PrintMsg_Print_Params* params) { - params->page_size = settings.page_setup_device_units().physical_size(); - params->content_size.SetSize( - settings.page_setup_device_units().content_area().width(), - settings.page_setup_device_units().content_area().height()); - params->printable_area.SetRect( - settings.page_setup_device_units().printable_area().x(), - settings.page_setup_device_units().printable_area().y(), - settings.page_setup_device_units().printable_area().width(), - settings.page_setup_device_units().printable_area().height()); - params->margin_top = settings.page_setup_device_units().content_area().y(); - params->margin_left = settings.page_setup_device_units().content_area().x(); - params->dpi = settings.dpi(); - // Currently hardcoded at 1.25. See PrintSettings' constructor. - params->min_shrink = settings.min_shrink(); - // Currently hardcoded at 2.0. See PrintSettings' constructor. - params->max_shrink = settings.max_shrink(); - // Currently hardcoded at 72dpi. See PrintSettings' constructor. - params->desired_dpi = settings.desired_dpi(); - // Always use an invalid cookie. - params->document_cookie = 0; - params->selection_only = settings.selection_only(); - params->supports_alpha_blend = settings.supports_alpha_blend(); - params->should_print_backgrounds = settings.should_print_backgrounds(); - params->display_header_footer = settings.display_header_footer(); - params->title = settings.title(); - params->url = settings.url(); -} - -} // namespace - PrintingMessageFilter::PrintingMessageFilter(int render_process_id) : content::BrowserMessageFilter(PrintMsgStart), render_process_id_(render_process_id), @@ -95,17 +33,6 @@ PrintingMessageFilter::~PrintingMessageFilter() { void PrintingMessageFilter::OverrideThreadForMessage( const IPC::Message& message, BrowserThread::ID* thread) { -#if defined(OS_CHROMEOS) - if (message.type() == PrintHostMsg_AllocateTempFileForPrinting::ID || - message.type() == PrintHostMsg_TempFileForPrintingWritten::ID) { - *thread = BrowserThread::FILE; - } -#elif defined(OS_ANDROID) - if (message.type() == PrintHostMsg_AllocateTempFileForPrinting::ID || - message.type() == PrintHostMsg_TempFileForPrintingWritten::ID) { - *thread = BrowserThread::UI; - } -#endif } bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message) { @@ -113,12 +40,6 @@ bool PrintingMessageFilter::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(PrintingMessageFilter, message) #if defined(OS_WIN) IPC_MESSAGE_HANDLER(PrintHostMsg_DuplicateSection, OnDuplicateSection) -#endif -#if defined(OS_CHROMEOS) || defined(OS_ANDROID) - IPC_MESSAGE_HANDLER(PrintHostMsg_AllocateTempFileForPrinting, - OnAllocateTempFileForPrinting) - IPC_MESSAGE_HANDLER(PrintHostMsg_TempFileForPrintingWritten, - OnTempFileForPrintingWritten) #endif IPC_MESSAGE_HANDLER(PrintHostMsg_IsPrintingEnabled, OnIsPrintingEnabled) IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings, @@ -143,109 +64,6 @@ void PrintingMessageFilter::OnDuplicateSection( } #endif -#if defined(OS_CHROMEOS) || defined(OS_ANDROID) -void PrintingMessageFilter::OnAllocateTempFileForPrinting( - int render_view_id, - base::FileDescriptor* temp_file_fd, - int* sequence_number) { -#if defined(OS_CHROMEOS) - // TODO(thestig): Use |render_view_id| for Chrome OS. - DCHECK_CURRENTLY_ON(BrowserThread::FILE); - temp_file_fd->fd = *sequence_number = -1; - temp_file_fd->auto_close = false; - - SequenceToPathMap* map = &g_printing_file_descriptor_map.Get().map; - *sequence_number = g_printing_file_descriptor_map.Get().sequence++; - - base::FilePath path; - if (base::CreateTemporaryFile(&path)) { - int fd = open(path.value().c_str(), O_WRONLY); - if (fd >= 0) { - SequenceToPathMap::iterator it = map->find(*sequence_number); - if (it != map->end()) { - NOTREACHED() << "Sequence number already in use. seq=" << - *sequence_number; - } else { - (*map)[*sequence_number] = path; - temp_file_fd->fd = fd; - temp_file_fd->auto_close = true; - } - } - } -#elif defined(OS_ANDROID) - DCHECK_CURRENTLY_ON(BrowserThread::UI); - content::WebContents* wc = GetWebContentsForRenderView(render_view_id); - if (!wc) - return; - PrintViewManagerBasic* print_view_manager = - PrintViewManagerBasic::FromWebContents(wc); - // The file descriptor is originally created in & passed from the Android - // side, and it will handle the closing. - const base::FileDescriptor& file_descriptor = - print_view_manager->file_descriptor(); - temp_file_fd->fd = file_descriptor.fd; - temp_file_fd->auto_close = false; -#endif -} - -void PrintingMessageFilter::OnTempFileForPrintingWritten(int render_view_id, - int sequence_number) { -#if defined(OS_CHROMEOS) - DCHECK_CURRENTLY_ON(BrowserThread::FILE); - SequenceToPathMap* map = &g_printing_file_descriptor_map.Get().map; - SequenceToPathMap::iterator it = map->find(sequence_number); - if (it == map->end()) { - NOTREACHED() << "Got a sequence that we didn't pass to the " - "renderer: " << sequence_number; - return; - } - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, - base::Bind(&PrintingMessageFilter::CreatePrintDialogForFile, - this, render_view_id, it->second)); - - // Erase the entry in the map. - map->erase(it); -#elif defined(OS_ANDROID) - DCHECK_CURRENTLY_ON(BrowserThread::UI); - content::WebContents* wc = GetWebContentsForRenderView(render_view_id); - if (!wc) - return; - PrintViewManagerBasic* print_view_manager = - PrintViewManagerBasic::FromWebContents(wc); - const base::FileDescriptor& file_descriptor = - print_view_manager->file_descriptor(); - PrintingContextAndroid::PdfWritingDone(file_descriptor.fd, true); - // Invalidate the file descriptor so it doesn't accidentally get reused. - print_view_manager->set_file_descriptor(base::FileDescriptor(-1, false)); -#endif -} -#endif // defined(OS_CHROMEOS) || defined(OS_ANDROID) - -#if defined(OS_CHROMEOS) -void PrintingMessageFilter::CreatePrintDialogForFile( - int render_view_id, - const base::FilePath& path) { - content::WebContents* wc = GetWebContentsForRenderView(render_view_id); - if (!wc) - return; - print_dialog_cloud::CreatePrintDialogForFile( - wc->GetBrowserContext(), - wc->GetTopLevelNativeWindow(), - path, - wc->GetTitle(), - base::string16(), - std::string("application/pdf")); -} -#endif // defined(OS_CHROMEOS) - -content::WebContents* PrintingMessageFilter::GetWebContentsForRenderView( - int render_view_id) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - content::RenderViewHost* view = content::RenderViewHost::FromID( - render_process_id_, render_view_id); - return view ? content::WebContents::FromRenderViewHost(view) : NULL; -} void PrintingMessageFilter::OnIsPrintingEnabled(bool* is_enabled) { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -356,18 +174,6 @@ void PrintingMessageFilter::OnScriptedPrintReply( } } -#if defined(OS_ANDROID) -void PrintingMessageFilter::UpdateFileDescriptor(int render_view_id, int fd) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - content::WebContents* wc = GetWebContentsForRenderView(render_view_id); - if (!wc) - return; - PrintViewManagerBasic* print_view_manager = - PrintViewManagerBasic::FromWebContents(wc); - print_view_manager->set_file_descriptor(base::FileDescriptor(fd, false)); -} -#endif - void PrintingMessageFilter::OnUpdatePrintSettings( int document_cookie, const base::DictionaryValue& job_settings, IPC::Message* reply_msg) { @@ -424,7 +230,7 @@ void PrintingMessageFilter::OnUpdatePrintSettingsReply( void PrintingMessageFilter::OnCheckForCancel(int32 preview_ui_id, int preview_request_id, bool* cancel) { - *cancel = false; + *cancel = false; } } // namespace printing diff --git a/libcef/browser/printing/printing_message_filter.h b/libcef/browser/printing/printing_message_filter.h index 1a841d365..61426cac2 100644 --- a/libcef/browser/printing/printing_message_filter.h +++ b/libcef/browser/printing/printing_message_filter.h @@ -51,29 +51,6 @@ class PrintingMessageFilter : public content::BrowserMessageFilter { base::SharedMemoryHandle* browser_handle); #endif -#if defined(OS_CHROMEOS) || defined(OS_ANDROID) - // Used to ask the browser allocate a temporary file for the renderer - // to fill in resulting PDF in renderer. - void OnAllocateTempFileForPrinting(int render_view_id, - base::FileDescriptor* temp_file_fd, - int* sequence_number); - void OnTempFileForPrintingWritten(int render_view_id, int sequence_number); -#endif - -#if defined(OS_CHROMEOS) - void CreatePrintDialogForFile(int render_view_id, const base::FilePath& path); -#endif - -#if defined(OS_ANDROID) - // Updates the file descriptor for the PrintViewManagerBasic of a given - // render_view_id. - void UpdateFileDescriptor(int render_view_id, int fd); -#endif - - // Given a render_view_id get the corresponding WebContents. - // Must be called on the UI thread. - content::WebContents* GetWebContentsForRenderView(int render_view_id); - // GetPrintSettingsForRenderView must be called via PostTask and // base::Bind. Collapse the settings-specific params into a // struct to avoid running into issues with too many params diff --git a/libcef/browser/render_widget_host_view_osr.cc b/libcef/browser/render_widget_host_view_osr.cc index 362f2ee11..5da020c66 100644 --- a/libcef/browser/render_widget_host_view_osr.cc +++ b/libcef/browser/render_widget_host_view_osr.cc @@ -649,7 +649,8 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( output_surface_id, frame->delegated_frame_data.Pass(), frame->metadata.device_scale_factor, - frame->metadata.latency_info); + frame->metadata.latency_info, + &frame->metadata.satisfies_sequences); } else { if (!copy_frame_generator_.get()) { copy_frame_generator_.reset( @@ -668,7 +669,8 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( output_surface_id, frame->delegated_frame_data.Pass(), frame->metadata.device_scale_factor, - frame->metadata.latency_info); + frame->metadata.latency_info, + &frame->metadata.satisfies_sequences); // Request a copy of the last compositor frame which will eventually call // OnPaint asynchronously. @@ -677,16 +679,6 @@ void CefRenderWidgetHostViewOSR::OnSwapCompositorFrame( return; } - - if (frame->software_frame_data) { - DLOG(ERROR) << "Unable to use software frame in CEF windowless rendering"; - if (render_widget_host_) { - content::bad_message::ReceivedBadMessage( - render_widget_host_->GetProcess(), - content::bad_message::RWHVM_UNEXPECTED_FRAME_TYPE); - } - return; - } } void CefRenderWidgetHostViewOSR::InitAsPopup( @@ -783,10 +775,8 @@ void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) { } #if !defined(OS_MACOSX) -void CefRenderWidgetHostViewOSR::TextInputTypeChanged(ui::TextInputType type, - ui::TextInputMode mode, - bool can_compose_inline, - int flags) { +void CefRenderWidgetHostViewOSR::TextInputStateChanged( + const ViewHostMsg_TextInputState_Params& params) { } void CefRenderWidgetHostViewOSR::ImeCancelComposition() { diff --git a/libcef/browser/render_widget_host_view_osr.h b/libcef/browser/render_widget_host_view_osr.h index a7b89fa0e..30e99cc6a 100644 --- a/libcef/browser/render_widget_host_view_osr.h +++ b/libcef/browser/render_widget_host_view_osr.h @@ -126,10 +126,8 @@ class CefRenderWidgetHostViewOSR const std::vector& moves) override; void UpdateCursor(const content::WebCursor& cursor) override; void SetIsLoading(bool is_loading) override; - void TextInputTypeChanged(ui::TextInputType type, - ui::TextInputMode mode, - bool can_compose_inline, - int flags) override; + void TextInputStateChanged( + const ViewHostMsg_TextInputState_Params& params) override; void ImeCancelComposition() override; void RenderProcessGone(base::TerminationStatus status, int error_code) override; diff --git a/libcef/browser/render_widget_host_view_osr_mac.mm b/libcef/browser/render_widget_host_view_osr_mac.mm index 8e8d81d3f..dfcab7a89 100644 --- a/libcef/browser/render_widget_host_view_osr_mac.mm +++ b/libcef/browser/render_widget_host_view_osr_mac.mm @@ -54,10 +54,8 @@ bool CefRenderWidgetHostViewOSR::IsSpeaking() const { void CefRenderWidgetHostViewOSR::StopSpeaking() { } -void CefRenderWidgetHostViewOSR::TextInputTypeChanged(ui::TextInputType type, - ui::TextInputMode mode, - bool can_compose_inline, - int flags) { +void CefRenderWidgetHostViewOSR::TextInputStateChanged( + const ViewHostMsg_TextInputState_Params& params) { [NSApp updateWindows]; } diff --git a/libcef/browser/resource_dispatcher_host_delegate.cc b/libcef/browser/resource_dispatcher_host_delegate.cc index 9a1bba633..f49a19351 100644 --- a/libcef/browser/resource_dispatcher_host_delegate.cc +++ b/libcef/browser/resource_dispatcher_host_delegate.cc @@ -61,36 +61,6 @@ bool NavigationOnUIThread( return ignore_navigation; } -// TODO(raymes): This won't return the right result if plugins haven't been -// loaded yet. Fixing this properly really requires fixing crbug.com/443466. -bool IsPluginEnabledForExtension(const extensions::Extension* extension, - const content::ResourceRequestInfo* info, - const std::string& mime_type, - const GURL& url) { - content::PluginService* service = content::PluginService::GetInstance(); - std::vector plugins; - service->GetPluginInfoArray(url, mime_type, true, &plugins, nullptr); - content::PluginServiceFilter* filter = service->GetFilter(); - - for (auto& plugin : plugins) { - // Check that the plugin is running the extension. - if (plugin.path != - base::FilePath::FromUTF8Unsafe(extension->url().spec())) { - continue; - } - // Check that the plugin is actually enabled. - if (!filter || filter->IsPluginAvailable(info->GetChildID(), - info->GetRenderFrameID(), - info->GetContext(), - url, - GURL(), - &plugin)) { - return true; - } - } - return false; -} - void SendExecuteMimeTypeHandlerEvent(scoped_ptr stream, int64 expected_content_size, int render_process_id, @@ -184,6 +154,7 @@ bool CefResourceDispatcherHostDelegate::HandleExternalProtocol( // ChromeResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream. bool CefResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( net::URLRequest* request, + const base::FilePath& plugin_path, const std::string& mime_type, GURL* origin, std::string* payload) { @@ -213,23 +184,32 @@ bool CefResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( } MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); - if (handler && handler->CanHandleMIMEType(mime_type)) { - StreamTargetInfo target_info; - *origin = extensions::Extension::GetBaseURLFromExtensionId(extension_id); - target_info.extension_id = extension_id; - if (!handler->handler_url().empty()) { - // This is reached in the case of MimeHandlerViews. If the - // MimeHandlerView plugin is disabled, then we shouldn't intercept the - // stream. - if (!IsPluginEnabledForExtension(extension, info, mime_type, - request->url())) { - continue; - } + if (!handler) + continue; + + // If a plugin path is provided then a stream is being intercepted for the + // mimeHandlerPrivate API. Otherwise a stream is being intercepted for the + // streamsPrivate API. + if (!plugin_path.empty()) { + if (handler->HasPlugin() && plugin_path == handler->GetPluginPath()) { + StreamTargetInfo target_info; + *origin = + extensions::Extension::GetBaseURLFromExtensionId(extension_id); + target_info.extension_id = extension_id; target_info.view_id = base::GenerateGUID(); *payload = target_info.view_id; + stream_target_info_[request] = target_info; + return true; + } + } else { + if (!handler->HasPlugin() && handler->CanHandleMIMEType(mime_type)) { + StreamTargetInfo target_info; + *origin = + extensions::Extension::GetBaseURLFromExtensionId(extension_id); + target_info.extension_id = extension_id; + stream_target_info_[request] = target_info; + return true; } - stream_target_info_[request] = target_info; - return true; } } diff --git a/libcef/browser/resource_dispatcher_host_delegate.h b/libcef/browser/resource_dispatcher_host_delegate.h index 0028c4a7f..db52690a1 100644 --- a/libcef/browser/resource_dispatcher_host_delegate.h +++ b/libcef/browser/resource_dispatcher_host_delegate.h @@ -33,6 +33,7 @@ class CefResourceDispatcherHostDelegate ui::PageTransition page_transition, bool has_user_gesture) override; bool ShouldInterceptResourceAsStream(net::URLRequest* request, + const base::FilePath& plugin_path, const std::string& mime_type, GURL* origin, std::string* payload) override; diff --git a/libcef/browser/software_output_device_osr.cc b/libcef/browser/software_output_device_osr.cc index 02a0dabc2..716ac1651 100644 --- a/libcef/browser/software_output_device_osr.cc +++ b/libcef/browser/software_output_device_osr.cc @@ -66,16 +66,15 @@ SkCanvas* CefSoftwareOutputDeviceOSR::BeginPaint(const gfx::Rect& damage_rect) { return canvas_.get(); } -void CefSoftwareOutputDeviceOSR::EndPaint(cc::SoftwareFrameData* frame_data) { +void CefSoftwareOutputDeviceOSR::EndPaint() { CEF_REQUIRE_UIT(); DCHECK(canvas_.get()); DCHECK(bitmap_.get()); - DCHECK(frame_data); if (!bitmap_.get()) return; - cc::SoftwareOutputDevice::EndPaint(frame_data); + cc::SoftwareOutputDevice::EndPaint(); if (active_) OnPaint(damage_rect_); diff --git a/libcef/browser/software_output_device_osr.h b/libcef/browser/software_output_device_osr.h index 7e7c1ef27..045feed92 100644 --- a/libcef/browser/software_output_device_osr.h +++ b/libcef/browser/software_output_device_osr.h @@ -30,7 +30,7 @@ class CefSoftwareOutputDeviceOSR : public cc::SoftwareOutputDevice { void Resize(const gfx::Size& viewport_pixel_size, float scale_factor) override; SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override; - void EndPaint(cc::SoftwareFrameData* frame_data) override; + void EndPaint() override; void SetActive(bool active); diff --git a/libcef/browser/text_input_client_osr_mac.mm b/libcef/browser/text_input_client_osr_mac.mm index c20a5c3bf..249ec853d 100644 --- a/libcef/browser/text_input_client_osr_mac.mm +++ b/libcef/browser/text_input_client_osr_mac.mm @@ -120,7 +120,7 @@ extern "C" { // We ignore commands that insert characters, because this was causing // strange behavior (e.g. tab always inserted a tab rather than moving to // the next field on the page). - if (!base::StartsWithASCII(command, "insert", false)) + if (!base::StartsWith(command, "insert", base::CompareCase::SENSITIVE)) editCommands_.push_back(content::EditCommand(command, "")); } else { renderWidgetHostView_->render_widget_host()->Send( diff --git a/libcef/common/cef_switches.cc b/libcef/common/cef_switches.cc index 952c4179e..60b0e5eaf 100644 --- a/libcef/common/cef_switches.cc +++ b/libcef/common/cef_switches.cc @@ -103,4 +103,8 @@ const char kDisableScrollBounce[] = "disable-scroll-bounce"; // Disable the PDF extension. const char kDisablePdfExtension[] = "disable-pdf-extension"; +// Enable NPAPI plugins. Note that this functionality will be removed in an +// upcoming version of Chromium. +const char kEnableNPAPI[] = "enable-npapi"; + } // namespace switches diff --git a/libcef/common/cef_switches.h b/libcef/common/cef_switches.h index e6d90eb7f..592fe2d74 100644 --- a/libcef/common/cef_switches.h +++ b/libcef/common/cef_switches.h @@ -44,6 +44,7 @@ extern const char kOverrideSpellCheckLang[]; extern const char kEnableSystemFlash[]; extern const char kDisableScrollBounce[]; extern const char kDisablePdfExtension[]; +extern const char kEnableNPAPI[]; } // namespace switches diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index 4d7b7a936..fb69fb52b 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -88,13 +88,10 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, plugin.path = path; plugin.permissions = chrome::kPepperFlashPermissions; - std::vector flash_version_numbers; - base::SplitString(version, '.', &flash_version_numbers); + std::vector flash_version_numbers = base::SplitString( + version, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); if (flash_version_numbers.size() < 1) flash_version_numbers.push_back("11"); - // |SplitString()| puts in an empty string given an empty string. :( - else if (flash_version_numbers[0].empty()) - flash_version_numbers[0] = "11"; if (flash_version_numbers.size() < 2) flash_version_numbers.push_back("2"); if (flash_version_numbers.size() < 3) @@ -104,7 +101,7 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, // E.g., "Shockwave Flash 10.2 r154": plugin.description = plugin.name + " " + flash_version_numbers[0] + "." + flash_version_numbers[1] + " r" + flash_version_numbers[2]; - plugin.version = JoinString(flash_version_numbers, '.'); + plugin.version = base::JoinString(flash_version_numbers, "."); content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType, content::kFlashPluginSwfExtension, content::kFlashPluginSwfDescription); @@ -135,17 +132,6 @@ void AddPepperFlashFromCommandLine( CreatePepperFlashInfo(base::FilePath(flash_path), flash_version)); } -#if defined(OS_WIN) -const char kPepperFlashDLLBaseName[] = -#if defined(ARCH_CPU_X86) - "pepflashplayer32_"; -#elif defined(ARCH_CPU_X86_64) - "pepflashplayer64_"; -#else -#error Unsupported Windows CPU architecture. -#endif // defined(ARCH_CPU_X86) -#endif // defined(OS_WIN) - bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -157,14 +143,14 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { if (command_line->HasSwitch(switches::kPpapiFlashPath)) return false; - base::FilePath flash_path; - if (!PathService::Get(chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN, &flash_path)) + base::FilePath flash_filename; + if (!PathService::Get(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN, + &flash_filename)) { return false; + } - if (!base::PathExists(flash_path)) - return false; - - base::FilePath manifest_path(flash_path.AppendASCII("manifest.json")); + base::FilePath manifest_path( + flash_filename.DirName().AppendASCII("manifest.json")); std::string manifest_data; if (!base::ReadFileToString(manifest_path, &manifest_data)) @@ -181,23 +167,7 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { if (!chrome::CheckPepperFlashManifest(*manifest, &version)) return false; -#if defined(OS_WIN) - // PepperFlash DLLs on Windows look like basename_v_x_y_z.dll. - std::string filename(kPepperFlashDLLBaseName); - filename.append(version.GetString()); - base::ReplaceChars(filename, ".", "_", &filename); - filename.append(".dll"); - - base::FilePath path(flash_path.Append(base::ASCIIToUTF16(filename))); -#else - // PepperFlash on OS X is called PepperFlashPlayer.plugin - base::FilePath path(flash_path.Append(chrome::kPepperFlashPluginFilename)); -#endif - - if (!base::PathExists(path)) - return false; - - *plugin = CreatePepperFlashInfo(path, version.GetString()); + *plugin = CreatePepperFlashInfo(flash_filename, version.GetString()); return true; } diff --git a/libcef/common/content_client.h b/libcef/common/content_client.h index 04f833750..abade0413 100644 --- a/libcef/common/content_client.h +++ b/libcef/common/content_client.h @@ -44,9 +44,24 @@ class CefContentClient : public content::ContentClient, struct SchemeInfo { std::string scheme_name; + + // Registers a non-HTTP URL scheme which can be sent CORS requests. bool is_standard; + + // Registers a URL scheme that can be saved to disk. bool is_savable; + + // Registers a URL scheme to be treated as a local scheme (i.e., with the + // same security rules as those applied to "file" URLs). This means that + // normal pages cannot link to or access URLs of this scheme. bool is_local; + + // Registers a URL scheme to be treated as display-isolated. This means + // that pages cannot display these URLs unless they are from the same + // scheme. For example, pages in other origin cannot create iframes or + // hyperlinks to URLs with the scheme. For schemes that must be accessible + // from other schemes set this value to false and use CORS + // "Access-Control-Allow-Origin" headers to further restrict access. bool is_display_isolated; }; typedef std::list SchemeInfoList; diff --git a/libcef/common/extensions/api/schemas.gypi b/libcef/common/extensions/api/schemas.gypi index 707c52c69..56c8f9997 100644 --- a/libcef/common/extensions/api/schemas.gypi +++ b/libcef/common/extensions/api/schemas.gypi @@ -15,8 +15,9 @@ 'chromium_code': 1, 'cc_dir': 'cef/libcef/common/extensions/api', - # Match the Chrome namespace to minimize code changes. + # Match the Chrome namespace and bundle name to minimize code changes. 'root_namespace': 'extensions::api::%(namespace)s', + 'bundle_name': 'Chrome', 'impl_dir_': 'cef/libcef/browser/extensions/api', }, } diff --git a/libcef/common/extensions/extensions_client.cc b/libcef/common/extensions/extensions_client.cc index c43180f6f..962002495 100644 --- a/libcef/common/extensions/extensions_client.cc +++ b/libcef/common/extensions/extensions_client.cc @@ -45,29 +45,11 @@ class CefPermissionMessageProvider : public PermissionMessageProvider { ~CefPermissionMessageProvider() override {} // PermissionMessageProvider implementation. - PermissionMessageIDs GetLegacyPermissionMessageIDs( - const PermissionSet* permissions, - Manifest::Type extension_type) const override { - return PermissionMessageIDs(); - } - - CoalescedPermissionMessages GetCoalescedPermissionMessages( + CoalescedPermissionMessages GetPermissionMessages( const PermissionIDSet& permissions) const override { return CoalescedPermissionMessages(); } - std::vector GetLegacyWarningMessages( - const PermissionSet* permissions, - Manifest::Type extension_type) const override { - return std::vector(); - } - - std::vector GetLegacyWarningMessagesDetails( - const PermissionSet* permissions, - Manifest::Type extension_type) const override { - return std::vector(); - } - bool IsPrivilegeIncrease(const PermissionSet* old_permissions, const PermissionSet* new_permissions, Manifest::Type extension_type) const override { @@ -201,18 +183,18 @@ bool CefExtensionsClient::IsScriptableURL(const GURL& url, bool CefExtensionsClient::IsAPISchemaGenerated( const std::string& name) const { - return core_api::GeneratedSchemas::IsGenerated(name) || - api::GeneratedSchemas::IsGenerated(name); + return api::GeneratedSchemas::IsGenerated(name) || + api::ChromeGeneratedSchemas::IsGenerated(name); } base::StringPiece CefExtensionsClient::GetAPISchema( const std::string& name) const { // Schema for CEF-only APIs. - if (api::GeneratedSchemas::IsGenerated(name)) - return api::GeneratedSchemas::Get(name); + if (api::ChromeGeneratedSchemas::IsGenerated(name)) + return api::ChromeGeneratedSchemas::Get(name); // Core extensions APIs. - return core_api::GeneratedSchemas::Get(name); + return api::GeneratedSchemas::Get(name); } void CefExtensionsClient::RegisterAPISchemaResources( diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index 0da8ec880..02a0829d1 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -23,6 +23,7 @@ #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" #include "chrome/child/pdf_child_init.h" +#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "content/public/browser/browser_main_runner.h" @@ -131,18 +132,19 @@ base::FilePath GetResourcesFilePath() { #if defined(OS_WIN) -const wchar_t kFlashRegistryRoot[] = L"SOFTWARE\\Macromedia\\FlashPlayerPepper"; -const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath"; - // Gets the Flash path if installed on the system. -bool GetSystemFlashDirectory(base::FilePath* out_path) { - base::win::RegKey path_key(HKEY_LOCAL_MACHINE, kFlashRegistryRoot, KEY_READ); +bool GetSystemFlashFilename(base::FilePath* out_path) { + const wchar_t kPepperFlashRegistryRoot[] = + L"SOFTWARE\\Macromedia\\FlashPlayerPepper"; + const wchar_t kFlashPlayerPathValueName[] = L"PlayerPath"; + + base::win::RegKey path_key( + HKEY_LOCAL_MACHINE, kPepperFlashRegistryRoot, KEY_READ); base::string16 path_str; if (FAILED(path_key.ReadValue(kFlashPlayerPathValueName, &path_str))) return false; - base::FilePath plugin_path = base::FilePath(path_str).DirName(); - *out_path = plugin_path; + *out_path = base::FilePath(path_str); return true; } @@ -154,20 +156,22 @@ const base::FilePath::CharType kPepperFlashSystemBaseDirectory[] = #endif void OverridePepperFlashSystemPluginPath() { - base::FilePath plugin_path; + base::FilePath plugin_filename; #if defined(OS_WIN) - if (!GetSystemFlashDirectory(&plugin_path)) + if (!GetSystemFlashFilename(&plugin_filename)) return; #elif defined(OS_MACOSX) - if (!util_mac::GetLocalLibraryDirectory(&plugin_path)) + if (!util_mac::GetLocalLibraryDirectory(&plugin_filename)) return; - plugin_path = plugin_path.Append(kPepperFlashSystemBaseDirectory); + plugin_filename = plugin_filename.Append(kPepperFlashSystemBaseDirectory) + .Append(chrome::kPepperFlashPluginFilename); #else // A system plugin is not available on other platforms. return; #endif - PathService::Override(chrome::DIR_PEPPER_FLASH_SYSTEM_PLUGIN, plugin_path); + PathService::Override(chrome::FILE_PEPPER_FLASH_SYSTEM_PLUGIN, + plugin_filename); } #if defined(OS_LINUX) diff --git a/libcef/common/scheme_registration.cc b/libcef/common/scheme_registration.cc index 1570f81ac..e3dd7bc14 100644 --- a/libcef/common/scheme_registration.cc +++ b/libcef/common/scheme_registration.cc @@ -13,11 +13,11 @@ namespace scheme { void AddInternalSchemes(std::vector* standard_schemes, std::vector* savable_schemes) { + // chrome: and chrome-devtools: schemes are registered in + // RenderThreadImpl::RegisterSchemes(). static CefContentClient::SchemeInfo schemes[] = { - { content::kChromeUIScheme, true, false, true, true }, - { content::kChromeDevToolsScheme, true, false, false, true }, - { extensions::kExtensionScheme, true, true, true, true }, - { extensions::kExtensionResourceScheme, true, true, false, true }, + { extensions::kExtensionScheme, true, true, false, true }, + { extensions::kExtensionResourceScheme, true, true, false, false }, }; CefContentClient* client = CefContentClient::Get(); diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index ec362080f..1c728526d 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -14,6 +14,7 @@ #include "libcef/common/request_impl.h" #include "libcef/common/values_impl.h" #include "libcef/renderer/browser_impl.h" +#include "libcef/renderer/extensions/extensions_dispatcher_delegate.h" #include "libcef/renderer/extensions/extensions_renderer_client.h" #include "libcef/renderer/extensions/print_web_view_helper_delegate.h" #include "libcef/renderer/pepper/pepper_helper.h" @@ -430,7 +431,6 @@ void CefContentRendererClient::RenderThreadStarted() { thread->AddObserver(observer_.get()); thread->AddObserver(web_cache_observer_.get()); thread->GetChannel()->AddFilter(new CefRenderMessageFilter); - thread->RegisterExtension(extensions_v8::LoadTimesExtension::Get()); if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { spellcheck_.reset(new SpellCheck()); @@ -483,7 +483,8 @@ void CefContentRendererClient::RenderThreadStarted() { extensions::ExtensionsRendererClient::Set( extensions_renderer_client_.get()); - extension_dispatcher_delegate_.reset(new extensions::DispatcherDelegate()); + extension_dispatcher_delegate_.reset( + new extensions::CefExtensionsDispatcherDelegate()); // Must be initialized after ExtensionsRendererClient. extension_dispatcher_.reset( @@ -507,6 +508,9 @@ void CefContentRendererClient::RenderThreadStarted() { listValuePtr->Detach(NULL); } } + + // Register extensions last because it will trigger WebKit initialization. + thread->RegisterExtension(extensions_v8::LoadTimesExtension::Get()); } void CefContentRendererClient::RenderFrameCreated( diff --git a/libcef/renderer/dom_node_impl.cc b/libcef/renderer/dom_node_impl.cc index 6ab060382..f14ed0846 100644 --- a/libcef/renderer/dom_node_impl.cc +++ b/libcef/renderer/dom_node_impl.cc @@ -104,9 +104,12 @@ bool CefDOMNodeImpl::IsEditable() { // Also return true if it has an ARIA role of 'textbox'. for (unsigned i = 0; i < element.attributeCount(); ++i) { - if (base::LowerCaseEqualsASCII(element.attributeLocalName(i), "role")) { - if (base::LowerCaseEqualsASCII(element.attributeValue(i), "textbox")) + if (base::LowerCaseEqualsASCII(element.attributeLocalName(i).utf8(), + "role")) { + if (base::LowerCaseEqualsASCII(element.attributeValue(i).utf8(), + "textbox")) { return true; + } break; } } diff --git a/libcef/renderer/extensions/extensions_dispatcher_delegate.cc b/libcef/renderer/extensions/extensions_dispatcher_delegate.cc new file mode 100644 index 000000000..52c9bcd93 --- /dev/null +++ b/libcef/renderer/extensions/extensions_dispatcher_delegate.cc @@ -0,0 +1,36 @@ +// Copyright 2015 The Chromium Embedded Framework Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/renderer/extensions/extensions_dispatcher_delegate.h" + +#include "content/public/common/url_constants.h" +#include "extensions/common/extension.h" +#include "third_party/WebKit/public/platform/WebString.h" +#include "third_party/WebKit/public/platform/WebURL.h" +#include "third_party/WebKit/public/web/WebSecurityPolicy.h" + +namespace extensions { + +CefExtensionsDispatcherDelegate::CefExtensionsDispatcherDelegate() { +} + +CefExtensionsDispatcherDelegate::~CefExtensionsDispatcherDelegate() { +} + +void CefExtensionsDispatcherDelegate::InitOriginPermissions( + const Extension* extension, + bool is_extension_active) { + if (is_extension_active) { + // The chrome: scheme is marked as display isolated in + // RenderThreadImpl::RegisterSchemes() so an exception must be added for + // accessing chrome://resources from the extension origin. + blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( + extension->url(), + blink::WebString::fromUTF8(content::kChromeUIScheme), + blink::WebString::fromUTF8("resources"), + false); + } +} + +} // namespace extensions diff --git a/libcef/renderer/extensions/extensions_dispatcher_delegate.h b/libcef/renderer/extensions/extensions_dispatcher_delegate.h new file mode 100644 index 000000000..61e5eec58 --- /dev/null +++ b/libcef/renderer/extensions/extensions_dispatcher_delegate.h @@ -0,0 +1,28 @@ +// Copyright 2015 The Chromium Embedded Framework Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_RENDERER_EXTENSIONS_EXTENSIONS_DISPATCHER_DELEGATE_H_ +#define CEF_LIBCEF_RENDERER_EXTENSIONS_EXTENSIONS_DISPATCHER_DELEGATE_H_ + +#include "base/macros.h" +#include "extensions/renderer/dispatcher_delegate.h" + +namespace extensions { + +class CefExtensionsDispatcherDelegate : public DispatcherDelegate { + public: + CefExtensionsDispatcherDelegate(); + ~CefExtensionsDispatcherDelegate() override; + + private: + // DispatcherDelegate implementation. + void InitOriginPermissions(const Extension* extension, + bool is_extension_active) override; + + DISALLOW_COPY_AND_ASSIGN(CefExtensionsDispatcherDelegate); +}; + +} // namespace extensions + +#endif // CEF_LIBCEF_RENDERER_EXTENSIONS_EXTENSIONS_DISPATCHER_DELEGATE_H_ diff --git a/patch/patches/aura_window_1677.patch b/patch/patches/aura_window_1677.patch index c126648a3..dde074dd7 100644 --- a/patch/patches/aura_window_1677.patch +++ b/patch/patches/aura_window_1677.patch @@ -1,8 +1,8 @@ diff --git window.cc window.cc -index 0c021f8..ec62e3e 100644 +index 6cde8c2..bdd5093 100644 --- window.cc +++ window.cc -@@ -637,6 +637,12 @@ void Window::Focus() { +@@ -522,6 +522,12 @@ void Window::Focus() { client->FocusWindow(this); } @@ -16,7 +16,7 @@ index 0c021f8..ec62e3e 100644 client::FocusClient* client = client::GetFocusClient(this); return client && client->GetFocusedWindow() == this; diff --git window.h window.h -index 749a66a..229a867 100644 +index 5586044..53bfd2e 100644 --- window.h +++ window.h @@ -262,8 +262,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate, diff --git a/patch/patches/browser_plugin_guest_1565.patch b/patch/patches/browser_plugin_guest_1565.patch index 77947b020..607cb55cd 100644 --- a/patch/patches/browser_plugin_guest_1565.patch +++ b/patch/patches/browser_plugin_guest_1565.patch @@ -1,8 +1,8 @@ diff --git browser/browser_plugin/browser_plugin_guest.cc browser/browser_plugin/browser_plugin_guest.cc -index 092a045..baea4bb 100644 +index 6991a29..6aed799 100644 --- browser/browser_plugin/browser_plugin_guest.cc +++ browser/browser_plugin/browser_plugin_guest.cc -@@ -23,7 +23,7 @@ +@@ -22,7 +22,7 @@ #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/web_contents/web_contents_impl.h" @@ -11,14 +11,13 @@ index 092a045..baea4bb 100644 #include "content/common/browser_plugin/browser_plugin_constants.h" #include "content/common/browser_plugin/browser_plugin_messages.h" #include "content/common/content_constants_internal.h" -@@ -277,21 +277,20 @@ void BrowserPluginGuest::InitInternal( +@@ -275,20 +275,19 @@ void BrowserPluginGuest::InitInternal( guest_window_rect_ = params.view_rect; if (owner_web_contents_ != owner_web_contents) { - WebContentsViewGuest* new_view = nullptr; + WebContentsView* new_view = nullptr; - if (!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kSitePerProcess)) { + if (!BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { - new_view = - static_cast(GetWebContents()->GetView()); + new_view = GetWebContents()->GetView(); @@ -37,7 +36,7 @@ index 092a045..baea4bb 100644 } RendererPreferences* renderer_prefs = -@@ -733,12 +732,9 @@ void BrowserPluginGuest::OnWillAttachComplete( +@@ -720,12 +719,9 @@ void BrowserPluginGuest::OnWillAttachComplete( // This will trigger a callback to RenderViewReady after a round-trip IPC. static_cast( GetWebContents()->GetRenderViewHost())->Init(); diff --git a/patch/patches/browser_web_contents_1257.patch b/patch/patches/browser_web_contents_1257.patch index 32488b618..202df7f25 100644 --- a/patch/patches/browser_web_contents_1257.patch +++ b/patch/patches/browser_web_contents_1257.patch @@ -1,21 +1,16 @@ diff --git web_contents_impl.cc web_contents_impl.cc -index 3aedda6..b4aa061 100644 +index 7979b64..d63b4fc 100644 --- web_contents_impl.cc +++ web_contents_impl.cc -@@ -1312,24 +1312,31 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1351,23 +1351,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { params.main_frame_routing_id); frame_tree_.root()->SetFrameName(params.main_frame_name); - WebContentsViewDelegate* delegate = - GetContentClient()->browser()->GetWebContentsViewDelegate(this); -+ if (params.view && params.delegate_view) { -+ view_.reset(params.view); -+ render_view_host_delegate_view_ = params.delegate_view; -+ } - +- - if (browser_plugin_guest_ && -- !base::CommandLine::ForCurrentProcess()->HasSwitch( -- switches::kSitePerProcess)) { +- !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { - scoped_ptr platform_view(CreateWebContentsView( - this, delegate, &render_view_host_delegate_view_)); - @@ -28,13 +23,17 @@ index 3aedda6..b4aa061 100644 - // Regular WebContentsView. - view_.reset(CreateWebContentsView( - this, delegate, &render_view_host_delegate_view_)); ++ if (params.view && params.delegate_view) { ++ view_.reset(params.view); ++ render_view_host_delegate_view_ = params.delegate_view; ++ } ++ + if (!view_) { + WebContentsViewDelegate* delegate = + GetContentClient()->browser()->GetWebContentsViewDelegate(this); + + if (browser_plugin_guest_ && -+ !base::CommandLine::ForCurrentProcess()->HasSwitch( -+ switches::kSitePerProcess)) { ++ !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { + scoped_ptr platform_view(CreateWebContentsView( + this, delegate, &render_view_host_delegate_view_)); + @@ -51,7 +50,7 @@ index 3aedda6..b4aa061 100644 } CHECK(render_view_host_delegate_view_); CHECK(view_.get()); -@@ -1665,6 +1672,9 @@ void WebContentsImpl::CreateNewWindow( +@@ -1705,6 +1712,9 @@ void WebContentsImpl::CreateNewWindow( static_cast(session_storage_namespace); CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); @@ -61,7 +60,7 @@ index 3aedda6..b4aa061 100644 if (delegate_ && !delegate_->ShouldCreateWebContents(this, route_id, -@@ -1673,7 +1683,9 @@ void WebContentsImpl::CreateNewWindow( +@@ -1713,7 +1723,9 @@ void WebContentsImpl::CreateNewWindow( params.frame_name, params.target_url, partition_id, @@ -72,8 +71,8 @@ index 3aedda6..b4aa061 100644 if (route_id != MSG_ROUTING_NONE && !RenderViewHost::FromID(render_process_id, route_id)) { // If the embedder didn't create a WebContents for this route, we need to -@@ -1695,6 +1707,8 @@ void WebContentsImpl::CreateNewWindow( - create_params.opener_render_process_id = GetRenderProcessHost()->GetID(); +@@ -1735,6 +1747,8 @@ void WebContentsImpl::CreateNewWindow( + create_params.opener_render_process_id = render_process_id; create_params.opener_render_frame_id = params.opener_render_frame_id; create_params.opener_suppressed = params.opener_suppressed; + create_params.view = view; diff --git a/patch/patches/build.patch b/patch/patches/build.patch index 571ebb3e9..9cbc39462 100644 --- a/patch/patches/build.patch +++ b/patch/patches/build.patch @@ -1,5 +1,5 @@ diff --git common.gypi common.gypi -index a0ebbf3..10dfe71 100644 +index 4a55516..cbef796 100644 --- common.gypi +++ common.gypi @@ -9,6 +9,9 @@ diff --git a/patch/patches/chrome_browser_1257.patch b/patch/patches/chrome_browser_1257.patch index 90e2bc7cd..a08773a71 100644 --- a/patch/patches/chrome_browser_1257.patch +++ b/patch/patches/chrome_browser_1257.patch @@ -1,8 +1,8 @@ diff --git ui/browser.cc ui/browser.cc -index 242f79b..66326ef 100644 +index 90a10ad..c06bcf8 100644 --- ui/browser.cc +++ ui/browser.cc -@@ -1666,7 +1666,9 @@ bool Browser::ShouldCreateWebContents( +@@ -1649,7 +1649,9 @@ bool Browser::ShouldCreateWebContents( const std::string& frame_name, const GURL& target_url, const std::string& partition_id, @@ -14,10 +14,10 @@ index 242f79b..66326ef 100644 // If a BackgroundContents is created, suppress the normal WebContents. return !MaybeCreateBackgroundContents(route_id, diff --git ui/browser.h ui/browser.h -index 9bb2137..6dbdcbf 100644 +index 362d85a..60a12ef 100644 --- ui/browser.h +++ ui/browser.h -@@ -593,7 +593,9 @@ class Browser : public TabStripModelObserver, +@@ -586,7 +586,9 @@ class Browser : public TabStripModelObserver, const std::string& frame_name, const GURL& target_url, const std::string& partition_id, diff --git a/patch/patches/chrome_pepper_flash_1586.patch b/patch/patches/chrome_pepper_flash_1586.patch index b9b83a8dd..8b8c9efc4 100644 --- a/patch/patches/chrome_pepper_flash_1586.patch +++ b/patch/patches/chrome_pepper_flash_1586.patch @@ -1,5 +1,5 @@ diff --git pepper_flash.cc pepper_flash.cc -index da1c00d..f96c17d 100644 +index 16b4328..63b21c1 100644 --- pepper_flash.cc +++ pepper_flash.cc @@ -119,8 +119,15 @@ bool CheckPepperFlashManifest(const base::DictionaryValue& manifest, diff --git a/patch/patches/compositor_1368.patch b/patch/patches/compositor_1368.patch index 69ba98cf7..e8b6d0b68 100644 --- a/patch/patches/compositor_1368.patch +++ b/patch/patches/compositor_1368.patch @@ -1,5 +1,5 @@ diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc -index 35db2b9..b9adc3f 100644 +index fcb0a3e..40caf08 100644 --- content/browser/compositor/gpu_process_transport_factory.cc +++ content/browser/compositor/gpu_process_transport_factory.cc @@ -139,6 +139,13 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() { @@ -17,7 +17,7 @@ index 35db2b9..b9adc3f 100644 return scoped_ptr( new SoftwareOutputDeviceWin(software_backing_.get(), compositor)); diff --git ui/compositor/compositor.h ui/compositor/compositor.h -index f703771..307a2ab 100644 +index 7c4166f..afeea2f 100644 --- ui/compositor/compositor.h +++ ui/compositor/compositor.h @@ -15,6 +15,7 @@ diff --git a/patch/patches/content_nav_1129.patch b/patch/patches/content_nav_1129.patch index dfb9279ae..aff2bd7a4 100644 --- a/patch/patches/content_nav_1129.patch +++ b/patch/patches/content_nav_1129.patch @@ -1,60 +1,78 @@ diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc -index 7c6957b..c7270f1 100644 +index 95af2f7..c7270f1 100644 --- public/renderer/content_renderer_client.cc +++ public/renderer/content_renderer_client.cc -@@ -101,7 +101,6 @@ bool ContentRendererClient::AllowPopup() { +@@ -101,6 +101,18 @@ bool ContentRendererClient::AllowPopup() { return false; } --#ifdef OS_ANDROID - bool ContentRendererClient::HandleNavigation( - RenderFrame* render_frame, - DocumentState* document_state, -@@ -113,7 +112,6 @@ bool ContentRendererClient::HandleNavigation( - bool is_redirect) { - return false; - } --#endif - ++bool ContentRendererClient::HandleNavigation( ++ RenderFrame* render_frame, ++ DocumentState* document_state, ++ int opener_id, ++ blink::WebFrame* frame, ++ const blink::WebURLRequest& request, ++ blink::WebNavigationType type, ++ blink::WebNavigationPolicy default_policy, ++ bool is_redirect) { ++ return false; ++} ++ bool ContentRendererClient::ShouldFork(blink::WebLocalFrame* frame, const GURL& url, + const std::string& http_method, diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h -index 2a0517a..9a0d4e4 100644 +index ebb7f44..3f77142 100644 --- public/renderer/content_renderer_client.h +++ public/renderer/content_renderer_client.h -@@ -198,7 +198,6 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -16,6 +16,8 @@ + #include "base/strings/string16.h" + #include "content/public/common/content_client.h" + #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" ++#include "third_party/WebKit/public/web/WebNavigationPolicy.h" ++#include "third_party/WebKit/public/web/WebNavigationType.h" + #include "ui/base/page_transition_types.h" + #include "v8/include/v8.h" + +@@ -196,6 +198,17 @@ class CONTENT_EXPORT ContentRendererClient { // Returns true if a popup window should be allowed. virtual bool AllowPopup(); --#ifdef OS_ANDROID - // TODO(sgurun) This callback is deprecated and will be removed as soon - // as android webview completes implementation of a resource throttle based - // shouldoverrideurl implementation. See crbug.com/325351 -@@ -213,7 +212,6 @@ class CONTENT_EXPORT ContentRendererClient { - blink::WebNavigationType type, - blink::WebNavigationPolicy default_policy, - bool is_redirect); --#endif - ++ // Returns true if the navigation was handled by the embedder and should be ++ // ignored by WebKit. This method is used by CEF and android_webview. ++ virtual bool HandleNavigation(RenderFrame* render_frame, ++ DocumentState* document_state, ++ int opener_id, ++ blink::WebFrame* frame, ++ const blink::WebURLRequest& request, ++ blink::WebNavigationType type, ++ blink::WebNavigationPolicy default_policy, ++ bool is_redirect); ++ // Returns true if we should fork a new process for the given navigation. // If |send_referrer| is set to false (which is the default), no referrer + // header will be send for the navigation. Otherwise, the referrer header is diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc -index bee5039..a818d6e 100644 +index 05e6ad6..4c02fc8 100644 --- renderer/render_frame_impl.cc +++ renderer/render_frame_impl.cc -@@ -4186,7 +4186,6 @@ void RenderFrameImpl::OnFailedNavigation( +@@ -4195,6 +4195,19 @@ void RenderFrameImpl::OnFailedNavigation( WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( RenderFrame* render_frame, const NavigationPolicyInfo& info) { --#ifdef OS_ANDROID - // The handlenavigation API is deprecated and will be removed once - // crbug.com/325351 is resolved. - if (info.urlRequest.url() != GURL(kSwappedOutURL) && -@@ -4201,7 +4200,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( - info.isRedirect)) { - return blink::WebNavigationPolicyIgnore; - } --#endif - ++ if (info.urlRequest.url() != GURL(kSwappedOutURL) && ++ GetContentClient()->renderer()->HandleNavigation( ++ render_frame, ++ static_cast(info.extraData), ++ render_view_->opener_id_, ++ info.frame, ++ info.urlRequest, ++ info.navigationType, ++ info.defaultPolicy, ++ info.isRedirect)) { ++ return blink::WebNavigationPolicyIgnore; ++ } ++ Referrer referrer(RenderViewImpl::GetReferrerFromRequest(info.frame, info.urlRequest)); + diff --git a/patch/patches/extensions_1257.patch b/patch/patches/extensions_1257.patch index ee592eb9d..f37e063bd 100644 --- a/patch/patches/extensions_1257.patch +++ b/patch/patches/extensions_1257.patch @@ -1,5 +1,5 @@ diff --git browser/guest_view/extension_options/extension_options_guest.cc browser/guest_view/extension_options/extension_options_guest.cc -index cb9cdd5..8ad7ee0 100644 +index 28014e2..4a08998 100644 --- browser/guest_view/extension_options/extension_options_guest.cc +++ browser/guest_view/extension_options/extension_options_guest.cc @@ -195,7 +195,9 @@ bool ExtensionOptionsGuest::ShouldCreateWebContents( diff --git a/patch/patches/gritsettings.patch b/patch/patches/gritsettings.patch index 47ac39357..06e798800 100644 --- a/patch/patches/gritsettings.patch +++ b/patch/patches/gritsettings.patch @@ -1,5 +1,5 @@ diff --git resource_ids resource_ids -index 49973d1..86cc523 100644 +index 7cfda8e..71b0deb 100644 --- resource_ids +++ resource_ids @@ -14,6 +14,12 @@ diff --git a/patch/patches/hwnd_message_handler_1481.patch b/patch/patches/hwnd_message_handler_1481.patch index ed7096d86..82bb2ed8d 100644 --- a/patch/patches/hwnd_message_handler_1481.patch +++ b/patch/patches/hwnd_message_handler_1481.patch @@ -1,8 +1,8 @@ diff --git hwnd_message_handler.cc hwnd_message_handler.cc -index bd2072b..c3fd2ea 100644 +index 5cadce1..26c27ca 100644 --- hwnd_message_handler.cc +++ hwnd_message_handler.cc -@@ -2649,8 +2649,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -2650,8 +2650,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, "440919 HWNDMessageHandler::HandleMouseEventInternal6")); // Reroute the mouse wheel to the window under the pointer if applicable. diff --git a/patch/patches/ime_1610.patch b/patch/patches/ime_1610.patch index e43903961..c0851e6e7 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 0870fde..23d8038 100644 +index 7db88b6..16793d8 100644 --- input_method_win.cc +++ input_method_win.cc -@@ -567,8 +567,9 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { +@@ -581,8 +581,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. @@ -12,4 +12,4 @@ index 0870fde..23d8038 100644 + GetActiveWindow() == ::GetAncestor(toplevel_window_handle_, GA_ROOT); } - bool InputMethodWin::DispatchFabricatedKeyEvent(const ui::KeyEvent& event) { + void InputMethodWin::DispatchFabricatedKeyEvent(ui::KeyEvent* event) { diff --git a/patch/patches/message_loop_443.patch b/patch/patches/message_loop_443.patch index 1a84513bf..98719f764 100644 --- a/patch/patches/message_loop_443.patch +++ b/patch/patches/message_loop_443.patch @@ -1,8 +1,8 @@ diff --git message_loop.cc message_loop.cc -index 4fecbc5..7298151 100644 +index 4e5594b..d42a362 100644 --- message_loop.cc +++ message_loop.cc -@@ -134,12 +134,6 @@ MessageLoop::~MessageLoop() { +@@ -135,12 +135,6 @@ MessageLoop::~MessageLoop() { // bound to a thread. DCHECK(current() == this || !current()); diff --git a/patch/patches/prefs_content_1161.patch b/patch/patches/prefs_content_1161.patch index b48c4b22b..31bd46917 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 060fbb9..f028062 100644 +index 3c0c982..26d1b55 100644 --- public/common/common_param_traits_macros.h +++ public/common/common_param_traits_macros.h -@@ -195,6 +195,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) +@@ -196,6 +196,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 060fbb9..f028062 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 e140001..42f3b2d 100644 +index 39db29a..b7e102c 100644 --- public/common/web_preferences.cc +++ public/common/web_preferences.cc -@@ -170,6 +170,7 @@ WebPreferences::WebPreferences() +@@ -171,6 +171,7 @@ WebPreferences::WebPreferences() pinch_overlay_scrollbar_thickness(0), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), @@ -23,10 +23,10 @@ index e140001..42f3b2d 100644 slimming_paint_enabled(false), cookie_enabled(true), diff --git public/common/web_preferences.h public/common/web_preferences.h -index e8d7d13..493c743 100644 +index 8cc35b7..e1031ad 100644 --- public/common/web_preferences.h +++ public/common/web_preferences.h -@@ -171,6 +171,7 @@ struct CONTENT_EXPORT WebPreferences { +@@ -173,6 +173,7 @@ struct CONTENT_EXPORT WebPreferences { int pinch_overlay_scrollbar_thickness; bool use_solid_color_scrollbars; bool navigate_on_drag_drop; @@ -35,10 +35,10 @@ index e8d7d13..493c743 100644 bool slimming_paint_enabled; diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc -index 12f950e..61fc3c1 100644 +index 29f4d4f..cb19708 100644 --- renderer/render_view_impl.cc +++ renderer/render_view_impl.cc -@@ -1002,6 +1002,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs, +@@ -1003,6 +1003,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs, settings->setJavaEnabled(prefs.java_enabled); diff --git a/patch/patches/process_title_1639.patch b/patch/patches/process_title_1639.patch index 5206a7ed5..e189cb83f 100644 --- a/patch/patches/process_title_1639.patch +++ b/patch/patches/process_title_1639.patch @@ -1,5 +1,5 @@ diff --git set_process_title.cc set_process_title.cc -index 229524e..86559f6 100644 +index d74af96..5c7ebd2 100644 --- set_process_title.cc +++ set_process_title.cc @@ -42,7 +42,7 @@ void SetProcessTitleFromCommandLine(const char** main_argv) { diff --git a/patch/patches/public_browser_1257.patch b/patch/patches/public_browser_1257.patch index d38f62411..44cc86627 100644 --- a/patch/patches/public_browser_1257.patch +++ b/patch/patches/public_browser_1257.patch @@ -67,7 +67,7 @@ index 016097b..4fb00ed 100644 } diff --git web_contents_delegate.h web_contents_delegate.h -index 34ddd26..7a850af 100644 +index 685c1e6..782ab86 100644 --- web_contents_delegate.h +++ web_contents_delegate.h @@ -38,9 +38,11 @@ class DownloadItem; diff --git a/patch/patches/ui_dragdrop_355390.patch b/patch/patches/ui_dragdrop_355390.patch index 7b7f6ee0e..45b92f91f 100644 --- a/patch/patches/ui_dragdrop_355390.patch +++ b/patch/patches/ui_dragdrop_355390.patch @@ -1,5 +1,5 @@ diff --git os_exchange_data_provider_aurax11.cc os_exchange_data_provider_aurax11.cc -index e7a815c..8188710 100644 +index 73ec4bf..9023835 100644 --- os_exchange_data_provider_aurax11.cc +++ os_exchange_data_provider_aurax11.cc @@ -159,7 +159,8 @@ void OSExchangeDataProviderAuraX11::SetURL(const GURL& url, diff --git a/patch/patches/views_widget_180_1677.patch b/patch/patches/views_widget_180_1677.patch index 8b9b69b9d..a39a4fed4 100644 --- a/patch/patches/views_widget_180_1677.patch +++ b/patch/patches/views_widget_180_1677.patch @@ -12,7 +12,7 @@ index a8e088c..838b6a0 100644 return host ? host->GetAcceleratedWidget() : NULL; } diff --git desktop_aura/desktop_window_tree_host_win.cc desktop_aura/desktop_window_tree_host_win.cc -index 93b3c5b..a0940ce 100644 +index 5bee7fd..53e6c22 100644 --- desktop_aura/desktop_window_tree_host_win.cc +++ desktop_aura/desktop_window_tree_host_win.cc @@ -131,7 +131,9 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window, @@ -40,10 +40,10 @@ index 93b3c5b..a0940ce 100644 bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) { diff --git desktop_aura/desktop_window_tree_host_x11.cc desktop_aura/desktop_window_tree_host_x11.cc -index a56deb7..a5e8422 100644 +index 4a69310..3b00233 100644 --- desktop_aura/desktop_window_tree_host_x11.cc +++ desktop_aura/desktop_window_tree_host_x11.cc -@@ -171,7 +171,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -172,7 +172,8 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( window_parent_(NULL), custom_window_shape_(false), urgency_hint_set_(false), @@ -53,7 +53,7 @@ index a56deb7..a5e8422 100644 } DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { -@@ -381,7 +382,8 @@ void DesktopWindowTreeHostX11::CloseNow() { +@@ -382,7 +383,8 @@ void DesktopWindowTreeHostX11::CloseNow() { // Actually free our native resources. if (ui::PlatformEventSource::GetInstance()) ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); @@ -63,7 +63,7 @@ index a56deb7..a5e8422 100644 xwindow_ = None; desktop_native_widget_aura_->OnHostClosed(); -@@ -525,6 +527,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( +@@ -526,6 +528,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( } gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const { @@ -72,7 +72,7 @@ index a56deb7..a5e8422 100644 return ToDIPRect(bounds_in_pixels_); } -@@ -962,6 +966,8 @@ void DesktopWindowTreeHostX11::HideImpl() { +@@ -963,6 +967,8 @@ void DesktopWindowTreeHostX11::HideImpl() { } gfx::Rect DesktopWindowTreeHostX11::GetBounds() const { @@ -81,7 +81,7 @@ index a56deb7..a5e8422 100644 return bounds_in_pixels_; } -@@ -1018,6 +1024,8 @@ void DesktopWindowTreeHostX11::SetBounds( +@@ -1019,6 +1025,8 @@ void DesktopWindowTreeHostX11::SetBounds( } gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const { @@ -90,7 +90,7 @@ index a56deb7..a5e8422 100644 return bounds_in_pixels_.origin(); } -@@ -1131,9 +1139,13 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1132,9 +1140,13 @@ void DesktopWindowTreeHostX11::InitX11Window( } } @@ -105,7 +105,7 @@ index a56deb7..a5e8422 100644 bounds_in_pixels_.y(), bounds_in_pixels_.width(), bounds_in_pixels_.height(), 0, // border width -@@ -1782,6 +1794,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( +@@ -1787,6 +1799,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( } break; } @@ -117,7 +117,7 @@ index a56deb7..a5e8422 100644 if (xev->xfocus.mode != NotifyGrab) { ReleaseCapture(); diff --git desktop_aura/desktop_window_tree_host_x11.h desktop_aura/desktop_window_tree_host_x11.h -index 787372d..d9d57b8 100644 +index 73e9e3e..deb2cef 100644 --- desktop_aura/desktop_window_tree_host_x11.h +++ desktop_aura/desktop_window_tree_host_x11.h @@ -85,6 +85,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 @@ -129,7 +129,7 @@ index 787372d..d9d57b8 100644 protected: // Overridden from DesktopWindowTreeHost: void Init(aura::Window* content_window, -@@ -262,6 +264,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -265,6 +267,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // The bounds of |xwindow_|. gfx::Rect bounds_in_pixels_; @@ -139,7 +139,7 @@ index 787372d..d9d57b8 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 -@@ -348,6 +353,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -351,6 +356,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 base::WeakPtrFactory close_widget_factory_; diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index 3189e95a3..aba882843 100644 --- a/patch/patches/webkit_popups.patch +++ b/patch/patches/webkit_popups.patch @@ -1,21 +1,21 @@ diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp -index 58e8166..23c0cea 100644 +index 89f8b5e..4acbf11 100644 --- Source/web/ChromeClientImpl.cpp +++ Source/web/ChromeClientImpl.cpp -@@ -774,7 +774,7 @@ bool ChromeClientImpl::hasOpenedPopup() const - PassRefPtrWillBeRawPtr ChromeClientImpl::openPopupMenu(LocalFrame& frame, PopupMenuClient* client) +@@ -781,7 +781,7 @@ bool ChromeClientImpl::hasOpenedPopup() const + PassRefPtrWillBeRawPtr ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select) { notifyPopupOpeningObservers(); - if (WebViewImpl::useExternalPopupMenus()) + if (m_webView->useExternalPopupMenus()) - return adoptRefWillBeNoop(new ExternalPopupMenu(frame, client, *m_webView)); + return adoptRefWillBeNoop(new ExternalPopupMenu(frame, select, *m_webView)); ASSERT(RuntimeEnabledFeatures::pagePopupEnabled()); diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp -index 1f8413a..efeff15 100644 +index 67c213c..ef14a25 100644 --- Source/web/WebViewImpl.cpp +++ Source/web/WebViewImpl.cpp -@@ -397,6 +397,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) +@@ -426,6 +426,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_fakePageScaleAnimationPageScaleFactor(0) , m_fakePageScaleAnimationUseAnchor(false) , m_contextMenuAllowed(false) @@ -23,7 +23,7 @@ index 1f8413a..efeff15 100644 , m_doingDragAndDrop(false) , m_ignoreInputEvents(false) , m_compositorDeviceScaleFactorOverride(0) -@@ -3925,9 +3926,14 @@ void WebViewImpl::pageScaleFactorChanged() +@@ -3977,9 +3978,14 @@ void WebViewImpl::pageScaleFactorChanged() m_client->pageScaleFactorChanged(); } @@ -40,7 +40,7 @@ index 1f8413a..efeff15 100644 void WebViewImpl::startDragging(LocalFrame* frame, diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h -index a3ece01..60adce4 100644 +index a663a10..58900a1 100644 --- Source/web/WebViewImpl.h +++ Source/web/WebViewImpl.h @@ -389,7 +389,8 @@ public: @@ -53,7 +53,7 @@ index a3ece01..60adce4 100644 bool contextMenuAllowed() const { -@@ -675,6 +676,8 @@ private: +@@ -680,6 +681,8 @@ private: bool m_contextMenuAllowed; @@ -63,10 +63,10 @@ index a3ece01..60adce4 100644 bool m_ignoreInputEvents; diff --git public/web/WebView.h public/web/WebView.h -index 4046206..fd01e64 100644 +index 9f564ec..660e869 100644 --- public/web/WebView.h +++ public/web/WebView.h -@@ -387,6 +387,7 @@ public: +@@ -398,6 +398,7 @@ public: // Sets whether select popup menus should be rendered by the browser. BLINK_EXPORT static void setUseExternalPopupMenus(bool);