OLD | NEW |
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 return url_request_context_getter_.get(); |
| 63 } |
| 64 |
| 65 void ShellBrowserContext::Init(){ |
| 66 content:: BrowserThread:: PostTask( |
| 67 content::BrowserThread::IO, |
| 68 FROM_HERE, |
| 69 base::Bind( |
| 70 &ShellBrowserContext::InitializationOnIOThread, |
| 71 base::Unretained(this))); |
| 72 } |
| 73 |
| 74 void ShellBrowserContext::InitializationOnIOThread() { |
| 75 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 76 |
| 77 url_request_context_getter_->GetURLRequestContext(); |
| 78 } |
| 79 |
30 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() { | 80 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() { |
31 NOTREACHED(); | 81 NOTREACHED(); |
32 } | 82 } |
33 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext2() { | 83 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext2() { |
34 NOTREACHED(); | 84 NOTREACHED(); |
35 } | 85 } |
36 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext3() { | 86 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext3() { |
37 NOTREACHED(); | 87 NOTREACHED(); |
38 } | 88 } |
39 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext4() { | 89 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext4() { |
(...skipping 27 matching lines...) Expand all Loading... |
67 NOTREACHED(); | 117 NOTREACHED(); |
68 } | 118 } |
69 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext14() { | 119 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext14() { |
70 NOTREACHED(); | 120 NOTREACHED(); |
71 } | 121 } |
72 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext15() { | 122 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext15() { |
73 NOTREACHED(); | 123 NOTREACHED(); |
74 } | 124 } |
75 | 125 |
76 } // namespace extensions | 126 } // namespace extensions |
OLD | NEW |