Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/profiles/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 media_request_context_->set_http_transaction_factory(media_cache); | 430 media_request_context_->set_http_transaction_factory(media_cache); |
| 431 | 431 |
| 432 ftp_factory_.reset( | 432 ftp_factory_.reset( |
| 433 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); | 433 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); |
| 434 main_context->set_ftp_transaction_factory(ftp_factory_.get()); | 434 main_context->set_ftp_transaction_factory(ftp_factory_.get()); |
| 435 media_request_context_->set_ftp_transaction_factory(ftp_factory_.get()); | 435 media_request_context_->set_ftp_transaction_factory(ftp_factory_.get()); |
| 436 | 436 |
| 437 main_context->set_chrome_url_data_manager_backend( | 437 main_context->set_chrome_url_data_manager_backend( |
| 438 chrome_url_data_manager_backend()); | 438 chrome_url_data_manager_backend()); |
| 439 | 439 |
| 440 main_context->set_job_factory(job_factory()); | 440 main_job_factory_.reset(new net::URLRequestJobFactory); |
| 441 media_request_context_->set_job_factory(job_factory()); | 441 media_request_job_factory_.reset(new net::URLRequestJobFactory); |
| 442 extensions_context->set_job_factory(job_factory()); | 442 extensions_job_factory_.reset(new net::URLRequestJobFactory); |
| 443 | 443 |
| 444 job_factory()->AddInterceptor( | 444 net::URLRequestJobFactory* job_factories[3]; |
| 445 new chrome_browser_net::ConnectInterceptor(predictor_.get())); | 445 job_factories[0] = main_job_factory_.get(); |
| 446 job_factories[1] = media_request_job_factory_.get(); | |
| 447 job_factories[2] = extensions_job_factory_.get(); | |
| 448 | |
| 449 for (int i = 0; i < 3; i++) { | |
| 450 SetUpJobFactoryDefaults(job_factories[i]); | |
| 451 AddConnectInterceptor(job_factories[i]); | |
|
willchan no longer on Chromium
2012/06/29 17:47:23
Do we really need a function for this? It's just a
shalev
2012/07/03 18:28:44
Done.
| |
| 452 } | |
| 453 | |
| 454 main_context->set_job_factory(main_job_factory_.get()); | |
| 455 media_request_context_->set_job_factory(media_request_job_factory_.get()); | |
| 456 extensions_context->set_job_factory(extensions_job_factory_.get()); | |
| 446 | 457 |
| 447 lazy_params_.reset(); | 458 lazy_params_.reset(); |
| 448 } | 459 } |
| 449 | 460 |
| 450 ChromeURLRequestContext* | 461 ChromeURLRequestContext* |
| 451 ProfileImplIOData::InitializeAppRequestContext( | 462 ProfileImplIOData::InitializeAppRequestContext( |
| 452 ChromeURLRequestContext* main_context, | 463 ChromeURLRequestContext* main_context, |
| 453 const std::string& app_id) const { | 464 const std::string& app_id) const { |
| 454 AppRequestContext* context = new AppRequestContext; | 465 AppRequestContext* context = new AppRequestContext; |
| 455 | 466 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 532 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
| 522 ChromeURLRequestContext* main_context, | 533 ChromeURLRequestContext* main_context, |
| 523 const std::string& app_id) const { | 534 const std::string& app_id) const { |
| 524 // We create per-app contexts on demand, unlike the others above. | 535 // We create per-app contexts on demand, unlike the others above. |
| 525 ChromeURLRequestContext* app_request_context = | 536 ChromeURLRequestContext* app_request_context = |
| 526 InitializeAppRequestContext(main_context, app_id); | 537 InitializeAppRequestContext(main_context, app_id); |
| 527 DCHECK(app_request_context); | 538 DCHECK(app_request_context); |
| 528 return app_request_context; | 539 return app_request_context; |
| 529 } | 540 } |
| 530 | 541 |
| 542 void ProfileImplIOData::AddConnectInterceptor( | |
| 543 net::URLRequestJobFactory* job_factory) const { | |
| 544 job_factory->AddInterceptor( | |
| 545 new chrome_browser_net::ConnectInterceptor(predictor_.get())); | |
| 546 } | |
| 547 | |
| 531 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 548 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
| 532 base::Time time) { | 549 base::Time time) { |
| 533 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 550 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 534 LazyInitialize(); | 551 LazyInitialize(); |
| 535 | 552 |
| 536 DCHECK(transport_security_state()); | 553 DCHECK(transport_security_state()); |
| 537 transport_security_state()->DeleteSince(time); | 554 transport_security_state()->DeleteSince(time); |
| 538 DCHECK(http_server_properties_manager()); | 555 DCHECK(http_server_properties_manager()); |
| 539 http_server_properties_manager()->Clear(); | 556 http_server_properties_manager()->Clear(); |
| 540 } | 557 } |
| OLD | NEW |