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

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: rebase 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
« no previous file with comments | « content/browser/web_contents/web_drag_source_mac.mm ('k') | content/common/drag_traits.h » ('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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0)) 1157 else if (headers->GetHttpVersion() == net::HttpVersion(1, 0))
1158 version = WebURLResponse::HTTPVersion_1_0; 1158 version = WebURLResponse::HTTPVersion_1_0;
1159 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1)) 1159 else if (headers->GetHttpVersion() == net::HttpVersion(1, 1))
1160 version = WebURLResponse::HTTPVersion_1_1; 1160 version = WebURLResponse::HTTPVersion_1_1;
1161 else if (headers->GetHttpVersion() == net::HttpVersion(2, 0)) 1161 else if (headers->GetHttpVersion() == net::HttpVersion(2, 0))
1162 version = WebURLResponse::HTTPVersion_2_0; 1162 version = WebURLResponse::HTTPVersion_2_0;
1163 response->setHTTPVersion(version); 1163 response->setHTTPVersion(version);
1164 response->setHTTPStatusCode(headers->response_code()); 1164 response->setHTTPStatusCode(headers->response_code());
1165 response->setHTTPStatusText(WebString::fromLatin1(headers->GetStatusText())); 1165 response->setHTTPStatusText(WebString::fromLatin1(headers->GetStatusText()));
1166 1166
1167 // TODO(darin): We should leverage HttpResponseHeaders for this, and this
1168 // should be using the same code as ResourceDispatcherHost.
1169 // TODO(jungshik): Figure out the actual value of the referrer charset and
1170 // pass it to GetSuggestedFilename.
1171 std::string value;
1172 headers->EnumerateHeader(NULL, "content-disposition", &value);
1173 response->setSuggestedFileName(blink::WebString::fromUTF16(
1174 net::GetSuggestedFilename(url, value,
1175 std::string(), // referrer_charset
1176 std::string(), // suggested_name
1177 std::string(), // mime_type
1178 std::string()))); // default_name
1179
1180 Time time_val; 1167 Time time_val;
1181 if (headers->GetLastModifiedValue(&time_val)) 1168 if (headers->GetLastModifiedValue(&time_val))
1182 response->setLastModifiedDate(time_val.ToDoubleT()); 1169 response->setLastModifiedDate(time_val.ToDoubleT());
1183 1170
1184 // Build up the header map. 1171 // Build up the header map.
1185 size_t iter = 0; 1172 size_t iter = 0;
1186 std::string name; 1173 std::string name;
1174 std::string value;
1187 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { 1175 while (headers->EnumerateHeaderLines(&iter, &name, &value)) {
1188 response->addHTTPHeaderField(WebString::fromLatin1(name), 1176 response->addHTTPHeaderField(WebString::fromLatin1(name),
1189 WebString::fromLatin1(value)); 1177 WebString::fromLatin1(value));
1190 } 1178 }
1191 } 1179 }
1192 1180
1193 WebURLRequest WebURLLoaderImpl::PopulateURLRequestForRedirect( 1181 WebURLRequest WebURLLoaderImpl::PopulateURLRequestForRedirect(
1194 const blink::WebURLRequest& request, 1182 const blink::WebURLRequest& request,
1195 const net::RedirectInfo& redirect_info, 1183 const net::RedirectInfo& redirect_info,
1196 blink::WebURLRequest::SkipServiceWorker skip_service_worker) { 1184 blink::WebURLRequest::SkipServiceWorker skip_service_worker) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 int intra_priority_value) { 1262 int intra_priority_value) {
1275 context_->DidChangePriority(new_priority, intra_priority_value); 1263 context_->DidChangePriority(new_priority, intra_priority_value);
1276 } 1264 }
1277 1265
1278 void WebURLLoaderImpl::setLoadingTaskRunner( 1266 void WebURLLoaderImpl::setLoadingTaskRunner(
1279 base::SingleThreadTaskRunner* loading_task_runner) { 1267 base::SingleThreadTaskRunner* loading_task_runner) {
1280 context_->SetTaskRunner(loading_task_runner); 1268 context_->SetTaskRunner(loading_task_runner);
1281 } 1269 }
1282 1270
1283 } // namespace content 1271 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_drag_source_mac.mm ('k') | content/common/drag_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698