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

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

Issue 9317018: referrer_charset is a lie. It's really the user's default_charset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 params->appcache_service = profile->GetAppCacheService(); 196 params->appcache_service = profile->GetAppCacheService();
197 197
198 // Set up Accept-Language and Accept-Charset header values 198 // Set up Accept-Language and Accept-Charset header values
199 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader( 199 params->accept_language = net::HttpUtil::GenerateAcceptLanguageHeader(
200 pref_service->GetString(prefs::kAcceptLanguages)); 200 pref_service->GetString(prefs::kAcceptLanguages));
201 std::string default_charset = 201 std::string default_charset =
202 pref_service->GetString(prefs::kGlobalDefaultCharset); 202 pref_service->GetString(prefs::kGlobalDefaultCharset);
203 params->accept_charset = 203 params->accept_charset =
204 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset); 204 net::HttpUtil::GenerateAcceptCharsetHeader(default_charset);
205 205 params->default_charset = default_charset;
206 // At this point, we don't know the charset of the referring page
207 // where a url request originates from. This is used to get a suggested
208 // filename from Content-Disposition header made of raw 8bit characters.
209 // Down the road, it can be overriden if it becomes known (for instance,
210 // when download request is made through the context menu in a web page).
211 // At the moment, it'll remain 'undeterministic' when a user
212 // types a URL in the omnibar or click on a download link in a page.
213 // For the latter, we need a change on the webkit-side.
214 // We initialize it to the default charset here and a user will
215 // have an *arguably* better default charset for interpreting a raw 8bit
216 // C-D header field. It means the native OS codepage fallback in
217 // net_util::GetSuggestedFilename is unlikely to be taken.
218 params->referrer_charset = default_charset;
219
220 params->io_thread = g_browser_process->io_thread(); 206 params->io_thread = g_browser_process->io_thread();
221 params->audio_manager = g_browser_process->audio_manager(); 207 params->audio_manager = g_browser_process->audio_manager();
222 208
223 params->host_content_settings_map = profile->GetHostContentSettingsMap(); 209 params->host_content_settings_map = profile->GetHostContentSettingsMap();
224 params->cookie_settings = CookieSettings::GetForProfile(profile); 210 params->cookie_settings = CookieSettings::GetForProfile(profile);
225 params->host_zoom_map = profile->GetHostZoomMap(); 211 params->host_zoom_map = profile->GetHostZoomMap();
226 params->ssl_config_service = profile->GetSSLConfigService(); 212 params->ssl_config_service = profile->GetSSLConfigService();
227 base::Callback<Profile*(void)> profile_getter = 213 base::Callback<Profile*(void)> profile_getter =
228 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), 214 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(),
229 profile); 215 profile);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 504
519 profile_params_.reset(); 505 profile_params_.reset();
520 initialized_ = true; 506 initialized_ = true;
521 } 507 }
522 508
523 void ProfileIOData::ApplyProfileParamsToContext( 509 void ProfileIOData::ApplyProfileParamsToContext(
524 ChromeURLRequestContext* context) const { 510 ChromeURLRequestContext* context) const {
525 context->set_is_incognito(profile_params_->is_incognito); 511 context->set_is_incognito(profile_params_->is_incognito);
526 context->set_accept_language(profile_params_->accept_language); 512 context->set_accept_language(profile_params_->accept_language);
527 context->set_accept_charset(profile_params_->accept_charset); 513 context->set_accept_charset(profile_params_->accept_charset);
528 context->set_referrer_charset(profile_params_->referrer_charset); 514 context->set_default_charset(profile_params_->default_charset);
529 context->set_ssl_config_service(profile_params_->ssl_config_service); 515 context->set_ssl_config_service(profile_params_->ssl_config_service);
530 } 516 }
531 517
532 void ProfileIOData::ShutdownOnUIThread() { 518 void ProfileIOData::ShutdownOnUIThread() {
533 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 519 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
534 enable_referrers_.Destroy(); 520 enable_referrers_.Destroy();
535 clear_local_state_on_exit_.Destroy(); 521 clear_local_state_on_exit_.Destroy();
536 safe_browsing_enabled_.Destroy(); 522 safe_browsing_enabled_.Destroy();
537 #if defined(ENABLE_CONFIGURATION_POLICY) 523 #if defined(ENABLE_CONFIGURATION_POLICY)
538 if (url_blacklist_manager_.get()) 524 if (url_blacklist_manager_.get())
539 url_blacklist_manager_->ShutdownOnUIThread(); 525 url_blacklist_manager_->ShutdownOnUIThread();
540 #endif 526 #endif
541 BrowserThread::PostTask( 527 BrowserThread::PostTask(
542 BrowserThread::IO, FROM_HERE, 528 BrowserThread::IO, FROM_HERE,
543 base::Bind( 529 base::Bind(
544 &ResourceDispatcherHost::CancelRequestsForContext, 530 &ResourceDispatcherHost::CancelRequestsForContext,
545 base::Unretained(ResourceDispatcherHost::Get()), 531 base::Unretained(ResourceDispatcherHost::Get()),
546 &resource_context_)); 532 &resource_context_));
547 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); 533 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this);
548 if (!posted) 534 if (!posted)
549 delete this; 535 delete this;
550 } 536 }
551 537
552 void ProfileIOData::set_origin_bound_cert_service( 538 void ProfileIOData::set_origin_bound_cert_service(
553 net::OriginBoundCertService* origin_bound_cert_service) const { 539 net::OriginBoundCertService* origin_bound_cert_service) const {
554 origin_bound_cert_service_.reset(origin_bound_cert_service); 540 origin_bound_cert_service_.reset(origin_bound_cert_service);
555 } 541 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | content/browser/download/download_create_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698