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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/shell/browser/shell_browser_context.h" 5 #include "extensions/shell/browser/shell_browser_context.h"
6 6
7 #include "base/command_line.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/common/content_switches.h"
10 #include "extensions/browser/extension_network_delegate.h"
11 #include "extensions/browser/extension_url_request_context_getter.h"
7 #include "extensions/browser/guest_view/guest_view_manager.h" 12 #include "extensions/browser/guest_view/guest_view_manager.h"
13 #include "extensions/common/switches.h"
8 #include "extensions/shell/browser/shell_special_storage_policy.h" 14 #include "extensions/shell/browser/shell_special_storage_policy.h"
9 15
10 namespace extensions { 16 namespace extensions {
11 17
12 // Create a normal recording browser context. If we used an incognito context 18 // Create a normal recording browser context. If we used an incognito context
13 // then app_shell would also have to create a normal context and manage both. 19 // then app_shell would also have to create a normal context and manage both.
14 ShellBrowserContext::ShellBrowserContext() 20 ShellBrowserContext::ShellBrowserContext(net::NetLog* net_log)
15 : content::ShellBrowserContext(false, NULL), 21 : content::ShellBrowserContext(false, NULL),
22 net_log_(net_log),
23 ignore_certificate_errors_(false),
16 storage_policy_(new ShellSpecialStoragePolicy) { 24 storage_policy_(new ShellSpecialStoragePolicy) {
25 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
26 if (cmd_line->HasSwitch(::switches::kIgnoreCertificateErrors) ||
27 cmd_line->HasSwitch(switches::kDumpRenderTree)) {
28 ignore_certificate_errors_ = true;
29 }
17 } 30 }
18 31
19 ShellBrowserContext::~ShellBrowserContext() { 32 ShellBrowserContext::~ShellBrowserContext() {
20 } 33 }
21 34
22 content::BrowserPluginGuestManager* ShellBrowserContext::GetGuestManager() { 35 content::BrowserPluginGuestManager* ShellBrowserContext::GetGuestManager() {
23 return GuestViewManager::FromBrowserContext(this); 36 return GuestViewManager::FromBrowserContext(this);
24 } 37 }
25 38
26 storage::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { 39 storage::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() {
27 return storage_policy_.get(); 40 return storage_policy_.get();
28 } 41 }
29 42
43 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext(
44 content::ProtocolHandlerMap* protocol_handlers,
45 content::URLRequestInterceptorScopedVector request_interceptors,
46 InfoMap* extension_info_map) {
47 DCHECK(!url_request_context_getter_.get());
48 url_request_context_getter_ =
49 new extensions::ExtensionURLRequestContextGetter(
50 this,
51 ignore_certificate_errors_,
52 GetPath(),
53 content::BrowserThread::UnsafeGetMessageLoopForThread(
54 content::BrowserThread::IO),
55 content::BrowserThread::UnsafeGetMessageLoopForThread(
56 content::BrowserThread::FILE),
57 protocol_handlers,
58 request_interceptors.Pass(),
59 net_log_,
60 extension_info_map);
61 Init();
62 //set_url_request_context_getter(url_request_context_getter_.get());
Ken Rockot(use gerrit already) 2014/10/02 22:38:38 Remove this?
63 return url_request_context_getter_.get();
64 }
65
66 void ShellBrowserContext::Init(){
67 content:: BrowserThread:: PostTask(
68 content::BrowserThread::IO,
69 FROM_HERE,
70 base::Bind(
71 &ShellBrowserContext::InitializationOnIOThread,
72 base::Unretained(this)));
73 }
74
75 void ShellBrowserContext::InitializationOnIOThread() {
76 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
77
78 url_request_context_getter_->GetURLRequestContext();
79 }
80
30 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() { 81 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() {
31 NOTREACHED(); 82 NOTREACHED();
32 } 83 }
33 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext2() { 84 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext2() {
34 NOTREACHED(); 85 NOTREACHED();
35 } 86 }
36 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext3() { 87 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext3() {
37 NOTREACHED(); 88 NOTREACHED();
38 } 89 }
39 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext4() { 90 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext4() {
(...skipping 27 matching lines...) Expand all
67 NOTREACHED(); 118 NOTREACHED();
68 } 119 }
69 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext14() { 120 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext14() {
70 NOTREACHED(); 121 NOTREACHED();
71 } 122 }
72 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext15() { 123 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext15() {
73 NOTREACHED(); 124 NOTREACHED();
74 } 125 }
75 126
76 } // namespace extensions 127 } // namespace extensions
OLDNEW
« 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