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

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

Issue 23514007: Refactor TrashResourceRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_api_requests.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 using google_apis::drive::AppsListRequest; 55 using google_apis::drive::AppsListRequest;
56 using google_apis::drive::ChangesListRequest; 56 using google_apis::drive::ChangesListRequest;
57 using google_apis::drive::ContinueGetFileListRequest; 57 using google_apis::drive::ContinueGetFileListRequest;
58 using google_apis::drive::DeleteResourceRequest; 58 using google_apis::drive::DeleteResourceRequest;
59 using google_apis::drive::DownloadFileRequest; 59 using google_apis::drive::DownloadFileRequest;
60 using google_apis::drive::FilesCopyRequest; 60 using google_apis::drive::FilesCopyRequest;
61 using google_apis::drive::FilesGetRequest; 61 using google_apis::drive::FilesGetRequest;
62 using google_apis::drive::FilesInsertRequest; 62 using google_apis::drive::FilesInsertRequest;
63 using google_apis::drive::FilesPatchRequest; 63 using google_apis::drive::FilesPatchRequest;
64 using google_apis::drive::FilesListRequest; 64 using google_apis::drive::FilesListRequest;
65 using google_apis::drive::FilesTrashRequest;
65 using google_apis::drive::GetUploadStatusRequest; 66 using google_apis::drive::GetUploadStatusRequest;
66 using google_apis::drive::InitiateUploadExistingFileRequest; 67 using google_apis::drive::InitiateUploadExistingFileRequest;
67 using google_apis::drive::InitiateUploadNewFileRequest; 68 using google_apis::drive::InitiateUploadNewFileRequest;
68 using google_apis::drive::InsertResourceRequest; 69 using google_apis::drive::InsertResourceRequest;
69 using google_apis::drive::ResumeUploadRequest; 70 using google_apis::drive::ResumeUploadRequest;
70 using google_apis::drive::TrashResourceRequest;
71 71
72 namespace drive { 72 namespace drive {
73 73
74 namespace { 74 namespace {
75 75
76 // OAuth2 scopes for Drive API. 76 // OAuth2 scopes for Drive API.
77 const char kDriveScope[] = "https://www.googleapis.com/auth/drive"; 77 const char kDriveScope[] = "https://www.googleapis.com/auth/drive";
78 const char kDriveAppsReadonlyScope[] = 78 const char kDriveAppsReadonlyScope[] =
79 "https://www.googleapis.com/auth/drive.apps.readonly"; 79 "https://www.googleapis.com/auth/drive.apps.readonly";
80 80
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 progress_callback)); 585 progress_callback));
586 } 586 }
587 587
588 CancelCallback DriveAPIService::DeleteResource( 588 CancelCallback DriveAPIService::DeleteResource(
589 const std::string& resource_id, 589 const std::string& resource_id,
590 const std::string& etag, 590 const std::string& etag,
591 const EntryActionCallback& callback) { 591 const EntryActionCallback& callback) {
592 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 592 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
593 DCHECK(!callback.is_null()); 593 DCHECK(!callback.is_null());
594 594
595 return sender_->StartRequestWithRetry(new TrashResourceRequest( 595 FilesTrashRequest* request = new FilesTrashRequest(
596 sender_.get(), 596 sender_.get(), url_generator_,
597 url_generator_, 597 base::Bind(&EntryActionCallbackAdapter, callback));
598 resource_id, 598 request->set_file_id(resource_id);
599 callback)); 599 return sender_->StartRequestWithRetry(request);
600 } 600 }
601 601
602 CancelCallback DriveAPIService::AddNewDirectory( 602 CancelCallback DriveAPIService::AddNewDirectory(
603 const std::string& parent_resource_id, 603 const std::string& parent_resource_id,
604 const std::string& directory_title, 604 const std::string& directory_title,
605 const GetResourceEntryCallback& callback) { 605 const GetResourceEntryCallback& callback) {
606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
607 DCHECK(!callback.is_null()); 607 DCHECK(!callback.is_null());
608 608
609 FilesInsertRequest* request = new FilesInsertRequest( 609 FilesInsertRequest* request = new FilesInsertRequest(
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 if (CanSendRequest()) { 869 if (CanSendRequest()) {
870 FOR_EACH_OBSERVER( 870 FOR_EACH_OBSERVER(
871 DriveServiceObserver, observers_, OnReadyToSendRequests()); 871 DriveServiceObserver, observers_, OnReadyToSendRequests());
872 } else if (!HasRefreshToken()) { 872 } else if (!HasRefreshToken()) {
873 FOR_EACH_OBSERVER( 873 FOR_EACH_OBSERVER(
874 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); 874 DriveServiceObserver, observers_, OnRefreshTokenInvalid());
875 } 875 }
876 } 876 }
877 877
878 } // namespace drive 878 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_api_requests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698