OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "google_apis/drive/drive_api_url_generator.h" | 5 #include "google_apis/drive/drive_api_url_generator.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 const char kDriveV2UploadExistingFileUrlPrefix[] = "upload/drive/v2/files/"; | 35 const char kDriveV2UploadExistingFileUrlPrefix[] = "upload/drive/v2/files/"; |
36 const char kDriveV2BatchUploadUrl[] = "upload/drive"; | 36 const char kDriveV2BatchUploadUrl[] = "upload/drive"; |
37 const char kDriveV2PermissionsUrlFormat[] = "drive/v2/files/%s/permissions"; | 37 const char kDriveV2PermissionsUrlFormat[] = "drive/v2/files/%s/permissions"; |
38 const char kDriveV2DownloadUrlFormat[] = "drive/v2/files/%s?alt=media"; | 38 const char kDriveV2DownloadUrlFormat[] = "drive/v2/files/%s?alt=media"; |
39 const char kDriveV2ThumbnailUrlFormat[] = "d/%s=w%d-h%d"; | 39 const char kDriveV2ThumbnailUrlFormat[] = "d/%s=w%d-h%d"; |
40 const char kDriveV2ThumbnailUrlWithCropFormat[] = "d/%s=w%d-h%d-c"; | 40 const char kDriveV2ThumbnailUrlWithCropFormat[] = "d/%s=w%d-h%d-c"; |
41 const char kDriveV2TeamDrivesUrl[] = "drive/v2/teamdrives"; | 41 const char kDriveV2TeamDrivesUrl[] = "drive/v2/teamdrives"; |
42 | 42 |
43 const char kIncludeTeamDriveItems[] = "includeTeamDriveItems"; | 43 const char kIncludeTeamDriveItems[] = "includeTeamDriveItems"; |
44 const char kSupportsTeamDrives[] = "supportsTeamDrives"; | 44 const char kSupportsTeamDrives[] = "supportsTeamDrives"; |
45 const char kCorpora[] = "corpora"; | |
45 | 46 |
46 // apps.delete and file.authorize API is exposed through a special endpoint | 47 // apps.delete and file.authorize API is exposed through a special endpoint |
47 // v2internal that is accessible only by the official API key for Chrome. | 48 // v2internal that is accessible only by the official API key for Chrome. |
48 const char kDriveV2InternalAppsUrl[] = "drive/v2internal/apps"; | 49 const char kDriveV2InternalAppsUrl[] = "drive/v2internal/apps"; |
49 const char kDriveV2AppsDeleteUrlFormat[] = "drive/v2internal/apps/%s"; | 50 const char kDriveV2AppsDeleteUrlFormat[] = "drive/v2internal/apps/%s"; |
50 const char kDriveV2FilesAuthorizeUrlFormat[] = | 51 const char kDriveV2FilesAuthorizeUrlFormat[] = |
51 "drive/v2internal/files/%s/authorize?appId=%s"; | 52 "drive/v2internal/files/%s/authorize?appId=%s"; |
52 const char kDriveV2InternalFileUrlPrefix[] = "drive/v2internal/files/"; | 53 const char kDriveV2InternalFileUrlPrefix[] = "drive/v2internal/files/"; |
53 | 54 |
54 GURL AddResumableUploadParam(const GURL& url) { | 55 GURL AddResumableUploadParam(const GURL& url) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 } | 185 } |
185 | 186 |
186 GURL DriveApiUrlGenerator::GetFilesListUrl(int max_results, | 187 GURL DriveApiUrlGenerator::GetFilesListUrl(int max_results, |
187 const std::string& page_token, | 188 const std::string& page_token, |
188 const std::string& q) const { | 189 const std::string& q) const { |
189 GURL url = base_url_.Resolve(kDriveV2FilesUrl); | 190 GURL url = base_url_.Resolve(kDriveV2FilesUrl); |
190 if (enable_team_drives_) { | 191 if (enable_team_drives_) { |
191 url = net::AppendOrReplaceQueryParameter(url, kSupportsTeamDrives, "true"); | 192 url = net::AppendOrReplaceQueryParameter(url, kSupportsTeamDrives, "true"); |
192 url = net::AppendOrReplaceQueryParameter(url, kIncludeTeamDriveItems, | 193 url = net::AppendOrReplaceQueryParameter(url, kIncludeTeamDriveItems, |
193 "true"); | 194 "true"); |
195 url = net::AppendOrReplaceQueryParameter(url, kCorpora, | |
196 "default,allTeamDrives"); | |
hashimoto
2017/05/19 11:14:26
1. Is allTeamDrives the best option we can use her
yamaguchi
2017/05/24 01:32:44
Revised it to have a parameter for specifying the
| |
194 } | 197 } |
195 // maxResults is 100 by default. | 198 // maxResults is 100 by default. |
196 if (max_results != 100) { | 199 if (max_results != 100) { |
197 url = net::AppendOrReplaceQueryParameter( | 200 url = net::AppendOrReplaceQueryParameter( |
198 url, "maxResults", base::IntToString(max_results)); | 201 url, "maxResults", base::IntToString(max_results)); |
199 } | 202 } |
200 | 203 |
201 if (!page_token.empty()) | 204 if (!page_token.empty()) |
202 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token); | 205 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token); |
203 | 206 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 url = net::AppendOrReplaceQueryParameter(url, "maxResults", | 388 url = net::AppendOrReplaceQueryParameter(url, "maxResults", |
386 base::IntToString(max_results)); | 389 base::IntToString(max_results)); |
387 } | 390 } |
388 if (!page_token.empty()) | 391 if (!page_token.empty()) |
389 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token); | 392 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token); |
390 | 393 |
391 return url; | 394 return url; |
392 } | 395 } |
393 | 396 |
394 } // namespace google_apis | 397 } // namespace google_apis |
OLD | NEW |