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

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: add TODO Created 8 years, 2 months 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 } // namespace 139 } // namespace
139 140
140 void ProfileIOData::InitializeOnUIThread(Profile* profile) { 141 void ProfileIOData::InitializeOnUIThread(Profile* profile) {
141 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
142 PrefService* pref_service = profile->GetPrefs(); 143 PrefService* pref_service = profile->GetPrefs();
143 144
144 scoped_ptr<ProfileParams> params(new ProfileParams); 145 scoped_ptr<ProfileParams> params(new ProfileParams);
145 params->path = profile->GetPath(); 146 params->path = profile->GetPath();
146 147
147 // Set up Accept-Language and Accept-Charset header values 148 // Set up Accept-Language and Accept-Charset header values
148 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( 149 std::string accept_language = net::HttpUtil::GenerateAcceptLanguageHeader(
willchan no longer on Chromium 2012/10/24 03:40:10 This |accept_language| useless now?
erikwright (departed) 2012/10/24 13:14:33 Not required anymore, right?
149 pref_service->GetString(prefs::kAcceptLanguages)); 150 pref_service->GetString(prefs::kAcceptLanguages));
150 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); 151 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset);
151 params->accept_charset = 152 std::string accept_charset =
willchan no longer on Chromium 2012/10/24 03:40:10 Ditto with these two stack vars too.
erikwright (departed) 2012/10/24 13:14:33 ditto
152 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); 153 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset);
154 params->chrome_http_user_agent_settings.reset(
155 new ChromeHttpUserAgentSettings(pref_service));
156
153 157
154 // At this point, we don't know the charset of the referring page 158 // At this point, we don't know the charset of the referring page
155 // where a url request originates from. This is used to get a suggested 159 // where a url request originates from. This is used to get a suggested
156 // filename from Content-Disposition header made of raw 8bit characters. 160 // filename from Content-Disposition header made of raw 8bit characters.
157 // Down the road, it can be overriden if it becomes known (for instance, 161 // Down the road, it can be overriden if it becomes known (for instance,
158 // when download request is made through the context menu in a web page). 162 // when download request is made through the context menu in a web page).
159 // At the moment, it'll remain 'undeterministic' when a user 163 // At the moment, it'll remain 'undeterministic' when a user
160 // types a URL in the omnibar or click on a download link in a page. 164 // types a URL in the omnibar or click on a download link in a page.
161 // For the latter, we need a change on the webkit-side. 165 // For the latter, we need a change on the webkit-side.
162 // We initialize it to the default charset here and a user will 166 // We initialize it to the default charset here and a user will
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 extension_info_map_ = profile_params_->extension_info_map; 580 extension_info_map_ = profile_params_->extension_info_map;
577 581
578 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); 582 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get();
579 resource_context_->request_context_ = main_request_context_.get(); 583 resource_context_->request_context_ = main_request_context_.get();
580 584
581 if (profile_params_->resource_prefetch_predictor_observer_.get()) { 585 if (profile_params_->resource_prefetch_predictor_observer_.get()) {
582 resource_prefetch_predictor_observer_.reset( 586 resource_prefetch_predictor_observer_.reset(
583 profile_params_->resource_prefetch_predictor_observer_.release()); 587 profile_params_->resource_prefetch_predictor_observer_.release());
584 } 588 }
585 589
590 chrome_http_user_agent_settings_.reset(
591 profile_params_->chrome_http_user_agent_settings.release());
592
586 LazyInitializeInternal(profile_params_.get()); 593 LazyInitializeInternal(profile_params_.get());
587 594
588 profile_params_.reset(); 595 profile_params_.reset();
589 initialized_ = true; 596 initialized_ = true;
590 } 597 }
591 598
592 void ProfileIOData::ApplyProfileParamsToContext( 599 void ProfileIOData::ApplyProfileParamsToContext(
593 ChromeURLRequestContext* context) const { 600 ChromeURLRequestContext* context) const {
594 context->set_is_incognito(is_incognito()); 601 context->set_is_incognito(is_incognito());
595 context->set_accept_language(profile_params_->accept_language); 602 context->set_http_user_agent_settings(
596 context->set_accept_charset(profile_params_->accept_charset); 603 chrome_http_user_agent_settings_.get());
597 context->set_referrer_charset(profile_params_->referrer_charset); 604 context->set_referrer_charset(profile_params_->referrer_charset);
erikwright (departed) 2012/10/24 13:14:33 presumably this should go away? I guess you just n
598 context->set_ssl_config_service(profile_params_->ssl_config_service); 605 context->set_ssl_config_service(profile_params_->ssl_config_service);
599 } 606 }
600 607
601 void ProfileIOData::SetUpJobFactoryDefaults( 608 void ProfileIOData::SetUpJobFactoryDefaults(
602 net::URLRequestJobFactory* job_factory, 609 net::URLRequestJobFactory* job_factory,
603 scoped_ptr<net::URLRequestJobFactory::Interceptor> 610 scoped_ptr<net::URLRequestJobFactory::Interceptor>
604 protocol_handler_interceptor, 611 protocol_handler_interceptor,
605 net::NetworkDelegate* network_delegate, 612 net::NetworkDelegate* network_delegate,
606 net::FtpTransactionFactory* ftp_transaction_factory, 613 net::FtpTransactionFactory* ftp_transaction_factory,
607 net::FtpAuthCache* ftp_auth_cache) const { 614 net::FtpAuthCache* ftp_auth_cache) const {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 #if !defined(OS_CHROMEOS) 678 #if !defined(OS_CHROMEOS)
672 enable_metrics_.Destroy(); 679 enable_metrics_.Destroy();
673 #endif 680 #endif
674 safe_browsing_enabled_.Destroy(); 681 safe_browsing_enabled_.Destroy();
675 printing_enabled_.Destroy(); 682 printing_enabled_.Destroy();
676 session_startup_pref_.Destroy(); 683 session_startup_pref_.Destroy();
677 #if defined(ENABLE_CONFIGURATION_POLICY) 684 #if defined(ENABLE_CONFIGURATION_POLICY)
678 if (url_blacklist_manager_.get()) 685 if (url_blacklist_manager_.get())
679 url_blacklist_manager_->ShutdownOnUIThread(); 686 url_blacklist_manager_->ShutdownOnUIThread();
680 #endif 687 #endif
688 if (chrome_http_user_agent_settings_.get())
689 chrome_http_user_agent_settings_->CleanupOnUIThread();
681 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); 690 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
682 if (!posted) 691 if (!posted)
683 delete this; 692 delete this;
684 } 693 }
685 694
686 void ProfileIOData::set_server_bound_cert_service( 695 void ProfileIOData::set_server_bound_cert_service(
687 net::ServerBoundCertService* server_bound_cert_service) const { 696 net::ServerBoundCertService* server_bound_cert_service) const {
688 server_bound_cert_service_.reset(server_bound_cert_service); 697 server_bound_cert_service_.reset(server_bound_cert_service);
689 } 698 }
690 699
(...skipping 26 matching lines...) Expand all
717 params->http_pipelining_enabled = globals->http_pipelining_enabled; 726 params->http_pipelining_enabled = globals->http_pipelining_enabled;
718 params->testing_fixed_http_port = globals->testing_fixed_http_port; 727 params->testing_fixed_http_port = globals->testing_fixed_http_port;
719 params->testing_fixed_https_port = globals->testing_fixed_https_port; 728 params->testing_fixed_https_port = globals->testing_fixed_https_port;
720 729
721 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 730 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
722 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { 731 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) {
723 params->trusted_spdy_proxy = command_line.GetSwitchValueASCII( 732 params->trusted_spdy_proxy = command_line.GetSwitchValueASCII(
724 switches::kTrustedSpdyProxy); 733 switches::kTrustedSpdyProxy);
725 } 734 }
726 } 735 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698