From 30c36156ea392fb633315a154d0abf51291c5a5d Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Thu, 2 Jan 2014 22:41:11 +0000 Subject: [PATCH] Update to Chromium revision 242756. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1553 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- CHROMIUM_BUILD_COMPATIBILITY.txt | 2 +- libcef/browser/browser_context_impl.cc | 8 +- libcef/browser/browser_host_impl.cc | 113 ++++++++++++++---- libcef/browser/browser_host_impl.h | 16 ++- libcef/browser/browser_host_impl_gtk.cc | 2 +- libcef/browser/browser_host_impl_win.cc | 6 +- libcef/browser/browser_info.cc | 113 ++++++++++++------ libcef/browser/browser_info.h | 36 ++++-- libcef/browser/browser_message_filter.cc | 14 ++- libcef/browser/browser_message_filter.h | 6 +- libcef/browser/chrome_scheme_handler.cc | 3 +- libcef/browser/content_browser_client.cc | 73 ++++++++--- libcef/browser/content_browser_client.h | 17 ++- libcef/browser/devtools_delegate.cc | 2 +- libcef/browser/devtools_frontend.cc | 2 +- libcef/browser/javascript_dialog_gtk.cc | 8 +- libcef/browser/javascript_dialog_mac.mm | 8 +- libcef/browser/javascript_dialog_manager.cc | 2 +- libcef/browser/javascript_dialog_win.cc | 3 +- .../printing/printing_message_filter.cc | 2 +- libcef/browser/render_widget_host_view_osr.cc | 5 +- libcef/browser/render_widget_host_view_osr.h | 6 +- .../resource_dispatcher_host_delegate.cc | 6 +- libcef/browser/scheme_handler.cc | 2 +- libcef/browser/url_network_delegate.cc | 4 - libcef/browser/url_network_delegate.h | 2 - libcef/browser/url_request_context_getter.cc | 3 +- libcef/browser/url_request_context_proxy.cc | 10 ++ libcef/common/breakpad_client.cc | 4 +- libcef/common/cef_messages.h | 11 +- libcef/common/scheme_registration.cc | 8 +- libcef/common/string_types_impl.cc | 16 +-- libcef/common/values_impl.cc | 4 +- libcef/renderer/browser_impl.cc | 23 ++-- libcef/renderer/content_renderer_client.cc | 82 ++++++++----- libcef/renderer/content_renderer_client.h | 4 + libcef/renderer/dom_node_impl.cc | 4 +- libcef/renderer/v8_impl.cc | 11 +- patch/patches/content_nav_1129.patch | 10 +- patch/patches/views_widget_180.patch | 10 +- patch/patches/webkit_popups.patch | 26 ++-- tests/unittests/display_unittest.cc | 5 + 42 files changed, 456 insertions(+), 236 deletions(-) diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 2dccb9b06..ea850607a 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -17,5 +17,5 @@ { 'chromium_url': 'http://src.chromium.org/svn/trunk/src', - 'chromium_revision': '241258', + 'chromium_revision': '242756', } diff --git a/libcef/browser/browser_context_impl.cc b/libcef/browser/browser_context_impl.cc index c0fa1e29d..1820fb522 100644 --- a/libcef/browser/browser_context_impl.cc +++ b/libcef/browser/browser_context_impl.cc @@ -86,8 +86,8 @@ class CefGeolocationPermissionContext CEF_REQUIRE_IOT(); CefRefPtr browser = - CefBrowserHostImpl::GetBrowserByRoutingID(render_process_id, - render_view_id); + CefBrowserHostImpl::GetBrowserForView(render_process_id, + render_view_id); if (browser.get()) { CefRefPtr client = browser->GetClient(); if (client.get()) { @@ -120,8 +120,8 @@ class CefGeolocationPermissionContext RemoveCallback(bridge_id); CefRefPtr browser = - CefBrowserHostImpl::GetBrowserByRoutingID(render_process_id, - render_view_id); + CefBrowserHostImpl::GetBrowserForView(render_process_id, + render_view_id); if (browser.get()) { CefRefPtr client = browser->GetClient(); if (client.get()) { diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 497a4779e..401dd3aa7 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -35,8 +35,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" -#include "content/browser/renderer_host/render_view_host_impl.h" -#include "content/browser/web_contents/web_contents_impl.h" +#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/common/view_messages.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/download_url_parameters.h" @@ -46,6 +45,9 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/render_process_host.h" +#include "content/public/browser/render_view_host.h" #include "content/public/browser/resource_request_info.h" #include "content/public/browser/web_contents_view.h" #include "content/public/common/file_chooser_params.h" @@ -494,8 +496,21 @@ CefRefPtr CefBrowserHostImpl::GetBrowserForHost( const content::RenderViewHost* host) { DCHECK(host); CEF_REQUIRE_UIT(); - content::WebContentsImpl* web_contents = - static_cast(host->GetDelegate()); + content::WebContents* web_contents = + content::WebContents::FromRenderViewHost(host); + if (web_contents) + return static_cast(web_contents->GetDelegate()); + return NULL; +} + +// static +CefRefPtr CefBrowserHostImpl::GetBrowserForHost( + const content::RenderFrameHost* host) { + DCHECK(host); + CEF_REQUIRE_UIT(); + content::WebContents* web_contents = + content::WebContents::FromRenderFrameHost( + const_cast(host)); if (web_contents) return static_cast(web_contents->GetDelegate()); return NULL; @@ -515,42 +530,77 @@ CefRefPtr CefBrowserHostImpl::GetBrowserForRequest( DCHECK(request); CEF_REQUIRE_IOT(); int render_process_id = -1; - int render_view_id = MSG_ROUTING_NONE; + int render_frame_id = MSG_ROUTING_NONE; - if (!content::ResourceRequestInfo::GetRenderViewForRequest( - request, &render_process_id, &render_view_id) || + if (!content::ResourceRequestInfo::GetRenderFrameForRequest( + request, &render_process_id, &render_frame_id) || render_process_id == -1 || - render_view_id == MSG_ROUTING_NONE) { + render_frame_id == MSG_ROUTING_NONE) { return NULL; } - return GetBrowserByRoutingID(render_process_id, render_view_id); + return GetBrowserForFrame(render_process_id, render_frame_id); } // static -CefRefPtr CefBrowserHostImpl::GetBrowserByRoutingID( - int render_process_id, int render_view_id) { - if (render_process_id == -1 || render_view_id == MSG_ROUTING_NONE) +CefRefPtr CefBrowserHostImpl::GetBrowserForView( + int render_process_id, int render_routing_id) { + if (render_process_id == -1 || render_routing_id == MSG_ROUTING_NONE) return NULL; if (CEF_CURRENTLY_ON_UIT()) { // Use the non-thread-safe but potentially faster approach. content::RenderViewHost* render_view_host = - content::RenderViewHost::FromID(render_process_id, render_view_id); + content::RenderViewHost::FromID(render_process_id, render_routing_id); if (!render_view_host) return NULL; return GetBrowserForHost(render_view_host); } else { // Use the thread-safe approach. scoped_refptr info = - CefContentBrowserClient::Get()->GetBrowserInfo(render_process_id, - render_view_id); + CefContentBrowserClient::Get()->GetBrowserInfoForView( + render_process_id, + render_routing_id); if (info.get()) { CefRefPtr browser = info->browser(); if (!browser.get()) { LOG(WARNING) << "Found browser id " << info->browser_id() << - " but no browser object matching process id " << - render_process_id << " and view id " << render_view_id; + " but no browser object matching view process id " << + render_process_id << " and routing id " << + render_routing_id; + } + return browser; + } + return NULL; + } +} + +// static +CefRefPtr CefBrowserHostImpl::GetBrowserForFrame( + int render_process_id, int render_routing_id) { + if (render_process_id == -1 || render_routing_id == MSG_ROUTING_NONE) + return NULL; + + if (CEF_CURRENTLY_ON_UIT()) { + // Use the non-thread-safe but potentially faster approach. + content::RenderFrameHost* render_frame_host = + content::RenderFrameHost::FromID(render_process_id, render_routing_id); + if (!render_frame_host) + return NULL; + return GetBrowserForHost(render_frame_host); + } else { + // Use the thread-safe approach. + scoped_refptr info = + CefContentBrowserClient::Get()->GetBrowserInfoForFrame( + render_process_id, + render_routing_id); + if (info.get()) { + CefRefPtr browser = info->browser(); + if (!browser.get()) { + LOG(WARNING) << "Found browser id " << info->browser_id() << + " but no browser object matching frame process id " << + render_process_id << " and routing id " << + render_routing_id; } return browser; } @@ -1894,11 +1944,16 @@ void CefBrowserHostImpl::WebContentsCreated( } DCHECK(pending_popup_info.get()); + content::RenderViewHost* view_host = new_contents->GetRenderViewHost(); + content::RenderFrameHost* main_frame_host = new_contents->GetMainFrame(); + CefWindowHandle opener = NULL; scoped_refptr info = CefContentBrowserClient::Get()->GetOrCreateBrowserInfo( - new_contents->GetRenderProcessHost()->GetID(), - new_contents->GetRoutingID()); + view_host->GetProcess()->GetID(), + view_host->GetRoutingID(), + main_frame_host->GetProcess()->GetID(), + main_frame_host->GetRoutingID()); if (source_contents) { DCHECK(info->is_popup()); @@ -2005,10 +2060,22 @@ void CefBrowserHostImpl::RequestMediaAccessPermission( // content::WebContentsObserver methods. // ----------------------------------------------------------------------------- +void CefBrowserHostImpl::RenderFrameCreated( + content::RenderFrameHost* render_frame_host) { + browser_info_->add_render_frame_id(render_frame_host->GetProcess()->GetID(), + render_frame_host->GetRoutingID()); +} + +void CefBrowserHostImpl::RenderFrameDeleted( + content::RenderFrameHost* render_frame_host) { + browser_info_->remove_render_frame_id(render_frame_host->GetProcess()->GetID(), + render_frame_host->GetRoutingID()); +} + void CefBrowserHostImpl::RenderViewCreated( content::RenderViewHost* render_view_host) { - browser_info_->add_render_id(render_view_host->GetProcess()->GetID(), - render_view_host->GetRoutingID()); + browser_info_->add_render_view_id(render_view_host->GetProcess()->GetID(), + render_view_host->GetRoutingID()); // May be already registered if the renderer crashed previously. if (!registrar_->IsRegistered( @@ -2021,8 +2088,8 @@ void CefBrowserHostImpl::RenderViewCreated( void CefBrowserHostImpl::RenderViewDeleted( content::RenderViewHost* render_view_host) { - browser_info_->remove_render_id(render_view_host->GetProcess()->GetID(), - render_view_host->GetRoutingID()); + browser_info_->remove_render_view_id(render_view_host->GetProcess()->GetID(), + render_view_host->GetRoutingID()); if (registrar_->IsRegistered( this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index b5985daf4..3b1091c47 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -104,15 +104,21 @@ class CefBrowserHostImpl : public CefBrowserHost, // Returns the browser associated with the specified RenderViewHost. static CefRefPtr GetBrowserForHost( const content::RenderViewHost* host); + // Returns the browser associated with the specified RenderFrameHost. + static CefRefPtr GetBrowserForHost( + const content::RenderFrameHost* host); // Returns the browser associated with the specified WebContents. static CefRefPtr GetBrowserForContents( content::WebContents* contents); // Returns the browser associated with the specified URLRequest. static CefRefPtr GetBrowserForRequest( net::URLRequest* request); - // Returns the browser associated with the specified routing IDs. - static CefRefPtr GetBrowserByRoutingID( - int render_process_id, int render_view_id); + // Returns the browser associated with the specified view routing IDs. + static CefRefPtr GetBrowserForView( + int render_process_id, int render_routing_id); + // Returns the browser associated with the specified frame routing IDs. + static CefRefPtr GetBrowserForFrame( + int render_process_id, int render_routing_id); // Returns true if window rendering is disabled in CefWindowInfo. static bool IsWindowRenderingDisabled(const CefWindowInfo& info); @@ -367,6 +373,10 @@ class CefBrowserHostImpl : public CefBrowserHost, // content::WebContentsObserver methods. using content::WebContentsObserver::BeforeUnloadFired; using content::WebContentsObserver::WasHidden; + virtual void RenderFrameCreated( + content::RenderFrameHost* render_frame_host) OVERRIDE; + virtual void RenderFrameDeleted( + content::RenderFrameHost* render_frame_host) OVERRIDE; virtual void RenderViewCreated( content::RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewDeleted( diff --git a/libcef/browser/browser_host_impl_gtk.cc b/libcef/browser/browser_host_impl_gtk.cc index fa238046f..676ac0e25 100644 --- a/libcef/browser/browser_host_impl_gtk.cc +++ b/libcef/browser/browser_host_impl_gtk.cc @@ -164,7 +164,7 @@ bool RunFileDialog(const content::FileChooserParams& params, std::string title; if (!params.title.empty()) { - title = UTF16ToUTF8(params.title); + title = base::UTF16ToUTF8(params.title); } else { int string_id = 0; switch (params.mode) { diff --git a/libcef/browser/browser_host_impl_win.cc b/libcef/browser/browser_host_impl_win.cc index a5e091c08..4c4999a0f 100644 --- a/libcef/browser/browser_host_impl_win.cc +++ b/libcef/browser/browser_host_impl_win.cc @@ -163,7 +163,7 @@ std::wstring FormatFilterForExtensions( include_all_files = true; desc = l10n_util::GetStringFUTF16( IDS_APP_SAVEAS_EXTENSION_FORMAT, - base::i18n::ToUpper(WideToUTF16(ext_name)), + base::i18n::ToUpper(base::WideToUTF16(ext_name)), ext_name); } } @@ -216,7 +216,7 @@ std::wstring GetFilterStringFromAcceptTypes( if (ascii_type.length()) { // Just treat as extension if contains '.' as the first character. if (ascii_type[0] == '.') { - extensions.push_back(L"*" + ASCIIToWide(ascii_type)); + extensions.push_back(L"*" + base::ASCIIToWide(ascii_type)); descriptions.push_back(std::wstring()); } else { // Otherwise convert mime type to one or more extensions. @@ -415,7 +415,7 @@ const int kMaxAddressLengthChars = 2048; bool HasExternalHandler(const std::string& scheme) { base::win::RegKey key; const std::wstring registry_path = - ASCIIToWide(scheme + "\\shell\\open\\command"); + base::ASCIIToWide(scheme + "\\shell\\open\\command"); key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ); if (key.Valid()) { DWORD size = 0; diff --git a/libcef/browser/browser_info.cc b/libcef/browser/browser_info.cc index 85f85f508..cdb36d9de 100644 --- a/libcef/browser/browser_info.cc +++ b/libcef/browser/browser_info.cc @@ -19,51 +19,38 @@ void CefBrowserInfo::set_window_rendering_disabled(bool disabled) { is_window_rendering_disabled_ = disabled; } -void CefBrowserInfo::add_render_id( - int render_process_id, int render_view_id) { - DCHECK_GT(render_process_id, 0); - DCHECK_GT(render_view_id, 0); - - base::AutoLock lock_scope(lock_); - - if (!render_id_set_.empty()) { - RenderIdSet::const_iterator it = - render_id_set_.find(std::make_pair(render_process_id, render_view_id)); - if (it != render_id_set_.end()) - return; - } - - render_id_set_.insert(std::make_pair(render_process_id, render_view_id)); +void CefBrowserInfo::add_render_view_id( + int render_process_id, int render_routing_id) { + add_render_id(&render_view_id_set_, render_process_id, render_routing_id); } -void CefBrowserInfo::remove_render_id( - int render_process_id, int render_view_id) { - DCHECK_GT(render_process_id, 0); - DCHECK_GT(render_view_id, 0); - - base::AutoLock lock_scope(lock_); - - DCHECK(!render_id_set_.empty()); - if (render_id_set_.empty()) - return; - - RenderIdSet::iterator it = - render_id_set_.find(std::make_pair(render_process_id, render_view_id)); - DCHECK(it != render_id_set_.end()); - if (it != render_id_set_.end()) - render_id_set_.erase(it); +void CefBrowserInfo::add_render_frame_id( + int render_process_id, int render_routing_id) { + add_render_id(&render_frame_id_set_, render_process_id, render_routing_id); } -bool CefBrowserInfo::is_render_id_match( - int render_process_id, int render_view_id) { - base::AutoLock lock_scope(lock_); +void CefBrowserInfo::remove_render_view_id( + int render_process_id, int render_routing_id) { + remove_render_id(&render_view_id_set_, render_process_id, render_routing_id); +} - if (render_id_set_.empty()) - return false; +void CefBrowserInfo::remove_render_frame_id( + int render_process_id, int render_routing_id) { + remove_render_id(&render_frame_id_set_, render_process_id, render_routing_id); +} - RenderIdSet::const_iterator it = - render_id_set_.find(std::make_pair(render_process_id, render_view_id)); - return (it != render_id_set_.end()); +bool CefBrowserInfo::is_render_view_id_match( + int render_process_id, int render_routing_id) { + return is_render_id_match(&render_view_id_set_, + render_process_id, + render_routing_id); +} + +bool CefBrowserInfo::is_render_frame_id_match( + int render_process_id, int render_routing_id) { + return is_render_id_match(&render_frame_id_set_, + render_process_id, + render_routing_id); } CefRefPtr CefBrowserInfo::browser() { @@ -75,3 +62,51 @@ void CefBrowserInfo::set_browser(CefRefPtr browser) { base::AutoLock lock_scope(lock_); browser_ = browser; } + +void CefBrowserInfo::add_render_id(RenderIdSet* id_set, + int render_process_id, + int render_routing_id) { + DCHECK_GT(render_process_id, 0); + DCHECK_GT(render_routing_id, 0); + + base::AutoLock lock_scope(lock_); + + if (!id_set->empty()) { + RenderIdSet::const_iterator it = + id_set->find(std::make_pair(render_process_id, render_routing_id)); + if (it != id_set->end()) + return; + } + + id_set->insert(std::make_pair(render_process_id, render_routing_id)); +} + +void CefBrowserInfo::remove_render_id(RenderIdSet* id_set, + int render_process_id, + int render_routing_id) { + DCHECK_GT(render_process_id, 0); + DCHECK_GT(render_routing_id, 0); + + base::AutoLock lock_scope(lock_); + + DCHECK(!id_set->empty()); + if (id_set->empty()) + return; + + bool erased = id_set->erase( + std::make_pair(render_process_id, render_routing_id)) != 0; + DCHECK(erased); +} + +bool CefBrowserInfo::is_render_id_match(const RenderIdSet* id_set, + int render_process_id, + int render_routing_id) { + base::AutoLock lock_scope(lock_); + + if (id_set->empty()) + return false; + + RenderIdSet::const_iterator it = + id_set->find(std::make_pair(render_process_id, render_routing_id)); + return (it != id_set->end()); +} diff --git a/libcef/browser/browser_info.h b/libcef/browser/browser_info.h index 710a086e9..772a7187b 100644 --- a/libcef/browser/browser_info.h +++ b/libcef/browser/browser_info.h @@ -30,18 +30,34 @@ class CefBrowserInfo : public base::RefCountedThreadSafe { void set_window_rendering_disabled(bool disabled); - void add_render_id(int render_process_id, int render_view_id); - void remove_render_id(int render_process_id, int render_view_id); + // Adds an ID pair if it doesn't already exist. + void add_render_view_id(int render_process_id, int render_routing_id); + void add_render_frame_id(int render_process_id, int render_routing_id); - // Returns true if this browser matches the specified ID values. If - // |render_view_id| is -1 any browser with the specified |render_process_id| - // will match. - bool is_render_id_match(int render_process_id, int render_view_id); + // Remove an ID pair if it exists. + void remove_render_view_id(int render_process_id, int render_routing_id); + void remove_render_frame_id(int render_process_id, int render_routing_id); + + // Returns true if this browser matches the specified ID pair. + bool is_render_view_id_match(int render_process_id, int render_routing_id); + bool is_render_frame_id_match(int render_process_id, int render_routing_id); CefRefPtr browser(); void set_browser(CefRefPtr browser); private: + typedef std::set > RenderIdSet; + + void add_render_id(RenderIdSet* id_set, + int render_process_id, + int render_routing_id); + void remove_render_id(RenderIdSet* id_set, + int render_process_id, + int render_routing_id); + bool is_render_id_match(const RenderIdSet* id_set, + int render_process_id, + int render_routing_id); + int browser_id_; bool is_popup_; bool is_window_rendering_disabled_; @@ -50,8 +66,8 @@ class CefBrowserInfo : public base::RefCountedThreadSafe { // The below members must be protected by |lock_|. - // Set of mapped (process_id, view_id) pairs. Keeping this set is necessary - // for the following reasons: + // Set of mapped (process_id, routing_id) pairs. Keeping this set is + // necessary for the following reasons: // 1. When navigating cross-origin the new (pending) RenderViewHost will be // created before the old (current) RenderViewHost is destroyed. // 2. When canceling and asynchronously continuing navigation of the same URL @@ -59,8 +75,8 @@ class CefBrowserInfo : public base::RefCountedThreadSafe { // and then destroyed as a result of the second (allowed) navigation. // 3. Out-of-process iframes have their own render IDs which must also be // associated with the host browser. - typedef std::set > RenderIdSet; - RenderIdSet render_id_set_; + RenderIdSet render_view_id_set_; + RenderIdSet render_frame_id_set_; // May be NULL if the browser has not yet been created or if the browser has // been destroyed. diff --git a/libcef/browser/browser_message_filter.cc b/libcef/browser/browser_message_filter.cc index b69483291..ac77165b2 100644 --- a/libcef/browser/browser_message_filter.cc +++ b/libcef/browser/browser_message_filter.cc @@ -76,11 +76,19 @@ void CefBrowserMessageFilter::OnGetNewRenderThreadInfo( } void CefBrowserMessageFilter::OnGetNewBrowserInfo( - int routing_id, CefProcessHostMsg_GetNewBrowserInfo_Params* params) { + int render_view_routing_id, + int render_frame_routing_id, + CefProcessHostMsg_GetNewBrowserInfo_Params* params) { + DCHECK_GT(render_view_routing_id, 0); + DCHECK_GT(render_frame_routing_id, 0); + // Popup windows may not have info yet. scoped_refptr info = - CefContentBrowserClient::Get()->GetOrCreateBrowserInfo(host_->GetID(), - routing_id); + CefContentBrowserClient::Get()->GetOrCreateBrowserInfo( + host_->GetID(), + render_view_routing_id, + host_->GetID(), + render_frame_routing_id); params->browser_id = info->browser_id(); params->is_popup = info->is_popup(); params->is_window_rendering_disabled = info->is_window_rendering_disabled(); diff --git a/libcef/browser/browser_message_filter.h b/libcef/browser/browser_message_filter.h index 490723165..8acaffc42 100644 --- a/libcef/browser/browser_message_filter.h +++ b/libcef/browser/browser_message_filter.h @@ -34,8 +34,10 @@ class CefBrowserMessageFilter : public IPC::ChannelProxy::MessageFilter { // Message handlers. void OnGetNewRenderThreadInfo( CefProcessHostMsg_GetNewRenderThreadInfo_Params* params); - void OnGetNewBrowserInfo(int routing_id, - CefProcessHostMsg_GetNewBrowserInfo_Params* params); + void OnGetNewBrowserInfo( + int render_view_routing_id, + int render_frame_routing_id, + CefProcessHostMsg_GetNewBrowserInfo_Params* params); void OnCreateWindow(const ViewHostMsg_CreateWindow_Params& params, IPC::Message* reply_msg); diff --git a/libcef/browser/chrome_scheme_handler.cc b/libcef/browser/chrome_scheme_handler.cc index f9019b9d5..74f7a22f7 100644 --- a/libcef/browser/chrome_scheme_handler.cc +++ b/libcef/browser/chrome_scheme_handler.cc @@ -93,7 +93,8 @@ std::string GetOSType() { std::string GetCommandLine() { #if defined(OS_WIN) - return WideToUTF8(CommandLine::ForCurrentProcess()->GetCommandLineString()); + return base::WideToUTF8( + CommandLine::ForCurrentProcess()->GetCommandLineString()); #elif defined(OS_POSIX) std::string command_line = ""; typedef std::vector ArgvList; diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index 406cafa8b..318e7bebc 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -187,8 +187,8 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext { bool handled = false; CefRefPtr browser = - CefBrowserHostImpl::GetBrowserByRoutingID(render_process_id, - render_view_id); + CefBrowserHostImpl::GetBrowserForView(render_process_id, + render_view_id); if (browser.get()) { CefRefPtr client = browser->GetClient(); if (client.get()) { @@ -229,8 +229,8 @@ class CefPluginServiceFilter : public content::PluginServiceFilter { bool allowed = true; CefRefPtr browser = - CefBrowserHostImpl::GetBrowserByRoutingID(render_process_id, - render_view_id); + CefBrowserHostImpl::GetBrowserForView(render_process_id, + render_view_id); if (browser.get()) { CefRefPtr client = browser->GetClient(); if (client.get()) { @@ -376,21 +376,39 @@ scoped_refptr CefContentBrowserClient::CreateBrowserInfo( } scoped_refptr - CefContentBrowserClient::GetOrCreateBrowserInfo(int render_process_id, - int render_view_id) { + CefContentBrowserClient::GetOrCreateBrowserInfo( + int render_view_process_id, + int render_view_routing_id, + int render_frame_process_id, + int render_frame_routing_id) { base::AutoLock lock_scope(browser_info_lock_); BrowserInfoList::const_iterator it = browser_info_list_.begin(); for (; it != browser_info_list_.end(); ++it) { const scoped_refptr& browser_info = *it; - if (browser_info->is_render_id_match(render_process_id, render_view_id)) + if (browser_info->is_render_view_id_match(render_view_process_id, + render_view_routing_id)) { + // Make sure the frame id is also registered. + browser_info->add_render_frame_id(render_frame_process_id, + render_frame_routing_id); return browser_info; + } else if (browser_info->is_render_frame_id_match( + render_frame_process_id, + render_frame_routing_id)) { + // Make sure the view id is also registered. + browser_info->add_render_view_id(render_view_process_id, + render_view_routing_id); + return browser_info; + } } // Must be a popup if it hasn't already been created. scoped_refptr browser_info = new CefBrowserInfo(++next_browser_id_, true); - browser_info->add_render_id(render_process_id, render_view_id); + browser_info->add_render_view_id(render_view_process_id, + render_view_routing_id); + browser_info->add_render_frame_id(render_frame_process_id, + render_frame_routing_id); browser_info_list_.push_back(browser_info); return browser_info; } @@ -444,19 +462,40 @@ void CefContentBrowserClient::DestroyAllBrowsers() { #endif } -scoped_refptr CefContentBrowserClient::GetBrowserInfo( - int render_process_id, int render_view_id) { +scoped_refptr CefContentBrowserClient::GetBrowserInfoForView( + int render_process_id, int render_routing_id) { base::AutoLock lock_scope(browser_info_lock_); BrowserInfoList::const_iterator it = browser_info_list_.begin(); for (; it != browser_info_list_.end(); ++it) { const scoped_refptr& browser_info = *it; - if (browser_info->is_render_id_match(render_process_id, render_view_id)) + if (browser_info->is_render_view_id_match( + render_process_id, render_routing_id)) { return browser_info; + } } - LOG(WARNING) << "No browser info matching process id " << - render_process_id << " and view id " << render_view_id; + LOG(WARNING) << "No browser info matching view process id " << + render_process_id << " and routing id " << render_routing_id; + + return scoped_refptr(); +} + +scoped_refptr CefContentBrowserClient::GetBrowserInfoForFrame( + int render_process_id, int render_routing_id) { + base::AutoLock lock_scope(browser_info_lock_); + + BrowserInfoList::const_iterator it = browser_info_list_.begin(); + for (; it != browser_info_list_.end(); ++it) { + const scoped_refptr& browser_info = *it; + if (browser_info->is_render_frame_id_match( + render_process_id, render_routing_id)) { + return browser_info; + } + } + + LOG(WARNING) << "No browser info matching frame process id " << + render_process_id << " and routing id " << render_routing_id; return scoped_refptr(); } @@ -517,7 +556,7 @@ CefContentBrowserClient::OverrideCreateWebContentsView( return view; } -void CefContentBrowserClient::RenderProcessHostCreated( +void CefContentBrowserClient::RenderProcessWillLaunch( content::RenderProcessHost* host) { host->GetChannel()->AddFilter(new CefBrowserMessageFilter(host)); host->AddFilter(new PrintingMessageFilter(host->GetID())); @@ -664,8 +703,8 @@ void CefContentBrowserClient::AllowCertificateError( } CefRefPtr browser = - CefBrowserHostImpl::GetBrowserByRoutingID(render_process_id, - render_view_id); + CefBrowserHostImpl::GetBrowserForView(render_process_id, + render_view_id); if (!browser.get()) return; CefRefPtr client = browser->GetClient(); @@ -717,7 +756,7 @@ bool CefContentBrowserClient::CanCreateWindow( return false; CefRefPtr browser = - CefBrowserHostImpl::GetBrowserByRoutingID( + CefBrowserHostImpl::GetBrowserForView( last_create_window_params_.opener_process_id, last_create_window_params_.opener_view_id); DCHECK(browser.get()); diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h index b408f7909..f56c94799 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/content_browser_client.h @@ -51,17 +51,22 @@ class CefContentBrowserClient : public content::ContentBrowserClient { // this race CefBrowserInfo may be created when requested for the first time // and before the associated CefBrowserHostImpl is created. scoped_refptr CreateBrowserInfo(bool is_popup); - scoped_refptr GetOrCreateBrowserInfo(int render_process_id, - int render_view_id); + scoped_refptr GetOrCreateBrowserInfo( + int render_view_process_id, + int render_view_routing_id, + int render_frame_process_id, + int render_frame_routing_id); void RemoveBrowserInfo(scoped_refptr browser_info); void DestroyAllBrowsers(); // Retrieves the CefBrowserInfo matching the specified IDs or an empty // pointer if no match is found. It is allowed to add new callers of this - // method but consider using CefBrowserHostImpl::GetBrowserByRoutingID() + // method but consider using CefBrowserHostImpl::GetBrowserFor[View|Frame]() // instead. - scoped_refptr GetBrowserInfo(int render_process_id, - int render_view_id); + scoped_refptr GetBrowserInfoForView(int render_process_id, + int render_routing_id); + scoped_refptr GetBrowserInfoForFrame(int render_process_id, + int render_routing_id); // Create and return a new CefBrowserContextProxy object. CefBrowserContext* CreateBrowserContextProxy( @@ -79,7 +84,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient { virtual content::WebContentsViewPort* OverrideCreateWebContentsView( content::WebContents* web_contents, content::RenderViewHostDelegateView** rvhdv) OVERRIDE; - virtual void RenderProcessHostCreated( + virtual void RenderProcessWillLaunch( content::RenderProcessHost* host) OVERRIDE; virtual net::URLRequestContextGetter* CreateRequestContext( content::BrowserContext* browser_context, diff --git a/libcef/browser/devtools_delegate.cc b/libcef/browser/devtools_delegate.cc index f080047ae..ab6721b85 100644 --- a/libcef/browser/devtools_delegate.cc +++ b/libcef/browser/devtools_delegate.cc @@ -73,7 +73,7 @@ Target::Target(content::WebContents* web_contents) { content::DevToolsAgentHost::GetOrCreateFor( web_contents->GetRenderViewHost()); id_ = agent_host_->GetId(); - title_ = UTF16ToUTF8(web_contents->GetTitle()); + title_ = base::UTF16ToUTF8(web_contents->GetTitle()); url_ = web_contents->GetURL(); content::NavigationController& controller = web_contents->GetController(); content::NavigationEntry* entry = controller.GetActiveEntry(); diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index f78bf278b..e5bb11cbc 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -86,7 +86,7 @@ void CefDevToolsFrontend::RenderViewCreated( void CefDevToolsFrontend::DocumentOnLoadCompletedInMainFrame(int32 page_id) { web_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame( base::string16(), - ASCIIToUTF16("InspectorFrontendAPI.setUseSoftMenu(true);")); + base::ASCIIToUTF16("InspectorFrontendAPI.setUseSoftMenu(true);")); } void CefDevToolsFrontend::WebContentsDestroyed( diff --git a/libcef/browser/javascript_dialog_gtk.cc b/libcef/browser/javascript_dialog_gtk.cc index 696c98fbe..ee603500a 100644 --- a/libcef/browser/javascript_dialog_gtk.cc +++ b/libcef/browser/javascript_dialog_gtk.cc @@ -23,7 +23,7 @@ base::string16 GetPromptText(GtkDialog* dialog) { GtkWidget* widget = static_cast( g_object_get_data(G_OBJECT(dialog), kPromptTextId)); if (widget) - return UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(widget))); + return base::UTF8ToUTF16(gtk_entry_get_text(GTK_ENTRY(widget))); return base::string16(); } @@ -67,7 +67,7 @@ CefJavaScriptDialog::CefJavaScriptDialog( if (!display_url.empty()) { title += " - "; - title += UTF16ToUTF8(display_url).c_str(); + title += base::UTF16ToUTF8(display_url).c_str(); } GtkWidget* window = @@ -79,7 +79,7 @@ CefJavaScriptDialog::CefJavaScriptDialog( gtk_message_type, buttons, "%s", - UTF16ToUTF8(message_text).c_str()); + base::UTF16ToUTF8(message_text).c_str()); g_signal_connect(gtk_dialog_, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), @@ -99,7 +99,7 @@ CefJavaScriptDialog::CefJavaScriptDialog( gtk_dialog_get_content_area(GTK_DIALOG(gtk_dialog_)); GtkWidget* text_box = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(text_box), - UTF16ToUTF8(default_prompt_text).c_str()); + base::UTF16ToUTF8(default_prompt_text).c_str()); gtk_box_pack_start(GTK_BOX(content_area), text_box, TRUE, TRUE, 0); g_object_set_data(G_OBJECT(gtk_dialog_), kPromptTextId, text_box); gtk_entry_set_activates_default(GTK_ENTRY(text_box), TRUE); diff --git a/libcef/browser/javascript_dialog_mac.mm b/libcef/browser/javascript_dialog_mac.mm index a129f713c..83de49cf3 100644 --- a/libcef/browser/javascript_dialog_mac.mm +++ b/libcef/browser/javascript_dialog_mac.mm @@ -116,17 +116,17 @@ CefJavaScriptDialog::CefJavaScriptDialog( base::string16 label; switch (message_type) { case content::JAVASCRIPT_MESSAGE_TYPE_ALERT: - label = ASCIIToUTF16("JavaScript Alert"); + label = base::ASCIIToUTF16("JavaScript Alert"); break; case content::JAVASCRIPT_MESSAGE_TYPE_PROMPT: - label = ASCIIToUTF16("JavaScript Prompt"); + label = base::ASCIIToUTF16("JavaScript Prompt"); break; case content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM: - label = ASCIIToUTF16("JavaScript Confirm"); + label = base::ASCIIToUTF16("JavaScript Confirm"); break; } if (!display_url.empty()) - label += ASCIIToUTF16(" - ") + display_url; + label += base::ASCIIToUTF16(" - ") + display_url; [alert setMessageText:base::SysUTF16ToNSString(label)]; diff --git a/libcef/browser/javascript_dialog_manager.cc b/libcef/browser/javascript_dialog_manager.cc index a0b936b5c..a52c37906 100644 --- a/libcef/browser/javascript_dialog_manager.cc +++ b/libcef/browser/javascript_dialog_manager.cc @@ -170,7 +170,7 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog( base::string16 new_message_text = message_text + - ASCIIToUTF16("\n\nIs it OK to leave/reload this page?"); + base::ASCIIToUTF16("\n\nIs it OK to leave/reload this page?"); dialog_.reset( new CefJavaScriptDialog(this, diff --git a/libcef/browser/javascript_dialog_win.cc b/libcef/browser/javascript_dialog_win.cc index 13defb9a9..861978c2c 100644 --- a/libcef/browser/javascript_dialog_win.cc +++ b/libcef/browser/javascript_dialog_win.cc @@ -130,7 +130,8 @@ CefJavaScriptDialog::CefJavaScriptDialog( TCHAR text[64]; GetWindowText(dialog_win_, text, sizeof(text)/sizeof(TCHAR)); - base::string16 new_window_text = text + ASCIIToUTF16(" - ") + display_url; + base::string16 new_window_text = + text + base::ASCIIToUTF16(" - ") + display_url; SetWindowText(dialog_win_, new_window_text.c_str()); } diff --git a/libcef/browser/printing/printing_message_filter.cc b/libcef/browser/printing/printing_message_filter.cc index 01a4af0aa..0c21cb16c 100644 --- a/libcef/browser/printing/printing_message_filter.cc +++ b/libcef/browser/printing/printing_message_filter.cc @@ -409,7 +409,7 @@ void PrintingMessageFilter::UpdateFileDescriptor(int render_view_id, int fd) { #endif void PrintingMessageFilter::OnUpdatePrintSettings( - int document_cookie, const DictionaryValue& job_settings, + int document_cookie, const base::DictionaryValue& job_settings, IPC::Message* reply_msg) { scoped_refptr printer_query; printer_query = queue_->PopPrinterQuery(document_cookie); diff --git a/libcef/browser/render_widget_host_view_osr.cc b/libcef/browser/render_widget_host_view_osr.cc index 42670f1a3..4068cdd5c 100644 --- a/libcef/browser/render_widget_host_view_osr.cc +++ b/libcef/browser/render_widget_host_view_osr.cc @@ -237,7 +237,7 @@ void CefRenderWidgetHostViewOSR::DidUpdateBackingStore( const gfx::Rect& scroll_rect, const gfx::Vector2d& scroll_delta, const std::vector& copy_rects, - const ui::LatencyInfo& latency_info) { + const std::vector& latency_info) { if (!scroll_rect.IsEmpty()) { std::vector dirty_rects(copy_rects); dirty_rects.push_back(scroll_rect); @@ -321,8 +321,7 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() { return gfx::Rect(); } -void CefRenderWidgetHostViewOSR::OnAccessibilityEvents( - const std::vector& params) { +void CefRenderWidgetHostViewOSR::CreateBrowserAccessibilityManagerIfNeeded() { } void CefRenderWidgetHostViewOSR::Destroy() { diff --git a/libcef/browser/render_widget_host_view_osr.h b/libcef/browser/render_widget_host_view_osr.h index a9d37fd65..64c21f8cc 100644 --- a/libcef/browser/render_widget_host_view_osr.h +++ b/libcef/browser/render_widget_host_view_osr.h @@ -132,7 +132,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase { const gfx::Rect& scroll_rect, const gfx::Vector2d& scroll_delta, const std::vector& copy_rects, - const ui::LatencyInfo& latency_info) OVERRIDE; + const std::vector& latency_info) OVERRIDE; virtual void RenderProcessGone(base::TerminationStatus status, int error_code) OVERRIDE; #if defined(OS_WIN) && !defined(USE_AURA) @@ -145,9 +145,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase { #endif virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; - virtual void OnAccessibilityEvents( - const std::vector& params) - OVERRIDE; + virtual void CreateBrowserAccessibilityManagerIfNeeded() OVERRIDE; virtual void Destroy() OVERRIDE; virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE; virtual void SelectionBoundsChanged( diff --git a/libcef/browser/resource_dispatcher_host_delegate.cc b/libcef/browser/resource_dispatcher_host_delegate.cc index df7066b27..141750c29 100644 --- a/libcef/browser/resource_dispatcher_host_delegate.cc +++ b/libcef/browser/resource_dispatcher_host_delegate.cc @@ -21,14 +21,14 @@ namespace { bool NavigationOnUIThread( int64 frame_id, CefRefPtr request, - content::RenderViewHost* source, + content::WebContents* source, const navigation_interception::NavigationParams& params) { CEF_REQUIRE_UIT(); bool ignore_navigation = false; CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForHost(source); + CefBrowserHostImpl::GetBrowserForContents(source); DCHECK(browser.get()); if (browser.get()) { CefRefPtr client = browser->GetClient(); @@ -95,7 +95,7 @@ bool CefResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url, int child_id, int route_id) { CefRefPtr browser = - CefBrowserHostImpl::GetBrowserByRoutingID(child_id, route_id); + CefBrowserHostImpl::GetBrowserForView(child_id, route_id); if (browser.get()) browser->HandleExternalProtocol(url); return false; diff --git a/libcef/browser/scheme_handler.cc b/libcef/browser/scheme_handler.cc index 593ac5361..96a668392 100644 --- a/libcef/browser/scheme_handler.cc +++ b/libcef/browser/scheme_handler.cc @@ -29,7 +29,7 @@ void InstallInternalProtectedHandlers( linked_ptr( new net::DataProtocolHandler))); protocol_handlers->insert( - std::make_pair(chrome::kFileScheme, + std::make_pair(content::kFileScheme, linked_ptr( new net::FileProtocolHandler( content::BrowserThread::GetBlockingPool()-> diff --git a/libcef/browser/url_network_delegate.cc b/libcef/browser/url_network_delegate.cc index c45a5f936..0cc5e0f4c 100644 --- a/libcef/browser/url_network_delegate.cc +++ b/libcef/browser/url_network_delegate.cc @@ -245,7 +245,3 @@ int CefNetworkDelegate::OnBeforeSocketStreamConnect( const net::CompletionCallback& callback) { return net::OK; } - -void CefNetworkDelegate::OnRequestWaitStateChange(const net::URLRequest& request, - RequestWaitState state) { -} diff --git a/libcef/browser/url_network_delegate.h b/libcef/browser/url_network_delegate.h index 37030f560..a012b2055 100644 --- a/libcef/browser/url_network_delegate.h +++ b/libcef/browser/url_network_delegate.h @@ -57,8 +57,6 @@ class CefNetworkDelegate : public net::NetworkDelegate { virtual int OnBeforeSocketStreamConnect( net::SocketStream* stream, const net::CompletionCallback& callback) OVERRIDE; - virtual void OnRequestWaitStateChange(const net::URLRequest& request, - RequestWaitState state) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(CefNetworkDelegate); }; diff --git a/libcef/browser/url_request_context_getter.cc b/libcef/browser/url_request_context_getter.cc index c1ff9e891..2780a58b6 100644 --- a/libcef/browser/url_request_context_getter.cc +++ b/libcef/browser/url_request_context_getter.cc @@ -153,7 +153,8 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() { url_request_context_.get(), url_request_context_->network_delegate(), CefContentBrowserClient::Get()->proxy_config_service().release(), - command_line)); + command_line, + true)); storage_->set_proxy_service(system_proxy_service.release()); storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults); diff --git a/libcef/browser/url_request_context_proxy.cc b/libcef/browser/url_request_context_proxy.cc index 412c23cd3..ba5b77d90 100644 --- a/libcef/browser/url_request_context_proxy.cc +++ b/libcef/browser/url_request_context_proxy.cc @@ -62,6 +62,16 @@ class CefCookieStoreProxy : public net::CookieStore { callback); } + virtual void DeleteAllCreatedBetweenForHostAsync( + const base::Time delete_begin, + const base::Time delete_end, + const GURL& url, + const DeleteCallback& callback) OVERRIDE { + scoped_refptr cookie_store = GetCookieStore(); + cookie_store->DeleteAllCreatedBetweenForHostAsync(delete_begin, delete_end, + url, callback); + } + virtual void DeleteSessionCookiesAsync(const DeleteCallback& callback) OVERRIDE { scoped_refptr cookie_store = GetCookieStore(); diff --git a/libcef/common/breakpad_client.cc b/libcef/common/breakpad_client.cc index d466594c4..64744ea88 100644 --- a/libcef/common/breakpad_client.cc +++ b/libcef/common/breakpad_client.cc @@ -23,8 +23,8 @@ void CefBreakpadClient::GetProductNameAndVersion( base::string16* version, base::string16* special_build, base::string16* channel_name) { - *product_name = ASCIIToUTF16("cef"); - *version = UTF8ToUTF16(base::StringPrintf( + *product_name = base::ASCIIToUTF16("cef"); + *version = base::UTF8ToUTF16(base::StringPrintf( "%d.%d.%d", CEF_VERSION_MAJOR, CHROME_VERSION_BUILD, CEF_REVISION)); *special_build = base::string16(); *channel_name = base::string16(); diff --git a/libcef/common/cef_messages.h b/libcef/common/cef_messages.h index 36d08a5cf..1a8c4ef20 100644 --- a/libcef/common/cef_messages.h +++ b/libcef/common/cef_messages.h @@ -40,7 +40,7 @@ IPC_STRUCT_BEGIN(Cef_Request_Params) IPC_STRUCT_MEMBER(std::string, name) // List of message arguments. - IPC_STRUCT_MEMBER(ListValue, arguments) + IPC_STRUCT_MEMBER(base::ListValue, arguments) IPC_STRUCT_END() // Parameters structure for a response. @@ -138,7 +138,7 @@ IPC_STRUCT_BEGIN(CefProcessHostMsg_GetNewRenderThreadInfo_Params) IPC_STRUCT_MEMBER(std::vector, cross_origin_whitelist_entries) - IPC_STRUCT_MEMBER(ListValue, extra_info) + IPC_STRUCT_MEMBER(base::ListValue, extra_info) IPC_STRUCT_END() // Retrieve information about a newly created render thread. @@ -153,10 +153,11 @@ IPC_STRUCT_BEGIN(CefProcessHostMsg_GetNewBrowserInfo_Params) IPC_STRUCT_MEMBER(bool, is_window_rendering_disabled) IPC_STRUCT_END() -// Retrieve information about a newly created browser window. -IPC_SYNC_MESSAGE_CONTROL1_1( +// Retrieve information about a newly created browser. +IPC_SYNC_MESSAGE_CONTROL2_1( CefProcessHostMsg_GetNewBrowserInfo, - int /* routing_id */, + int /* render_view_routing_id */, + int /* render_frame_routing_id */, CefProcessHostMsg_GetNewBrowserInfo_Params /* params*/) // Sent when a frame is identified for the first time. diff --git a/libcef/common/scheme_registration.cc b/libcef/common/scheme_registration.cc index 26cf2f330..b359ca723 100644 --- a/libcef/common/scheme_registration.cc +++ b/libcef/common/scheme_registration.cc @@ -29,8 +29,8 @@ bool IsInternalHandledScheme(const std::string& scheme) { chrome::kChromeDevToolsScheme, chrome::kChromeUIScheme, chrome::kDataScheme, - chrome::kFileScheme, - chrome::kFileSystemScheme, + content::kFileScheme, + content::kFileSystemScheme, }; for (size_t i = 0; i < sizeof(schemes) / sizeof(schemes[0]); ++i) { @@ -49,8 +49,8 @@ bool IsInternalProtectedScheme(const std::string& scheme) { chrome::kBlobScheme, chrome::kChromeUIScheme, chrome::kDataScheme, - chrome::kFileScheme, - chrome::kFileSystemScheme, + content::kFileScheme, + content::kFileSystemScheme, #if !defined(DISABLE_FTP_SUPPORT) content::kFtpScheme, #endif diff --git a/libcef/common/string_types_impl.cc b/libcef/common/string_types_impl.cc index 02b003d57..17efd052c 100644 --- a/libcef/common/string_types_impl.cc +++ b/libcef/common/string_types_impl.cc @@ -171,7 +171,7 @@ CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1, CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len, cef_string_utf8_t* output) { std::string str; - bool ret = WideToUTF8(src, src_len, &str); + bool ret = base::WideToUTF8(src, src_len, &str); if (!cef_string_utf8_set(str.c_str(), str.length(), output, true)) return false; return ret; @@ -180,7 +180,7 @@ CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len, CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len, cef_string_wide_t* output) { std::wstring str; - bool ret = UTF8ToWide(src, src_len, &str); + bool ret = base::UTF8ToWide(src, src_len, &str); if (!cef_string_wide_set(str.c_str(), str.length(), output, true)) return false; return ret; @@ -189,7 +189,7 @@ CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len, CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len, cef_string_utf16_t* output) { base::string16 str; - bool ret = WideToUTF16(src, src_len, &str); + bool ret = base::WideToUTF16(src, src_len, &str); if (!cef_string_utf16_set(str.c_str(), str.length(), output, true)) return false; return ret; @@ -198,7 +198,7 @@ CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len, CEF_EXPORT int cef_string_utf16_to_wide(const char16* src, size_t src_len, cef_string_wide_t* output) { std::wstring str; - bool ret = UTF16ToWide(src, src_len, &str); + bool ret = base::UTF16ToWide(src, src_len, &str); if (!cef_string_wide_set(str.c_str(), str.length(), output, true)) return false; return ret; @@ -207,7 +207,7 @@ CEF_EXPORT int cef_string_utf16_to_wide(const char16* src, size_t src_len, CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len, cef_string_utf16_t* output) { base::string16 str; - bool ret = UTF8ToUTF16(src, src_len, &str); + bool ret = base::UTF8ToUTF16(src, src_len, &str); if (!cef_string_utf16_set(str.c_str(), str.length(), output, true)) return false; return ret; @@ -216,7 +216,7 @@ CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len, CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src, size_t src_len, cef_string_utf8_t* output) { std::string str; - bool ret = UTF16ToUTF8(src, src_len, &str); + bool ret = base::UTF16ToUTF8(src, src_len, &str); if (!cef_string_utf8_set(str.c_str(), str.length(), output, true)) return false; return ret; @@ -224,13 +224,13 @@ CEF_EXPORT int cef_string_utf16_to_utf8(const char16* src, size_t src_len, CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len, cef_string_wide_t* output) { - std::wstring str = ASCIIToWide(std::string(src, src_len)); + std::wstring str = base::ASCIIToWide(std::string(src, src_len)); return cef_string_wide_set(str.c_str(), str.length(), output, true); } CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len, cef_string_utf16_t* output) { - base::string16 str = ASCIIToUTF16(std::string(src, src_len)); + base::string16 str = base::ASCIIToUTF16(std::string(src, src_len)); return cef_string_utf16_set(str.c_str(), str.length(), output, true); } diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index a2eb13bd0..647609b66 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -227,8 +227,10 @@ bool CefDictionaryValueImpl::HasKey(const CefString& key) { bool CefDictionaryValueImpl::GetKeys(KeyList& keys) { CEF_VALUE_VERIFY_RETURN(false, 0); - for (DictionaryValue::Iterator i(const_value()); !i.IsAtEnd(); i.Advance()) + for (base::DictionaryValue::Iterator i(const_value()); + !i.IsAtEnd(); i.Advance()) { keys.push_back(i.key()); + } return true; } diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index b48d18353..3513046fb 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -52,9 +52,9 @@ const int64 kInvalidFrameId = -1; blink::WebString FilePathStringToWebString( const base::FilePath::StringType& str) { #if defined(OS_POSIX) - return WideToUTF16Hack(base::SysNativeMBToWide(str)); + return base::WideToUTF16Hack(base::SysNativeMBToWide(str)); #elif defined(OS_WIN) - return WideToUTF16Hack(str); + return base::WideToUTF16Hack(str); #endif } @@ -296,7 +296,7 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) { request.setRequestorID(-1); if (!params.method.empty()) - request.setHTTPMethod(ASCIIToUTF16(params.method)); + request.setHTTPMethod(base::ASCIIToUTF16(params.method)); if (params.referrer.is_valid()) { WebString referrer = blink::WebSecurityPolicy::generateReferrerHeader( @@ -321,13 +321,16 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) { if (params.upload_data.get()) { base::string16 method = request.httpMethod(); - if (method == ASCIIToUTF16("GET") || method == ASCIIToUTF16("HEAD")) - request.setHTTPMethod(ASCIIToUTF16("POST")); + if (method == base::ASCIIToUTF16("GET") || + method == base::ASCIIToUTF16("HEAD")) { + request.setHTTPMethod(base::ASCIIToUTF16("POST")); + } - if (request.httpHeaderField(ASCIIToUTF16("Content-Type")).length() == 0) { + if (request.httpHeaderField( + base::ASCIIToUTF16("Content-Type")).length() == 0) { request.setHTTPHeaderField( - ASCIIToUTF16("Content-Type"), - ASCIIToUTF16("application/x-www-form-urlencoded")); + base::ASCIIToUTF16("Content-Type"), + base::ASCIIToUTF16("application/x-www-form-urlencoded")); } blink::WebHTTPBody body; @@ -670,7 +673,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { if (is_javascript) { web_frame->executeScript( - WebScriptSource(UTF8ToUTF16(code), + WebScriptSource(base::UTF8ToUTF16(code), GURL(script_url), script_start_line)); success = true; @@ -699,7 +702,7 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) { } else if (LowerCaseEqualsASCII(command, "gettext")) { response = webkit_glue::DumpDocumentText(web_frame); success = true; - } else if (web_frame->executeCommand(UTF8ToUTF16(command))) { + } else if (web_frame->executeCommand(base::UTF8ToUTF16(command))) { success = true; } } diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index f85ab74e5..1e141aebd 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -421,40 +421,14 @@ void CefContentRendererClient::RenderThreadStarted() { } } +void CefContentRendererClient::RenderFrameCreated( + content::RenderFrame* render_frame) { + BrowserCreated(render_frame->GetRenderView(), render_frame); +} + void CefContentRendererClient::RenderViewCreated( content::RenderView* render_view) { - // Retrieve the new browser information synchronously. - CefProcessHostMsg_GetNewBrowserInfo_Params params; - content::RenderThread::Get()->Send( - new CefProcessHostMsg_GetNewBrowserInfo(render_view->GetRoutingID(), - ¶ms)); - DCHECK_GT(params.browser_id, 0); - -#if defined(OS_MACOSX) - // FIXME: It would be better if this API would be a callback from the - // WebKit layer, or if it would be exposed as an WebView instance method; the - // current implementation uses a static variable, and WebKit needs to be - // patched in order to make it work for each WebView instance - render_view->GetWebView()->setUseExternalPopupMenusThisInstance( - !params.is_window_rendering_disabled); -#endif - - CefRefPtr browser = - new CefBrowserImpl(render_view, params.browser_id, params.is_popup, - params.is_window_rendering_disabled); - browsers_.insert(std::make_pair(render_view, browser)); - - new CefPrerendererClient(render_view); - new printing::PrintWebViewHelper(render_view); - - // Notify the render process handler. - CefRefPtr application = CefContentClient::Get()->application(); - if (application.get()) { - CefRefPtr handler = - application->GetRenderProcessHandler(); - if (handler.get()) - handler->OnBrowserCreated(browser.get()); - } + BrowserCreated(render_view, render_view->GetMainRenderFrame()); } bool CefContentRendererClient::OverrideCreatePlugin( @@ -666,6 +640,50 @@ void CefContentRendererClient::WillDestroyCurrentMessageLoop() { single_process_cleanup_complete_ = true; } +void CefContentRendererClient::BrowserCreated( + content::RenderView* render_view, + content::RenderFrame* render_frame) { + // Retrieve the browser information synchronously. This will also register + // the routing ids with the browser info object in the browser process. + CefProcessHostMsg_GetNewBrowserInfo_Params params; + content::RenderThread::Get()->Send( + new CefProcessHostMsg_GetNewBrowserInfo( + render_view->GetRoutingID(), + render_frame->GetRoutingID(), + ¶ms)); + DCHECK_GT(params.browser_id, 0); + + // Don't create another browser object if one already exists for the view. + if (GetBrowserForView(render_view)) + return; + +#if defined(OS_MACOSX) + // FIXME: It would be better if this API would be a callback from the + // WebKit layer, or if it would be exposed as an WebView instance method; the + // current implementation uses a static variable, and WebKit needs to be + // patched in order to make it work for each WebView instance + render_view->GetWebView()->setUseExternalPopupMenusThisInstance( + !params.is_window_rendering_disabled); +#endif + + CefRefPtr browser = + new CefBrowserImpl(render_view, params.browser_id, params.is_popup, + params.is_window_rendering_disabled); + browsers_.insert(std::make_pair(render_view, browser)); + + new CefPrerendererClient(render_view); + new printing::PrintWebViewHelper(render_view); + + // Notify the render process handler. + CefRefPtr application = CefContentClient::Get()->application(); + if (application.get()) { + CefRefPtr handler = + application->GetRenderProcessHandler(); + if (handler.get()) + handler->OnBrowserCreated(browser.get()); + } +} + void CefContentRendererClient::RunSingleProcessCleanupOnUIThread() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/content_renderer_client.h index ed8e18aff..3476754a6 100644 --- a/libcef/renderer/content_renderer_client.h +++ b/libcef/renderer/content_renderer_client.h @@ -75,6 +75,7 @@ class CefContentRendererClient : public content::ContentRendererClient, private: // ContentRendererClient implementation. virtual void RenderThreadStarted() OVERRIDE; + virtual void RenderFrameCreated(content::RenderFrame* render_frame) OVERRIDE; virtual void RenderViewCreated(content::RenderView* render_view) OVERRIDE; virtual bool OverrideCreatePlugin( content::RenderFrame* render_frame, @@ -100,6 +101,9 @@ class CefContentRendererClient : public content::ContentRendererClient, // MessageLoop::DestructionObserver implementation. virtual void WillDestroyCurrentMessageLoop() OVERRIDE; + void BrowserCreated(content::RenderView* render_view, + content::RenderFrame* render_frame); + // Perform cleanup work for single-process mode. void RunSingleProcessCleanupOnUIThread(); diff --git a/libcef/renderer/dom_node_impl.cc b/libcef/renderer/dom_node_impl.cc index 39d1d8d79..f0916bc78 100644 --- a/libcef/renderer/dom_node_impl.cc +++ b/libcef/renderer/dom_node_impl.cc @@ -242,11 +242,11 @@ CefString CefDOMNodeImpl::GetValue() { base::string16 value; const base::string16& form_control_type = formElement.formControlType(); - if (form_control_type == ASCIIToUTF16("text")) { + if (form_control_type == base::ASCIIToUTF16("text")) { const WebInputElement& input_element = formElement.toConst(); value = input_element.value(); - } else if (form_control_type == ASCIIToUTF16("select-one")) { + } else if (form_control_type == base::ASCIIToUTF16("select-one")) { const WebSelectElement& select_element = formElement.toConst(); value = select_element.value(); diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index 841d599a2..a4e1c701e 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -1053,12 +1053,13 @@ CefV8ValueImpl::Handle::~Handle() { (tracker_ ? new CefV8MakeWeakParam(isolate(), context_state_, tracker_) : NULL), TrackDestructor); - } else { - handle_.Reset(); - - if (tracker_) - delete tracker_; + } else if (tracker_) { + delete tracker_; } + + // Always call Reset() on a persistent handle to avoid the + // CHECK(state() != NEAR_DEATH) in V8's PostGarbageCollectionProcessing. + handle_.Reset(); tracker_ = NULL; } diff --git a/patch/patches/content_nav_1129.patch b/patch/patches/content_nav_1129.patch index 250ad7fe2..7b6fcf1ce 100644 --- a/patch/patches/content_nav_1129.patch +++ b/patch/patches/content_nav_1129.patch @@ -1,6 +1,6 @@ Index: public/renderer/content_renderer_client.cc =================================================================== ---- public/renderer/content_renderer_client.cc (revision 240657) +--- public/renderer/content_renderer_client.cc (revision 242756) +++ public/renderer/content_renderer_client.cc (working copy) @@ -91,7 +91,6 @@ return false; @@ -20,7 +20,7 @@ Index: public/renderer/content_renderer_client.cc const GURL& url, Index: public/renderer/content_renderer_client.h =================================================================== ---- public/renderer/content_renderer_client.h (revision 240657) +--- public/renderer/content_renderer_client.h (revision 242756) +++ public/renderer/content_renderer_client.h (working copy) @@ -172,7 +172,6 @@ // Returns true if a popup window should be allowed. @@ -40,9 +40,9 @@ Index: public/renderer/content_renderer_client.h // If |send_referrer| is set to false (which is the default), no referrer Index: renderer/render_view_impl.cc =================================================================== ---- renderer/render_view_impl.cc (revision 240657) +--- renderer/render_view_impl.cc (revision 242756) +++ renderer/render_view_impl.cc (working copy) -@@ -3134,7 +3134,6 @@ +@@ -3124,7 +3124,6 @@ WebFrame* frame, WebDataSource::ExtraData* extraData, const WebURLRequest& request, WebNavigationType type, WebNavigationPolicy default_policy, bool is_redirect) { @@ -50,7 +50,7 @@ Index: renderer/render_view_impl.cc // The handlenavigation API is deprecated and will be removed once // crbug.com/325351 is resolved. if (request.url() != GURL(kSwappedOutURL) && -@@ -3149,7 +3148,6 @@ +@@ -3139,7 +3138,6 @@ is_redirect)) { return blink::WebNavigationPolicyIgnore; } diff --git a/patch/patches/views_widget_180.patch b/patch/patches/views_widget_180.patch index 043b35387..7335324bc 100644 --- a/patch/patches/views_widget_180.patch +++ b/patch/patches/views_widget_180.patch @@ -1,6 +1,6 @@ Index: desktop_aura/desktop_root_window_host_win.cc =================================================================== ---- desktop_aura/desktop_root_window_host_win.cc (revision 241258) +--- desktop_aura/desktop_root_window_host_win.cc (revision 242756) +++ desktop_aura/desktop_root_window_host_win.cc (working copy) @@ -131,7 +131,9 @@ native_widget_delegate_); @@ -13,7 +13,7 @@ Index: desktop_aura/desktop_root_window_host_win.cc parent_hwnd = params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); } -@@ -751,7 +753,7 @@ +@@ -752,7 +754,7 @@ void DesktopRootWindowHostWin::HandleCreate() { // TODO(beng): moar @@ -24,7 +24,7 @@ Index: desktop_aura/desktop_root_window_host_win.cc Index: desktop_aura/desktop_screen_win.cc =================================================================== ---- desktop_aura/desktop_screen_win.cc (revision 241258) +--- desktop_aura/desktop_screen_win.cc (revision 242756) +++ desktop_aura/desktop_screen_win.cc (working copy) @@ -54,6 +54,8 @@ } @@ -37,9 +37,9 @@ Index: desktop_aura/desktop_screen_win.cc } Index: widget.h =================================================================== ---- widget.h (revision 241258) +--- widget.h (revision 242756) +++ widget.h (working copy) -@@ -201,6 +201,7 @@ +@@ -197,6 +197,7 @@ // Should the widget be double buffered? Default is false. bool double_buffer; gfx::NativeView parent; diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index df6262af4..4b0e58080 100644 --- a/patch/patches/webkit_popups.patch +++ b/patch/patches/webkit_popups.patch @@ -1,33 +1,33 @@ Index: public/web/WebView.h =================================================================== ---- public/web/WebView.h (revision 163979) +--- public/web/WebView.h (revision 164381) +++ public/web/WebView.h (working copy) -@@ -441,6 +441,7 @@ +@@ -417,6 +417,7 @@ // Sets whether select popup menus should be rendered by the browser. BLINK_EXPORT static void setUseExternalPopupMenus(bool); + virtual void setUseExternalPopupMenusThisInstance(bool) = 0; - - // Visited link state -------------------------------------------------- + // Hides any popup (suggestions, selects...) that might be showing. + virtual void hidePopups() = 0; Index: Source/web/ChromeClientImpl.cpp =================================================================== ---- Source/web/ChromeClientImpl.cpp (revision 163979) +--- Source/web/ChromeClientImpl.cpp (revision 164381) +++ Source/web/ChromeClientImpl.cpp (working copy) -@@ -867,7 +867,7 @@ +@@ -851,7 +851,7 @@ PassRefPtr ChromeClientImpl::createPopupMenu(Frame& frame, PopupMenuClient* client) const { - if (WebViewImpl::useExternalPopupMenus()) + if (m_webView->useExternalPopupMenus()) - return adoptRef(new ExternalPopupMenu(frame, client, m_webView->client())); + return adoptRef(new ExternalPopupMenu(frame, client, *m_webView)); return adoptRef(new PopupMenuChromium(frame, client)); Index: Source/web/WebViewImpl.cpp =================================================================== ---- Source/web/WebViewImpl.cpp (revision 163979) +--- Source/web/WebViewImpl.cpp (revision 164381) +++ Source/web/WebViewImpl.cpp (working copy) -@@ -393,6 +393,7 @@ +@@ -348,6 +348,7 @@ , m_fakePageScaleAnimationPageScaleFactor(0) , m_fakePageScaleAnimationUseAnchor(false) , m_contextMenuAllowed(false) @@ -35,7 +35,7 @@ Index: Source/web/WebViewImpl.cpp , m_doingDragAndDrop(false) , m_ignoreInputEvents(false) , m_compositorDeviceScaleFactorOverride(0) -@@ -3708,9 +3709,14 @@ +@@ -3552,9 +3553,14 @@ updateLayerTreeViewport(); } @@ -53,9 +53,9 @@ Index: Source/web/WebViewImpl.cpp void WebViewImpl::startDragging(Frame* frame, Index: Source/web/WebViewImpl.h =================================================================== ---- Source/web/WebViewImpl.h (revision 163979) +--- Source/web/WebViewImpl.h (revision 164381) +++ Source/web/WebViewImpl.h (working copy) -@@ -416,7 +416,8 @@ +@@ -398,7 +398,8 @@ // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). @@ -65,7 +65,7 @@ Index: Source/web/WebViewImpl.h bool contextMenuAllowed() const { -@@ -714,6 +715,8 @@ +@@ -680,6 +681,8 @@ bool m_contextMenuAllowed; diff --git a/tests/unittests/display_unittest.cc b/tests/unittests/display_unittest.cc index 3f77978a4..f5efec715 100644 --- a/tests/unittests/display_unittest.cc +++ b/tests/unittests/display_unittest.cc @@ -52,6 +52,11 @@ class TitleTestHandler : public TestHandler { } else if (step_ == 1 || step_ == 3) { EXPECT_STREQ(kTitleStr2, title_str.c_str()); } else if (step_ == 4) { + // Ignore the unexpected notification of the page URL. + // Related bug: http://crbug.com/331351 + if (title_str == &kTitleUrl2[7]) + return; + EXPECT_STREQ(kTitleStr3, title_str.c_str()); }