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 "chromecast/browser/url_request_context_factory.h" | 5 #include "chromecast/browser/url_request_context_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Set request context used by NSS for Crl requests. | 73 // Set request context used by NSS for Crl requests. |
74 net::SetURLRequestContextForNSSHttpIO(request_context_.get()); | 74 net::SetURLRequestContextForNSSHttpIO(request_context_.get()); |
75 #endif // defined(USE_NSS_CERTS) | 75 #endif // defined(USE_NSS_CERTS) |
76 } | 76 } |
77 } | 77 } |
78 return request_context_.get(); | 78 return request_context_.get(); |
79 } | 79 } |
80 | 80 |
81 scoped_refptr<base::SingleThreadTaskRunner> | 81 scoped_refptr<base::SingleThreadTaskRunner> |
82 GetNetworkTaskRunner() const override { | 82 GetNetworkTaskRunner() const override { |
83 return content::BrowserThread::GetMessageLoopProxyForThread( | 83 return content::BrowserThread::GetTaskRunnerForThread( |
84 content::BrowserThread::IO); | 84 content::BrowserThread::IO); |
85 } | 85 } |
86 | 86 |
87 private: | 87 private: |
88 ~URLRequestContextGetter() override {} | 88 ~URLRequestContextGetter() override {} |
89 | 89 |
90 const bool is_media_; | 90 const bool is_media_; |
91 URLRequestContextFactory* const factory_; | 91 URLRequestContextFactory* const factory_; |
92 std::unique_ptr<net::URLRequestContext> request_context_; | 92 std::unique_ptr<net::URLRequestContext> request_context_; |
93 | 93 |
(...skipping 21 matching lines...) Expand all Loading... |
115 request_context_.reset(factory_->CreateMainRequestContext( | 115 request_context_.reset(factory_->CreateMainRequestContext( |
116 browser_context_, &protocol_handlers_, | 116 browser_context_, &protocol_handlers_, |
117 std::move(request_interceptors_))); | 117 std::move(request_interceptors_))); |
118 protocol_handlers_.clear(); | 118 protocol_handlers_.clear(); |
119 } | 119 } |
120 return request_context_.get(); | 120 return request_context_.get(); |
121 } | 121 } |
122 | 122 |
123 scoped_refptr<base::SingleThreadTaskRunner> | 123 scoped_refptr<base::SingleThreadTaskRunner> |
124 GetNetworkTaskRunner() const override { | 124 GetNetworkTaskRunner() const override { |
125 return content::BrowserThread::GetMessageLoopProxyForThread( | 125 return content::BrowserThread::GetTaskRunnerForThread( |
126 content::BrowserThread::IO); | 126 content::BrowserThread::IO); |
127 } | 127 } |
128 | 128 |
129 private: | 129 private: |
130 ~MainURLRequestContextGetter() override {} | 130 ~MainURLRequestContextGetter() override {} |
131 | 131 |
132 content::BrowserContext* const browser_context_; | 132 content::BrowserContext* const browser_context_; |
133 URLRequestContextFactory* const factory_; | 133 URLRequestContextFactory* const factory_; |
134 content::ProtocolHandlerMap protocol_handlers_; | 134 content::ProtocolHandlerMap protocol_handlers_; |
135 content::URLRequestInterceptorScopedVector request_interceptors_; | 135 content::URLRequestInterceptorScopedVector request_interceptors_; |
(...skipping 16 matching lines...) Expand all Loading... |
152 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { | 152 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { |
153 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 153 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
154 // Cast http user agent settings must be initialized in UI thread | 154 // Cast http user agent settings must be initialized in UI thread |
155 // because it registers itself to pref notification observer which is not | 155 // because it registers itself to pref notification observer which is not |
156 // thread safe. | 156 // thread safe. |
157 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); | 157 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); |
158 | 158 |
159 // Proxy config service should be initialized in UI thread, since | 159 // Proxy config service should be initialized in UI thread, since |
160 // ProxyConfigServiceDelegate on Android expects UI thread. | 160 // ProxyConfigServiceDelegate on Android expects UI thread. |
161 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( | 161 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( |
162 content::BrowserThread::GetMessageLoopProxyForThread( | 162 content::BrowserThread::GetTaskRunnerForThread( |
163 content::BrowserThread::IO), | 163 content::BrowserThread::IO), |
164 content::BrowserThread::GetMessageLoopProxyForThread( | 164 content::BrowserThread::GetTaskRunnerForThread( |
165 content::BrowserThread::FILE)); | 165 content::BrowserThread::FILE)); |
166 | 166 |
167 net_log_ = net_log; | 167 net_log_ = net_log; |
168 } | 168 } |
169 | 169 |
170 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( | 170 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( |
171 content::BrowserContext* browser_context, | 171 content::BrowserContext* browser_context, |
172 content::ProtocolHandlerMap* protocol_handlers, | 172 content::ProtocolHandlerMap* protocol_handlers, |
173 content::URLRequestInterceptorScopedVector request_interceptors) { | 173 content::URLRequestInterceptorScopedVector request_interceptors) { |
174 DCHECK(!main_getter_.get()) | 174 DCHECK(!main_getter_.get()) |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 | 401 |
402 void URLRequestContextFactory::InitializeNetworkDelegates() { | 402 void URLRequestContextFactory::InitializeNetworkDelegates() { |
403 app_network_delegate_->Initialize(false); | 403 app_network_delegate_->Initialize(false); |
404 LOG(INFO) << "Initialized app network delegate."; | 404 LOG(INFO) << "Initialized app network delegate."; |
405 system_network_delegate_->Initialize(false); | 405 system_network_delegate_->Initialize(false); |
406 LOG(INFO) << "Initialized system network delegate."; | 406 LOG(INFO) << "Initialized system network delegate."; |
407 } | 407 } |
408 | 408 |
409 } // namespace shell | 409 } // namespace shell |
410 } // namespace chromecast | 410 } // namespace chromecast |
OLD | NEW |