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..f048012091bead546745372f5254ca94d1fec297 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. |
@@ -59,6 +64,19 @@ GURL AddMultipartUploadParam(const GURL& url) { |
return net::AppendOrReplaceQueryParameter(url, "uploadType", "multipart"); |
} |
+const char* GetCorporaString(FilesListCorpora corpora) { |
+ switch (corpora) { |
+ case CORPORA_DEFAULT: |
+ return kCorporaDefault; |
+ case CORPORA_TEAM_DRIVE: |
+ return kCorporaTeamDrive; |
+ case CORPORA_ALL_TEAM_DRIVES: |
+ return kCorporaAllTeamDrives; |
+ } |
+ NOTREACHED(); |
+ return kCorporaDefault; |
+} |
+ |
} // namespace |
DriveApiUrlGenerator::DriveApiUrlGenerator( |
@@ -185,12 +203,21 @@ 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"); |
+ if (corpora != CORPORA_DEFAULT) { |
+ 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 +265,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. |