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

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

Issue 443303003: Random cleanup around google_apis/drive and c/b/drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/drive/drive_api_util.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 2d01d1d98a4455184dc28fbd1a3612ca4a844697..38f737a5c8c697bc4663b5fd4fe3459343c5457b 100644
--- a/chrome/browser/drive/drive_api_service.cc
+++ b/chrome/browser/drive/drive_api_service.cc
@@ -78,6 +78,8 @@ namespace {
const char kDriveScope[] = "https://www.googleapis.com/auth/drive";
const char kDriveAppsReadonlyScope[] =
"https://www.googleapis.com/auth/drive.apps.readonly";
+const char kDriveAppsScope[] = "https://www.googleapis.com/auth/drive.apps";
+const char kDocsListScope[] = "https://docs.google.com/feeds/";
// Mime type to create a directory.
const char kFolderMimeType[] = "application/vnd.google-apps.folder";
@@ -196,10 +198,12 @@ void DriveAPIService::Initialize(const std::string& account_id) {
std::vector<std::string> scopes;
scopes.push_back(kDriveScope);
scopes.push_back(kDriveAppsReadonlyScope);
- scopes.push_back(util::kDriveAppsScope);
+ scopes.push_back(kDriveAppsScope);
- // GData WAPI token for GetShareUrl().
- scopes.push_back(util::kDocsListScope);
+ // Note: The following scope is used to support GetShareUrl on Drive API v2.
+ // Unfortunately, there is no support on Drive API v2, so we need to fall back
+ // to GData WAPI for the GetShareUrl.
+ scopes.push_back(kDocsListScope);
sender_.reset(new RequestSender(
new google_apis::AuthService(oauth2_token_service_,
@@ -262,7 +266,7 @@ CancelCallback DriveAPIService::GetFileListInDirectory(
request->set_max_results(kMaxNumFilesResourcePerRequest);
request->set_q(base::StringPrintf(
"'%s' in parents and trashed = false",
- drive::util::EscapeQueryStringValue(directory_resource_id).c_str()));
+ util::EscapeQueryStringValue(directory_resource_id).c_str()));
request->set_fields(kFileListFields);
return sender_->StartRequestWithRetry(request);
}
@@ -277,7 +281,7 @@ CancelCallback DriveAPIService::Search(
FilesListRequest* request = new FilesListRequest(
sender_.get(), url_generator_, callback);
request->set_max_results(kMaxNumFilesResourcePerRequestForSearch);
- request->set_q(drive::util::TranslateQuery(search_query));
+ request->set_q(util::TranslateQuery(search_query));
request->set_fields(kFileListFields);
return sender_->StartRequestWithRetry(request);
}
@@ -292,11 +296,11 @@ CancelCallback DriveAPIService::SearchByTitle(
std::string query;
base::StringAppendF(&query, "title = '%s'",
- drive::util::EscapeQueryStringValue(title).c_str());
+ util::EscapeQueryStringValue(title).c_str());
if (!directory_resource_id.empty()) {
base::StringAppendF(
&query, " and '%s' in parents",
- drive::util::EscapeQueryStringValue(directory_resource_id).c_str());
+ util::EscapeQueryStringValue(directory_resource_id).c_str());
}
query += " and trashed = false";
« no previous file with comments | « no previous file | chrome/browser/drive/drive_api_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698