summaryrefslogtreecommitdiffstats
path: root/chrome/browser/drive
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-31 11:46:44 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-31 11:46:44 +0000
commit7f28f0a43d039c78fc6085e9af53c8a27d9c3fbf (patch)
treeae1b7dd47d989ccf6f279e1cbfde43f28de9fefb /chrome/browser/drive
parent7fa4af9b89a7d7357db7b1ad12fba8a24f4ad12f (diff)
downloadchromium_src-7f28f0a43d039c78fc6085e9af53c8a27d9c3fbf.zip
chromium_src-7f28f0a43d039c78fc6085e9af53c8a27d9c3fbf.tar.gz
chromium_src-7f28f0a43d039c78fc6085e9af53c8a27d9c3fbf.tar.bz2
drive: Remove DriveServiceInterface::GetResourceListInDirectoryByWapi
BUG=357038 TEST=unit_tests Review URL: https://codereview.chromium.org/219093002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/drive')
-rw-r--r--chrome/browser/drive/drive_api_service.cc35
-rw-r--r--chrome/browser/drive/drive_api_service.h6
-rw-r--r--chrome/browser/drive/drive_service_interface.h21
-rw-r--r--chrome/browser/drive/dummy_drive_service.cc8
-rw-r--r--chrome/browser/drive/dummy_drive_service.h6
-rw-r--r--chrome/browser/drive/fake_drive_service.cc100
-rw-r--r--chrome/browser/drive/fake_drive_service.h6
7 files changed, 40 insertions, 142 deletions
diff --git a/chrome/browser/drive/drive_api_service.cc b/chrome/browser/drive/drive_api_service.cc
index cf81889..dd464d5 100644
--- a/chrome/browser/drive/drive_api_service.cc
+++ b/chrome/browser/drive/drive_api_service.cc
@@ -43,7 +43,6 @@ using google_apis::GetContentCallback;
using google_apis::GetResourceEntryCallback;
using google_apis::GetResourceEntryRequest;
using google_apis::GetResourceListCallback;
-using google_apis::GetResourceListRequest;
using google_apis::GetShareUrlCallback;
using google_apis::HTTP_NOT_IMPLEMENTED;
using google_apis::HTTP_SUCCESS;
@@ -833,40 +832,6 @@ CancelCallback DriveAPIService::UninstallApp(
return sender_->StartRequestWithRetry(request);
}
-CancelCallback DriveAPIService::GetResourceListInDirectoryByWapi(
- const std::string& directory_resource_id,
- const google_apis::GetResourceListCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!directory_resource_id.empty());
- DCHECK(!callback.is_null());
-
- return sender_->StartRequestWithRetry(
- new GetResourceListRequest(sender_.get(),
- wapi_url_generator_,
- GURL(), // No override url
- 0, // start changestamp
- std::string(), // empty search query
- directory_resource_id,
- callback));
-}
-
-CancelCallback DriveAPIService::GetRemainingResourceList(
- const GURL& next_link,
- const google_apis::GetResourceListCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!next_link.is_empty());
- DCHECK(!callback.is_null());
-
- return sender_->StartRequestWithRetry(
- new GetResourceListRequest(sender_.get(),
- wapi_url_generator_,
- next_link,
- 0, // start changestamp
- std::string(), // empty search query
- std::string(), // no directory resource id
- callback));
-}
-
google_apis::CancelCallback DriveAPIService::AddPermission(
const std::string& resource_id,
const std::string& email,
diff --git a/chrome/browser/drive/drive_api_service.h b/chrome/browser/drive/drive_api_service.h
index 90a580a..a43fe05 100644
--- a/chrome/browser/drive/drive_api_service.h
+++ b/chrome/browser/drive/drive_api_service.h
@@ -182,12 +182,6 @@ class DriveAPIService : public DriveServiceInterface,
virtual google_apis::CancelCallback UninstallApp(
const std::string& app_id,
const google_apis::EntryActionCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback GetResourceListInDirectoryByWapi(
- const std::string& directory_resource_id,
- const google_apis::GetResourceListCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback GetRemainingResourceList(
- const GURL& next_link,
- const google_apis::GetResourceListCallback& callback) OVERRIDE;
virtual google_apis::CancelCallback AddPermission(
const std::string& resource_id,
const std::string& email,
diff --git a/chrome/browser/drive/drive_service_interface.h b/chrome/browser/drive/drive_service_interface.h
index 151f308..1b393d6 100644
--- a/chrome/browser/drive/drive_service_interface.h
+++ b/chrome/browser/drive/drive_service_interface.h
@@ -414,27 +414,6 @@ class DriveServiceInterface {
const std::string& app_id,
const google_apis::EntryActionCallback& callback) = 0;
- // This is introduced as a temporary short term solution of the performance
- // regression issue on Drive API v2.
- //
- // This fetches the resource list in a directory by using GData WAPI
- // regardless of base protocol. In other words, even if we enables Drive API
- // v2, this method uses GData WAPI to fetch the resource list.
- //
- // |directory_resource_id| must not be empty.
- // |callback| must not be null.
- virtual google_apis::CancelCallback GetResourceListInDirectoryByWapi(
- const std::string& directory_resource_id,
- const google_apis::GetResourceListCallback& callback) = 0;
-
- // GetResourceListInDirectoryByWapi can be paged. This method fetches the
- // following pages.
- //
- // |callback| must not be null.
- virtual google_apis::CancelCallback GetRemainingResourceList(
- const GURL& next_link,
- const google_apis::GetResourceListCallback& callback) = 0;
-
// Authorizes the account |email| to access |resource_id| as a |role|.
//
// |callback| must not be null.
diff --git a/chrome/browser/drive/dummy_drive_service.cc b/chrome/browser/drive/dummy_drive_service.cc
index 17c13cd..1528c15 100644
--- a/chrome/browser/drive/dummy_drive_service.cc
+++ b/chrome/browser/drive/dummy_drive_service.cc
@@ -192,14 +192,6 @@ CancelCallback DummyDriveService::UninstallApp(
const std::string& app_id,
const EntryActionCallback& callback) { return CancelCallback(); }
-CancelCallback DummyDriveService::GetResourceListInDirectoryByWapi(
- const std::string& directory_resource_id,
- const GetResourceListCallback& callback) { return CancelCallback(); }
-
-CancelCallback DummyDriveService::GetRemainingResourceList(
- const GURL& next_link,
- const GetResourceListCallback& callback) { return CancelCallback(); }
-
CancelCallback DummyDriveService::AddPermission(
const std::string& resource_id,
const std::string& email,
diff --git a/chrome/browser/drive/dummy_drive_service.h b/chrome/browser/drive/dummy_drive_service.h
index 0dfce74..ce6ee94 100644
--- a/chrome/browser/drive/dummy_drive_service.h
+++ b/chrome/browser/drive/dummy_drive_service.h
@@ -138,12 +138,6 @@ class DummyDriveService : public DriveServiceInterface {
virtual google_apis::CancelCallback UninstallApp(
const std::string& app_id,
const google_apis::EntryActionCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback GetResourceListInDirectoryByWapi(
- const std::string& directory_resource_id,
- const google_apis::GetResourceListCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback GetRemainingResourceList(
- const GURL& next_link,
- const google_apis::GetResourceListCallback& callback) OVERRIDE;
virtual google_apis::CancelCallback AddPermission(
const std::string& resource_id,
const std::string& email,
diff --git a/chrome/browser/drive/fake_drive_service.cc b/chrome/browser/drive/fake_drive_service.cc
index 3931727..4605911 100644
--- a/chrome/browser/drive/fake_drive_service.cc
+++ b/chrome/browser/drive/fake_drive_service.cc
@@ -426,7 +426,45 @@ CancelCallback FakeDriveService::GetRemainingChangeList(
DCHECK(!next_link.is_empty());
DCHECK(!callback.is_null());
- return GetRemainingResourceList(next_link, callback);
+ // "changestamp", "q", "parent" and "start-offset" are parameters to
+ // implement "paging" of the result on FakeDriveService.
+ // The URL should be the one filled in GetResourceListInternal of the
+ // previous method invocation, so it should start with "http://localhost/?".
+ // See also GetResourceListInternal.
+ DCHECK_EQ(next_link.host(), "localhost");
+ DCHECK_EQ(next_link.path(), "/");
+
+ int64 start_changestamp = 0;
+ std::string search_query;
+ std::string directory_resource_id;
+ int start_offset = 0;
+ int max_results = default_max_results_;
+ std::vector<std::pair<std::string, std::string> > parameters;
+ if (base::SplitStringIntoKeyValuePairs(
+ next_link.query(), '=', '&', &parameters)) {
+ for (size_t i = 0; i < parameters.size(); ++i) {
+ if (parameters[i].first == "changestamp") {
+ base::StringToInt64(parameters[i].second, &start_changestamp);
+ } else if (parameters[i].first == "q") {
+ search_query =
+ net::UnescapeURLComponent(parameters[i].second,
+ net::UnescapeRule::URL_SPECIAL_CHARS);
+ } else if (parameters[i].first == "parent") {
+ directory_resource_id =
+ net::UnescapeURLComponent(parameters[i].second,
+ net::UnescapeRule::URL_SPECIAL_CHARS);
+ } else if (parameters[i].first == "start-offset") {
+ base::StringToInt(parameters[i].second, &start_offset);
+ } else if (parameters[i].first == "max-results") {
+ base::StringToInt(parameters[i].second, &max_results);
+ }
+ }
+ }
+
+ GetResourceListInternal(
+ start_changestamp, search_query, directory_resource_id,
+ start_offset, max_results, NULL, callback);
+ return CancelCallback();
}
CancelCallback FakeDriveService::GetRemainingFileList(
@@ -436,7 +474,7 @@ CancelCallback FakeDriveService::GetRemainingFileList(
DCHECK(!next_link.is_empty());
DCHECK(!callback.is_null());
- return GetRemainingResourceList(next_link, callback);
+ return GetRemainingChangeList(next_link, callback);
}
CancelCallback FakeDriveService::GetResourceEntry(
@@ -1195,64 +1233,6 @@ CancelCallback FakeDriveService::UninstallApp(
return CancelCallback();
}
-CancelCallback FakeDriveService::GetResourceListInDirectoryByWapi(
- const std::string& directory_resource_id,
- const google_apis::GetResourceListCallback& callback) {
- return GetResourceListInDirectory(
- directory_resource_id == util::kWapiRootDirectoryResourceId ?
- GetRootResourceId() :
- directory_resource_id,
- callback);
-}
-
-CancelCallback FakeDriveService::GetRemainingResourceList(
- const GURL& next_link,
- const google_apis::GetResourceListCallback& callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!next_link.is_empty());
- DCHECK(!callback.is_null());
-
- // "changestamp", "q", "parent" and "start-offset" are parameters to
- // implement "paging" of the result on FakeDriveService.
- // The URL should be the one filled in GetResourceListInternal of the
- // previous method invocation, so it should start with "http://localhost/?".
- // See also GetResourceListInternal.
- DCHECK_EQ(next_link.host(), "localhost");
- DCHECK_EQ(next_link.path(), "/");
-
- int64 start_changestamp = 0;
- std::string search_query;
- std::string directory_resource_id;
- int start_offset = 0;
- int max_results = default_max_results_;
- std::vector<std::pair<std::string, std::string> > parameters;
- if (base::SplitStringIntoKeyValuePairs(
- next_link.query(), '=', '&', &parameters)) {
- for (size_t i = 0; i < parameters.size(); ++i) {
- if (parameters[i].first == "changestamp") {
- base::StringToInt64(parameters[i].second, &start_changestamp);
- } else if (parameters[i].first == "q") {
- search_query =
- net::UnescapeURLComponent(parameters[i].second,
- net::UnescapeRule::URL_SPECIAL_CHARS);
- } else if (parameters[i].first == "parent") {
- directory_resource_id =
- net::UnescapeURLComponent(parameters[i].second,
- net::UnescapeRule::URL_SPECIAL_CHARS);
- } else if (parameters[i].first == "start-offset") {
- base::StringToInt(parameters[i].second, &start_offset);
- } else if (parameters[i].first == "max-results") {
- base::StringToInt(parameters[i].second, &max_results);
- }
- }
- }
-
- GetResourceListInternal(
- start_changestamp, search_query, directory_resource_id,
- start_offset, max_results, NULL, callback);
- return CancelCallback();
-}
-
void FakeDriveService::AddNewFile(const std::string& content_type,
const std::string& content_data,
const std::string& parent_resource_id,
diff --git a/chrome/browser/drive/fake_drive_service.h b/chrome/browser/drive/fake_drive_service.h
index f852fd6..b38a1f3 100644
--- a/chrome/browser/drive/fake_drive_service.h
+++ b/chrome/browser/drive/fake_drive_service.h
@@ -232,12 +232,6 @@ class FakeDriveService : public DriveServiceInterface {
virtual google_apis::CancelCallback UninstallApp(
const std::string& app_id,
const google_apis::EntryActionCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback GetResourceListInDirectoryByWapi(
- const std::string& directory_resource_id,
- const google_apis::GetResourceListCallback& callback) OVERRIDE;
- virtual google_apis::CancelCallback GetRemainingResourceList(
- const GURL& next_link,
- const google_apis::GetResourceListCallback& callback) OVERRIDE;
virtual google_apis::CancelCallback AddPermission(
const std::string& resource_id,
const std::string& email,