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

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

Issue 46303005: Fix chrome upload with content uri (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
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/child/weburlloader_impl.h" 7 #include "webkit/child/weburlloader_impl.h"
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 switch (element.type) { 404 switch (element.type) {
405 case WebHTTPBody::Element::TypeData: 405 case WebHTTPBody::Element::TypeData:
406 if (!element.data.isEmpty()) { 406 if (!element.data.isEmpty()) {
407 // WebKit sometimes gives up empty data to append. These aren't 407 // WebKit sometimes gives up empty data to append. These aren't
408 // necessary so we just optimize those out here. 408 // necessary so we just optimize those out here.
409 request_body->AppendBytes( 409 request_body->AppendBytes(
410 element.data.data(), static_cast<int>(element.data.size())); 410 element.data.data(), static_cast<int>(element.data.size()));
411 } 411 }
412 break; 412 break;
413 case WebHTTPBody::Element::TypeFile: 413 case WebHTTPBody::Element::TypeFile:
414 #if defined(OS_ANDROID)
415 {
416 GURL content_url = GURL(element.filePath);
417
418 if (content_url.SchemeIsContent()) {
419 if (element.fileLength == -1) {
420 request_body->AppendContentUrlRange(
421 content_url, 0, kuint64max, base::Time());
422 } else {
423 request_body->AppendContentUrlRange(
424 content_url,
425 static_cast<uint64>(element.fileStart),
426 static_cast<uint64>(element.fileLength),
427 base::Time::FromDoubleT(element.modificationTime));
428 }
429 break;
430 }
431 }
432 #endif
414 if (element.fileLength == -1) { 433 if (element.fileLength == -1) {
415 request_body->AppendFileRange( 434 request_body->AppendFileRange(
416 base::FilePath::FromUTF16Unsafe(element.filePath), 435 base::FilePath::FromUTF16Unsafe(element.filePath),
417 0, kuint64max, base::Time()); 436 0, kuint64max, base::Time());
418 } else { 437 } else {
419 request_body->AppendFileRange( 438 request_body->AppendFileRange(
420 base::FilePath::FromUTF16Unsafe(element.filePath), 439 base::FilePath::FromUTF16Unsafe(element.filePath),
421 static_cast<uint64>(element.fileStart), 440 static_cast<uint64>(element.fileStart),
422 static_cast<uint64>(element.fileLength), 441 static_cast<uint64>(element.fileLength),
423 base::Time::FromDoubleT(element.modificationTime)); 442 base::Time::FromDoubleT(element.modificationTime));
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 864
846 void WebURLLoaderImpl::setDefersLoading(bool value) { 865 void WebURLLoaderImpl::setDefersLoading(bool value) {
847 context_->SetDefersLoading(value); 866 context_->SetDefersLoading(value);
848 } 867 }
849 868
850 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) { 869 void WebURLLoaderImpl::didChangePriority(WebURLRequest::Priority new_priority) {
851 context_->DidChangePriority(new_priority); 870 context_->DidChangePriority(new_priority);
852 } 871 }
853 872
854 } // namespace webkit_glue 873 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698