Chromium Code Reviews| Index: content/shell/shell_browser_context.cc |
| diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc |
| index 86ae1a444b455cc1ccf871265b54b705b658e2b1..500e3f31df81255974892a53cb0be9694f73d97c 100644 |
| --- a/content/shell/shell_browser_context.cc |
| +++ b/content/shell/shell_browser_context.cc |
| @@ -12,11 +12,12 @@ |
| #include "base/path_service.h" |
| #include "base/threading/thread.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/browser/storage_partition.h" |
| +#include "content/public/common/content_switches.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" |
| #if defined(OS_WIN) |
| #include "base/base_paths_win.h" |
| @@ -100,14 +101,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_; |
| + content::StoragePartition* storage_partition = |
|
mmenke
2013/01/25 18:38:58
nit: content not needed.
|
| + BrowserContext::GetStoragePartition(this, NULL); |
| + return storage_partition->GetURLRequestContext(); |
| +} |
| + |
| +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_); |
| + 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()); |
| + return url_request_getter_.get(); |
| } |
| net::URLRequestContextGetter* |
| @@ -135,16 +150,24 @@ 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()))); |
| + if (!resource_context_) { |
| + ShellURLRequestContextGetter* getter = |
| + static_cast<ShellURLRequestContextGetter*>(GetRequestContext()); |
| + if (!resource_context_) |
| + resource_context_.reset(new ShellResourceContext(getter)); |
| } |
| return resource_context_.get(); |
| } |