Chromium Code Reviews| 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" | 7 #include "base/command_line.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 10 #include "extensions/browser/extension_network_delegate.h" | 10 #include "content/shell/common/shell_switches.h" |
| 11 #include "extensions/browser/extension_url_request_context_getter.h" | |
| 12 #include "extensions/browser/guest_view/guest_view_manager.h" | 11 #include "extensions/browser/guest_view/guest_view_manager.h" |
| 13 #include "extensions/common/switches.h" | 12 #include "extensions/shell/browser/shell_network_delegate.h" |
| 14 #include "extensions/shell/browser/shell_special_storage_policy.h" | 13 #include "extensions/shell/browser/shell_special_storage_policy.h" |
| 14 #include "extensions/shell/browser/shell_url_request_context_getter.h" | |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 | 17 |
| 18 // 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 |
| 19 // 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. |
| 20 ShellBrowserContext::ShellBrowserContext(net::NetLog* net_log) | 20 ShellBrowserContext::ShellBrowserContext(net::NetLog* net_log) |
| 21 : content::ShellBrowserContext(false, NULL), | 21 : content::ShellBrowserContext(false, NULL), |
| 22 net_log_(net_log), | 22 net_log_(net_log), |
| 23 ignore_certificate_errors_(false), | 23 ignore_certificate_errors_(false), |
| 24 storage_policy_(new ShellSpecialStoragePolicy) { | 24 storage_policy_(new ShellSpecialStoragePolicy) { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 37 } | 37 } |
| 38 | 38 |
| 39 storage::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { | 39 storage::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
| 40 return storage_policy_.get(); | 40 return storage_policy_.get(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( | 43 net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( |
| 44 content::ProtocolHandlerMap* protocol_handlers, | 44 content::ProtocolHandlerMap* protocol_handlers, |
| 45 content::URLRequestInterceptorScopedVector request_interceptors, | 45 content::URLRequestInterceptorScopedVector request_interceptors, |
| 46 InfoMap* extension_info_map) { | 46 InfoMap* extension_info_map) { |
| 47 DCHECK(!url_request_context_getter_.get()); | 47 DCHECK(!get_url_request_context_getter()); |
| 48 url_request_context_getter_ = | 48 extensions::ShellURLRequestContextGetter* url_request_context_getter = |
| 49 new extensions::ExtensionURLRequestContextGetter( | 49 new extensions::ShellURLRequestContextGetter( |
| 50 this, | 50 this, |
| 51 ignore_certificate_errors_, | 51 ignore_certificate_errors_, |
| 52 GetPath(), | 52 GetPath(), |
| 53 content::BrowserThread::UnsafeGetMessageLoopForThread( | 53 content::BrowserThread::UnsafeGetMessageLoopForThread( |
| 54 content::BrowserThread::IO), | 54 content::BrowserThread::IO), |
| 55 content::BrowserThread::UnsafeGetMessageLoopForThread( | 55 content::BrowserThread::UnsafeGetMessageLoopForThread( |
| 56 content::BrowserThread::FILE), | 56 content::BrowserThread::FILE), |
| 57 protocol_handlers, | 57 protocol_handlers, |
| 58 request_interceptors.Pass(), | 58 request_interceptors.Pass(), |
| 59 net_log_, | 59 net_log_, |
| 60 extension_info_map); | 60 extension_info_map); |
| 61 set_url_request_context_getter(url_request_context_getter); | |
| 61 Init(); | 62 Init(); |
| 62 return url_request_context_getter_.get(); | 63 return get_url_request_context_getter(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void ShellBrowserContext::Init(){ | 66 void ShellBrowserContext::Init(){ |
| 66 content:: BrowserThread:: PostTask( | 67 content:: BrowserThread:: PostTask( |
|
James Cook
2014/10/07 16:24:54
formatting
Xi Han
2014/10/07 19:29:53
Done.
| |
| 67 content::BrowserThread::IO, | 68 content::BrowserThread::IO, |
| 68 FROM_HERE, | 69 FROM_HERE, |
| 69 base::Bind( | 70 base::Bind( |
| 70 &ShellBrowserContext::InitializationOnIOThread, | 71 &ShellBrowserContext::InitializationOnIOThread, |
| 71 base::Unretained(this))); | 72 base::Unretained(this))); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void ShellBrowserContext::InitializationOnIOThread() { | 75 void ShellBrowserContext::InitializationOnIOThread() { |
| 75 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 76 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
| 76 | 77 |
| 77 url_request_context_getter_->GetURLRequestContext(); | 78 get_url_request_context_getter()->GetURLRequestContext(); |
|
James Cook
2014/10/07 16:24:54
This needs a comment explaining that GetURLRequest
Xi Han
2014/10/07 19:29:53
Remove Init() and rename.
| |
| 78 } | 79 } |
| 79 | 80 |
| 80 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() { | 81 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext1() { |
| 81 NOTREACHED(); | 82 NOTREACHED(); |
| 82 } | 83 } |
| 83 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext2() { | 84 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext2() { |
| 84 NOTREACHED(); | 85 NOTREACHED(); |
| 85 } | 86 } |
| 86 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext3() { | 87 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext3() { |
| 87 NOTREACHED(); | 88 NOTREACHED(); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 117 NOTREACHED(); | 118 NOTREACHED(); |
| 118 } | 119 } |
| 119 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext14() { | 120 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext14() { |
| 120 NOTREACHED(); | 121 NOTREACHED(); |
| 121 } | 122 } |
| 122 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext15() { | 123 void ShellBrowserContext::ProfileFunctionCallOnNonProfileBrowserContext15() { |
| 123 NOTREACHED(); | 124 NOTREACHED(); |
| 124 } | 125 } |
| 125 | 126 |
| 126 } // namespace extensions | 127 } // namespace extensions |
| OLD | NEW |