diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-08 20:37:19 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-08 20:37:19 +0000 |
commit | 9f3fba5755542d0f9ac5f39540e771713dd666bb (patch) | |
tree | fc5fd4b8c4f9399213f038394267ca969ab9761c /content/browser/renderer_host | |
parent | b42a9f62685ff25438ec0fd689e4b8952b70dd70 (diff) | |
download | chromium_src-9f3fba5755542d0f9ac5f39540e771713dd666bb.zip chromium_src-9f3fba5755542d0f9ac5f39540e771713dd666bb.tar.gz chromium_src-9f3fba5755542d0f9ac5f39540e771713dd666bb.tar.bz2 |
Remove last extension dependencies from content.
- UserScript reference from BufferedResourceHandler.
- ExtensionInfoMap references from RenderMessageFilter and WorkerProcessHost
and ResourceContext.
BUG=76697
Review URL: http://codereview.chromium.org/7135003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88388 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host')
6 files changed, 21 insertions, 16 deletions
diff --git a/content/browser/renderer_host/buffered_resource_handler.cc b/content/browser/renderer_host/buffered_resource_handler.cc index 64c8c6a..3e1b6e9 100644 --- a/content/browser/renderer_host/buffered_resource_handler.cc +++ b/content/browser/renderer_host/buffered_resource_handler.cc @@ -10,9 +10,10 @@ #include "base/metrics/histogram.h" #include "base/string_util.h" #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" -#include "chrome/common/extensions/user_script.h" #include "content/browser/browser_thread.h" +#include "content/browser/content_browser_client.h" #include "content/browser/renderer_host/resource_dispatcher_host.h" +#include "content/browser/renderer_host/resource_dispatcher_host_delegate.h" #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" #include "content/browser/renderer_host/x509_user_cert_resource_handler.h" #include "content/common/resource_response.h" @@ -377,8 +378,8 @@ bool BufferedResourceHandler::ShouldDownload(bool* need_plugin_list) { return true; } - // Special-case user scripts to get downloaded instead of viewed. - if (UserScript::IsURLUserScript(request_->url(), type)) + if (host_->delegate() && + host_->delegate()->ShouldForceDownloadResource(request_->url(), type)) return true; // MIME type checking. diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index a20698a..fa7aa90 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -15,7 +15,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_types.h" #include "chrome/browser/download/download_util.h" -#include "chrome/browser/extensions/extension_info_map.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" @@ -385,16 +384,10 @@ void RenderMessageFilter::OnDestruct() const { void RenderMessageFilter::OnMsgCreateWindow( const ViewHostMsg_CreateWindow_Params& params, int* route_id, int64* cloned_session_storage_namespace_id) { - // If the opener is trying to create a background window but doesn't have - // the appropriate permission, fail the attempt. - if (params.window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { - const Extension* extension = - extension_info_map_->extensions().GetByURL(params.opener_url); - if (!extension || - !extension->HasApiPermission(Extension::kBackgroundPermission)) { - *route_id = MSG_ROUTING_NONE; - return; - } + if (!content::GetContentClient()->browser()->CanCreateWindow( + params.opener_url, params.window_container_type, resource_context_)) { + *route_id = MSG_ROUTING_NONE; + return; } *cloned_session_storage_namespace_id = diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc index e6f4191..6c19527 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.cc +++ b/content/browser/renderer_host/resource_dispatcher_host.cc @@ -2012,5 +2012,3 @@ bool ResourceDispatcherHost::allow_cross_origin_auth_prompt() { void ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(bool value) { allow_cross_origin_auth_prompt_ = value; } - - diff --git a/content/browser/renderer_host/resource_dispatcher_host.h b/content/browser/renderer_host/resource_dispatcher_host.h index 9448684..ee476d0 100644 --- a/content/browser/renderer_host/resource_dispatcher_host.h +++ b/content/browser/renderer_host/resource_dispatcher_host.h @@ -250,6 +250,9 @@ class ResourceDispatcherHost : public net::URLRequest::Delegate { void set_delegate(ResourceDispatcherHostDelegate* delegate) { delegate_ = delegate; } + ResourceDispatcherHostDelegate* delegate() { + return delegate_; + } private: FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, diff --git a/content/browser/renderer_host/resource_dispatcher_host_delegate.cc b/content/browser/renderer_host/resource_dispatcher_host_delegate.cc index 79d08dd..c10f999 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_delegate.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_delegate.cc @@ -61,3 +61,8 @@ void ResourceDispatcherHostDelegate::HandleExternalProtocol(const GURL& url, int child_id, int route_id) { } + +bool ResourceDispatcherHostDelegate::ShouldForceDownloadResource( + const GURL& url, const std::string& mime_type) { + return false; +} diff --git a/content/browser/renderer_host/resource_dispatcher_host_delegate.h b/content/browser/renderer_host/resource_dispatcher_host_delegate.h index 4e1e00c..0aee39a 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_delegate.h +++ b/content/browser/renderer_host/resource_dispatcher_host_delegate.h @@ -83,6 +83,11 @@ class ResourceDispatcherHostDelegate { int child_id, int route_id); + // Returns true if we should force the given resource to be downloaded. + // Otherwise, the content layer decides. + virtual bool ShouldForceDownloadResource( + const GURL& url, const std::string& mime_type); + protected: ResourceDispatcherHostDelegate(); virtual ~ResourceDispatcherHostDelegate(); |