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

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

Issue 598303002: Chromecast: adds CastNetworkDelegate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removes gyp dep 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
« no previous file with comments | « chromecast/shell/browser/url_request_context_factory.h ('k') | no next file » | 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/shell/browser/url_request_context_factory.h" 5 #include "chromecast/shell/browser/url_request_context_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/threading/worker_pool.h" 11 #include "base/threading/worker_pool.h"
12 #include "chromecast/shell/browser/cast_http_user_agent_settings.h" 12 #include "chromecast/shell/browser/cast_http_user_agent_settings.h"
13 #include "chromecast/shell/browser/cast_network_delegate.h"
13 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/cookie_store_factory.h" 16 #include "content/public/browser/cookie_store_factory.h"
16 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
17 #include "content/public/common/url_constants.h" 18 #include "content/public/common/url_constants.h"
18 #include "net/cert/cert_verifier.h" 19 #include "net/cert/cert_verifier.h"
19 #include "net/cookies/cookie_store.h" 20 #include "net/cookies/cookie_store.h"
20 #include "net/dns/host_resolver.h" 21 #include "net/dns/host_resolver.h"
21 #include "net/http/http_auth_handler_factory.h" 22 #include "net/http/http_auth_handler_factory.h"
22 #include "net/http/http_cache.h" 23 #include "net/http/http_cache.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 content::BrowserContext* const browser_context_; 127 content::BrowserContext* const browser_context_;
127 URLRequestContextFactory* const factory_; 128 URLRequestContextFactory* const factory_;
128 content::ProtocolHandlerMap protocol_handlers_; 129 content::ProtocolHandlerMap protocol_handlers_;
129 content::URLRequestInterceptorScopedVector request_interceptors_; 130 content::URLRequestInterceptorScopedVector request_interceptors_;
130 scoped_ptr<net::URLRequestContext> request_context_; 131 scoped_ptr<net::URLRequestContext> request_context_;
131 132
132 DISALLOW_COPY_AND_ASSIGN(MainURLRequestContextGetter); 133 DISALLOW_COPY_AND_ASSIGN(MainURLRequestContextGetter);
133 }; 134 };
134 135
135 URLRequestContextFactory::URLRequestContextFactory() 136 URLRequestContextFactory::URLRequestContextFactory()
136 : system_dependencies_initialized_(false), 137 : app_network_delegate_(CastNetworkDelegate::Create()),
138 system_network_delegate_(CastNetworkDelegate::Create()),
139 system_dependencies_initialized_(false),
137 main_dependencies_initialized_(false), 140 main_dependencies_initialized_(false),
138 media_dependencies_initialized_(false) { 141 media_dependencies_initialized_(false) {
139 } 142 }
140 143
141 URLRequestContextFactory::~URLRequestContextFactory() { 144 URLRequestContextFactory::~URLRequestContextFactory() {
142 } 145 }
143 146
144 void URLRequestContextFactory::InitializeOnUIThread() { 147 void URLRequestContextFactory::InitializeOnUIThread() {
145 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 148 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
146 // Cast http user agent settings must be initialized in UI thread 149 // Cast http user agent settings must be initialized in UI thread
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 http_auth_handler_factory_.get()); 320 http_auth_handler_factory_.get());
318 system_context->set_http_server_properties( 321 system_context->set_http_server_properties(
319 http_server_properties_->GetWeakPtr()); 322 http_server_properties_->GetWeakPtr());
320 system_context->set_http_transaction_factory( 323 system_context->set_http_transaction_factory(
321 system_transaction_factory_.get()); 324 system_transaction_factory_.get());
322 system_context->set_http_user_agent_settings( 325 system_context->set_http_user_agent_settings(
323 http_user_agent_settings_.get()); 326 http_user_agent_settings_.get());
324 system_context->set_job_factory(system_job_factory_.get()); 327 system_context->set_job_factory(system_job_factory_.get());
325 system_context->set_cookie_store( 328 system_context->set_cookie_store(
326 content::CreateCookieStore(content::CookieStoreConfig())); 329 content::CreateCookieStore(content::CookieStoreConfig()));
330 system_context->set_network_delegate(system_network_delegate_.get());
327 return system_context; 331 return system_context;
328 } 332 }
329 333
330 net::URLRequestContext* URLRequestContextFactory::CreateMediaRequestContext() { 334 net::URLRequestContext* URLRequestContextFactory::CreateMediaRequestContext() {
331 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); 335 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
332 DCHECK(main_getter_.get()) 336 DCHECK(main_getter_.get())
333 << "Getting MediaRequestContext before MainRequestContext"; 337 << "Getting MediaRequestContext before MainRequestContext";
334 net::URLRequestContext* main_context = main_getter_->GetURLRequestContext(); 338 net::URLRequestContext* main_context = main_getter_->GetURLRequestContext();
335 339
336 // Set non caching backend. 340 // Set non caching backend.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 http_auth_handler_factory_.get()); 393 http_auth_handler_factory_.get());
390 main_context->set_http_server_properties( 394 main_context->set_http_server_properties(
391 http_server_properties_->GetWeakPtr()); 395 http_server_properties_->GetWeakPtr());
392 main_context->set_cookie_store(cookie_store.get()); 396 main_context->set_cookie_store(cookie_store.get());
393 main_context->set_http_user_agent_settings( 397 main_context->set_http_user_agent_settings(
394 http_user_agent_settings_.get()); 398 http_user_agent_settings_.get());
395 399
396 main_context->set_http_transaction_factory( 400 main_context->set_http_transaction_factory(
397 main_transaction_factory_.get()); 401 main_transaction_factory_.get());
398 main_context->set_job_factory(main_job_factory_.get()); 402 main_context->set_job_factory(main_job_factory_.get());
403 main_context->set_network_delegate(app_network_delegate_.get());
399 return main_context; 404 return main_context;
400 } 405 }
401 406
407 void URLRequestContextFactory::InitializeNetworkDelegates() {
408 app_network_delegate_->Initialize(false);
409 LOG(INFO) << "Initialized app network delegate.";
410 system_network_delegate_->Initialize(false);
411 LOG(INFO) << "Initialized system network delegate.";
412 }
413
402 } // namespace shell 414 } // namespace shell
403 } // namespace chromecast 415 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/shell/browser/url_request_context_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698