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

Side by Side 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 unified diff | Download patch
OLDNEW
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 "chrome/browser/google_apis/gdata_wapi_url_generator.h" 5 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "net/base/escape.h" 10 #include "net/base/escape.h"
(...skipping 24 matching lines...) Expand all
35 // URL requesting single resource entry whose resource id is followed by this 35 // URL requesting single resource entry whose resource id is followed by this
36 // prefix. 36 // prefix.
37 const char kGetEditURLPrefix[] = "/feeds/default/private/full/"; 37 const char kGetEditURLPrefix[] = "/feeds/default/private/full/";
38 38
39 // Root resource list url. 39 // Root resource list url.
40 const char kResourceListRootURL[] = "/feeds/default/private/full"; 40 const char kResourceListRootURL[] = "/feeds/default/private/full";
41 41
42 // Metadata feed with things like user quota. 42 // Metadata feed with things like user quota.
43 const char kAccountMetadataURL[] = "/feeds/metadata/default"; 43 const char kAccountMetadataURL[] = "/feeds/metadata/default";
44 44
45 // URL to upload a new file under a particular directory specified by "%s".
46 const char kInitiateUploadNewFileURLFormat[] =
47 "/feeds/upload/create-session/default/private/full/%s/contents";
48
49 // URL to upload a file content to overwrite a file whose resource id is
50 // followed by this prefix.
51 const char kInitiateUploadExistingFileURLPrefix[] =
52 "/feeds/upload/create-session/default/private/full/";
53
45 #ifndef NDEBUG 54 #ifndef NDEBUG
46 // Use smaller 'page' size while debugging to ensure we hit feed reload 55 // Use smaller 'page' size while debugging to ensure we hit feed reload
47 // almost always. Be careful not to use something too small on account that 56 // almost always. Be careful not to use something too small on account that
48 // have many items because server side 503 error might kick in. 57 // have many items because server side 503 error might kick in.
49 const int kMaxDocumentsPerFeed = 500; 58 const int kMaxDocumentsPerFeed = 500;
50 const int kMaxDocumentsPerSearchFeed = 50; 59 const int kMaxDocumentsPerSearchFeed = 50;
51 #else 60 #else
52 const int kMaxDocumentsPerFeed = 500; 61 const int kMaxDocumentsPerFeed = 500;
53 const int kMaxDocumentsPerSearchFeed = 50; 62 const int kMaxDocumentsPerSearchFeed = 50;
54 #endif 63 #endif
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 return GURL(); 195 return GURL();
187 } 196 }
188 197
189 GURL result = base_url_.Resolve( 198 GURL result = base_url_.Resolve(
190 base::StringPrintf(kResourceURLForRemovalFormat, 199 base::StringPrintf(kResourceURLForRemovalFormat,
191 net::EscapePath(parent_resource_id).c_str(), 200 net::EscapePath(parent_resource_id).c_str(),
192 net::EscapePath(resource_id).c_str())); 201 net::EscapePath(resource_id).c_str()));
193 return AddStandardUrlParams(result); 202 return AddStandardUrlParams(result);
194 } 203 }
195 204
205 GURL GDataWapiUrlGenerator::GenerateInitiateUploadNewFileUrl(
206 const std::string& parent_resource_id) const {
207 GURL result = base_url_.Resolve(
208 base::StringPrintf(kInitiateUploadNewFileURLFormat,
209 net::EscapePath(parent_resource_id).c_str()));
210 return AddInitiateUploadUrlParams(result);
211 }
212
213 GURL GDataWapiUrlGenerator::GenerateInitiateUploadExistingFileUrl(
214 const std::string& resource_id) const {
215 GURL result = base_url_.Resolve(
216 kInitiateUploadExistingFileURLPrefix + net::EscapePath(resource_id));
217 return AddInitiateUploadUrlParams(result);
218 }
219
196 GURL GDataWapiUrlGenerator::GenerateResourceListRootUrl() const { 220 GURL GDataWapiUrlGenerator::GenerateResourceListRootUrl() const {
197 return AddStandardUrlParams(base_url_.Resolve(kResourceListRootURL)); 221 return AddStandardUrlParams(base_url_.Resolve(kResourceListRootURL));
198 } 222 }
199 223
200 GURL GDataWapiUrlGenerator::GenerateAccountMetadataUrl() const { 224 GURL GDataWapiUrlGenerator::GenerateAccountMetadataUrl() const {
201 return AddMetadataUrlParams(base_url_.Resolve(kAccountMetadataURL)); 225 return AddMetadataUrlParams(base_url_.Resolve(kAccountMetadataURL));
202 } 226 }
203 227
204 } // namespace google_apis 228 } // namespace google_apis
OLDNEW
« 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