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

Side by Side Diff: chromecast/browser/url_request_context_factory.cc

Issue 2647323010: [Chromecast] Add proxy server support to chromecast (Closed)
Patch Set: Fixing test break. Created 3 years, 10 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
« no previous file with comments | « chromecast/browser/url_request_context_factory.h ('k') | chromecast/net/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/threading/worker_pool.h" 13 #include "base/threading/worker_pool.h"
14 #include "chromecast/base/chromecast_switches.h" 14 #include "chromecast/base/chromecast_switches.h"
15 #include "chromecast/browser/cast_browser_process.h"
15 #include "chromecast/browser/cast_http_user_agent_settings.h" 16 #include "chromecast/browser/cast_http_user_agent_settings.h"
16 #include "chromecast/browser/cast_network_delegate.h" 17 #include "chromecast/browser/cast_network_delegate.h"
18 #include "components/proxy_config/pref_proxy_config_tracker_impl.h"
17 #include "content/public/browser/browser_context.h" 19 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/cookie_store_factory.h" 21 #include "content/public/browser/cookie_store_factory.h"
20 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
21 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
22 #include "net/cert/cert_verifier.h" 24 #include "net/cert/cert_verifier.h"
23 #include "net/cert/ct_policy_enforcer.h" 25 #include "net/cert/ct_policy_enforcer.h"
24 #include "net/cert/ct_policy_status.h" 26 #include "net/cert/ct_policy_status.h"
25 #include "net/cert/do_nothing_ct_verifier.h" 27 #include "net/cert/do_nothing_ct_verifier.h"
26 #include "net/cert_net/nss_ocsp.h" 28 #include "net/cert_net/nss_ocsp.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 164
163 URLRequestContextFactory::URLRequestContextFactory() 165 URLRequestContextFactory::URLRequestContextFactory()
164 : app_network_delegate_(CastNetworkDelegate::Create()), 166 : app_network_delegate_(CastNetworkDelegate::Create()),
165 system_network_delegate_(CastNetworkDelegate::Create()), 167 system_network_delegate_(CastNetworkDelegate::Create()),
166 system_dependencies_initialized_(false), 168 system_dependencies_initialized_(false),
167 main_dependencies_initialized_(false), 169 main_dependencies_initialized_(false),
168 media_dependencies_initialized_(false), 170 media_dependencies_initialized_(false),
169 enable_quic_(true) {} 171 enable_quic_(true) {}
170 172
171 URLRequestContextFactory::~URLRequestContextFactory() { 173 URLRequestContextFactory::~URLRequestContextFactory() {
174 pref_proxy_config_tracker_impl_->DetachFromPrefService();
172 } 175 }
173 176
174 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { 177 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) {
175 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 178 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
176 // Cast http user agent settings must be initialized in UI thread 179 // Cast http user agent settings must be initialized in UI thread
177 // because it registers itself to pref notification observer which is not 180 // because it registers itself to pref notification observer which is not
178 // thread safe. 181 // thread safe.
179 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); 182 http_user_agent_settings_.reset(new CastHttpUserAgentSettings());
180 183
181 // Proxy config service should be initialized in UI thread, since 184 // Proxy config service should be initialized in UI thread, since
182 // ProxyConfigServiceDelegate on Android expects UI thread. 185 // ProxyConfigServiceDelegate on Android expects UI thread.
183 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( 186 pref_proxy_config_tracker_impl_ =
184 content::BrowserThread::GetTaskRunnerForThread( 187 base::WrapUnique<PrefProxyConfigTrackerImpl>(
185 content::BrowserThread::IO), 188 new PrefProxyConfigTrackerImpl(
186 content::BrowserThread::GetTaskRunnerForThread( 189 CastBrowserProcess::GetInstance()->pref_service(),
187 content::BrowserThread::FILE)); 190 content::BrowserThread::GetTaskRunnerForThread(
191 content::BrowserThread::IO)));
188 192
193 proxy_config_service_ =
194 pref_proxy_config_tracker_impl_->CreateTrackingProxyConfigService(
195 nullptr);
196 DCHECK(proxy_config_service_.get());
189 net_log_ = net_log; 197 net_log_ = net_log;
190 } 198 }
191 199
192 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( 200 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter(
193 content::BrowserContext* browser_context, 201 content::BrowserContext* browser_context,
194 content::ProtocolHandlerMap* protocol_handlers, 202 content::ProtocolHandlerMap* protocol_handlers,
195 content::URLRequestInterceptorScopedVector request_interceptors) { 203 content::URLRequestInterceptorScopedVector request_interceptors) {
196 DCHECK(!main_getter_.get()) 204 DCHECK(!main_getter_.get())
197 << "Main URLRequestContextGetter already initialized"; 205 << "Main URLRequestContextGetter already initialized";
198 main_getter_ = 206 main_getter_ =
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 if (media_getter_) { 472 if (media_getter_) {
465 media_getter_->GetURLRequestContext() 473 media_getter_->GetURLRequestContext()
466 ->http_transaction_factory() 474 ->http_transaction_factory()
467 ->GetSession() 475 ->GetSession()
468 ->DisableQuic(); 476 ->DisableQuic();
469 } 477 }
470 } 478 }
471 479
472 } // namespace shell 480 } // namespace shell
473 } // namespace chromecast 481 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/url_request_context_factory.h ('k') | chromecast/net/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698