diff options
author | hidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-16 10:41:44 +0000 |
---|---|---|
committer | hidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-16 10:41:44 +0000 |
commit | 379c716afdaed5b11e9076d1fc3a09aaa935d667 (patch) | |
tree | 045cbf061194bffdc9fdcd3675ad26236575fc30 /chrome/browser | |
parent | f4ef89c3a49e0e68773868b1dd404c6c3af22792 (diff) | |
download | chromium_src-379c716afdaed5b11e9076d1fc3a09aaa935d667.zip chromium_src-379c716afdaed5b11e9076d1fc3a09aaa935d667.tar.gz chromium_src-379c716afdaed5b11e9076d1fc3a09aaa935d667.tar.bz2 |
Add placeholder MoveResource to DriveServiceInterface for Drive API v2 support.
We are going to support "move" operation in more straightforward way on Drive
API v2. This is the placeholder of the implementation.
BUG=241814
TEST=Ran unit_tests
Review URL: https://chromiumcodereview.appspot.com/23190011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/drive/drive_api_service.cc | 13 | ||||
-rw-r--r-- | chrome/browser/drive/drive_api_service.h | 5 | ||||
-rw-r--r-- | chrome/browser/drive/drive_service_interface.h | 12 | ||||
-rw-r--r-- | chrome/browser/drive/dummy_drive_service.cc | 8 | ||||
-rw-r--r-- | chrome/browser/drive/dummy_drive_service.h | 5 | ||||
-rw-r--r-- | chrome/browser/drive/fake_drive_service.cc | 13 | ||||
-rw-r--r-- | chrome/browser/drive/fake_drive_service.h | 5 | ||||
-rw-r--r-- | chrome/browser/drive/gdata_wapi_service.cc | 16 | ||||
-rw-r--r-- | chrome/browser/drive/gdata_wapi_service.h | 5 |
9 files changed, 82 insertions, 0 deletions
diff --git a/chrome/browser/drive/drive_api_service.cc b/chrome/browser/drive/drive_api_service.cc index 71e8b92..6d5a571 100644 --- a/chrome/browser/drive/drive_api_service.cc +++ b/chrome/browser/drive/drive_api_service.cc @@ -600,6 +600,19 @@ CancelCallback DriveAPIService::CopyHostedDocument( base::Bind(&ParseResourceEntryAndRun, callback))); } +CancelCallback DriveAPIService::MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const GetResourceEntryCallback& callback) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK(!callback.is_null()); + + // TODO(hidehiko): Implement this. + NOTIMPLEMENTED(); + return CancelCallback(); +} + CancelCallback DriveAPIService::RenameResource( const std::string& resource_id, const std::string& new_title, diff --git a/chrome/browser/drive/drive_api_service.h b/chrome/browser/drive/drive_api_service.h index 8f506da..b896112 100644 --- a/chrome/browser/drive/drive_api_service.h +++ b/chrome/browser/drive/drive_api_service.h @@ -123,6 +123,11 @@ class DriveAPIService : public DriveServiceInterface, const std::string& resource_id, const std::string& new_title, const google_apis::GetResourceEntryCallback& callback) OVERRIDE; + virtual google_apis::CancelCallback MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const google_apis::GetResourceEntryCallback& callback) OVERRIDE; virtual google_apis::CancelCallback RenameResource( const std::string& resource_id, const std::string& new_title, diff --git a/chrome/browser/drive/drive_service_interface.h b/chrome/browser/drive/drive_service_interface.h index 4aff1f4..72ee3a8 100644 --- a/chrome/browser/drive/drive_service_interface.h +++ b/chrome/browser/drive/drive_service_interface.h @@ -210,6 +210,18 @@ class DriveServiceInterface { const std::string& new_title, const google_apis::GetResourceEntryCallback& callback) = 0; + // Moves a resource with |resource_id| to the directory of + // |parent_resource_id| with renaming to |new_title|. + // This request is supported only on DriveAPIService, because GData WAPI + // doesn't support the function unfortunately. + // Upon completion, invokes |callback| with results on the calling thread. + // |callback| must not be null. + virtual google_apis::CancelCallback MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const google_apis::GetResourceEntryCallback& callback) = 0; + // Renames a document or collection identified by its |resource_id| // to the UTF-8 encoded |new_title|. Upon completion, // invokes |callback| with results on the calling thread. diff --git a/chrome/browser/drive/dummy_drive_service.cc b/chrome/browser/drive/dummy_drive_service.cc index a61a182..99b7314 100644 --- a/chrome/browser/drive/dummy_drive_service.cc +++ b/chrome/browser/drive/dummy_drive_service.cc @@ -116,6 +116,14 @@ CancelCallback DummyDriveService::CopyHostedDocument( const std::string& new_title, const GetResourceEntryCallback& callback) { return CancelCallback(); } +CancelCallback DummyDriveService::MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const google_apis::GetResourceEntryCallback& callback) { + return CancelCallback(); +} + CancelCallback DummyDriveService::RenameResource( const std::string& resource_id, const std::string& new_title, diff --git a/chrome/browser/drive/dummy_drive_service.h b/chrome/browser/drive/dummy_drive_service.h index cb90bf1..c63becd 100644 --- a/chrome/browser/drive/dummy_drive_service.h +++ b/chrome/browser/drive/dummy_drive_service.h @@ -79,6 +79,11 @@ class DummyDriveService : public DriveServiceInterface { const std::string& resource_id, const std::string& new_title, const google_apis::GetResourceEntryCallback& callback) OVERRIDE; + virtual google_apis::CancelCallback MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const google_apis::GetResourceEntryCallback& callback) OVERRIDE; virtual google_apis::CancelCallback RenameResource( const std::string& resource_id, const std::string& new_title, diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc index 7af31aa..2dd032c 100644 --- a/chrome/browser/drive/fake_drive_service.cc +++ b/chrome/browser/drive/fake_drive_service.cc @@ -789,6 +789,19 @@ CancelCallback FakeDriveService::CopyHostedDocument( return CopyResource(resource_id, std::string(), new_title, callback); } +CancelCallback FakeDriveService::MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const google_apis::GetResourceEntryCallback& callback) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK(!callback.is_null()); + + // TODO(hidehiko): Implement this. + NOTIMPLEMENTED(); + return CancelCallback(); +} + CancelCallback FakeDriveService::RenameResource( const std::string& resource_id, const std::string& new_title, diff --git a/chrome/browser/drive/fake_drive_service.h b/chrome/browser/drive/fake_drive_service.h index 994bc53..ad7fdc3 100644 --- a/chrome/browser/drive/fake_drive_service.h +++ b/chrome/browser/drive/fake_drive_service.h @@ -156,6 +156,11 @@ class FakeDriveService : public DriveServiceInterface { const std::string& resource_id, const std::string& new_title, const google_apis::GetResourceEntryCallback& callback) OVERRIDE; + virtual google_apis::CancelCallback MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const google_apis::GetResourceEntryCallback& callback) OVERRIDE; virtual google_apis::CancelCallback RenameResource( const std::string& resource_id, const std::string& new_title, diff --git a/chrome/browser/drive/gdata_wapi_service.cc b/chrome/browser/drive/gdata_wapi_service.cc index 218eb6e..8a262a0 100644 --- a/chrome/browser/drive/gdata_wapi_service.cc +++ b/chrome/browser/drive/gdata_wapi_service.cc @@ -432,6 +432,22 @@ CancelCallback GDataWapiService::CopyHostedDocument( new_title)); } +CancelCallback GDataWapiService::MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const google_apis::GetResourceEntryCallback& callback) { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + DCHECK(!callback.is_null()); + + // GData WAPI doesn't support to "move" resources. + // This method should never be called if GData WAPI is enabled. + // Instead, client code should rename the file, add new parent, and then + // remove the old parent. + NOTREACHED(); + return CancelCallback(); +} + CancelCallback GDataWapiService::RenameResource( const std::string& resource_id, const std::string& new_title, diff --git a/chrome/browser/drive/gdata_wapi_service.h b/chrome/browser/drive/gdata_wapi_service.h index 9fa04be..a7139b8 100644 --- a/chrome/browser/drive/gdata_wapi_service.h +++ b/chrome/browser/drive/gdata_wapi_service.h @@ -119,6 +119,11 @@ class GDataWapiService : public DriveServiceInterface, const std::string& resource_id, const std::string& new_title, const google_apis::GetResourceEntryCallback& callback) OVERRIDE; + virtual google_apis::CancelCallback MoveResource( + const std::string& resource_id, + const std::string& parent_resource_id, + const std::string& new_title, + const google_apis::GetResourceEntryCallback& callback) OVERRIDE; virtual google_apis::CancelCallback RenameResource( const std::string& resource_id, const std::string& new_title, |