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

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

Issue 615583003: Introduce NetworkDelegate's implementation in extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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..8659de1ec59f8eb88a333e89707a6cc8bf16d2cd 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,43 @@ 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();
+ 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();
}
« no previous file with comments | « extensions/shell/browser/shell_browser_context.h ('k') | extensions/shell/browser/shell_browser_main_parts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698