From 1ded764281537e5c5539b69a62d347f41900067f Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Wed, 20 Apr 2011 02:21:21 +0000 Subject: Replace more uses of ChromeURLRequestContext/URLRequestContextGetter in content with ResourceContext BUG=78596 TEST=none Review URL: http://codereview.chromium.org/6882016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82219 0039d316-1c4b-4281-b951-d872f2087c98 --- .../file_system/file_system_dispatcher_host.cc | 30 ++++++++++++++------ .../file_system/file_system_dispatcher_host.h | 32 +++++++++++++--------- 2 files changed, 41 insertions(+), 21 deletions(-) (limited to 'content/browser/file_system') diff --git a/content/browser/file_system/file_system_dispatcher_host.cc b/content/browser/file_system/file_system_dispatcher_host.cc index 2bc89a8..a3ec0b7 100644 --- a/content/browser/file_system/file_system_dispatcher_host.cc +++ b/content/browser/file_system/file_system_dispatcher_host.cc @@ -14,6 +14,7 @@ #include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/net/chrome_url_request_context.h" #include "chrome/browser/profiles/profile.h" +#include "content/browser/resource_context.h" #include "content/common/file_system_messages.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_platform_file.h" @@ -100,10 +101,15 @@ class BrowserFileSystemCallbackDispatcher int request_id_; }; -FileSystemDispatcherHost::FileSystemDispatcherHost(Profile* profile) - : context_(profile->GetFileSystemContext()), - host_content_settings_map_(profile->GetHostContentSettingsMap()), - request_context_getter_(profile->GetRequestContext()) { +FileSystemDispatcherHost::FileSystemDispatcherHost( + const content::ResourceContext* resource_context, + HostContentSettingsMap* host_content_settings_map) + : context_(NULL), + host_content_settings_map_(host_content_settings_map), + resource_context_(resource_context), + request_context_(NULL) { + DCHECK(resource_context_); + DCHECK(host_content_settings_map_); } FileSystemDispatcherHost::FileSystemDispatcherHost( @@ -111,7 +117,11 @@ FileSystemDispatcherHost::FileSystemDispatcherHost( fileapi::FileSystemContext* file_system_context) : context_(file_system_context), host_content_settings_map_(request_context->host_content_settings_map()), + resource_context_(NULL), request_context_(request_context) { + DCHECK(request_context_); + DCHECK(host_content_settings_map_); + DCHECK(context_); } FileSystemDispatcherHost::~FileSystemDispatcherHost() { @@ -120,11 +130,15 @@ FileSystemDispatcherHost::~FileSystemDispatcherHost() { void FileSystemDispatcherHost::OnChannelConnected(int32 peer_pid) { BrowserMessageFilter::OnChannelConnected(peer_pid); - if (request_context_getter_.get()) { - DCHECK(!request_context_.get()); - request_context_ = request_context_getter_->GetURLRequestContext(); + if (resource_context_) { + DCHECK(!request_context_); + request_context_ = resource_context_->request_context(); + DCHECK(!context_); + context_ = resource_context_->file_system_context(); + resource_context_ = NULL; } - DCHECK(request_context_.get()); + DCHECK(request_context_); + DCHECK(context_); } bool FileSystemDispatcherHost::OnMessageReceived( diff --git a/content/browser/file_system/file_system_dispatcher_host.h b/content/browser/file_system/file_system_dispatcher_host.h index 76767fe..440f20b 100644 --- a/content/browser/file_system/file_system_dispatcher_host.h +++ b/content/browser/file_system/file_system_dispatcher_host.h @@ -12,10 +12,6 @@ #include "content/browser/browser_message_filter.h" #include "webkit/fileapi/file_system_types.h" -namespace base { -class Time; -} - class ChromeURLRequestContext; class GURL; class HostContentSettingsMap; @@ -23,20 +19,30 @@ class Profile; class Receiver; class RenderMessageFilter; -namespace net { -class URLRequestContext; -class URLRequestContextGetter; -} // namespace net +namespace base { +class Time; +} + +namespace content { +class ResourceContext; +} namespace fileapi { class FileSystemContext; class FileSystemOperation; } +namespace net { +class URLRequestContext; +class URLRequestContextGetter; +} // namespace net + class FileSystemDispatcherHost : public BrowserMessageFilter { public: // Used by the renderer. - explicit FileSystemDispatcherHost(Profile* profile); + FileSystemDispatcherHost( + const content::ResourceContext* resource_context, + HostContentSettingsMap* host_content_settings_map); // Used by the worker, since it has the context handy already. FileSystemDispatcherHost(ChromeURLRequestContext* request_context, fileapi::FileSystemContext* file_system_context); @@ -85,7 +91,7 @@ class FileSystemDispatcherHost : public BrowserMessageFilter { // Creates a new FileSystemOperation. fileapi::FileSystemOperation* GetNewOperation(int request_id); - scoped_refptr context_; + fileapi::FileSystemContext* context_; // Used to look up permissions. scoped_refptr host_content_settings_map_; @@ -94,10 +100,10 @@ class FileSystemDispatcherHost : public BrowserMessageFilter { typedef IDMap OperationsMap; OperationsMap operations_; - // This holds the URLRequestContextGetter until Init() can be called from the + // This holds the ResourceContext until Init() can be called from the // IO thread, which will extract the net::URLRequestContext from it. - scoped_refptr request_context_getter_; - scoped_refptr request_context_; + const content::ResourceContext* resource_context_; + net::URLRequestContext* request_context_; DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost); }; -- cgit v1.1