OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/glue/weburlloader_impl.h" | 7 #include "webkit/glue/weburlloader_impl.h" |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 switch (element.type) { | 368 switch (element.type) { |
369 case WebHTTPBody::Element::TypeData: | 369 case WebHTTPBody::Element::TypeData: |
370 if (!element.data.isEmpty()) { | 370 if (!element.data.isEmpty()) { |
371 // WebKit sometimes gives up empty data to append. These aren't | 371 // WebKit sometimes gives up empty data to append. These aren't |
372 // necessary so we just optimize those out here. | 372 // necessary so we just optimize those out here. |
373 bridge_->AppendDataToUpload( | 373 bridge_->AppendDataToUpload( |
374 element.data.data(), static_cast<int>(element.data.size())); | 374 element.data.data(), static_cast<int>(element.data.size())); |
375 } | 375 } |
376 break; | 376 break; |
377 case WebHTTPBody::Element::TypeFile: | 377 case WebHTTPBody::Element::TypeFile: |
378 bridge_->AppendFileToUpload(WebStringToFilePath(element.filePath)); | 378 if (element.fileLength == -1) { |
| 379 bridge_->AppendFileToUpload( |
| 380 WebStringToFilePath(element.filePath)); |
| 381 } else { |
| 382 bridge_->AppendFileRangeToUpload( |
| 383 WebStringToFilePath(element.filePath), |
| 384 static_cast<uint64>(element.fileStart), |
| 385 static_cast<uint64>(element.fileLength), |
| 386 base::Time::FromDoubleT(element.fileInfo.modificationTime)); |
| 387 } |
379 break; | 388 break; |
380 default: | 389 default: |
381 NOTREACHED(); | 390 NOTREACHED(); |
382 } | 391 } |
383 } | 392 } |
384 bridge_->SetUploadIdentifier(request.httpBody().identifier()); | 393 bridge_->SetUploadIdentifier(request.httpBody().identifier()); |
385 } | 394 } |
386 | 395 |
387 if (sync_load_response) { | 396 if (sync_load_response) { |
388 bridge_->SyncLoad(sync_load_response); | 397 bridge_->SyncLoad(sync_load_response); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 624 |
616 void WebURLLoaderImpl::cancel() { | 625 void WebURLLoaderImpl::cancel() { |
617 context_->Cancel(); | 626 context_->Cancel(); |
618 } | 627 } |
619 | 628 |
620 void WebURLLoaderImpl::setDefersLoading(bool value) { | 629 void WebURLLoaderImpl::setDefersLoading(bool value) { |
621 context_->SetDefersLoading(value); | 630 context_->SetDefersLoading(value); |
622 } | 631 } |
623 | 632 |
624 } // namespace webkit_glue | 633 } // namespace webkit_glue |
OLD | NEW |