Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1972)

Unified Diff: chrome/browser/google_apis/gdata_wapi_url_generator.cc

Issue 12226073: Implement GenerateInitiateUpload{New,Existing}FileUrl. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148632_split_initiate_upload_interface
Patch Set: Rebase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/google_apis/gdata_wapi_url_generator.cc
diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator.cc b/chrome/browser/google_apis/gdata_wapi_url_generator.cc
index 58bfdc23954320aed72d0c540e2a88a77a2cd4a6..2529b7b2645787d8f392445aefe046cd65738c73 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator.cc
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator.cc
@@ -42,6 +42,15 @@ const char kResourceListRootURL[] = "/feeds/default/private/full";
// Metadata feed with things like user quota.
const char kAccountMetadataURL[] = "/feeds/metadata/default";
+// URL to upload a new file under a particular directory specified by "%s".
+const char kInitiateUploadNewFileURLFormat[] =
+ "/feeds/upload/create-session/default/private/full/%s/contents";
+
+// URL to upload a file content to overwrite a file whose resource id is
+// followed by this prefix.
+const char kInitiateUploadExistingFileURLPrefix[] =
+ "/feeds/upload/create-session/default/private/full/";
+
#ifndef NDEBUG
// Use smaller 'page' size while debugging to ensure we hit feed reload
// almost always. Be careful not to use something too small on account that
@@ -193,6 +202,21 @@ GURL GDataWapiUrlGenerator::GenerateResourceUrlForRemoval(
return AddStandardUrlParams(result);
}
+GURL GDataWapiUrlGenerator::GenerateInitiateUploadNewFileUrl(
+ const std::string& parent_resource_id) const {
+ GURL result = base_url_.Resolve(
+ base::StringPrintf(kInitiateUploadNewFileURLFormat,
+ net::EscapePath(parent_resource_id).c_str()));
+ return AddInitiateUploadUrlParams(result);
+}
+
+GURL GDataWapiUrlGenerator::GenerateInitiateUploadExistingFileUrl(
+ const std::string& resource_id) const {
+ GURL result = base_url_.Resolve(
+ kInitiateUploadExistingFileURLPrefix + net::EscapePath(resource_id));
+ return AddInitiateUploadUrlParams(result);
+}
+
GURL GDataWapiUrlGenerator::GenerateResourceListRootUrl() const {
return AddStandardUrlParams(base_url_.Resolve(kResourceListRootURL));
}
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_url_generator.h ('k') | chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698