| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This file contains an implementation of the ResourceLoaderBridge class. | 5 // This file contains an implementation of the ResourceLoaderBridge class. |
| 6 // The class is implemented using URLRequest, meaning it is a "simple" version | 6 // The class is implemented using URLRequest, meaning it is a "simple" version |
| 7 // that directly issues requests. The more complicated one used in the | 7 // that directly issues requests. The more complicated one used in the |
| 8 // browser uses IPC. | 8 // browser uses IPC. |
| 9 // | 9 // |
| 10 // Because URLRequest only provides an asynchronous resource loading API, this | 10 // Because URLRequest only provides an asynchronous resource loading API, this |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 // -------------------------------------------------------------------------- | 508 // -------------------------------------------------------------------------- |
| 509 // ResourceLoaderBridge implementation: | 509 // ResourceLoaderBridge implementation: |
| 510 | 510 |
| 511 virtual void AppendDataToUpload(const char* data, int data_len) { | 511 virtual void AppendDataToUpload(const char* data, int data_len) { |
| 512 DCHECK(params_.get()); | 512 DCHECK(params_.get()); |
| 513 if (!params_->upload) | 513 if (!params_->upload) |
| 514 params_->upload = new net::UploadData(); | 514 params_->upload = new net::UploadData(); |
| 515 params_->upload->AppendBytes(data, data_len); | 515 params_->upload->AppendBytes(data, data_len); |
| 516 } | 516 } |
| 517 | 517 |
| 518 virtual void AppendFileRangeToUpload(const FilePath& file_path, | 518 virtual void AppendFileRangeToUpload( |
| 519 uint64 offset, uint64 length) { | 519 const FilePath& file_path, |
| 520 uint64 offset, |
| 521 uint64 length, |
| 522 const base::Time& expected_modification_time) { |
| 520 DCHECK(params_.get()); | 523 DCHECK(params_.get()); |
| 521 if (!params_->upload) | 524 if (!params_->upload) |
| 522 params_->upload = new net::UploadData(); | 525 params_->upload = new net::UploadData(); |
| 523 params_->upload->AppendFileRange(file_path, offset, length); | 526 params_->upload->AppendFileRange(file_path, offset, length, |
| 527 expected_modification_time); |
| 524 } | 528 } |
| 525 | 529 |
| 526 virtual void SetUploadIdentifier(int64 identifier) { | 530 virtual void SetUploadIdentifier(int64 identifier) { |
| 527 DCHECK(params_.get()); | 531 DCHECK(params_.get()); |
| 528 if (!params_->upload) | 532 if (!params_->upload) |
| 529 params_->upload = new net::UploadData(); | 533 params_->upload = new net::UploadData(); |
| 530 params_->upload->set_identifier(identifier); | 534 params_->upload->set_identifier(identifier); |
| 531 } | 535 } |
| 532 | 536 |
| 533 virtual bool Start(Peer* peer) { | 537 virtual bool Start(Peer* peer) { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 } | 731 } |
| 728 | 732 |
| 729 // static | 733 // static |
| 730 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) { | 734 void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) { |
| 731 StaticCookiePolicy::Type policy_type = accept_all_cookies ? | 735 StaticCookiePolicy::Type policy_type = accept_all_cookies ? |
| 732 StaticCookiePolicy::ALLOW_ALL_COOKIES : | 736 StaticCookiePolicy::ALLOW_ALL_COOKIES : |
| 733 StaticCookiePolicy::BLOCK_THIRD_PARTY_COOKIES; | 737 StaticCookiePolicy::BLOCK_THIRD_PARTY_COOKIES; |
| 734 static_cast<StaticCookiePolicy*>(request_context->cookie_policy())-> | 738 static_cast<StaticCookiePolicy*>(request_context->cookie_policy())-> |
| 735 set_type(policy_type); | 739 set_type(policy_type); |
| 736 } | 740 } |
| OLD | NEW |