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

Side by Side Diff: chrome/browser/drive/drive_api_service.cc

Issue 944413003: Add support for setting properties to requests uploading contents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
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 #include "chrome/browser/drive/drive_api_service.h" 5 #include "chrome/browser/drive/drive_api_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 InitiateUploadNewFileRequest* request = 557 InitiateUploadNewFileRequest* request =
558 new InitiateUploadNewFileRequest(sender_.get(), 558 new InitiateUploadNewFileRequest(sender_.get(),
559 url_generator_, 559 url_generator_,
560 content_type, 560 content_type,
561 content_length, 561 content_length,
562 parent_resource_id, 562 parent_resource_id,
563 title, 563 title,
564 callback); 564 callback);
565 request->set_modified_date(options.modified_date); 565 request->set_modified_date(options.modified_date);
566 request->set_last_viewed_by_me_date(options.last_viewed_by_me_date); 566 request->set_last_viewed_by_me_date(options.last_viewed_by_me_date);
567 request->set_properties(options.properties);
567 return sender_->StartRequestWithRetry(request); 568 return sender_->StartRequestWithRetry(request);
568 } 569 }
569 570
570 CancelCallback DriveAPIService::InitiateUploadExistingFile( 571 CancelCallback DriveAPIService::InitiateUploadExistingFile(
571 const std::string& content_type, 572 const std::string& content_type,
572 int64 content_length, 573 int64 content_length,
573 const std::string& resource_id, 574 const std::string& resource_id,
574 const UploadExistingFileOptions& options, 575 const UploadExistingFileOptions& options,
575 const InitiateUploadCallback& callback) { 576 const InitiateUploadCallback& callback) {
576 DCHECK(thread_checker_.CalledOnValidThread()); 577 DCHECK(thread_checker_.CalledOnValidThread());
577 DCHECK(!callback.is_null()); 578 DCHECK(!callback.is_null());
578 579
579 InitiateUploadExistingFileRequest* request = 580 InitiateUploadExistingFileRequest* request =
580 new InitiateUploadExistingFileRequest(sender_.get(), 581 new InitiateUploadExistingFileRequest(sender_.get(),
581 url_generator_, 582 url_generator_,
582 content_type, 583 content_type,
583 content_length, 584 content_length,
584 resource_id, 585 resource_id,
585 options.etag, 586 options.etag,
586 callback); 587 callback);
587 request->set_parent_resource_id(options.parent_resource_id); 588 request->set_parent_resource_id(options.parent_resource_id);
588 request->set_title(options.title); 589 request->set_title(options.title);
589 request->set_modified_date(options.modified_date); 590 request->set_modified_date(options.modified_date);
590 request->set_last_viewed_by_me_date(options.last_viewed_by_me_date); 591 request->set_last_viewed_by_me_date(options.last_viewed_by_me_date);
592 request->set_properties(options.properties);
591 return sender_->StartRequestWithRetry(request); 593 return sender_->StartRequestWithRetry(request);
592 } 594 }
593 595
594 CancelCallback DriveAPIService::ResumeUpload( 596 CancelCallback DriveAPIService::ResumeUpload(
595 const GURL& upload_url, 597 const GURL& upload_url,
596 int64 start_position, 598 int64 start_position,
597 int64 end_position, 599 int64 end_position,
598 int64 content_length, 600 int64 content_length,
599 const std::string& content_type, 601 const std::string& content_type,
600 const base::FilePath& local_file_path, 602 const base::FilePath& local_file_path,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 const UploadNewFileOptions& options, 641 const UploadNewFileOptions& options,
640 const FileResourceCallback& callback, 642 const FileResourceCallback& callback,
641 const google_apis::ProgressCallback& progress_callback) { 643 const google_apis::ProgressCallback& progress_callback) {
642 DCHECK(thread_checker_.CalledOnValidThread()); 644 DCHECK(thread_checker_.CalledOnValidThread());
643 DCHECK(!callback.is_null()); 645 DCHECK(!callback.is_null());
644 646
645 return sender_->StartRequestWithRetry( 647 return sender_->StartRequestWithRetry(
646 new google_apis::drive::MultipartUploadNewFileRequest( 648 new google_apis::drive::MultipartUploadNewFileRequest(
647 sender_.get(), title, parent_resource_id, content_type, 649 sender_.get(), title, parent_resource_id, content_type,
648 content_length, options.modified_date, options.last_viewed_by_me_date, 650 content_length, options.modified_date, options.last_viewed_by_me_date,
649 local_file_path, url_generator_, callback, progress_callback)); 651 local_file_path, options.properties, url_generator_, callback,
652 progress_callback));
650 } 653 }
651 654
652 CancelCallback DriveAPIService::MultipartUploadExistingFile( 655 CancelCallback DriveAPIService::MultipartUploadExistingFile(
653 const std::string& content_type, 656 const std::string& content_type,
654 int64 content_length, 657 int64 content_length,
655 const std::string& resource_id, 658 const std::string& resource_id,
656 const base::FilePath& local_file_path, 659 const base::FilePath& local_file_path,
657 const UploadExistingFileOptions& options, 660 const UploadExistingFileOptions& options,
658 const FileResourceCallback& callback, 661 const FileResourceCallback& callback,
659 const google_apis::ProgressCallback& progress_callback) { 662 const google_apis::ProgressCallback& progress_callback) {
660 DCHECK(thread_checker_.CalledOnValidThread()); 663 DCHECK(thread_checker_.CalledOnValidThread());
661 DCHECK(!callback.is_null()); 664 DCHECK(!callback.is_null());
662 665
663 return sender_->StartRequestWithRetry( 666 return sender_->StartRequestWithRetry(
664 new google_apis::drive::MultipartUploadExistingFileRequest( 667 new google_apis::drive::MultipartUploadExistingFileRequest(
665 sender_.get(), options.title, resource_id, options.parent_resource_id, 668 sender_.get(), options.title, resource_id, options.parent_resource_id,
666 content_type, content_length, options.modified_date, 669 content_type, content_length, options.modified_date,
667 options.last_viewed_by_me_date, local_file_path, options.etag, 670 options.last_viewed_by_me_date, local_file_path, options.etag,
668 url_generator_, callback, progress_callback)); 671 options.properties, url_generator_, callback, progress_callback));
669 } 672 }
670 673
671 CancelCallback DriveAPIService::AuthorizeApp( 674 CancelCallback DriveAPIService::AuthorizeApp(
672 const std::string& resource_id, 675 const std::string& resource_id,
673 const std::string& app_id, 676 const std::string& app_id,
674 const AuthorizeAppCallback& callback) { 677 const AuthorizeAppCallback& callback) {
675 DCHECK(thread_checker_.CalledOnValidThread()); 678 DCHECK(thread_checker_.CalledOnValidThread());
676 DCHECK(!callback.is_null()); 679 DCHECK(!callback.is_null());
677 680
678 // Files.Authorize is only available for whitelisted clients like official 681 // Files.Authorize is only available for whitelisted clients like official
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 if (CanSendRequest()) { 773 if (CanSendRequest()) {
771 FOR_EACH_OBSERVER( 774 FOR_EACH_OBSERVER(
772 DriveServiceObserver, observers_, OnReadyToSendRequests()); 775 DriveServiceObserver, observers_, OnReadyToSendRequests());
773 } else if (!HasRefreshToken()) { 776 } else if (!HasRefreshToken()) {
774 FOR_EACH_OBSERVER( 777 FOR_EACH_OBSERVER(
775 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); 778 DriveServiceObserver, observers_, OnRefreshTokenInvalid());
776 } 779 }
777 } 780 }
778 781
779 } // namespace drive 782 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/drive/drive_service_interface.h » ('j') | google_apis/drive/drive_api_requests.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698