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

Side by Side Diff: content/child/web_url_loader_impl.cc

Issue 2398053003: Compute ResourceResponse::suggestedFileName on the fly. (Closed)
Patch Set: clean up vestigial changes (trybots previous) Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/clipboard/DataTransfer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <openssl/ssl.h> 7 #include <openssl/ssl.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0)) 1104 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0))
1105 version = WebURLResponse::HTTPVersion_1_0; 1105 version = WebURLResponse::HTTPVersion_1_0;
1106 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1)) 1106 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1))
1107 version = WebURLResponse::HTTPVersion_1_1; 1107 version = WebURLResponse::HTTPVersion_1_1;
1108 else if (headers->GetHttpVersion() == net::HttpVersion(2, 0)) 1108 else if (headers->GetHttpVersion() == net::HttpVersion(2, 0))
1109 version = WebURLResponse::HTTPVersion_2_0; 1109 version = WebURLResponse::HTTPVersion_2_0;
1110 response->setHTTPVersion(version); 1110 response->setHTTPVersion(version);
1111 response->setHTTPStatusCode(headers->response_code()); 1111 response->setHTTPStatusCode(headers->response_code());
1112 response->setHTTPStatusText(WebString::fromLatin1(headers->GetStatusText())); 1112 response->setHTTPStatusText(WebString::fromLatin1(headers->GetStatusText()));
1113 1113
1114 // TODO(darin): We should leverage HttpResponseHeaders for this, and this
1115 // should be using the same code as ResourceDispatcherHost.
1116 // TODO(jungshik): Figure out the actual value of the referrer charset and
1117 // pass it to GetSuggestedFilename.
1118 std::string value;
1119 headers->EnumerateHeader(NULL, "content-disposition", &value);
1120 response->setSuggestedFileName(
1121 net::GetSuggestedFilename(url,
1122 value,
1123 std::string(), // referrer_charset
1124 std::string(), // suggested_name
1125 std::string(), // mime_type
1126 std::string())); // default_name
1127
1128 Time time_val; 1114 Time time_val;
1129 if (headers->GetLastModifiedValue(&time_val)) 1115 if (headers->GetLastModifiedValue(&time_val))
1130 response->setLastModifiedDate(time_val.ToDoubleT()); 1116 response->setLastModifiedDate(time_val.ToDoubleT());
1131 1117
1132 // Build up the header map. 1118 // Build up the header map.
1133 size_t iter = 0; 1119 size_t iter = 0;
1134 std::string name; 1120 std::string name;
1135 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { 1121 while (headers->EnumerateHeaderLines(&iter, &name, &value)) {
1136 response->addHTTPHeaderField(WebString::fromLatin1(name), 1122 response->addHTTPHeaderField(WebString::fromLatin1(name),
1137 WebString::fromLatin1(value)); 1123 WebString::fromLatin1(value));
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 response->clearHTTPHeaderField(webStringName); 1255 response->clearHTTPHeaderField(webStringName);
1270 while (response_headers->EnumerateHeader(&iterator, name, &value)) { 1256 while (response_headers->EnumerateHeader(&iterator, name, &value)) {
1271 response->addHTTPHeaderField(webStringName, 1257 response->addHTTPHeaderField(webStringName,
1272 WebString::fromLatin1(value)); 1258 WebString::fromLatin1(value));
1273 } 1259 }
1274 } 1260 }
1275 return true; 1261 return true;
1276 } 1262 }
1277 1263
1278 } // namespace content 1264 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/clipboard/DataTransfer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698