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

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

Issue 1686263008: Add utility method for WebString to base::FilePath conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase! Created 4 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/child/simple_webmimeregistry_impl.cc ('k') | content/child/webblobregistry_impl.cc » ('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_request_util.h" 5 #include "content/child/web_url_request_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "net/base/load_flags.h" 14 #include "net/base/load_flags.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "third_party/WebKit/public/platform/FilePathConversion.h"
16 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" 17 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
17 #include "third_party/WebKit/public/platform/WebString.h" 18 #include "third_party/WebKit/public/platform/WebString.h"
18 #include "third_party/WebKit/public/platform/WebURL.h" 19 #include "third_party/WebKit/public/platform/WebURL.h"
19 #include "third_party/WebKit/public/platform/WebURLError.h" 20 #include "third_party/WebKit/public/platform/WebURLError.h"
20 #include "third_party/WebKit/public/platform/WebURLRequest.h" 21 #include "third_party/WebKit/public/platform/WebURLRequest.h"
21 22
22 using blink::WebHTTPBody; 23 using blink::WebHTTPBody;
23 using blink::WebString; 24 using blink::WebString;
24 using blink::WebURLRequest; 25 using blink::WebURLRequest;
25 26
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if (!element.data.isEmpty()) { 250 if (!element.data.isEmpty()) {
250 // Blink sometimes gives empty data to append. These aren't 251 // Blink sometimes gives empty data to append. These aren't
251 // necessary so they are just optimized out here. 252 // necessary so they are just optimized out here.
252 request_body->AppendBytes( 253 request_body->AppendBytes(
253 element.data.data(), static_cast<int>(element.data.size())); 254 element.data.data(), static_cast<int>(element.data.size()));
254 } 255 }
255 break; 256 break;
256 case WebHTTPBody::Element::TypeFile: 257 case WebHTTPBody::Element::TypeFile:
257 if (element.fileLength == -1) { 258 if (element.fileLength == -1) {
258 request_body->AppendFileRange( 259 request_body->AppendFileRange(
259 base::FilePath::FromUTF16Unsafe(element.filePath), 0, 260 blink::WebStringToFilePath(element.filePath), 0,
260 std::numeric_limits<uint64_t>::max(), base::Time()); 261 std::numeric_limits<uint64_t>::max(), base::Time());
261 } else { 262 } else {
262 request_body->AppendFileRange( 263 request_body->AppendFileRange(
263 base::FilePath::FromUTF16Unsafe(element.filePath), 264 blink::WebStringToFilePath(element.filePath),
264 static_cast<uint64_t>(element.fileStart), 265 static_cast<uint64_t>(element.fileStart),
265 static_cast<uint64_t>(element.fileLength), 266 static_cast<uint64_t>(element.fileLength),
266 base::Time::FromDoubleT(element.modificationTime)); 267 base::Time::FromDoubleT(element.modificationTime));
267 } 268 }
268 break; 269 break;
269 case WebHTTPBody::Element::TypeFileSystemURL: { 270 case WebHTTPBody::Element::TypeFileSystemURL: {
270 GURL file_system_url = element.fileSystemURL; 271 GURL file_system_url = element.fileSystemURL;
271 DCHECK(file_system_url.SchemeIsFileSystem()); 272 DCHECK(file_system_url.SchemeIsFileSystem());
272 request_body->AppendFileSystemFileRange( 273 request_body->AppendFileSystemFileRange(
273 file_system_url, static_cast<uint64_t>(element.fileStart), 274 file_system_url, static_cast<uint64_t>(element.fileStart),
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 bool stale_copy_in_cache, 443 bool stale_copy_in_cache,
443 int reason, 444 int reason,
444 bool was_ignored_by_handler) { 445 bool was_ignored_by_handler) {
445 blink::WebURLError error = 446 blink::WebURLError error =
446 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); 447 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason);
447 error.wasIgnoredByHandler = was_ignored_by_handler; 448 error.wasIgnoredByHandler = was_ignored_by_handler;
448 return error; 449 return error;
449 } 450 }
450 451
451 } // namespace content 452 } // namespace content
OLDNEW
« no previous file with comments | « content/child/simple_webmimeregistry_impl.cc ('k') | content/child/webblobregistry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698