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

Unified Diff: google_apis/drive/drive_api_url_generator.cc

Issue 2910913002: WIP.
Patch Set: rebase Created 3 years, 7 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 | « google_apis/drive/drive_api_url_generator.h ('k') | google_apis/drive/drive_api_url_generator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/drive_api_url_generator.cc
diff --git a/google_apis/drive/drive_api_url_generator.cc b/google_apis/drive/drive_api_url_generator.cc
index e79bf0decca7285d8673d9767bc6f870ba3c6c7d..2b5823b77540a41ffc74ca70d7bfed676cb2899f 100644
--- a/google_apis/drive/drive_api_url_generator.cc
+++ b/google_apis/drive/drive_api_url_generator.cc
@@ -42,6 +42,11 @@ const char kDriveV2TeamDrivesUrl[] = "drive/v2/teamdrives";
const char kIncludeTeamDriveItems[] = "includeTeamDriveItems";
const char kSupportsTeamDrives[] = "supportsTeamDrives";
+const char kCorpora[] = "corpora";
+const char kCorporaAllTeamDrives[] = "default,allTeamDrives";
+const char kCorporaDefault[] = "default";
+const char kCorporaTeamDrive[] = "teamDrive";
+const char kTeamDriveId[] = "teamDriveId";
// apps.delete and file.authorize API is exposed through a special endpoint
// v2internal that is accessible only by the official API key for Chrome.
@@ -185,12 +190,19 @@ GURL DriveApiUrlGenerator::GetFilesCopyUrl(
GURL DriveApiUrlGenerator::GetFilesListUrl(int max_results,
const std::string& page_token,
+ FilesListCorpora corpora,
+ const std::string& team_drive_id,
const std::string& q) const {
GURL url = base_url_.Resolve(kDriveV2FilesUrl);
if (enable_team_drives_) {
url = net::AppendOrReplaceQueryParameter(url, kSupportsTeamDrives, "true");
- url = net::AppendOrReplaceQueryParameter(url, kIncludeTeamDriveItems,
- "true");
+ url =
+ net::AppendOrReplaceQueryParameter(url, kIncludeTeamDriveItems, "true");
+ url = net::AppendOrReplaceQueryParameter(url, kCorpora,
+ GetCorporaString_(corpora));
+ if (!team_drive_id.empty())
+ url =
+ net::AppendOrReplaceQueryParameter(url, kTeamDriveId, team_drive_id);
}
// maxResults is 100 by default.
if (max_results != 100) {
@@ -238,7 +250,7 @@ GURL DriveApiUrlGenerator::GetChangesListUrl(
"true");
if (!team_drive_id.empty()) {
url =
- net::AppendOrReplaceQueryParameter(url, "teamDriveId", team_drive_id);
+ net::AppendOrReplaceQueryParameter(url, kTeamDriveId, team_drive_id);
}
}
// includeDeleted is "true" by default.
@@ -391,4 +403,17 @@ GURL DriveApiUrlGenerator::GetTeamDriveListUrl(
return url;
}
+// static
+const char* DriveApiUrlGenerator::GetCorporaString_(FilesListCorpora corpora) {
+ switch (corpora) {
+ case CORPORA_TEAM_DRIVE:
+ return kCorporaTeamDrive;
+ case CORPORA_ALL_TEAM_DRIVES:
+ return kCorporaAllTeamDrives;
+ default:
+ DCHECK(corpora == CORPORA_DEFAULT);
+ return kCorporaDefault;
+ }
+}
+
} // namespace google_apis
« no previous file with comments | « google_apis/drive/drive_api_url_generator.h ('k') | google_apis/drive/drive_api_url_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698