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"); |
hashimoto
2017/06/02 09:44:46
Are kSupportsTeamDrives and kIncludeTeamDriveItems
yamaguchi
2017/06/02 12:04:01
Changed to turn off includeTeamDriveItems for the
|
+ 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: |
hashimoto
2017/06/02 09:44:46
Please have cases for all possible enums.
Instead
yamaguchi
2017/06/02 12:04:01
Done.
|
+ DCHECK(corpora == CORPORA_DEFAULT); |
+ return kCorporaDefault; |
+ } |
+} |
+ |
} // namespace google_apis |