Chromium Code Reviews| Index: extensions/shell/browser/shell_browser_context.cc |
| diff --git a/extensions/shell/browser/shell_browser_context.cc b/extensions/shell/browser/shell_browser_context.cc |
| index 33a08e3c99815994cc038c1c08ffe963f625cd6e..7b3283c7f9c997f20d6404437636fe540f990bc2 100644 |
| --- a/extensions/shell/browser/shell_browser_context.cc |
| +++ b/extensions/shell/browser/shell_browser_context.cc |
| @@ -4,16 +4,29 @@ |
| #include "extensions/shell/browser/shell_browser_context.h" |
| +#include "base/command_line.h" |
| +#include "content/public/browser/browser_thread.h" |
| +#include "content/public/common/content_switches.h" |
| +#include "extensions/browser/extension_network_delegate.h" |
| +#include "extensions/browser/extension_url_request_context_getter.h" |
| #include "extensions/browser/guest_view/guest_view_manager.h" |
| +#include "extensions/common/switches.h" |
| #include "extensions/shell/browser/shell_special_storage_policy.h" |
| namespace extensions { |
| // Create a normal recording browser context. If we used an incognito context |
| // then app_shell would also have to create a normal context and manage both. |
| -ShellBrowserContext::ShellBrowserContext() |
| +ShellBrowserContext::ShellBrowserContext(net::NetLog* net_log) |
| : content::ShellBrowserContext(false, NULL), |
| + net_log_(net_log), |
| + ignore_certificate_errors_(false), |
| storage_policy_(new ShellSpecialStoragePolicy) { |
| + base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| + if (cmd_line->HasSwitch(::switches::kIgnoreCertificateErrors) || |
| + cmd_line->HasSwitch(switches::kDumpRenderTree)) { |
| + ignore_certificate_errors_ = true; |
| + } |
| } |
| ShellBrowserContext::~ShellBrowserContext() { |
| @@ -27,6 +40,44 @@ storage::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
| return storage_policy_.get(); |
| } |
| +net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( |
| + content::ProtocolHandlerMap* protocol_handlers, |
| + content::URLRequestInterceptorScopedVector request_interceptors, |
| + InfoMap* extension_info_map) { |
| + DCHECK(!url_request_context_getter_.get()); |
| + url_request_context_getter_ = |
| + new extensions::ExtensionURLRequestContextGetter( |
| + this, |
| + ignore_certificate_errors_, |
| + GetPath(), |
| + content::BrowserThread::UnsafeGetMessageLoopForThread( |
| + content::BrowserThread::IO), |
| + content::BrowserThread::UnsafeGetMessageLoopForThread( |
| + content::BrowserThread::FILE), |
| + protocol_handlers, |
| + request_interceptors.Pass(), |
| + net_log_, |
| + extension_info_map); |
| + Init(); |
| + //set_url_request_context_getter(url_request_context_getter_.get()); |
|
Ken Rockot(use gerrit already)
2014/10/02 22:38:38
Remove this?
|
| + return url_request_context_getter_.get(); |
| +} |
| + |
| +void ShellBrowserContext::Init(){ |
| + content:: BrowserThread:: PostTask( |
| + content::BrowserThread::IO, |
| + FROM_HERE, |
| + base::Bind( |
| + &ShellBrowserContext::InitializationOnIOThread, |
| + base::Unretained(this))); |
| +} |
| + |
| +void ShellBrowserContext::InitializationOnIOThread() { |
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| + |
| + url_request_context_getter_->GetURLRequestContext(); |
| +} |
| + |
| void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() { |
| NOTREACHED(); |
| } |