| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 | 217 |
| 218 GURL DriveApiUrlGenerator::GetFilesTrashUrl(const std::string& file_id) const { | 218 GURL DriveApiUrlGenerator::GetFilesTrashUrl(const std::string& file_id) const { |
| 219 GURL url = base_url_.Resolve(base::StringPrintf( | 219 GURL url = base_url_.Resolve(base::StringPrintf( |
| 220 kDriveV2FileTrashUrlFormat, net::EscapePath(file_id).c_str())); | 220 kDriveV2FileTrashUrlFormat, net::EscapePath(file_id).c_str())); |
| 221 if (enable_team_drives_) | 221 if (enable_team_drives_) |
| 222 url = net::AppendOrReplaceQueryParameter(url, kSupportsTeamDrives, "true"); | 222 url = net::AppendOrReplaceQueryParameter(url, kSupportsTeamDrives, "true"); |
| 223 return url; | 223 return url; |
| 224 } | 224 } |
| 225 | 225 |
| 226 GURL DriveApiUrlGenerator::GetChangesListUrl(bool include_deleted, | 226 GURL DriveApiUrlGenerator::GetChangesListUrl( |
| 227 int max_results, | 227 bool include_deleted, |
| 228 const std::string& page_token, | 228 int max_results, |
| 229 int64_t start_change_id) const { | 229 const std::string& page_token, |
| 230 int64_t start_change_id, |
| 231 const std::string& team_drive_id) const { |
| 230 DCHECK_GE(start_change_id, 0); | 232 DCHECK_GE(start_change_id, 0); |
| 231 | 233 |
| 232 GURL url = base_url_.Resolve(kDriveV2ChangelistUrl); | 234 GURL url = base_url_.Resolve(kDriveV2ChangelistUrl); |
| 233 if (enable_team_drives_) { | 235 if (enable_team_drives_) { |
| 234 url = net::AppendOrReplaceQueryParameter(url, kSupportsTeamDrives, "true"); | 236 url = net::AppendOrReplaceQueryParameter(url, kSupportsTeamDrives, "true"); |
| 235 url = net::AppendOrReplaceQueryParameter(url, kIncludeTeamDriveItems, | 237 url = net::AppendOrReplaceQueryParameter(url, kIncludeTeamDriveItems, |
| 236 "true"); | 238 "true"); |
| 239 if (!team_drive_id.empty()) { |
| 240 url = |
| 241 net::AppendOrReplaceQueryParameter(url, "teamDriveId", team_drive_id); |
| 242 } |
| 237 } | 243 } |
| 238 // includeDeleted is "true" by default. | 244 // includeDeleted is "true" by default. |
| 239 if (!include_deleted) | 245 if (!include_deleted) |
| 240 url = net::AppendOrReplaceQueryParameter(url, "includeDeleted", "false"); | 246 url = net::AppendOrReplaceQueryParameter(url, "includeDeleted", "false"); |
| 241 | 247 |
| 242 // maxResults is "100" by default. | 248 // maxResults is "100" by default. |
| 243 if (max_results != 100) { | 249 if (max_results != 100) { |
| 244 url = net::AppendOrReplaceQueryParameter( | 250 url = net::AppendOrReplaceQueryParameter( |
| 245 url, "maxResults", base::IntToString(max_results)); | 251 url, "maxResults", base::IntToString(max_results)); |
| 246 } | 252 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 url = net::AppendOrReplaceQueryParameter(url, "maxResults", | 385 url = net::AppendOrReplaceQueryParameter(url, "maxResults", |
| 380 base::IntToString(max_results)); | 386 base::IntToString(max_results)); |
| 381 } | 387 } |
| 382 if (!page_token.empty()) | 388 if (!page_token.empty()) |
| 383 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token); | 389 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token); |
| 384 | 390 |
| 385 return url; | 391 return url; |
| 386 } | 392 } |
| 387 | 393 |
| 388 } // namespace google_apis | 394 } // namespace google_apis |
| OLD | NEW |