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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 10918279: Provide mutable members of UrlRequestContext via pure-virtual interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable test for chrome_frame_net_tests Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" 24 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
25 #include "chrome/browser/download/download_service.h" 25 #include "chrome/browser/download/download_service.h"
26 #include "chrome/browser/download/download_service_factory.h" 26 #include "chrome/browser/download/download_service_factory.h"
27 #include "chrome/browser/extensions/extension_info_map.h" 27 #include "chrome/browser/extensions/extension_info_map.h"
28 #include "chrome/browser/extensions/extension_protocols.h" 28 #include "chrome/browser/extensions/extension_protocols.h"
29 #include "chrome/browser/extensions/extension_resource_protocols.h" 29 #include "chrome/browser/extensions/extension_resource_protocols.h"
30 #include "chrome/browser/extensions/extension_system.h" 30 #include "chrome/browser/extensions/extension_system.h"
31 #include "chrome/browser/io_thread.h" 31 #include "chrome/browser/io_thread.h"
32 #include "chrome/browser/net/chrome_cookie_notification_details.h" 32 #include "chrome/browser/net/chrome_cookie_notification_details.h"
33 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" 33 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h"
34 #include "chrome/browser/net/chrome_http_user_agent_settings.h"
34 #include "chrome/browser/net/chrome_net_log.h" 35 #include "chrome/browser/net/chrome_net_log.h"
35 #include "chrome/browser/net/chrome_network_delegate.h" 36 #include "chrome/browser/net/chrome_network_delegate.h"
36 #include "chrome/browser/net/http_server_properties_manager.h" 37 #include "chrome/browser/net/http_server_properties_manager.h"
37 #include "chrome/browser/net/load_time_stats.h" 38 #include "chrome/browser/net/load_time_stats.h"
38 #include "chrome/browser/net/proxy_service_factory.h" 39 #include "chrome/browser/net/proxy_service_factory.h"
39 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" 40 #include "chrome/browser/net/resource_prefetch_predictor_observer.h"
40 #include "chrome/browser/net/transport_security_persister.h" 41 #include "chrome/browser/net/transport_security_persister.h"
41 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 42 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
42 #include "chrome/browser/policy/url_blacklist_manager.h" 43 #include "chrome/browser/policy/url_blacklist_manager.h"
43 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 44 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 139
139 } // namespace 140 } // namespace
140 141
141 void ProfileIOData::InitializeOnUIThread(Profile* profile) { 142 void ProfileIOData::InitializeOnUIThread(Profile* profile) {
142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 143 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
143 PrefService* pref_service = profile->GetPrefs(); 144 PrefService* pref_service = profile->GetPrefs();
144 145
145 scoped_ptr<ProfileParams> params(new ProfileParams); 146 scoped_ptr<ProfileParams> params(new ProfileParams);
146 params->path = profile->GetPath(); 147 params->path = profile->GetPath();
147 148
148 // Set up Accept-Language and Accept-Charset header values
149 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader(
150 pref_service->GetString(prefs::kAcceptLanguages));
151 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset);
152 params->accept_charset =
153 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset);
154
155 params->io_thread = g_browser_process->io_thread(); 149 params->io_thread = g_browser_process->io_thread();
156 150
157 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile); 151 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile);
158 params->ssl_config_service = profile->GetSSLConfigService(); 152 params->ssl_config_service = profile->GetSSLConfigService();
159 base::Callback<Profile*(void)> profile_getter = 153 base::Callback<Profile*(void)> profile_getter =
160 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), 154 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(),
161 profile); 155 profile);
162 params->cookie_monster_delegate = 156 params->cookie_monster_delegate =
163 new ChromeCookieMonsterDelegate(profile_getter); 157 new ChromeCookieMonsterDelegate(profile_getter);
164 params->extension_info_map = 158 params->extension_info_map =
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 ChromeNetworkDelegate::InitializePrefsOnUIThread( 191 ChromeNetworkDelegate::InitializePrefsOnUIThread(
198 &enable_referrers_, 192 &enable_referrers_,
199 &enable_do_not_track_, 193 &enable_do_not_track_,
200 pref_service); 194 pref_service);
201 195
202 #if defined(ENABLE_PRINTING) 196 #if defined(ENABLE_PRINTING)
203 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service, NULL); 197 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service, NULL);
204 printing_enabled_.MoveToThread( 198 printing_enabled_.MoveToThread(
205 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 199 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
206 #endif 200 #endif
201 chrome_http_user_agent_settings_.reset(
202 new ChromeHttpUserAgentSettings(pref_service));
207 203
208 // The URLBlacklistManager has to be created on the UI thread to register 204 // The URLBlacklistManager has to be created on the UI thread to register
209 // observers of |pref_service|, and it also has to clean up on 205 // observers of |pref_service|, and it also has to clean up on
210 // ShutdownOnUIThread to release these observers on the right thread. 206 // ShutdownOnUIThread to release these observers on the right thread.
211 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, 207 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up,
212 // in particular when this ProfileIOData isn't |initialized_| during deletion. 208 // in particular when this ProfileIOData isn't |initialized_| during deletion.
213 #if defined(ENABLE_CONFIGURATION_POLICY) 209 #if defined(ENABLE_CONFIGURATION_POLICY)
214 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service)); 210 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service));
215 #endif 211 #endif
216 212
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 572
577 LazyInitializeInternal(profile_params_.get()); 573 LazyInitializeInternal(profile_params_.get());
578 574
579 profile_params_.reset(); 575 profile_params_.reset();
580 initialized_ = true; 576 initialized_ = true;
581 } 577 }
582 578
583 void ProfileIOData::ApplyProfileParamsToContext( 579 void ProfileIOData::ApplyProfileParamsToContext(
584 ChromeURLRequestContext* context) const { 580 ChromeURLRequestContext* context) const {
585 context->set_is_incognito(is_incognito()); 581 context->set_is_incognito(is_incognito());
586 context->set_accept_language(profile_params_->accept_language); 582 context->set_http_user_agent_settings(
587 context->set_accept_charset(profile_params_->accept_charset); 583 chrome_http_user_agent_settings_.get());
588 context->set_ssl_config_service(profile_params_->ssl_config_service); 584 context->set_ssl_config_service(profile_params_->ssl_config_service);
589 } 585 }
590 586
591 void ProfileIOData::SetUpJobFactoryDefaults( 587 void ProfileIOData::SetUpJobFactoryDefaults(
592 net::URLRequestJobFactoryImpl* job_factory, 588 net::URLRequestJobFactoryImpl* job_factory,
593 scoped_ptr<net::URLRequestJobFactory::Interceptor> 589 scoped_ptr<net::URLRequestJobFactory::Interceptor>
594 protocol_handler_interceptor, 590 protocol_handler_interceptor,
595 net::NetworkDelegate* network_delegate, 591 net::NetworkDelegate* network_delegate,
596 net::FtpTransactionFactory* ftp_transaction_factory, 592 net::FtpTransactionFactory* ftp_transaction_factory,
597 net::FtpAuthCache* ftp_auth_cache) const { 593 net::FtpAuthCache* ftp_auth_cache) const {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 #if !defined(OS_CHROMEOS) 657 #if !defined(OS_CHROMEOS)
662 enable_metrics_.Destroy(); 658 enable_metrics_.Destroy();
663 #endif 659 #endif
664 safe_browsing_enabled_.Destroy(); 660 safe_browsing_enabled_.Destroy();
665 printing_enabled_.Destroy(); 661 printing_enabled_.Destroy();
666 session_startup_pref_.Destroy(); 662 session_startup_pref_.Destroy();
667 #if defined(ENABLE_CONFIGURATION_POLICY) 663 #if defined(ENABLE_CONFIGURATION_POLICY)
668 if (url_blacklist_manager_.get()) 664 if (url_blacklist_manager_.get())
669 url_blacklist_manager_->ShutdownOnUIThread(); 665 url_blacklist_manager_->ShutdownOnUIThread();
670 #endif 666 #endif
667 if (chrome_http_user_agent_settings_.get())
668 chrome_http_user_agent_settings_->CleanupOnUIThread();
671 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); 669 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
672 if (!posted) 670 if (!posted)
673 delete this; 671 delete this;
674 } 672 }
675 673
676 void ProfileIOData::set_server_bound_cert_service( 674 void ProfileIOData::set_server_bound_cert_service(
677 net::ServerBoundCertService* server_bound_cert_service) const { 675 net::ServerBoundCertService* server_bound_cert_service) const {
678 server_bound_cert_service_.reset(server_bound_cert_service); 676 server_bound_cert_service_.reset(server_bound_cert_service);
679 } 677 }
680 678
(...skipping 26 matching lines...) Expand all
707 params->http_pipelining_enabled = globals->http_pipelining_enabled; 705 params->http_pipelining_enabled = globals->http_pipelining_enabled;
708 params->testing_fixed_http_port = globals->testing_fixed_http_port; 706 params->testing_fixed_http_port = globals->testing_fixed_http_port;
709 params->testing_fixed_https_port = globals->testing_fixed_https_port; 707 params->testing_fixed_https_port = globals->testing_fixed_https_port;
710 708
711 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 709 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
712 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { 710 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) {
713 params->trusted_spdy_proxy = command_line.GetSwitchValueASCII( 711 params->trusted_spdy_proxy = command_line.GetSwitchValueASCII(
714 switches::kTrustedSpdyProxy); 712 switches::kTrustedSpdyProxy);
715 } 713 }
716 } 714 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698