| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 scoped_ptr<ProfileParams> params(new ProfileParams); | 144 scoped_ptr<ProfileParams> params(new ProfileParams); |
| 145 params->path = profile->GetPath(); | 145 params->path = profile->GetPath(); |
| 146 | 146 |
| 147 // Set up Accept-Language and Accept-Charset header values | 147 // Set up Accept-Language and Accept-Charset header values |
| 148 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( | 148 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( |
| 149 pref_service->GetString(prefs::kAcceptLanguages)); | 149 pref_service->GetString(prefs::kAcceptLanguages)); |
| 150 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); | 150 std::string default_charset = pref_service->GetString(prefs::kDefaultCharset); |
| 151 params->accept_charset = | 151 params->accept_charset = |
| 152 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); | 152 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); |
| 153 | 153 |
| 154 // 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 | |
| 156 // filename from Content-Disposition header made of raw 8bit characters. | |
| 157 // 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). | |
| 159 // 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. | |
| 161 // For the latter, we need a change on the webkit-side. | |
| 162 // We initialize it to the default charset here and a user will | |
| 163 // have an *arguably* better default charset for interpreting a raw 8bit | |
| 164 // C-D header field. It means the native OS codepage fallback in | |
| 165 // net_util::GetSuggestedFilename is unlikely to be taken. | |
| 166 params->referrer_charset = default_charset; | |
| 167 | |
| 168 params->io_thread = g_browser_process->io_thread(); | 154 params->io_thread = g_browser_process->io_thread(); |
| 169 | 155 |
| 170 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile); | 156 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile); |
| 171 params->ssl_config_service = profile->GetSSLConfigService(); | 157 params->ssl_config_service = profile->GetSSLConfigService(); |
| 172 base::Callback<Profile*(void)> profile_getter = | 158 base::Callback<Profile*(void)> profile_getter = |
| 173 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), | 159 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), |
| 174 profile); | 160 profile); |
| 175 params->cookie_monster_delegate = | 161 params->cookie_monster_delegate = |
| 176 new ChromeCookieMonsterDelegate(profile_getter); | 162 new ChromeCookieMonsterDelegate(profile_getter); |
| 177 params->extension_info_map = | 163 params->extension_info_map = |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 573 |
| 588 profile_params_.reset(); | 574 profile_params_.reset(); |
| 589 initialized_ = true; | 575 initialized_ = true; |
| 590 } | 576 } |
| 591 | 577 |
| 592 void ProfileIOData::ApplyProfileParamsToContext( | 578 void ProfileIOData::ApplyProfileParamsToContext( |
| 593 ChromeURLRequestContext* context) const { | 579 ChromeURLRequestContext* context) const { |
| 594 context->set_is_incognito(is_incognito()); | 580 context->set_is_incognito(is_incognito()); |
| 595 context->set_accept_language(profile_params_->accept_language); | 581 context->set_accept_language(profile_params_->accept_language); |
| 596 context->set_accept_charset(profile_params_->accept_charset); | 582 context->set_accept_charset(profile_params_->accept_charset); |
| 597 context->set_referrer_charset(profile_params_->referrer_charset); | |
| 598 context->set_ssl_config_service(profile_params_->ssl_config_service); | 583 context->set_ssl_config_service(profile_params_->ssl_config_service); |
| 599 } | 584 } |
| 600 | 585 |
| 601 void ProfileIOData::SetUpJobFactoryDefaults( | 586 void ProfileIOData::SetUpJobFactoryDefaults( |
| 602 net::URLRequestJobFactory* job_factory, | 587 net::URLRequestJobFactory* job_factory, |
| 603 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 588 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 604 protocol_handler_interceptor, | 589 protocol_handler_interceptor, |
| 605 net::NetworkDelegate* network_delegate, | 590 net::NetworkDelegate* network_delegate, |
| 606 net::FtpTransactionFactory* ftp_transaction_factory, | 591 net::FtpTransactionFactory* ftp_transaction_factory, |
| 607 net::FtpAuthCache* ftp_auth_cache) const { | 592 net::FtpAuthCache* ftp_auth_cache) const { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 params->http_pipelining_enabled = globals->http_pipelining_enabled; | 702 params->http_pipelining_enabled = globals->http_pipelining_enabled; |
| 718 params->testing_fixed_http_port = globals->testing_fixed_http_port; | 703 params->testing_fixed_http_port = globals->testing_fixed_http_port; |
| 719 params->testing_fixed_https_port = globals->testing_fixed_https_port; | 704 params->testing_fixed_https_port = globals->testing_fixed_https_port; |
| 720 | 705 |
| 721 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 706 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 722 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { | 707 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { |
| 723 params->trusted_spdy_proxy = command_line.GetSwitchValueASCII( | 708 params->trusted_spdy_proxy = command_line.GetSwitchValueASCII( |
| 724 switches::kTrustedSpdyProxy); | 709 switches::kTrustedSpdyProxy); |
| 725 } | 710 } |
| 726 } | 711 } |
| OLD | NEW |