Index: content/shell/shell_browser_context.cc |
diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc |
index a36d5e5d8c6d6c348bb6cd51a243eb6df728a7df..fa7d3e957a53cdf960e307f6fdb19a9cb6cb391e 100644 |
--- a/content/shell/shell_browser_context.cc |
+++ b/content/shell/shell_browser_context.cc |
@@ -13,7 +13,6 @@ |
#include "base/threading/thread.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/shell/shell_download_manager_delegate.h" |
-#include "content/shell/shell_resource_context.h" |
#include "content/shell/shell_switches.h" |
#include "content/shell/shell_url_request_context_getter.h" |
#include "content/public/common/content_switches.h" |
@@ -30,7 +29,8 @@ namespace content { |
ShellBrowserContext::ShellBrowserContext(bool off_the_record) |
: off_the_record_(off_the_record), |
- ignore_certificate_errors_(false) { |
+ ignore_certificate_errors_(false), |
+ resource_context_(new ShellResourceContext()) { |
InitWhileIOAllowed(); |
} |
@@ -100,14 +100,28 @@ DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { |
} |
net::URLRequestContextGetter* ShellBrowserContext::GetRequestContext() { |
- if (!url_request_getter_) { |
- url_request_getter_ = new ShellURLRequestContextGetter( |
- ignore_certificate_errors_, |
- GetPath(), |
- BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), |
- BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE)); |
- } |
- return url_request_getter_; |
+ DCHECK(url_request_getter_.get()); |
+ return url_request_getter_.get(); |
+} |
+ |
+net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( |
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
+ blob_protocol_handler, |
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
+ file_system_protocol_handler, |
+ scoped_ptr<net::URLRequestJobFactory::Interceptor> |
+ developer_protocol_handler) { |
+ DCHECK(!url_request_getter_.get()); |
+ url_request_getter_ = new ShellURLRequestContextGetter( |
+ ignore_certificate_errors_, |
+ GetPath(), |
+ BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), |
+ BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE), |
+ blob_protocol_handler.Pass(), |
+ file_system_protocol_handler.Pass(), |
+ developer_protocol_handler.Pass()); |
+ resource_context_->getter_ = url_request_getter_.get(); |
+ return url_request_getter_.get(); |
} |
net::URLRequestContextGetter* |
@@ -135,17 +149,19 @@ net::URLRequestContextGetter* |
} |
net::URLRequestContextGetter* |
- ShellBrowserContext::GetRequestContextForStoragePartition( |
+ ShellBrowserContext::CreateRequestContextForStoragePartition( |
const FilePath& partition_path, |
- bool in_memory) { |
+ bool in_memory, |
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
+ blob_protocol_handler, |
+ scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
+ file_system_protocol_handler, |
+ scoped_ptr<net::URLRequestJobFactory::Interceptor> |
+ developer_protocol_handler) { |
return NULL; |
} |
ResourceContext* ShellBrowserContext::GetResourceContext() { |
- if (!resource_context_.get()) { |
- resource_context_.reset(new ShellResourceContext( |
- static_cast<ShellURLRequestContextGetter*>(GetRequestContext()))); |
- } |
return resource_context_.get(); |
} |
@@ -163,4 +179,22 @@ quota::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
return NULL; |
} |
+ShellBrowserContext::ShellResourceContext::ShellResourceContext() { |
+} |
+ |
+ShellBrowserContext::ShellResourceContext::~ShellResourceContext() { |
+} |
+ |
+net::HostResolver* |
+ShellBrowserContext::ShellResourceContext::GetHostResolver() { |
+ return getter_->host_resolver(); |
+} |
+ |
+net::URLRequestContext* |
+ShellBrowserContext::ShellResourceContext::GetRequestContext() { |
+ return getter_->GetURLRequestContext(); |
+} |
+ |
+ |
+ |
} // namespace content |