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

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

Issue 2674953003: Only generate suggested filenames when actually dragging an image. (Closed)
Patch Set: Maybe? Created 3 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
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0)) 1155 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0))
1156 version = WebURLResponse::HTTPVersion_1_0; 1156 version = WebURLResponse::HTTPVersion_1_0;
1157 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1)) 1157 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1))
1158 version = WebURLResponse::HTTPVersion_1_1; 1158 version = WebURLResponse::HTTPVersion_1_1;
1159 else if (headers->GetHttpVersion() == net::HttpVersion(2, 0)) 1159 else if (headers->GetHttpVersion() == net::HttpVersion(2, 0))
1160 version = WebURLResponse::HTTPVersion_2_0; 1160 version = WebURLResponse::HTTPVersion_2_0;
1161 response->setHTTPVersion(version); 1161 response->setHTTPVersion(version);
1162 response->setHTTPStatusCode(headers->response_code()); 1162 response->setHTTPStatusCode(headers->response_code());
1163 response->setHTTPStatusText(WebString::fromLatin1(headers->GetStatusText())); 1163 response->setHTTPStatusText(WebString::fromLatin1(headers->GetStatusText()));
1164 1164
1165 // TODO(darin): We should leverage HttpResponseHeaders for this, and this
1166 // should be using the same code as ResourceDispatcherHost.
1167 // TODO(jungshik): Figure out the actual value of the referrer charset and
1168 // pass it to GetSuggestedFilename.
1169 std::string value;
1170 headers->EnumerateHeader(NULL, "content-disposition", &value);
1171 response->setSuggestedFileName(blink::WebString::fromUTF16(
1172 net::GetSuggestedFilename(url, value,
1173 std::string(), // referrer_charset
1174 std::string(), // suggested_name
1175 std::string(), // mime_type
1176 std::string()))); // default_name
1177
1178 Time time_val; 1165 Time time_val;
1179 if (headers->GetLastModifiedValue(&time_val)) 1166 if (headers->GetLastModifiedValue(&time_val))
1180 response->setLastModifiedDate(time_val.ToDoubleT()); 1167 response->setLastModifiedDate(time_val.ToDoubleT());
1181 1168
1182 // Build up the header map. 1169 // Build up the header map.
1183 size_t iter = 0; 1170 size_t iter = 0;
1184 std::string name; 1171 std::string name;
1172 std::string value;
1185 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { 1173 while (headers->EnumerateHeaderLines(&iter, &name, &value)) {
1186 response->addHTTPHeaderField(WebString::fromLatin1(name), 1174 response->addHTTPHeaderField(WebString::fromLatin1(name),
1187 WebString::fromLatin1(value)); 1175 WebString::fromLatin1(value));
1188 } 1176 }
1189 } 1177 }
1190 1178
1191 WebURLRequest WebURLLoaderImpl::PopulateURLRequestForRedirect( 1179 WebURLRequest WebURLLoaderImpl::PopulateURLRequestForRedirect(
1192 const blink::WebURLRequest& request, 1180 const blink::WebURLRequest& request,
1193 const net::RedirectInfo& redirect_info, 1181 const net::RedirectInfo& redirect_info,
1194 blink::WebURLRequest::SkipServiceWorker skip_service_worker) { 1182 blink::WebURLRequest::SkipServiceWorker skip_service_worker) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 int intra_priority_value) { 1260 int intra_priority_value) {
1273 context_->DidChangePriority(new_priority, intra_priority_value); 1261 context_->DidChangePriority(new_priority, intra_priority_value);
1274 } 1262 }
1275 1263
1276 void WebURLLoaderImpl::setLoadingTaskRunner( 1264 void WebURLLoaderImpl::setLoadingTaskRunner(
1277 base::SingleThreadTaskRunner* loading_task_runner) { 1265 base::SingleThreadTaskRunner* loading_task_runner) {
1278 context_->SetTaskRunner(loading_task_runner); 1266 context_->SetTaskRunner(loading_task_runner);
1279 } 1267 }
1280 1268
1281 } // namespace content 1269 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698