diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 15:04:38 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-22 15:04:38 +0000 |
commit | 395045ce1c03cad228aa2769847aa67a45fa0250 (patch) | |
tree | 70c4f1bcbee20fde6f7295fedffb575f559614ca | |
parent | 04920e9208eb7a42db37e53ae528d120e92bd2ac (diff) | |
download | chromium_src-395045ce1c03cad228aa2769847aa67a45fa0250.zip chromium_src-395045ce1c03cad228aa2769847aa67a45fa0250.tar.gz chromium_src-395045ce1c03cad228aa2769847aa67a45fa0250.tar.bz2 |
Move TransferNavigationResourceThrottle to content since that's where it belongs. This is a step in getting rid of RenderViewHostDelegate usage in chrome, so that we can hide it.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/10414035
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138251 0039d316-1c4b-4281-b951-d872f2087c98
16 files changed, 123 insertions, 95 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 821e4a5..4facf9d 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -72,6 +72,7 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/extension_process_policy.h" #include "chrome/common/extensions/extension_set.h" #include "chrome/common/logging_chrome.h" #include "chrome/common/pref_names.h" @@ -682,6 +683,15 @@ bool ChromeContentBrowserClient::ShouldSwapProcessesForNavigation( return false; } +bool ChromeContentBrowserClient::ShouldSwapProcessesForRedirect( + content::ResourceContext* resource_context, const GURL& current_url, + const GURL& new_url) { + ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); + return extensions::CrossesExtensionProcessBoundary( + io_data->GetExtensionInfoMap()->extensions(), + ExtensionURLInfo(current_url), ExtensionURLInfo(new_url)); +} + std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( const std::string& alias_name) { return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 8fd2945..d5615b4 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -53,6 +53,10 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { OVERRIDE; virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url, const GURL& new_url) OVERRIDE; + virtual bool ShouldSwapProcessesForRedirect( + content::ResourceContext* resource_context, + const GURL& current_url, + const GURL& new_url) OVERRIDE; virtual std::string GetCanonicalEncodingNameByAliasName( const std::string& alias_name) OVERRIDE; virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc index 2e445d3..a5153dd 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc @@ -23,7 +23,6 @@ #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/renderer_host/chrome_url_request_user_data.h" #include "chrome/browser/renderer_host/safe_browsing_resource_throttle.h" -#include "chrome/browser/renderer_host/transfer_navigation_resource_throttle.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" #include "chrome/browser/ui/auto_login_prompter.h" #include "chrome/browser/ui/login/login_prompt.h" @@ -133,16 +132,14 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning( request->set_priority(net::IDLE); } - if (resource_type == ResourceType::MAIN_FRAME) { - throttles->push_back(new TransferNavigationResourceThrottle(request)); - #if defined(OS_CHROMEOS) + if (resource_type == ResourceType::MAIN_FRAME) { // We check offline first, then check safe browsing so that we still can // block unsafe site after we remove offline page. throttles->push_back(new OfflineResourceThrottle( child_id, route_id, request, resource_context)); -#endif } +#endif AppendChromeMetricsHeaders(request, resource_context, resource_type); diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 8ba6fde..ab78f2b 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1875,8 +1875,6 @@ 'browser/renderer_host/plugin_info_message_filter.h', 'browser/renderer_host/safe_browsing_resource_throttle.cc', 'browser/renderer_host/safe_browsing_resource_throttle.h', - 'browser/renderer_host/transfer_navigation_resource_throttle.cc', - 'browser/renderer_host/transfer_navigation_resource_throttle.h', 'browser/renderer_host/web_cache_manager.cc', 'browser/renderer_host/web_cache_manager.h', 'browser/renderer_preferences_util.cc', diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc index c356b93..bda51ff 100644 --- a/content/browser/mock_content_browser_client.cc +++ b/content/browser/mock_content_browser_client.cc @@ -87,6 +87,12 @@ bool MockContentBrowserClient::ShouldSwapProcessesForNavigation( return false; } +bool MockContentBrowserClient::ShouldSwapProcessesForRedirect( + ResourceContext* resource_context, const GURL& current_url, + const GURL& new_url) { + return false; +} + std::string MockContentBrowserClient::GetCanonicalEncodingNameByAliasName( const std::string& alias_name) { return std::string(); diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h index bc042b7..b9f4c80 100644 --- a/content/browser/mock_content_browser_client.h +++ b/content/browser/mock_content_browser_client.h @@ -45,6 +45,10 @@ class MockContentBrowserClient : public ContentBrowserClient { virtual void SiteInstanceDeleting(SiteInstance* site_instance) OVERRIDE; virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url, const GURL& new_url) OVERRIDE; + virtual bool ShouldSwapProcessesForRedirect( + ResourceContext* resource_context, + const GURL& current_url, + const GURL& new_url) OVERRIDE; virtual std::string GetCanonicalEncodingNameByAliasName( const std::string& alias_name) OVERRIDE; virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.cc b/content/browser/renderer_host/resource_dispatcher_host_impl.cc index 05fe46f3..0fbfe14 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.cc @@ -39,7 +39,7 @@ #include "content/browser/renderer_host/redirect_to_file_resource_handler.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/resource_message_filter.h" -#include "content/public/browser/resource_request_details.h" +#include "content/browser/renderer_host/transfer_navigation_resource_throttle.h" #include "content/browser/renderer_host/resource_request_info_impl.h" #include "content/browser/renderer_host/sync_resource_handler.h" #include "content/browser/renderer_host/throttling_resource_handler.h" @@ -58,6 +58,7 @@ #include "content/public/browser/render_view_host_delegate.h" #include "content/public/browser/resource_dispatcher_host_delegate.h" #include "content/public/browser/resource_dispatcher_host_login_delegate.h" +#include "content/public/browser/resource_request_details.h" #include "content/public/browser/resource_throttle.h" #include "content/public/common/content_switches.h" #include "content/public/common/process_type.h" @@ -552,27 +553,6 @@ void ResourceDispatcherHostImpl::ClearLoginDelegateForRequest( info->set_login_delegate(NULL); } -void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( - net::URLRequest* transferred_request) { - ResourceRequestInfoImpl* info = - ResourceRequestInfoImpl::ForRequest(transferred_request); - - GlobalRequestID transferred_request_id(info->GetChildID(), - info->GetRequestID()); - transferred_navigations_[transferred_request_id] = transferred_request; - - // If a URLRequest is transferred to a new RenderViewHost, its - // ResourceHandler should not receive any notifications because it may - // depend on the state of the old RVH. We set a ResourceHandler that only - // allows canceling requests, because on shutdown of the RDH all pending - // requests are canceled. The RVH of requests that are being transferred may - // be gone by that time. If the request is resumed, the ResoureHandlers are - // substituted again. - scoped_refptr<ResourceHandler> transferred_resource_handler( - new DoomedResourceHandler(info->resource_handler())); - info->set_resource_handler(transferred_resource_handler.get()); -} - void ResourceDispatcherHostImpl::Shutdown() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); BrowserThread::PostTask(BrowserThread::IO, @@ -898,11 +878,11 @@ void ResourceDispatcherHostImpl::BeginRequest( // Insert a buffered event handler before the actual one. handler = new BufferedResourceHandler(handler, this, request); + ScopedVector<ResourceThrottle> throttles; if (delegate_) { bool is_continuation_of_transferred_request = (deferred_request != NULL); - ScopedVector<ResourceThrottle> throttles; delegate_->RequestBeginning(request, resource_context, request_data.resource_type, @@ -910,10 +890,16 @@ void ResourceDispatcherHostImpl::BeginRequest( route_id, is_continuation_of_transferred_request, &throttles); - if (!throttles.empty()) { - handler = new ThrottlingResourceHandler(this, handler, child_id, - request_id, throttles.Pass()); - } + } + + if (request_data.resource_type == ResourceType::MAIN_FRAME) { + throttles.insert( + throttles.begin(), new TransferNavigationResourceThrottle(request)); + } + + if (!throttles.empty()) { + handler = new ThrottlingResourceHandler(this, handler, child_id, request_id, + throttles.Pass()); } bool allow_download = request_data.allow_download && @@ -1263,6 +1249,27 @@ bool ResourceDispatcherHostImpl::WillSendData(int child_id, return true; } +void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( + net::URLRequest* transferred_request) { + ResourceRequestInfoImpl* info = + ResourceRequestInfoImpl::ForRequest(transferred_request); + + GlobalRequestID transferred_request_id(info->GetChildID(), + info->GetRequestID()); + transferred_navigations_[transferred_request_id] = transferred_request; + + // If a URLRequest is transferred to a new RenderViewHost, its + // ResourceHandler should not receive any notifications because it may + // depend on the state of the old RVH. We set a ResourceHandler that only + // allows canceling requests, because on shutdown of the RDH all pending + // requests are canceled. The RVH of requests that are being transferred may + // be gone by that time. If the request is resumed, the ResoureHandlers are + // substituted again. + scoped_refptr<ResourceHandler> transferred_resource_handler( + new DoomedResourceHandler(info->resource_handler())); + info->set_resource_handler(transferred_resource_handler.get()); +} + int ResourceDispatcherHostImpl::GetOutstandingRequestsMemoryCost( int child_id) const { OutstandingRequestsMemoryCostMap::const_iterator entry = diff --git a/content/browser/renderer_host/resource_dispatcher_host_impl.h b/content/browser/renderer_host/resource_dispatcher_host_impl.h index 26c8c3d..0202cf65 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_impl.h +++ b/content/browser/renderer_host/resource_dispatcher_host_impl.h @@ -84,7 +84,6 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl const DownloadSaveInfo& save_info, const DownloadStartedCallback& started_callback) OVERRIDE; virtual void ClearLoginDelegateForRequest(net::URLRequest* request) OVERRIDE; - virtual void MarkAsTransferredNavigation(net::URLRequest* request) OVERRIDE; // Puts the resource dispatcher host in an inactive state (unable to begin // new requests). Cancels all pending requests. @@ -144,6 +143,10 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl // case the caller should not send the data. bool WillSendData(int child_id, int request_id); + // Marks the request as "parked". This happens if a request is + // redirected cross-site and needs to be resumed by a new render view. + void MarkAsTransferredNavigation(net::URLRequest* request); + // Returns the number of pending requests. This is designed for the unittests int pending_requests() const { return static_cast<int>(pending_requests_.size()); diff --git a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc b/content/browser/renderer_host/transfer_navigation_resource_throttle.cc index c59a19f..2b48cda 100644 --- a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.cc +++ b/content/browser/renderer_host/transfer_navigation_resource_throttle.cc @@ -2,16 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/renderer_host/transfer_navigation_resource_throttle.h" +#include "content/browser/renderer_host/transfer_navigation_resource_throttle.h" #include "base/bind.h" -#include "chrome/browser/extensions/extension_info_map.h" -#include "chrome/browser/profiles/profile_io_data.h" -#include "chrome/common/extensions/extension_process_policy.h" +#include "content/browser/renderer_host/resource_dispatcher_host_impl.h" +#include "content/public/browser/content_browser_client.h" #include "content/public/browser/global_request_id.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host_delegate.h" -#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/resource_request_info.h" #include "content/public/common/referrer.h" #include "net/url_request/url_request.h" @@ -19,7 +17,7 @@ using content::GlobalRequestID; using content::Referrer; using content::RenderViewHostDelegate; -using content::ResourceDispatcherHost; +using content::ResourceDispatcherHostImpl; using content::ResourceRequestInfo; namespace { @@ -57,8 +55,6 @@ TransferNavigationResourceThrottle::~TransferNavigationResourceThrottle() { void TransferNavigationResourceThrottle::WillRedirectRequest( const GURL& new_url, bool* defer) { - // TODO(darin): Move this logic into src/content. - const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); // If a toplevel request is redirecting across extension extents, we want to @@ -67,13 +63,11 @@ void TransferNavigationResourceThrottle::WillRedirectRequest( // to host the new URL. // TODO(mpcomplete): handle for cases other than extensions (e.g. WebUI). content::ResourceContext* resource_context = info->GetContext(); - ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); - if (extensions::CrossesExtensionProcessBoundary( - io_data->GetExtensionInfoMap()->extensions(), - ExtensionURLInfo(request_->url()), ExtensionURLInfo(new_url))) { + if (content::GetContentClient()->browser()->ShouldSwapProcessesForRedirect( + resource_context, request_->url(), new_url)) { int render_process_id, render_view_id; if (info->GetAssociatedRenderView(&render_process_id, &render_view_id)) { - ResourceDispatcherHost::Get()->MarkAsTransferredNavigation(request_); + ResourceDispatcherHostImpl::Get()->MarkAsTransferredNavigation(request_); GlobalRequestID global_id(info->GetChildID(), info->GetRequestID()); content::BrowserThread::PostTask( diff --git a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.h b/content/browser/renderer_host/transfer_navigation_resource_throttle.h index 637314f..e30d444 100644 --- a/chrome/browser/renderer_host/transfer_navigation_resource_throttle.h +++ b/content/browser/renderer_host/transfer_navigation_resource_throttle.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_THROTTLE_H_ -#define CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_THROTTLE_H_ +#ifndef CONTENT_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_THROTTLE_H_ +#define CONTENT_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_THROTTLE_H_ #pragma once #include "base/basictypes.h" @@ -33,5 +33,4 @@ class TransferNavigationResourceThrottle : public content::ResourceThrottle { DISALLOW_COPY_AND_ASSIGN(TransferNavigationResourceThrottle); }; - -#endif // CHROME_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_THROTTLE_H_ +#endif // CONTENT_BROWSER_RENDERER_HOST_TRANSFER_NAVIGATION_RESOURCE_THROTTLE_H_ diff --git a/content/content_browser.gypi b/content/content_browser.gypi index ecefda0..b5bda95 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -612,6 +612,8 @@ 'browser/renderer_host/text_input_client_message_filter.mm', 'browser/renderer_host/throttling_resource_handler.cc', 'browser/renderer_host/throttling_resource_handler.h', + 'browser/renderer_host/transfer_navigation_resource_throttle.cc', + 'browser/renderer_host/transfer_navigation_resource_throttle.h', 'browser/renderer_host/web_input_event_aura.cc', 'browser/renderer_host/web_input_event_aura.h', 'browser/renderer_host/web_input_event_aurawin.cc', diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index b2edd2b..8ae2dc6 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -80,8 +80,7 @@ class WebUIControllerFactory; struct MainFunctionParams; struct ShowDesktopNotificationHostMsgParams; -typedef base::Callback< void(const content::MediaStreamDevices&) > - MediaResponseCallback; +typedef base::Callback< void(const MediaStreamDevices&) > MediaResponseCallback; // Embedder API (or SPI) for participating in browser logic, to be implemented // by the client of the content browser. See ChromeContentBrowserClient for the @@ -99,7 +98,7 @@ class ContentBrowserClient { // implementations for the browser startup code. See comments in // browser_main_parts.h. virtual BrowserMainParts* CreateBrowserMainParts( - const content::MainFunctionParams& parameters) = 0; + const MainFunctionParams& parameters) = 0; // Allows an embedder to return their own WebContentsView implementation. // Return NULL to let the default one for the platform be created. @@ -113,18 +112,15 @@ class ContentBrowserClient { WebContents* web_contents) = 0; // Notifies that a new RenderHostView has been created. - virtual void RenderViewHostCreated( - content::RenderViewHost* render_view_host) = 0; + virtual void RenderViewHostCreated(RenderViewHost* render_view_host) = 0; // Notifies that a RenderProcessHost has been created. This is called before // the content layer adds its own BrowserMessageFilters, so that the // embedder's IPC filters have priority. - virtual void RenderProcessHostCreated( - content::RenderProcessHost* host) = 0; + virtual void RenderProcessHostCreated(RenderProcessHost* host) = 0; // Notifies that a BrowserChildProcessHost has been created. - virtual void BrowserChildProcessHostCreated( - content::BrowserChildProcessHost* host) {} + virtual void BrowserChildProcessHostCreated(BrowserChildProcessHost* host) {} // Gets the WebUIControllerFactory which will be responsible for generating // WebUIs. Can return NULL if the embedder doesn't need WebUI support. @@ -146,7 +142,7 @@ class ContentBrowserClient { // Returns whether a new view for a given |site_url| can be launched in a // given |process_host|. - virtual bool IsSuitableHost(content::RenderProcessHost* process_host, + virtual bool IsSuitableHost(RenderProcessHost* process_host, const GURL& site_url) = 0; // Returns whether a new process should be created or an existing one should @@ -156,11 +152,10 @@ class ContentBrowserClient { BrowserContext* browser_context, const GURL& url) = 0; // Called when a site instance is first associated with a process. - virtual void SiteInstanceGotProcess( - content::SiteInstance* site_instance) = 0; + virtual void SiteInstanceGotProcess(SiteInstance* site_instance) = 0; // Called from a site instance's destructor. - virtual void SiteInstanceDeleting(content::SiteInstance* site_instance) = 0; + virtual void SiteInstanceDeleting(SiteInstance* site_instance) = 0; // Returns true if for the navigation from |current_url| to |new_url|, // processes should be swapped (even if we are in a process model that @@ -168,6 +163,13 @@ class ContentBrowserClient { virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url, const GURL& new_url) = 0; + // Returns true if the given navigation redirect should cause a renderer + // process swap. + // This is called on the IO thread. + virtual bool ShouldSwapProcessesForRedirect(ResourceContext* resource_context, + const GURL& current_url, + const GURL& new_url) = 0; + // See CharacterEncoding's comment. virtual std::string GetCanonicalEncodingNameByAliasName( const std::string& alias_name) = 0; @@ -182,8 +184,7 @@ class ContentBrowserClient { // Returns the languages used in the Accept-Languages HTTP header. // (Not called GetAcceptLanguages so it doesn't clash with win32). - virtual std::string GetAcceptLangs( - content::BrowserContext* context) = 0; + virtual std::string GetAcceptLangs(BrowserContext* context) = 0; // Returns the default favicon. The callee doesn't own the given bitmap. virtual SkBitmap* GetDefaultFavicon() = 0; @@ -192,14 +193,14 @@ class ContentBrowserClient { // This is called on the IO thread. virtual bool AllowAppCache(const GURL& manifest_url, const GURL& first_party, - content::ResourceContext* context) = 0; + ResourceContext* context) = 0; // Allow the embedder to control if the given cookie can be read. // This is called on the IO thread. virtual bool AllowGetCookie(const GURL& url, const GURL& first_party, const net::CookieList& cookie_list, - content::ResourceContext* context, + ResourceContext* context, int render_process_id, int render_view_id) = 0; @@ -208,13 +209,13 @@ class ContentBrowserClient { virtual bool AllowSetCookie(const GURL& url, const GURL& first_party, const std::string& cookie_line, - content::ResourceContext* context, + ResourceContext* context, int render_process_id, int render_view_id, net::CookieOptions* options) = 0; // This is called on the IO thread. - virtual bool AllowSaveLocalState(content::ResourceContext* context) = 0; + virtual bool AllowSaveLocalState(ResourceContext* context) = 0; // Allow the embedder to control if access to web database by a shared worker // is allowed. |render_views| is a vector of pairs of @@ -225,7 +226,7 @@ class ContentBrowserClient { const string16& name, const string16& display_name, unsigned long estimated_size, - content::ResourceContext* context, + ResourceContext* context, const std::vector<std::pair<int, int> >& render_views) = 0; // Allow the embedder to control if access to file system by a shared worker @@ -233,7 +234,7 @@ class ContentBrowserClient { // This is called on the IO thread. virtual bool AllowWorkerFileSystem( const GURL& url, - content::ResourceContext* context, + ResourceContext* context, const std::vector<std::pair<int, int> >& render_views) = 0; // Allow the embedder to control if access to IndexedDB by a shared worker @@ -242,7 +243,7 @@ class ContentBrowserClient { virtual bool AllowWorkerIndexedDB( const GURL& url, const string16& name, - content::ResourceContext* context, + ResourceContext* context, const std::vector<std::pair<int, int> >& render_views) = 0; // Allows the embedder to override the request context based on the URL for @@ -250,7 +251,7 @@ class ContentBrowserClient { // regular request context should be used. // This is called on the IO thread. virtual net::URLRequestContext* OverrideRequestContextForURL( - const GURL& url, content::ResourceContext* context) = 0; + const GURL& url, ResourceContext* context) = 0; // Create and return a new quota permission context. virtual QuotaPermissionContext* CreateQuotaPermissionContext() = 0; @@ -306,7 +307,7 @@ class ContentBrowserClient { // of devices. |request| has the details of the request (e.g. which of audio // and/or video devices are requested, and lists of available devices). virtual void RequestMediaAccessPermission( - const content::MediaStreamRequest* request, + const MediaStreamRequest* request, const MediaResponseCallback& callback) = 0; // Asks permission to show desktop notifications. @@ -321,13 +322,13 @@ class ContentBrowserClient { virtual WebKit::WebNotificationPresenter::Permission CheckDesktopNotificationPermission( const GURL& source_url, - content::ResourceContext* context, + ResourceContext* context, int render_process_id) = 0; // Show a desktop notification. If |worker| is true, the request came from an // HTML5 web worker, otherwise, it came from a renderer. virtual void ShowDesktopNotification( - const content::ShowDesktopNotificationHostMsgParams& params, + const ShowDesktopNotificationHostMsgParams& params, int render_process_id, int render_view_id, bool worker) = 0; @@ -346,15 +347,15 @@ class ContentBrowserClient { const GURL& opener_url, const GURL& source_origin, WindowContainerType container_type, - content::ResourceContext* context, + ResourceContext* context, int render_process_id, bool* no_javascript_access) = 0; // Returns a title string to use in the task manager for a process host with // the given URL, or the empty string to fall back to the default logic. // This is called on the IO thread. - virtual std::string GetWorkerProcessTitle( - const GURL& url, content::ResourceContext* context) = 0; + virtual std::string GetWorkerProcessTitle(const GURL& url, + ResourceContext* context) = 0; // Notifies the embedder that the ResourceDispatcherHost has been created. // This is when it can optionally add a delegate or ResourceQueueDelegates. @@ -378,27 +379,27 @@ class ContentBrowserClient { // Called by WebContents to override the WebKit preferences that are used by // the renderer. The content layer will add its own settings, and then it's up // to the embedder to update it if it wants. - virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host, + virtual void OverrideWebkitPrefs(RenderViewHost* render_view_host, const GURL& url, webkit_glue::WebPreferences* prefs) = 0; // Inspector setting was changed and should be persisted. - virtual void UpdateInspectorSetting(content::RenderViewHost* rvh, + virtual void UpdateInspectorSetting(RenderViewHost* rvh, const std::string& key, const std::string& value) = 0; // Clear the Inspector settings. - virtual void ClearInspectorSettings(content::RenderViewHost* rvh) = 0; + virtual void ClearInspectorSettings(RenderViewHost* rvh) = 0; // Notifies that BrowserURLHandler has been created, so that the embedder can // optionally add their own handlers. virtual void BrowserURLHandlerCreated(BrowserURLHandler* handler) = 0; // Clears browser cache. - virtual void ClearCache(content::RenderViewHost* rvh) = 0; + virtual void ClearCache(RenderViewHost* rvh) = 0; // Clears browser cookies. - virtual void ClearCookies(content::RenderViewHost* rvh) = 0; + virtual void ClearCookies(RenderViewHost* rvh) = 0; // Returns the default download directory. // This can be called on any thread. diff --git a/content/public/browser/resource_dispatcher_host.h b/content/public/browser/resource_dispatcher_host.h index 030dd75..d6f813b 100644 --- a/content/public/browser/resource_dispatcher_host.h +++ b/content/public/browser/resource_dispatcher_host.h @@ -53,10 +53,6 @@ class CONTENT_EXPORT ResourceDispatcherHost { // Clears the ResourceDispatcherHostLoginDelegate associated with the request. virtual void ClearLoginDelegateForRequest(net::URLRequest* request) = 0; - // Marks the request as "parked". This happens if a request is - // redirected cross-site and needs to be resumed by a new render view. - virtual void MarkAsTransferredNavigation(net::URLRequest* request) = 0; - protected: virtual ~ResourceDispatcherHost() {} }; diff --git a/content/public/browser/resource_dispatcher_host_delegate.h b/content/public/browser/resource_dispatcher_host_delegate.h index 19cd6cf..d23c0da 100644 --- a/content/public/browser/resource_dispatcher_host_delegate.h +++ b/content/public/browser/resource_dispatcher_host_delegate.h @@ -47,10 +47,8 @@ class CONTENT_EXPORT ResourceDispatcherHostDelegate { ResourceContext* resource_context, const Referrer& referrer); - // Called after ShouldBeginRequest when all the resource handlers from the - // content layer have been added. To add new handlers to the front, return - // a new handler that is chained to the given one, otherwise just reutrn the - // given handler. + // Called after ShouldBeginRequest to allow the embedder to add resource + // throttles. virtual void RequestBeginning( net::URLRequest* request, ResourceContext* resource_context, diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc index 4cda0df..93e66e1 100644 --- a/content/shell/shell_content_browser_client.cc +++ b/content/shell/shell_content_browser_client.cc @@ -93,6 +93,12 @@ bool ShellContentBrowserClient::ShouldSwapProcessesForNavigation( return false; } +bool ShellContentBrowserClient::ShouldSwapProcessesForRedirect( + ResourceContext* resource_context, const GURL& current_url, + const GURL& new_url) { + return false; +} + std::string ShellContentBrowserClient::GetCanonicalEncodingNameByAliasName( const std::string& alias_name) { return std::string(); diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h index ba6f99a..ecd62ba 100644 --- a/content/shell/shell_content_browser_client.h +++ b/content/shell/shell_content_browser_client.h @@ -48,7 +48,10 @@ class ShellContentBrowserClient : public ContentBrowserClient { virtual void SiteInstanceDeleting(SiteInstance* site_instance) OVERRIDE; virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url, const GURL& new_url) OVERRIDE; - + virtual bool ShouldSwapProcessesForRedirect( + ResourceContext* resource_context, + const GURL& current_url, + const GURL& new_url) OVERRIDE; virtual std::string GetCanonicalEncodingNameByAliasName( const std::string& alias_name) OVERRIDE; virtual void AppendExtraCommandLineSwitches(CommandLine* command_line, |