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_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 context = AcquireIsolatedMediaRequestContext(app_context, | 534 context = AcquireIsolatedMediaRequestContext(app_context, |
535 partition_descriptor); | 535 partition_descriptor); |
536 isolated_media_request_context_map_[partition_descriptor] = context; | 536 isolated_media_request_context_map_[partition_descriptor] = context; |
537 } | 537 } |
538 DCHECK(context); | 538 DCHECK(context); |
539 return context; | 539 return context; |
540 } | 540 } |
541 | 541 |
542 ExtensionInfoMap* ProfileIOData::GetExtensionInfoMap() const { | 542 ExtensionInfoMap* ProfileIOData::GetExtensionInfoMap() const { |
543 DCHECK(initialized_) << "ExtensionSystem not initialized"; | 543 DCHECK(initialized_) << "ExtensionSystem not initialized"; |
544 return extension_info_map_; | 544 return extension_info_map_.get(); |
545 } | 545 } |
546 | 546 |
547 CookieSettings* ProfileIOData::GetCookieSettings() const { | 547 CookieSettings* ProfileIOData::GetCookieSettings() const { |
548 // Allow either Init() or SetCookieSettingsForTesting() to initialize. | 548 // Allow either Init() or SetCookieSettingsForTesting() to initialize. |
549 DCHECK(initialized_ || cookie_settings_); | 549 DCHECK(initialized_ || cookie_settings_.get()); |
550 return cookie_settings_; | 550 return cookie_settings_.get(); |
551 } | 551 } |
552 | 552 |
553 #if defined(ENABLE_NOTIFICATIONS) | 553 #if defined(ENABLE_NOTIFICATIONS) |
554 DesktopNotificationService* ProfileIOData::GetNotificationService() const { | 554 DesktopNotificationService* ProfileIOData::GetNotificationService() const { |
555 DCHECK(initialized_); | 555 DCHECK(initialized_); |
556 return notification_service_; | 556 return notification_service_; |
557 } | 557 } |
558 #endif | 558 #endif |
559 | 559 |
560 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { | 560 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 load_time_stats_)); | 653 load_time_stats_)); |
654 extensions_request_context_.reset( | 654 extensions_request_context_.reset( |
655 new ChromeURLRequestContext( | 655 new ChromeURLRequestContext( |
656 ChromeURLRequestContext::CONTEXT_TYPE_EXTENSIONS, | 656 ChromeURLRequestContext::CONTEXT_TYPE_EXTENSIONS, |
657 load_time_stats_)); | 657 load_time_stats_)); |
658 | 658 |
659 ChromeNetworkDelegate* network_delegate = | 659 ChromeNetworkDelegate* network_delegate = |
660 new ChromeNetworkDelegate( | 660 new ChromeNetworkDelegate( |
661 io_thread_globals->extension_event_router_forwarder.get(), | 661 io_thread_globals->extension_event_router_forwarder.get(), |
662 &enable_referrers_); | 662 &enable_referrers_); |
663 network_delegate->set_extension_info_map(profile_params_->extension_info_map); | 663 network_delegate->set_extension_info_map( |
| 664 profile_params_->extension_info_map.get()); |
664 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 665 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
665 network_delegate->set_profile(profile_params_->profile); | 666 network_delegate->set_profile(profile_params_->profile); |
666 network_delegate->set_cookie_settings(profile_params_->cookie_settings); | 667 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); |
667 network_delegate->set_enable_do_not_track(&enable_do_not_track_); | 668 network_delegate->set_enable_do_not_track(&enable_do_not_track_); |
668 network_delegate->set_force_google_safe_search(&force_safesearch_); | 669 network_delegate->set_force_google_safe_search(&force_safesearch_); |
669 network_delegate->set_load_time_stats(load_time_stats_); | 670 network_delegate->set_load_time_stats(load_time_stats_); |
670 network_delegate_.reset(network_delegate); | 671 network_delegate_.reset(network_delegate); |
671 | 672 |
672 fraudulent_certificate_reporter_.reset( | 673 fraudulent_certificate_reporter_.reset( |
673 new chrome_browser_net::ChromeFraudulentCertificateReporter( | 674 new chrome_browser_net::ChromeFraudulentCertificateReporter( |
674 main_request_context_.get())); | 675 main_request_context_.get())); |
675 | 676 |
676 // NOTE: Proxy service uses the default io thread network delegate, not the | 677 // NOTE: Proxy service uses the default io thread network delegate, not the |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 InitializeInternal(profile_params_.get(), protocol_handlers); | 721 InitializeInternal(profile_params_.get(), protocol_handlers); |
721 | 722 |
722 profile_params_.reset(); | 723 profile_params_.reset(); |
723 initialized_ = true; | 724 initialized_ = true; |
724 } | 725 } |
725 | 726 |
726 void ProfileIOData::ApplyProfileParamsToContext( | 727 void ProfileIOData::ApplyProfileParamsToContext( |
727 ChromeURLRequestContext* context) const { | 728 ChromeURLRequestContext* context) const { |
728 context->set_http_user_agent_settings( | 729 context->set_http_user_agent_settings( |
729 chrome_http_user_agent_settings_.get()); | 730 chrome_http_user_agent_settings_.get()); |
730 context->set_ssl_config_service(profile_params_->ssl_config_service); | 731 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); |
731 } | 732 } |
732 | 733 |
733 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( | 734 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( |
734 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 735 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
735 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 736 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
736 protocol_handler_interceptor, | 737 protocol_handler_interceptor, |
737 net::NetworkDelegate* network_delegate, | 738 net::NetworkDelegate* network_delegate, |
738 net::FtpTransactionFactory* ftp_transaction_factory) const { | 739 net::FtpTransactionFactory* ftp_transaction_factory) const { |
739 // NOTE(willchan): Keep these protocol handlers in sync with | 740 // NOTE(willchan): Keep these protocol handlers in sync with |
740 // ProfileIOData::IsHandledProtocol(). | 741 // ProfileIOData::IsHandledProtocol(). |
741 bool set_protocol = job_factory->SetProtocolHandler( | 742 bool set_protocol = job_factory->SetProtocolHandler( |
742 chrome::kFileScheme, new net::FileProtocolHandler()); | 743 chrome::kFileScheme, new net::FileProtocolHandler()); |
743 DCHECK(set_protocol); | 744 DCHECK(set_protocol); |
744 | 745 |
745 DCHECK(extension_info_map_); | 746 DCHECK(extension_info_map_.get()); |
746 set_protocol = job_factory->SetProtocolHandler( | 747 set_protocol = job_factory->SetProtocolHandler( |
747 extensions::kExtensionScheme, | 748 extensions::kExtensionScheme, |
748 CreateExtensionProtocolHandler(is_incognito(), extension_info_map_)); | 749 CreateExtensionProtocolHandler(is_incognito(), |
| 750 extension_info_map_.get())); |
749 DCHECK(set_protocol); | 751 DCHECK(set_protocol); |
750 set_protocol = job_factory->SetProtocolHandler( | 752 set_protocol = job_factory->SetProtocolHandler( |
751 chrome::kExtensionResourceScheme, | 753 chrome::kExtensionResourceScheme, |
752 CreateExtensionResourceProtocolHandler()); | 754 CreateExtensionResourceProtocolHandler()); |
753 DCHECK(set_protocol); | 755 DCHECK(set_protocol); |
754 set_protocol = job_factory->SetProtocolHandler( | 756 set_protocol = job_factory->SetProtocolHandler( |
755 chrome::kDataScheme, new net::DataProtocolHandler()); | 757 chrome::kDataScheme, new net::DataProtocolHandler()); |
756 DCHECK(set_protocol); | 758 DCHECK(set_protocol); |
757 #if defined(OS_CHROMEOS) | 759 #if defined(OS_CHROMEOS) |
758 if (!is_incognito() && profile_params_) { | 760 if (!is_incognito() && profile_params_) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 params->ssl_session_cache_shard = GetSSLSessionCacheShard(); | 851 params->ssl_session_cache_shard = GetSSLSessionCacheShard(); |
850 params->ssl_config_service = context->ssl_config_service(); | 852 params->ssl_config_service = context->ssl_config_service(); |
851 params->http_auth_handler_factory = context->http_auth_handler_factory(); | 853 params->http_auth_handler_factory = context->http_auth_handler_factory(); |
852 params->network_delegate = network_delegate(); | 854 params->network_delegate = network_delegate(); |
853 params->http_server_properties = context->http_server_properties(); | 855 params->http_server_properties = context->http_server_properties(); |
854 params->net_log = context->net_log(); | 856 params->net_log = context->net_log(); |
855 } | 857 } |
856 | 858 |
857 void ProfileIOData::SetCookieSettingsForTesting( | 859 void ProfileIOData::SetCookieSettingsForTesting( |
858 CookieSettings* cookie_settings) { | 860 CookieSettings* cookie_settings) { |
859 DCHECK(!cookie_settings_); | 861 DCHECK(!cookie_settings_.get()); |
860 cookie_settings_ = cookie_settings; | 862 cookie_settings_ = cookie_settings; |
861 } | 863 } |
862 | 864 |
863 void ProfileIOData::set_signin_names_for_testing( | 865 void ProfileIOData::set_signin_names_for_testing( |
864 SigninNamesOnIOThread* signin_names) { | 866 SigninNamesOnIOThread* signin_names) { |
865 signin_names_.reset(signin_names); | 867 signin_names_.reset(signin_names); |
866 } | 868 } |
OLD | NEW |