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 15 matching lines...) Expand all Loading... |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
29 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
30 #include "content/public/browser/notification_service.h" | 30 #include "content/public/browser/notification_service.h" |
31 #include "content/public/browser/resource_context.h" | 31 #include "content/public/browser/resource_context.h" |
32 #include "net/base/server_bound_cert_service.h" | 32 #include "net/base/server_bound_cert_service.h" |
33 #include "net/ftp/ftp_network_layer.h" | 33 #include "net/ftp/ftp_network_layer.h" |
34 #include "net/http/http_cache.h" | 34 #include "net/http/http_cache.h" |
35 #include "net/url_request/ftp_protocol_handler.h" | 35 #include "net/url_request/ftp_protocol_handler.h" |
| 36 #include "net/url_request/http_protocol_handler.h" |
36 #include "net/url_request/url_request_job_factory.h" | 37 #include "net/url_request/url_request_job_factory.h" |
37 #include "webkit/quota/special_storage_policy.h" | 38 #include "webkit/quota/special_storage_policy.h" |
38 | 39 |
39 using content::BrowserThread; | 40 using content::BrowserThread; |
40 | 41 |
41 ProfileImplIOData::Handle::Handle(Profile* profile) | 42 ProfileImplIOData::Handle::Handle(Profile* profile) |
42 : io_data_(new ProfileImplIOData), | 43 : io_data_(new ProfileImplIOData), |
43 profile_(profile), | 44 profile_(profile), |
44 initialized_(false) { | 45 initialized_(false) { |
45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 449 |
449 main_job_factory_.reset(new net::URLRequestJobFactory); | 450 main_job_factory_.reset(new net::URLRequestJobFactory); |
450 media_request_job_factory_.reset(new net::URLRequestJobFactory); | 451 media_request_job_factory_.reset(new net::URLRequestJobFactory); |
451 extensions_job_factory_.reset(new net::URLRequestJobFactory); | 452 extensions_job_factory_.reset(new net::URLRequestJobFactory); |
452 | 453 |
453 net::URLRequestJobFactory* job_factories[3]; | 454 net::URLRequestJobFactory* job_factories[3]; |
454 job_factories[0] = main_job_factory_.get(); | 455 job_factories[0] = main_job_factory_.get(); |
455 job_factories[1] = media_request_job_factory_.get(); | 456 job_factories[1] = media_request_job_factory_.get(); |
456 job_factories[2] = extensions_job_factory_.get(); | 457 job_factories[2] = extensions_job_factory_.get(); |
457 | 458 |
458 net::FtpAuthCache* ftp_auth_caches[3]; | 459 bool set_protocol = main_job_factory_->SetProtocolHandler( |
459 ftp_auth_caches[0] = main_context->ftp_auth_cache(); | 460 chrome::kHttpScheme, |
460 ftp_auth_caches[1] = media_request_context_->ftp_auth_cache(); | 461 new net::HttpProtocolHandler(main_cache, |
461 ftp_auth_caches[2] = extensions_context->ftp_auth_cache(); | 462 network_delegate(), |
| 463 io_thread_globals->throttler_manager.get(), |
| 464 main_context->accept_language(), |
| 465 main_context->accept_charset(), |
| 466 cookie_store, |
| 467 fraudulent_certificate_reporter(), |
| 468 main_context->ssl_config_service(), |
| 469 transport_security_state())); |
| 470 DCHECK(set_protocol); |
| 471 set_protocol = media_request_job_factory_->SetProtocolHandler( |
| 472 chrome::kHttpScheme, |
| 473 new net::HttpProtocolHandler(media_cache, |
| 474 network_delegate(), |
| 475 io_thread_globals->throttler_manager.get(), |
| 476 main_context->accept_language(), |
| 477 main_context->accept_charset(), |
| 478 cookie_store, |
| 479 fraudulent_certificate_reporter(), |
| 480 main_context->ssl_config_service(), |
| 481 transport_security_state())); |
| 482 DCHECK(set_protocol); |
| 483 set_protocol = extensions_job_factory_->SetProtocolHandler( |
| 484 chrome::kHttpScheme, |
| 485 new net::HttpProtocolHandler(extensions_context-> |
| 486 http_transaction_factory(), |
| 487 NULL, |
| 488 io_thread_globals->throttler_manager.get(), |
| 489 main_context->accept_language(), |
| 490 main_context->accept_charset(), |
| 491 extensions_cookie_store, |
| 492 NULL, |
| 493 main_context->ssl_config_service(), |
| 494 transport_security_state())); |
| 495 DCHECK(set_protocol); |
| 496 |
| 497 CreateFtpProtocolHandler(job_factories[0], |
| 498 main_context->ftp_auth_cache(), |
| 499 network_delegate()); |
| 500 CreateFtpProtocolHandler(job_factories[1], |
| 501 media_request_context_->ftp_auth_cache(), |
| 502 network_delegate()); |
| 503 CreateFtpProtocolHandler(job_factories[2], |
| 504 extensions_context->ftp_auth_cache(), |
| 505 NULL); |
462 | 506 |
463 for (int i = 0; i < 3; i++) { | 507 for (int i = 0; i < 3; i++) { |
464 SetUpJobFactoryDefaults(job_factories[i]); | 508 SetUpJobFactoryDefaults(job_factories[i]); |
465 CreateFtpProtocolHandler(job_factories[i], ftp_auth_caches[i]); | |
466 job_factories[i]->AddInterceptor( | 509 job_factories[i]->AddInterceptor( |
467 new chrome_browser_net::ConnectInterceptor(predictor_.get())); | 510 new chrome_browser_net::ConnectInterceptor(predictor_.get())); |
468 } | 511 } |
469 | 512 |
470 main_context->set_job_factory(main_job_factory_.get()); | 513 main_context->set_job_factory(main_job_factory_.get()); |
471 media_request_context_->set_job_factory(media_request_job_factory_.get()); | 514 media_request_context_->set_job_factory(media_request_job_factory_.get()); |
472 extensions_context->set_job_factory(extensions_job_factory_.get()); | 515 extensions_context->set_job_factory(extensions_job_factory_.get()); |
473 | 516 |
474 lazy_params_.reset(); | 517 lazy_params_.reset(); |
475 } | 518 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 return app_request_context; | 608 return app_request_context; |
566 } | 609 } |
567 | 610 |
568 chrome_browser_net::CacheStats* ProfileImplIOData::GetCacheStats( | 611 chrome_browser_net::CacheStats* ProfileImplIOData::GetCacheStats( |
569 IOThread::Globals* io_thread_globals) const { | 612 IOThread::Globals* io_thread_globals) const { |
570 return io_thread_globals->cache_stats.get(); | 613 return io_thread_globals->cache_stats.get(); |
571 } | 614 } |
572 | 615 |
573 void ProfileImplIOData::CreateFtpProtocolHandler( | 616 void ProfileImplIOData::CreateFtpProtocolHandler( |
574 net::URLRequestJobFactory* job_factory, | 617 net::URLRequestJobFactory* job_factory, |
575 net::FtpAuthCache* ftp_auth_cache) const { | 618 net::FtpAuthCache* ftp_auth_cache, |
576 job_factory->SetProtocolHandler( | 619 net::NetworkDelegate* network_delegate) const { |
| 620 bool set_protocol = job_factory->SetProtocolHandler( |
577 chrome::kFtpScheme, | 621 chrome::kFtpScheme, |
578 new net::FtpProtocolHandler(network_delegate(), | 622 new net::FtpProtocolHandler(network_delegate, |
579 ftp_factory_.get(), | 623 ftp_factory_.get(), |
580 ftp_auth_cache)); | 624 ftp_auth_cache)); |
| 625 DCHECK(set_protocol); |
581 } | 626 } |
582 | 627 |
583 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( | 628 void ProfileImplIOData::ClearNetworkingHistorySinceOnIOThread( |
584 base::Time time) { | 629 base::Time time) { |
585 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 630 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
586 LazyInitialize(); | 631 LazyInitialize(); |
587 | 632 |
588 DCHECK(transport_security_state()); | 633 DCHECK(transport_security_state()); |
589 transport_security_state()->DeleteSince(time); | 634 transport_security_state()->DeleteSince(time); |
590 DCHECK(http_server_properties_manager()); | 635 DCHECK(http_server_properties_manager()); |
591 http_server_properties_manager()->Clear(); | 636 http_server_properties_manager()->Clear(); |
592 } | 637 } |
OLD | NEW |