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

Side by Side Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 83002: download filename fix (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/net/chrome_url_request_context.h" 5 #include "chrome/browser/net/chrome_url_request_context.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_thread.h" 10 #include "chrome/browser/chrome_thread.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile) 191 ChromeURLRequestContext::ChromeURLRequestContext(Profile* profile)
192 : prefs_(profile->GetPrefs()), 192 : prefs_(profile->GetPrefs()),
193 is_media_(false), 193 is_media_(false),
194 is_off_the_record_(profile->IsOffTheRecord()) { 194 is_off_the_record_(profile->IsOffTheRecord()) {
195 // Set up Accept-Language and Accept-Charset header values 195 // Set up Accept-Language and Accept-Charset header values
196 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader( 196 accept_language_ = net::HttpUtil::GenerateAcceptLanguageHeader(
197 WideToASCII(prefs_->GetString(prefs::kAcceptLanguages))); 197 WideToASCII(prefs_->GetString(prefs::kAcceptLanguages)));
198 accept_charset_ = net::HttpUtil::GenerateAcceptCharsetHeader( 198 accept_charset_ = net::HttpUtil::GenerateAcceptCharsetHeader(
199 WideToASCII(prefs_->GetString(prefs::kDefaultCharset))); 199 WideToASCII(prefs_->GetString(prefs::kDefaultCharset)));
200 200
201 // At this point, we don't know the charset of the referring page
202 // where a url request originates from. This is used to get a suggested
203 // filename from Content-Disposition header made of raw 8bit characters.
204 // Down the road, it can be overriden if it becomes known (for instance,
205 // when download request is made through the context menu in a web page).
206 // At the moment, it'll remain 'undeterministic' when a user
207 // types a URL in the omnibar or click on a download link in a page.
208 // For the latter, we need a change on the webkit-side.
209 // We initialize it to the default charset here and a user will
210 // have an *arguably* better default charset for interpreting a raw 8bit
211 // C-D header field. It means the native OS codepage fallback in
212 // net_util::GetSuggestedFilename is unlikely to be taken.
213 referrer_charset_ = accept_charset_;
214
201 cookie_policy_.SetType(net::CookiePolicy::FromInt( 215 cookie_policy_.SetType(net::CookiePolicy::FromInt(
202 prefs_->GetInteger(prefs::kCookieBehavior))); 216 prefs_->GetInteger(prefs::kCookieBehavior)));
203 217
204 if (profile->GetExtensionsService()) { 218 if (profile->GetExtensionsService()) {
205 const ExtensionList* extensions = 219 const ExtensionList* extensions =
206 profile->GetExtensionsService()->extensions(); 220 profile->GetExtensionsService()->extensions();
207 for (ExtensionList::const_iterator iter = extensions->begin(); 221 for (ExtensionList::const_iterator iter = extensions->begin();
208 iter != extensions->end(); ++iter) { 222 iter != extensions->end(); ++iter) {
209 extension_paths_[(*iter)->id()] = (*iter)->path(); 223 extension_paths_[(*iter)->id()] = (*iter)->path();
210 } 224 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // Do not delete the cookie store in the case of the media context, as it is 334 // Do not delete the cookie store in the case of the media context, as it is
321 // owned by the original context. 335 // owned by the original context.
322 if (!is_media_) 336 if (!is_media_)
323 delete cookie_store_; 337 delete cookie_store_;
324 338
325 // Do not delete the proxy service in the case of OTR or media contexts, as 339 // Do not delete the proxy service in the case of OTR or media contexts, as
326 // it is owned by the original URLRequestContext. 340 // it is owned by the original URLRequestContext.
327 if (!is_off_the_record_ && !is_media_) 341 if (!is_off_the_record_ && !is_media_)
328 delete proxy_service_; 342 delete proxy_service_;
329 } 343 }
OLDNEW
« no previous file with comments | « chrome/browser/history/download_types.h ('k') | chrome/browser/renderer_host/download_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698