Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: extensions/shell/browser/shell_browser_context.cc

Issue 631203003: Fix bug: AppShell: CHECK failure in PeerConnection init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/shell/browser/shell_browser_context.h ('k') | extensions/shell/browser/shell_network_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8659de1ec59f8eb88a333e89707a6cc8bf16d2cd..064dbf381daa9749d705adaddacd383c87b939cd 100644
--- a/extensions/shell/browser/shell_browser_context.cc
+++ b/extensions/shell/browser/shell_browser_context.cc
@@ -7,26 +7,28 @@
#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_network_delegate.h"
#include "extensions/shell/browser/shell_special_storage_policy.h"
+#include "extensions/shell/browser/shell_url_request_context_getter.h"
namespace extensions {
+namespace {
+
+bool IgnoreCertificateErrors() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ ::switches::kIgnoreCertificateErrors);
+}
+
+} // namespace
+
// 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(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() {
@@ -44,11 +46,11 @@ 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(
+ DCHECK(!url_request_context_getter());
+ set_url_request_context_getter(
+ new ShellURLRequestContextGetter(
this,
- ignore_certificate_errors_,
+ IgnoreCertificateErrors(),
GetPath(),
content::BrowserThread::UnsafeGetMessageLoopForThread(
content::BrowserThread::IO),
@@ -57,24 +59,24 @@ net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext(
protocol_handlers,
request_interceptors.Pass(),
net_log_,
- extension_info_map);
- Init();
- return url_request_context_getter_.get();
-}
-
-void ShellBrowserContext::Init(){
- content:: BrowserThread:: PostTask(
+ extension_info_map));
+ resource_context_->set_url_request_context_getter(
+ url_request_context_getter());
+ content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,
base::Bind(
- &ShellBrowserContext::InitializationOnIOThread,
+ &ShellBrowserContext::InitURLRequestContextOnIOThread,
base::Unretained(this)));
+ return url_request_context_getter();
}
-void ShellBrowserContext::InitializationOnIOThread() {
+void ShellBrowserContext::InitURLRequestContextOnIOThread() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- url_request_context_getter_->GetURLRequestContext();
+ // GetURLRequestContext() will create a URLRequestContext if it isn't
+ // initialized.
+ url_request_context_getter()->GetURLRequestContext();
}
void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() {
« no previous file with comments | « extensions/shell/browser/shell_browser_context.h ('k') | extensions/shell/browser/shell_network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698