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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 }; | 128 }; |
129 | 129 |
130 Profile* GetProfileOnUI(ProfileManager* profile_manager, Profile* profile) { | 130 Profile* GetProfileOnUI(ProfileManager* profile_manager, Profile* profile) { |
131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
132 DCHECK(profile); | 132 DCHECK(profile); |
133 if (profile_manager->IsValidProfile(profile)) | 133 if (profile_manager->IsValidProfile(profile)) |
134 return profile; | 134 return profile; |
135 return NULL; | 135 return NULL; |
136 } | 136 } |
137 | 137 |
| 138 // Inform PrefProxyConfigTracker of underlying ChromeProxyConfigService. |
| 139 void SetChromeProxyConfigService( |
| 140 base::Callback<Profile*(void)> profile_getter, |
| 141 ChromeProxyConfigService* chrome_proxy_config_service) { |
| 142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 143 Profile* profile = profile_getter.Run(); |
| 144 if (profile) { |
| 145 profile->GetProxyConfigTracker()->SetChromeProxyConfigService( |
| 146 chrome_proxy_config_service); |
| 147 } |
| 148 } |
| 149 |
138 } // namespace | 150 } // namespace |
139 | 151 |
140 void ProfileIOData::InitializeOnUIThread(Profile* profile) { | 152 void ProfileIOData::InitializeOnUIThread(Profile* profile) { |
141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
142 PrefService* pref_service = profile->GetPrefs(); | 154 PrefService* pref_service = profile->GetPrefs(); |
143 | 155 |
144 scoped_ptr<ProfileParams> params(new ProfileParams); | 156 scoped_ptr<ProfileParams> params(new ProfileParams); |
145 params->path = profile->GetPath(); | 157 params->path = profile->GetPath(); |
146 | 158 |
147 // Set up Accept-Language and Accept-Charset header values | 159 // Set up Accept-Language and Accept-Charset header values |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 ProtocolHandlerRegistry* protocol_handler_registry = | 204 ProtocolHandlerRegistry* protocol_handler_registry = |
193 ProtocolHandlerRegistryFactory::GetForProfile(profile); | 205 ProtocolHandlerRegistryFactory::GetForProfile(profile); |
194 DCHECK(protocol_handler_registry); | 206 DCHECK(protocol_handler_registry); |
195 | 207 |
196 // The profile instance is only available here in the InitializeOnUIThread | 208 // The profile instance is only available here in the InitializeOnUIThread |
197 // method, so we create the url interceptor here, then save it for | 209 // method, so we create the url interceptor here, then save it for |
198 // later delivery to the job factory in LazyInitialize. | 210 // later delivery to the job factory in LazyInitialize. |
199 params->protocol_handler_interceptor.reset( | 211 params->protocol_handler_interceptor.reset( |
200 protocol_handler_registry->CreateURLInterceptor()); | 212 protocol_handler_registry->CreateURLInterceptor()); |
201 | 213 |
202 ChromeProxyConfigService* proxy_config_service = | 214 params->profile_getter = profile_getter; |
203 ProxyServiceFactory::CreateProxyConfigService(true); | |
204 params->proxy_config_service.reset(proxy_config_service); | |
205 profile->GetProxyConfigTracker()->SetChromeProxyConfigService( | |
206 proxy_config_service); | |
207 params->profile = profile; | 215 params->profile = profile; |
208 profile_params_.reset(params.release()); | 216 profile_params_.reset(params.release()); |
209 | 217 |
210 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 218 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
211 &enable_referrers_, | 219 &enable_referrers_, |
212 &enable_do_not_track_, | 220 &enable_do_not_track_, |
213 pref_service); | 221 pref_service); |
214 | 222 |
215 #if defined(ENABLE_PRINTING) | 223 #if defined(ENABLE_PRINTING) |
216 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service, NULL); | 224 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service, NULL); |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 profile_params_->profile, | 553 profile_params_->profile, |
546 profile_params_->cookie_settings, | 554 profile_params_->cookie_settings, |
547 &enable_referrers_, | 555 &enable_referrers_, |
548 &enable_do_not_track_, | 556 &enable_do_not_track_, |
549 load_time_stats_)); | 557 load_time_stats_)); |
550 | 558 |
551 fraudulent_certificate_reporter_.reset( | 559 fraudulent_certificate_reporter_.reset( |
552 new chrome_browser_net::ChromeFraudulentCertificateReporter( | 560 new chrome_browser_net::ChromeFraudulentCertificateReporter( |
553 main_request_context_.get())); | 561 main_request_context_.get())); |
554 | 562 |
| 563 ChromeProxyConfigService* proxy_config_service = |
| 564 ProxyServiceFactory::CreateProxyConfigService(true); |
| 565 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 566 base::Bind(&SetChromeProxyConfigService, |
| 567 profile_params_->profile_getter, |
| 568 proxy_config_service)); |
| 569 |
555 proxy_service_.reset( | 570 proxy_service_.reset( |
556 ProxyServiceFactory::CreateProxyService( | 571 ProxyServiceFactory::CreateProxyService( |
557 io_thread->net_log(), | 572 io_thread->net_log(), |
558 io_thread_globals->proxy_script_fetcher_context.get(), | 573 io_thread_globals->proxy_script_fetcher_context.get(), |
559 profile_params_->proxy_config_service.release(), | 574 proxy_config_service, |
560 command_line)); | 575 command_line)); |
561 | 576 |
562 transport_security_state_.reset(new net::TransportSecurityState()); | 577 transport_security_state_.reset(new net::TransportSecurityState()); |
563 transport_security_persister_.reset( | 578 transport_security_persister_.reset( |
564 new TransportSecurityPersister(transport_security_state_.get(), | 579 new TransportSecurityPersister(transport_security_state_.get(), |
565 profile_params_->path, | 580 profile_params_->path, |
566 is_incognito())); | 581 is_incognito())); |
567 const std::string& serialized = | 582 const std::string& serialized = |
568 command_line.GetSwitchValueASCII(switches::kHstsHosts); | 583 command_line.GetSwitchValueASCII(switches::kHstsHosts); |
569 transport_security_persister_.get()->DeserializeFromCommandLine(serialized); | 584 transport_security_persister_.get()->DeserializeFromCommandLine(serialized); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 #if !defined(OS_CHROMEOS) | 685 #if !defined(OS_CHROMEOS) |
671 enable_metrics_.Destroy(); | 686 enable_metrics_.Destroy(); |
672 #endif | 687 #endif |
673 safe_browsing_enabled_.Destroy(); | 688 safe_browsing_enabled_.Destroy(); |
674 printing_enabled_.Destroy(); | 689 printing_enabled_.Destroy(); |
675 session_startup_pref_.Destroy(); | 690 session_startup_pref_.Destroy(); |
676 #if defined(ENABLE_CONFIGURATION_POLICY) | 691 #if defined(ENABLE_CONFIGURATION_POLICY) |
677 if (url_blacklist_manager_.get()) | 692 if (url_blacklist_manager_.get()) |
678 url_blacklist_manager_->ShutdownOnUIThread(); | 693 url_blacklist_manager_->ShutdownOnUIThread(); |
679 #endif | 694 #endif |
| 695 if (proxy_service_.get()) |
| 696 proxy_service_->StartTearDown(); |
680 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 697 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
681 if (!posted) | 698 if (!posted) |
682 delete this; | 699 delete this; |
683 } | 700 } |
684 | 701 |
685 void ProfileIOData::set_server_bound_cert_service( | 702 void ProfileIOData::set_server_bound_cert_service( |
686 net::ServerBoundCertService* server_bound_cert_service) const { | 703 net::ServerBoundCertService* server_bound_cert_service) const { |
687 server_bound_cert_service_.reset(server_bound_cert_service); | 704 server_bound_cert_service_.reset(server_bound_cert_service); |
688 } | 705 } |
689 | 706 |
(...skipping 26 matching lines...) Expand all Loading... |
716 params->http_pipelining_enabled = globals->http_pipelining_enabled; | 733 params->http_pipelining_enabled = globals->http_pipelining_enabled; |
717 params->testing_fixed_http_port = globals->testing_fixed_http_port; | 734 params->testing_fixed_http_port = globals->testing_fixed_http_port; |
718 params->testing_fixed_https_port = globals->testing_fixed_https_port; | 735 params->testing_fixed_https_port = globals->testing_fixed_https_port; |
719 | 736 |
720 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 737 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
721 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { | 738 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { |
722 params->trusted_spdy_proxy = command_line.GetSwitchValueASCII( | 739 params->trusted_spdy_proxy = command_line.GetSwitchValueASCII( |
723 switches::kTrustedSpdyProxy); | 740 switches::kTrustedSpdyProxy); |
724 } | 741 } |
725 } | 742 } |
OLD | NEW |