OLD | NEW |
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 #include "chrome/browser/google_apis/gdata_wapi_requests.h" | 5 #include "chrome/browser/google_apis/gdata_wapi_requests.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/task_runner_util.h" | 9 #include "base/task_runner_util.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 return headers; | 569 return headers; |
570 } | 570 } |
571 | 571 |
572 //======================= InitiateUploadNewFileRequest ======================= | 572 //======================= InitiateUploadNewFileRequest ======================= |
573 | 573 |
574 InitiateUploadNewFileRequest::InitiateUploadNewFileRequest( | 574 InitiateUploadNewFileRequest::InitiateUploadNewFileRequest( |
575 RequestSender* runner, | 575 RequestSender* runner, |
576 net::URLRequestContextGetter* url_request_context_getter, | 576 net::URLRequestContextGetter* url_request_context_getter, |
577 const GDataWapiUrlGenerator& url_generator, | 577 const GDataWapiUrlGenerator& url_generator, |
578 const InitiateUploadCallback& callback, | 578 const InitiateUploadCallback& callback, |
579 const base::FilePath& drive_file_path, | |
580 const std::string& content_type, | 579 const std::string& content_type, |
581 int64 content_length, | 580 int64 content_length, |
582 const std::string& parent_resource_id, | 581 const std::string& parent_resource_id, |
583 const std::string& title) | 582 const std::string& title) |
584 : InitiateUploadRequestBase(runner, | 583 : InitiateUploadRequestBase(runner, |
585 url_request_context_getter, | 584 url_request_context_getter, |
586 callback, | 585 callback, |
587 drive_file_path, | |
588 content_type, | 586 content_type, |
589 content_length), | 587 content_length), |
590 url_generator_(url_generator), | 588 url_generator_(url_generator), |
591 parent_resource_id_(parent_resource_id), | 589 parent_resource_id_(parent_resource_id), |
592 title_(title) { | 590 title_(title) { |
593 } | 591 } |
594 | 592 |
595 InitiateUploadNewFileRequest::~InitiateUploadNewFileRequest() {} | 593 InitiateUploadNewFileRequest::~InitiateUploadNewFileRequest() {} |
596 | 594 |
597 GURL InitiateUploadNewFileRequest::GetURL() const { | 595 GURL InitiateUploadNewFileRequest::GetURL() const { |
(...skipping 24 matching lines...) Expand all Loading... |
622 return true; | 620 return true; |
623 } | 621 } |
624 | 622 |
625 //===================== InitiateUploadExistingFileRequest ==================== | 623 //===================== InitiateUploadExistingFileRequest ==================== |
626 | 624 |
627 InitiateUploadExistingFileRequest::InitiateUploadExistingFileRequest( | 625 InitiateUploadExistingFileRequest::InitiateUploadExistingFileRequest( |
628 RequestSender* runner, | 626 RequestSender* runner, |
629 net::URLRequestContextGetter* url_request_context_getter, | 627 net::URLRequestContextGetter* url_request_context_getter, |
630 const GDataWapiUrlGenerator& url_generator, | 628 const GDataWapiUrlGenerator& url_generator, |
631 const InitiateUploadCallback& callback, | 629 const InitiateUploadCallback& callback, |
632 const base::FilePath& drive_file_path, | |
633 const std::string& content_type, | 630 const std::string& content_type, |
634 int64 content_length, | 631 int64 content_length, |
635 const std::string& resource_id, | 632 const std::string& resource_id, |
636 const std::string& etag) | 633 const std::string& etag) |
637 : InitiateUploadRequestBase(runner, | 634 : InitiateUploadRequestBase(runner, |
638 url_request_context_getter, | 635 url_request_context_getter, |
639 callback, | 636 callback, |
640 drive_file_path, | |
641 content_type, | 637 content_type, |
642 content_length), | 638 content_length), |
643 url_generator_(url_generator), | 639 url_generator_(url_generator), |
644 resource_id_(resource_id), | 640 resource_id_(resource_id), |
645 etag_(etag) { | 641 etag_(etag) { |
646 } | 642 } |
647 | 643 |
648 InitiateUploadExistingFileRequest::~InitiateUploadExistingFileRequest() {} | 644 InitiateUploadExistingFileRequest::~InitiateUploadExistingFileRequest() {} |
649 | 645 |
650 GURL InitiateUploadExistingFileRequest::GetURL() const { | 646 GURL InitiateUploadExistingFileRequest::GetURL() const { |
(...skipping 25 matching lines...) Expand all Loading... |
676 return headers; | 672 return headers; |
677 } | 673 } |
678 | 674 |
679 //============================ ResumeUploadRequest =========================== | 675 //============================ ResumeUploadRequest =========================== |
680 | 676 |
681 ResumeUploadRequest::ResumeUploadRequest( | 677 ResumeUploadRequest::ResumeUploadRequest( |
682 RequestSender* runner, | 678 RequestSender* runner, |
683 net::URLRequestContextGetter* url_request_context_getter, | 679 net::URLRequestContextGetter* url_request_context_getter, |
684 const UploadRangeCallback& callback, | 680 const UploadRangeCallback& callback, |
685 const ProgressCallback& progress_callback, | 681 const ProgressCallback& progress_callback, |
686 const base::FilePath& drive_file_path, | |
687 const GURL& upload_location, | 682 const GURL& upload_location, |
688 int64 start_position, | 683 int64 start_position, |
689 int64 end_position, | 684 int64 end_position, |
690 int64 content_length, | 685 int64 content_length, |
691 const std::string& content_type, | 686 const std::string& content_type, |
692 const base::FilePath& local_file_path) | 687 const base::FilePath& local_file_path) |
693 : ResumeUploadRequestBase(runner, | 688 : ResumeUploadRequestBase(runner, |
694 url_request_context_getter, | 689 url_request_context_getter, |
695 drive_file_path, | |
696 upload_location, | 690 upload_location, |
697 start_position, | 691 start_position, |
698 end_position, | 692 end_position, |
699 content_length, | 693 content_length, |
700 content_type, | 694 content_type, |
701 local_file_path), | 695 local_file_path), |
702 callback_(callback), | 696 callback_(callback), |
703 progress_callback_(progress_callback) { | 697 progress_callback_(progress_callback) { |
704 DCHECK(!callback_.is_null()); | 698 DCHECK(!callback_.is_null()); |
705 } | 699 } |
(...skipping 10 matching lines...) Expand all Loading... |
716 if (!progress_callback_.is_null()) | 710 if (!progress_callback_.is_null()) |
717 progress_callback_.Run(current, total); | 711 progress_callback_.Run(current, total); |
718 } | 712 } |
719 | 713 |
720 //========================== GetUploadStatusRequest ========================== | 714 //========================== GetUploadStatusRequest ========================== |
721 | 715 |
722 GetUploadStatusRequest::GetUploadStatusRequest( | 716 GetUploadStatusRequest::GetUploadStatusRequest( |
723 RequestSender* runner, | 717 RequestSender* runner, |
724 net::URLRequestContextGetter* url_request_context_getter, | 718 net::URLRequestContextGetter* url_request_context_getter, |
725 const UploadRangeCallback& callback, | 719 const UploadRangeCallback& callback, |
726 const base::FilePath& drive_file_path, | |
727 const GURL& upload_url, | 720 const GURL& upload_url, |
728 int64 content_length) | 721 int64 content_length) |
729 : GetUploadStatusRequestBase(runner, | 722 : GetUploadStatusRequestBase(runner, |
730 url_request_context_getter, | 723 url_request_context_getter, |
731 drive_file_path, | |
732 upload_url, | 724 upload_url, |
733 content_length), | 725 content_length), |
734 callback_(callback) { | 726 callback_(callback) { |
735 DCHECK(!callback.is_null()); | 727 DCHECK(!callback.is_null()); |
736 } | 728 } |
737 | 729 |
738 GetUploadStatusRequest::~GetUploadStatusRequest() {} | 730 GetUploadStatusRequest::~GetUploadStatusRequest() {} |
739 | 731 |
740 void GetUploadStatusRequest::OnRangeRequestComplete( | 732 void GetUploadStatusRequest::OnRangeRequestComplete( |
741 const UploadRangeResponse& response, scoped_ptr<base::Value> value) { | 733 const UploadRangeResponse& response, scoped_ptr<base::Value> value) { |
742 callback_.Run(response, ParseResourceEntry(value.Pass())); | 734 callback_.Run(response, ParseResourceEntry(value.Pass())); |
743 } | 735 } |
744 | 736 |
745 } // namespace google_apis | 737 } // namespace google_apis |
OLD | NEW |