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

Side by Side Diff: webkit/glue/weburlloader_impl.cc

Issue 11790003: Always make an attempt to fill in the suggested filename. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // An implementation of WebURLLoader in terms of ResourceLoaderBridge. 5 // An implementation of WebURLLoader in terms of ResourceLoaderBridge.
6 6
7 #include "webkit/glue/weburlloader_impl.h" 7 #include "webkit/glue/weburlloader_impl.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1)) 238 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1))
239 version = WebURLResponse::HTTP_1_1; 239 version = WebURLResponse::HTTP_1_1;
240 response->setHTTPVersion(version); 240 response->setHTTPVersion(version);
241 response->setHTTPStatusCode(headers->response_code()); 241 response->setHTTPStatusCode(headers->response_code());
242 response->setHTTPStatusText(WebString::fromUTF8(headers->GetStatusText())); 242 response->setHTTPStatusText(WebString::fromUTF8(headers->GetStatusText()));
243 243
244 // TODO(darin): We should leverage HttpResponseHeaders for this, and this 244 // TODO(darin): We should leverage HttpResponseHeaders for this, and this
245 // should be using the same code as ResourceDispatcherHost. 245 // should be using the same code as ResourceDispatcherHost.
246 // TODO(jungshik): Figure out the actual value of the referrer charset and 246 // TODO(jungshik): Figure out the actual value of the referrer charset and
247 // pass it to GetSuggestedFilename. 247 // pass it to GetSuggestedFilename.
248 std::string value; 248 std::string disposition_filename;
249 if (headers->EnumerateHeader(NULL, "content-disposition", &value)) { 249 headers->EnumerateHeader(NULL, "content-disposition", &disposition_filename);
250 response->setSuggestedFileName( 250 response->setSuggestedFileName(
251 net::GetSuggestedFilename(url, value, "", "", "", std::string())); 251 net::GetSuggestedFilename(url,
252 } 252 disposition_filename,
253 std::string(), // referrer_charset
254 std::string(), // suggested_name
255 std::string(), // mime_type
256 std::string())); // default_name
253 257
254 Time time_val; 258 Time time_val;
255 if (headers->GetLastModifiedValue(&time_val)) 259 if (headers->GetLastModifiedValue(&time_val))
256 response->setLastModifiedDate(time_val.ToDoubleT()); 260 response->setLastModifiedDate(time_val.ToDoubleT());
257 261
258 // Build up the header map. 262 // Build up the header map.
259 void* iter = NULL; 263 void* iter = NULL;
260 std::string name; 264 std::string name;
261 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { 265 while (headers->EnumerateHeaderLines(&iter, &name, &disposition_filename)) {
darin (slow to review) 2013/01/07 23:05:03 nit: This is an awkward use of the variable named
Avi (use Gerrit) 2013/01/07 23:08:26 I actually didn't see this second use of |value| :
262 response->addHTTPHeaderField(WebString::fromUTF8(name), 266 response->addHTTPHeaderField(WebString::fromUTF8(name),
263 WebString::fromUTF8(value)); 267 WebString::fromUTF8(disposition_filename));
264 } 268 }
265 } 269 }
266 270
267 } // namespace 271 } // namespace
268 272
269 // WebURLLoaderImpl::Context -------------------------------------------------- 273 // WebURLLoaderImpl::Context --------------------------------------------------
270 274
271 // This inner class exists since the WebURLLoader may be deleted while inside a 275 // This inner class exists since the WebURLLoader may be deleted while inside a
272 // call to WebURLLoaderClient. The bridge requires its Peer to stay alive 276 // call to WebURLLoaderClient. The bridge requires its Peer to stay alive
273 // until it receives OnCompletedRequest. 277 // until it receives OnCompletedRequest.
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 776
773 void WebURLLoaderImpl::cancel() { 777 void WebURLLoaderImpl::cancel() {
774 context_->Cancel(); 778 context_->Cancel();
775 } 779 }
776 780
777 void WebURLLoaderImpl::setDefersLoading(bool value) { 781 void WebURLLoaderImpl::setDefersLoading(bool value) {
778 context_->SetDefersLoading(value); 782 context_->SetDefersLoading(value);
779 } 783 }
780 784
781 } // namespace webkit_glue 785 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698