summaryrefslogtreecommitdiffstats
path: root/chrome/browser/drive
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-03 13:52:02 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-03 13:52:02 +0000
commit46b508d94e105db62c3fb44d7327ce7abeb19766 (patch)
tree581c0f6bf08b56dc14ea790a851dfac9d48f1aa4 /chrome/browser/drive
parentd70cfd4ff15243bd40d49d13e5e8697f91b4fd2a (diff)
downloadchromium_src-46b508d94e105db62c3fb44d7327ce7abeb19766.zip
chromium_src-46b508d94e105db62c3fb44d7327ce7abeb19766.tar.gz
chromium_src-46b508d94e105db62c3fb44d7327ce7abeb19766.tar.bz2
drive: Remove unused DriveServiceInterface::TouchResource
UpdateResource can do the same thing. BUG=None TEST=build Review URL: https://codereview.chromium.org/100903005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/drive')
-rw-r--r--chrome/browser/drive/drive_api_service.cc26
-rw-r--r--chrome/browser/drive/drive_api_service.h5
-rw-r--r--chrome/browser/drive/drive_service_interface.h11
-rw-r--r--chrome/browser/drive/dummy_drive_service.cc6
-rw-r--r--chrome/browser/drive/dummy_drive_service.h5
-rw-r--r--chrome/browser/drive/fake_drive_service.cc41
-rw-r--r--chrome/browser/drive/fake_drive_service.h5
-rw-r--r--chrome/browser/drive/fake_drive_service_unittest.cc78
-rw-r--r--chrome/browser/drive/gdata_wapi_service.cc19
-rw-r--r--chrome/browser/drive/gdata_wapi_service.h5
10 files changed, 0 insertions, 201 deletions
diff --git a/chrome/browser/drive/drive_api_service.cc b/chrome/browser/drive/drive_api_service.cc
index 5732dc3..ec7d25a 100644
--- a/chrome/browser/drive/drive_api_service.cc
+++ b/chrome/browser/drive/drive_api_service.cc
@@ -670,32 +670,6 @@ CancelCallback DriveAPIService::RenameResource(
return sender_->StartRequestWithRetry(request);
}
-CancelCallback DriveAPIService::TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const GetResourceEntryCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!modified_date.is_null());
- DCHECK(!last_viewed_by_me_date.is_null());
- DCHECK(!callback.is_null());
-
- FilesPatchRequest* request = new FilesPatchRequest(
- sender_.get(), url_generator_,
- base::Bind(&ConvertFileEntryToResourceEntryAndRun, callback));
- // Need to set setModifiedDate to true to overwrite modifiedDate.
- request->set_set_modified_date(true);
-
- // Need to set updateViewedDate to false, otherwise the lastViewedByMeDate
- // will be set to the request time (not the specified time via request).
- request->set_update_viewed_date(false);
-
- request->set_modified_date(modified_date);
- request->set_last_viewed_by_me_date(last_viewed_by_me_date);
- request->set_fields(kFileResourceFields);
- return sender_->StartRequestWithRetry(request);
-}
-
CancelCallback DriveAPIService::AddResourceToDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
diff --git a/chrome/browser/drive/drive_api_service.h b/chrome/browser/drive/drive_api_service.h
index 1e2d88c..b2b4816 100644
--- a/chrome/browser/drive/drive_api_service.h
+++ b/chrome/browser/drive/drive_api_service.h
@@ -137,11 +137,6 @@ class DriveAPIService : public DriveServiceInterface,
const std::string& resource_id,
const std::string& new_title,
const google_apis::EntryActionCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
virtual google_apis::CancelCallback AddResourceToDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
diff --git a/chrome/browser/drive/drive_service_interface.h b/chrome/browser/drive/drive_service_interface.h
index deeaf2b..e443c5c 100644
--- a/chrome/browser/drive/drive_service_interface.h
+++ b/chrome/browser/drive/drive_service_interface.h
@@ -256,17 +256,6 @@ class DriveServiceInterface {
const std::string& new_title,
const google_apis::EntryActionCallback& callback) = 0;
- // Touches the resource with |resource_id|.
- // Its modifiedDate and lastViewedByMeDate fields on the server will be
- // updated to |modified_date| and |last_viewed_by_me_date| respectively.
- // Upon completion, invokes |callback| with the updated resource data.
- // |modified_date|, |last_viewed_by_me_date| and |callback| must not be null.
- virtual google_apis::CancelCallback TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const google_apis::GetResourceEntryCallback& callback) = 0;
-
// Adds a resource (document, file, or collection) identified by its
// |resource_id| to a collection represented by the |parent_resource_id|.
// 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 bd828d0..8833571 100644
--- a/chrome/browser/drive/dummy_drive_service.cc
+++ b/chrome/browser/drive/dummy_drive_service.cc
@@ -138,12 +138,6 @@ CancelCallback DummyDriveService::RenameResource(
const std::string& new_title,
const EntryActionCallback& callback) { return CancelCallback(); }
-CancelCallback DummyDriveService::TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const GetResourceEntryCallback& callback) { return CancelCallback(); }
-
CancelCallback DummyDriveService::AddResourceToDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
diff --git a/chrome/browser/drive/dummy_drive_service.h b/chrome/browser/drive/dummy_drive_service.h
index 4864125..b081a63 100644
--- a/chrome/browser/drive/dummy_drive_service.h
+++ b/chrome/browser/drive/dummy_drive_service.h
@@ -93,11 +93,6 @@ class DummyDriveService : public DriveServiceInterface {
const std::string& resource_id,
const std::string& new_title,
const google_apis::EntryActionCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
virtual google_apis::CancelCallback AddResourceToDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc
index 66ef7c0..0fe40e1 100644
--- a/chrome/browser/drive/fake_drive_service.cc
+++ b/chrome/browser/drive/fake_drive_service.cc
@@ -863,47 +863,6 @@ CancelCallback FakeDriveService::RenameResource(
base::Bind(&EntryActionCallbackAdapter, callback));
}
-CancelCallback FakeDriveService::TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const GetResourceEntryCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!modified_date.is_null());
- DCHECK(!last_viewed_by_me_date.is_null());
- DCHECK(!callback.is_null());
-
- if (offline_) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(callback, GDATA_NO_CONNECTION,
- base::Passed(scoped_ptr<ResourceEntry>())));
- return CancelCallback();
- }
-
- base::DictionaryValue* entry = FindEntryByResourceId(resource_id);
- if (!entry) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(callback, HTTP_NOT_FOUND,
- base::Passed(scoped_ptr<ResourceEntry>())));
- return CancelCallback();
- }
-
- entry->SetString("updated.$t",
- google_apis::util::FormatTimeAsString(modified_date));
- entry->SetString(
- "gd$lastViewed.$t",
- google_apis::util::FormatTimeAsString(last_viewed_by_me_date));
- AddNewChangestampAndETag(entry);
-
- scoped_ptr<ResourceEntry> parsed_entry(ResourceEntry::CreateFrom(*entry));
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(callback, HTTP_SUCCESS, base::Passed(&parsed_entry)));
- return CancelCallback();
-}
-
CancelCallback FakeDriveService::AddResourceToDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
diff --git a/chrome/browser/drive/fake_drive_service.h b/chrome/browser/drive/fake_drive_service.h
index e09afcb..158527c 100644
--- a/chrome/browser/drive/fake_drive_service.h
+++ b/chrome/browser/drive/fake_drive_service.h
@@ -182,11 +182,6 @@ class FakeDriveService : public DriveServiceInterface {
const std::string& resource_id,
const std::string& new_title,
const google_apis::EntryActionCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
virtual google_apis::CancelCallback AddResourceToDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
diff --git a/chrome/browser/drive/fake_drive_service_unittest.cc b/chrome/browser/drive/fake_drive_service_unittest.cc
index 7692cc0..b681bd7 100644
--- a/chrome/browser/drive/fake_drive_service_unittest.cc
+++ b/chrome/browser/drive/fake_drive_service_unittest.cc
@@ -1289,84 +1289,6 @@ TEST_F(FakeDriveServiceTest, RenameResource_Offline) {
EXPECT_EQ(GDATA_NO_CONNECTION, error);
}
-TEST_F(FakeDriveServiceTest, TouchResource_ExistingFile) {
- ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
- "gdata/root_feed.json"));
- ASSERT_TRUE(fake_service_.LoadAccountMetadataForWapi(
- "gdata/account_metadata.json"));
-
- int64 old_largest_change_id = GetLargestChangeByAboutResource();
-
- const std::string kResourceId = "file:2_file_resource_id";
- const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123};
- const base::Time::Exploded kLastViewedByMeDate =
- {2013, 7, 0, 19, 15, 59, 13, 123};
-
- GDataErrorCode error = GDATA_OTHER_ERROR;
- scoped_ptr<ResourceEntry> entry;
- fake_service_.TouchResource(
- kResourceId,
- base::Time::FromUTCExploded(kModifiedDate),
- base::Time::FromUTCExploded(kLastViewedByMeDate),
- test_util::CreateCopyResultCallback(&error, &entry));
- base::RunLoop().RunUntilIdle();
-
- EXPECT_EQ(HTTP_SUCCESS, error);
-
- ASSERT_TRUE(entry);
- EXPECT_EQ(base::Time::FromUTCExploded(kModifiedDate),
- entry->updated_time());
- EXPECT_EQ(base::Time::FromUTCExploded(kLastViewedByMeDate),
- entry->last_viewed_time());
-
- // Should be incremented as a file was renamed.
- EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp());
- EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource());
-}
-
-TEST_F(FakeDriveServiceTest, TouchResource_NonexistingFile) {
- ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
- "gdata/root_feed.json"));
-
- const std::string kResourceId = "file:nonexisting_file";
- const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123};
- const base::Time::Exploded kLastViewedByMeDate =
- {2013, 7, 0, 19, 15, 59, 13, 123};
-
- GDataErrorCode error = GDATA_OTHER_ERROR;
- scoped_ptr<ResourceEntry> entry;
- fake_service_.TouchResource(
- kResourceId,
- base::Time::FromUTCExploded(kModifiedDate),
- base::Time::FromUTCExploded(kLastViewedByMeDate),
- test_util::CreateCopyResultCallback(&error, &entry));
- base::RunLoop().RunUntilIdle();
-
- EXPECT_EQ(HTTP_NOT_FOUND, error);
-}
-
-TEST_F(FakeDriveServiceTest, TouchResource_Offline) {
- ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
- "gdata/root_feed.json"));
- fake_service_.set_offline(true);
-
- const std::string kResourceId = "file:2_file_resource_id";
- const base::Time::Exploded kModifiedDate = {2012, 7, 0, 19, 15, 59, 13, 123};
- const base::Time::Exploded kLastViewedByMeDate =
- {2013, 7, 0, 19, 15, 59, 13, 123};
-
- GDataErrorCode error = GDATA_OTHER_ERROR;
- scoped_ptr<ResourceEntry> entry;
- fake_service_.TouchResource(
- kResourceId,
- base::Time::FromUTCExploded(kModifiedDate),
- base::Time::FromUTCExploded(kLastViewedByMeDate),
- test_util::CreateCopyResultCallback(&error, &entry));
- base::RunLoop().RunUntilIdle();
-
- EXPECT_EQ(GDATA_NO_CONNECTION, error);
-}
-
TEST_F(FakeDriveServiceTest, AddResourceToDirectory_FileInRootDirectory) {
ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
"gdata/root_feed.json"));
diff --git a/chrome/browser/drive/gdata_wapi_service.cc b/chrome/browser/drive/gdata_wapi_service.cc
index c3c139c..b9de153 100644
--- a/chrome/browser/drive/gdata_wapi_service.cc
+++ b/chrome/browser/drive/gdata_wapi_service.cc
@@ -466,25 +466,6 @@ CancelCallback GDataWapiService::RenameResource(
new_title));
}
-CancelCallback GDataWapiService::TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const GetResourceEntryCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!modified_date.is_null());
- DCHECK(!last_viewed_by_me_date.is_null());
- DCHECK(!callback.is_null());
-
- // Unfortunately, there is no way to support this method on GData WAPI.
- // So, this should always return an error.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(callback, HTTP_NOT_IMPLEMENTED,
- base::Passed(scoped_ptr<ResourceEntry>())));
- return base::Bind(&base::DoNothing);
-}
-
CancelCallback GDataWapiService::AddResourceToDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,
diff --git a/chrome/browser/drive/gdata_wapi_service.h b/chrome/browser/drive/gdata_wapi_service.h
index 980ce47..fa606ea 100644
--- a/chrome/browser/drive/gdata_wapi_service.h
+++ b/chrome/browser/drive/gdata_wapi_service.h
@@ -133,11 +133,6 @@ class GDataWapiService : public DriveServiceInterface,
const std::string& resource_id,
const std::string& new_title,
const google_apis::EntryActionCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback TouchResource(
- const std::string& resource_id,
- const base::Time& modified_date,
- const base::Time& last_viewed_by_me_date,
- const google_apis::GetResourceEntryCallback& callback) OVERRIDE;
virtual google_apis::CancelCallback AddResourceToDirectory(
const std::string& parent_resource_id,
const std::string& resource_id,