| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 } | 449 } |
| 450 | 450 |
| 451 virtual void AppendFileRangeToUpload(const std::wstring& file_path, | 451 virtual void AppendFileRangeToUpload(const std::wstring& file_path, |
| 452 uint64 offset, uint64 length) { | 452 uint64 offset, uint64 length) { |
| 453 DCHECK(params_.get()); | 453 DCHECK(params_.get()); |
| 454 if (!params_->upload) | 454 if (!params_->upload) |
| 455 params_->upload = new net::UploadData(); | 455 params_->upload = new net::UploadData(); |
| 456 params_->upload->AppendFileRange(file_path, offset, length); | 456 params_->upload->AppendFileRange(file_path, offset, length); |
| 457 } | 457 } |
| 458 | 458 |
| 459 virtual void SetUploadIdentifier(int64 identifier) { |
| 460 DCHECK(params_.get()); |
| 461 if (!params_->upload) |
| 462 params_->upload = new net::UploadData(); |
| 463 params_->upload->set_identifier(identifier); |
| 464 } |
| 465 |
| 459 virtual bool Start(Peer* peer) { | 466 virtual bool Start(Peer* peer) { |
| 460 DCHECK(!proxy_); | 467 DCHECK(!proxy_); |
| 461 | 468 |
| 462 if (!EnsureIOThread()) | 469 if (!EnsureIOThread()) |
| 463 return false; | 470 return false; |
| 464 | 471 |
| 465 proxy_ = new RequestProxy(); | 472 proxy_ = new RequestProxy(); |
| 466 proxy_->AddRef(); | 473 proxy_->AddRef(); |
| 467 | 474 |
| 468 proxy_->Start(peer, params_.release()); | 475 proxy_->Start(peer, params_.release()); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 return std::string(); | 635 return std::string(); |
| 629 } | 636 } |
| 630 | 637 |
| 631 scoped_refptr<CookieGetter> getter = new CookieGetter(); | 638 scoped_refptr<CookieGetter> getter = new CookieGetter(); |
| 632 | 639 |
| 633 io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( | 640 io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
| 634 getter.get(), &CookieGetter::Get, url)); | 641 getter.get(), &CookieGetter::Get, url)); |
| 635 | 642 |
| 636 return getter->GetResult(); | 643 return getter->GetResult(); |
| 637 } | 644 } |
| OLD | NEW |