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

Side by Side Diff: chrome/browser/google_apis/gdata_wapi_url_util.cc

Issue 11411086: google_apis: Move URL constants out of gdata_wapi_operations.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
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_util.h" 5 #include "chrome/browser/google_apis/gdata_wapi_url_util.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 "chrome/common/net/url_util.h" 9 #include "chrome/common/net/url_util.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "net/base/escape.h" 11 #include "net/base/escape.h"
12 12
13 namespace google_apis { 13 namespace google_apis {
14 namespace gdata_wapi_url_util { 14 namespace gdata_wapi_url_util {
15 15
16 namespace { 16 namespace {
17 17
18 // URL requesting documents list that belong to the authenticated user only 18 // URL requesting documents list that belong to the authenticated user only
19 // (handled with '/-/mine' part). 19 // (handled with '/-/mine' part).
20 const char kGetDocumentListURLForAllDocuments[] = 20 const char kGetDocumentListURLForAllDocuments[] =
21 "https://docs.google.com/feeds/default/private/full/-/mine"; 21 "https://docs.google.com/feeds/default/private/full/-/mine";
22 22
23 // URL requesting documents list in a particular directory specified by "%s" 23 // URL requesting documents list in a particular directory specified by "%s"
24 // that belong to the authenticated user only (handled with '/-/mine' part). 24 // that belong to the authenticated user only (handled with '/-/mine' part).
25 const char kGetDocumentListURLForDirectoryFormat[] = 25 const char kGetDocumentListURLForDirectoryFormat[] =
26 "https://docs.google.com/feeds/default/private/full/%s/contents/-/mine"; 26 "https://docs.google.com/feeds/default/private/full/%s/contents/-/mine";
27 27
28 // URL requesting single document entry whose resource id is specified by "%s".
29 const char kGetDocumentEntryURLFormat[] =
30 "https://docs.google.com/feeds/default/private/full/%s";
31
32 // Root document list url.
33 const char kDocumentListRootURL[] =
34 "https://docs.google.com/feeds/default/private/full";
35
36 // Metadata feed with things like user quota.
37 const char kAccountMetadataURL[] =
38 "https://docs.google.com/feeds/metadata/default";
39
28 #ifndef NDEBUG 40 #ifndef NDEBUG
29 // Use smaller 'page' size while debugging to ensure we hit feed reload 41 // Use smaller 'page' size while debugging to ensure we hit feed reload
30 // almost always. Be careful not to use something too small on account that 42 // almost always. Be careful not to use something too small on account that
31 // have many items because server side 503 error might kick in. 43 // have many items because server side 503 error might kick in.
32 const int kMaxDocumentsPerFeed = 500; 44 const int kMaxDocumentsPerFeed = 500;
33 const int kMaxDocumentsPerSearchFeed = 50; 45 const int kMaxDocumentsPerSearchFeed = 50;
34 #else 46 #else
35 const int kMaxDocumentsPerFeed = 500; 47 const int kMaxDocumentsPerFeed = 500;
36 const int kMaxDocumentsPerSearchFeed = 50; 48 const int kMaxDocumentsPerSearchFeed = 50;
37 #endif 49 #endif
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } else if (!directory_resource_id.empty()) { 125 } else if (!directory_resource_id.empty()) {
114 url = GURL(base::StringPrintf(kGetDocumentListURLForDirectoryFormat, 126 url = GURL(base::StringPrintf(kGetDocumentListURLForDirectoryFormat,
115 net::EscapePath( 127 net::EscapePath(
116 directory_resource_id).c_str())); 128 directory_resource_id).c_str()));
117 } else { 129 } else {
118 url = GURL(kGetDocumentListURLForAllDocuments); 130 url = GURL(kGetDocumentListURLForAllDocuments);
119 } 131 }
120 return AddFeedUrlParams(url, max_docs, start_changestamp, search_string); 132 return AddFeedUrlParams(url, max_docs, start_changestamp, search_string);
121 } 133 }
122 134
135 GURL GenerateDocumentEntryUrl(const std::string& resource_id) {
136 GURL result = GURL(base::StringPrintf(kGetDocumentEntryURLFormat,
137 net::EscapePath(resource_id).c_str()));
138 return AddStandardUrlParams(result);
139 }
140
141 GURL GenerateDocumentListRootUrl() {
142 return AddStandardUrlParams(GURL(kDocumentListRootURL));
143 }
144
145 GURL GenerateAccountMetadataUrl() {
146 return AddMetadataUrlParams(GURL(kAccountMetadataURL));
147 }
148
123 } // namespace gdata_wapi_url_util 149 } // namespace gdata_wapi_url_util
124 } // namespace google_apis 150 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_url_util.h ('k') | chrome/browser/google_apis/gdata_wapi_url_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698