Index: chrome/browser/google_apis/drive_api_url_generator.cc |
diff --git a/chrome/browser/google_apis/drive_api_url_generator.cc b/chrome/browser/google_apis/drive_api_url_generator.cc |
index 7dc911d1feddb49912bc993fc8462722ff9881af..5387033e390c44667b6569034313a3e1c63c34ec 100644 |
--- a/chrome/browser/google_apis/drive_api_url_generator.cc |
+++ b/chrome/browser/google_apis/drive_api_url_generator.cc |
@@ -23,6 +23,13 @@ const char kDriveV2ChildrenUrlFormat[] = "/drive/v2/files/%s/children"; |
const char kDriveV2ChildrenUrlForRemovalFormat[] = |
"/drive/v2/files/%s/children/%s"; |
const char kDriveV2FileTrashUrlFormat[] = "/drive/v2/files/%s/trash"; |
+const char kDriveV2InitiateUploadNewFileUrl[] = "/upload/drive/v2/files"; |
+const char kDriveV2InitiateUploadExistingFileUrlPrefix[] = |
+ "/upload/drive/v2/files/"; |
+ |
+GURL AddResumableUploadParam(const GURL& url) { |
+ return net::AppendOrReplaceQueryParameter(url, "uploadType", "resumable"); |
+} |
} // namespace |
@@ -96,4 +103,17 @@ GURL DriveApiUrlGenerator::GetChildrenUrlForRemoval( |
net::EscapePath(child_id).c_str())); |
} |
+GURL DriveApiUrlGenerator::GetInitiateUploadNewFileUrl() const { |
+ return AddResumableUploadParam( |
+ base_url_.Resolve(kDriveV2InitiateUploadNewFileUrl)); |
+} |
+ |
+GURL DriveApiUrlGenerator::GetInitiateUploadExistingFileUrl( |
+ const std::string& resource_id) const { |
+ const GURL& url = base_url_.Resolve( |
+ kDriveV2InitiateUploadExistingFileUrlPrefix + |
+ net::EscapePath(resource_id)); |
+ return AddResumableUploadParam(url); |
+} |
+ |
} // namespace google_apis |