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

Unified Diff: chrome/browser/drive/drive_api_service.cc

Issue 23042004: Implement MoveResourceRequest on Drive API v2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/google_apis/drive_api_requests.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/drive/drive_api_service.cc
diff --git a/chrome/browser/drive/drive_api_service.cc b/chrome/browser/drive/drive_api_service.cc
index 6d5a5712f2fb64f972a8fdd9314e0bb2ea684ef9..48ee6b58d687dcf66979f6339bc54b8899597a08 100644
--- a/chrome/browser/drive/drive_api_service.cc
+++ b/chrome/browser/drive/drive_api_service.cc
@@ -65,7 +65,7 @@ using google_apis::drive::GetUploadStatusRequest;
using google_apis::drive::InitiateUploadExistingFileRequest;
using google_apis::drive::InitiateUploadNewFileRequest;
using google_apis::drive::InsertResourceRequest;
-using google_apis::drive::RenameResourceRequest;
+using google_apis::drive::MoveResourceRequest;
using google_apis::drive::ResumeUploadRequest;
using google_apis::drive::TouchResourceRequest;
using google_apis::drive::TrashResourceRequest;
@@ -259,6 +259,13 @@ void ExtractOpenUrlAndRun(const std::string& app_id,
callback.Run(GDATA_OTHER_ERROR, GURL());
}
+// Ignores the |entry|, and runs the |callback|.
+void EntryActionCallbackAdapter(
+ const EntryActionCallback& callback,
+ GDataErrorCode error, scoped_ptr<FileResource> entry) {
+ callback.Run(error);
+}
+
// The resource ID for the root directory for Drive API is defined in the spec:
// https://developers.google.com/drive/folder
const char kDriveApiRootDirectoryResourceId[] = "root";
@@ -608,9 +615,14 @@ CancelCallback DriveAPIService::MoveResource(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- // TODO(hidehiko): Implement this.
- NOTIMPLEMENTED();
- return CancelCallback();
+ return sender_->StartRequestWithRetry(
+ new MoveResourceRequest(
+ sender_.get(),
+ url_generator_,
+ resource_id,
+ parent_resource_id,
+ new_title,
+ base::Bind(&ParseResourceEntryAndRun, callback)));
}
CancelCallback DriveAPIService::RenameResource(
@@ -621,12 +633,13 @@ CancelCallback DriveAPIService::RenameResource(
DCHECK(!callback.is_null());
return sender_->StartRequestWithRetry(
- new RenameResourceRequest(
+ new MoveResourceRequest(
sender_.get(),
url_generator_,
resource_id,
+ std::string(),
new_title,
- callback));
+ base::Bind(&EntryActionCallbackAdapter, callback)));
}
CancelCallback DriveAPIService::TouchResource(
« 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