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

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

Issue 12861002: drive: Remove "/-/mine" from WAPI resource list urls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified the test feed to include an not-mine entry. Created 7 years, 9 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 | 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_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"
11 #include "net/base/url_util.h" 11 #include "net/base/url_util.h"
12 12
13 namespace google_apis { 13 namespace google_apis {
14 namespace { 14 namespace {
15 15
16 // URL requesting resource list that belong to the authenticated user only 16 // Content URL for modification or resource list retrieval in a particular
17 // (handled with '/-/mine' part). 17 // directory specified by "%s" which will be replaced with its resource id.
18 const char kGetResourceListURLForAllDocuments[] =
19 "/feeds/default/private/full/-/mine";
20
21 // URL requesting resource list in a particular directory specified by "%s"
22 // that belong to the authenticated user only (handled with '/-/mine' part).
23 const char kGetResourceListURLForDirectoryFormat[] =
24 "/feeds/default/private/full/%s/contents/-/mine";
25
26 // Content URL for modification in a particular directory specified by "%s"
27 // which will be replaced with its resource id.
28 const char kContentURLFormat[] = "/feeds/default/private/full/%s/contents"; 18 const char kContentURLFormat[] = "/feeds/default/private/full/%s/contents";
29 19
30 // Content URL for removing a resource specified by the latter "%s" from the 20 // Content URL for removing a resource specified by the latter "%s" from the
31 // directory specified by the former "%s". 21 // directory specified by the former "%s".
32 const char kResourceURLForRemovalFormat[] = 22 const char kResourceURLForRemovalFormat[] =
33 "/feeds/default/private/full/%s/contents/%s"; 23 "/feeds/default/private/full/%s/contents/%s";
34 24
35 // URL requesting single resource entry whose resource id is followed by this 25 // URL requesting single resource entry whose resource id is followed by this
36 // prefix. 26 // prefix.
37 const char kGetEditURLPrefix[] = "/feeds/default/private/full/"; 27 const char kGetEditURLPrefix[] = "/feeds/default/private/full/";
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 start_changestamp = 0; 126 start_changestamp = 0;
137 url = override_url; 127 url = override_url;
138 } else if (shared_with_me) { 128 } else if (shared_with_me) {
139 url = base_url_.Resolve(kGetResourceListURLForSharedWithMe); 129 url = base_url_.Resolve(kGetResourceListURLForSharedWithMe);
140 } else if (start_changestamp > 0) { 130 } else if (start_changestamp > 0) {
141 // The start changestamp shouldn't be used for a search. 131 // The start changestamp shouldn't be used for a search.
142 DCHECK(search_string.empty()); 132 DCHECK(search_string.empty());
143 url = base_url_.Resolve(kGetChangesListURL); 133 url = base_url_.Resolve(kGetChangesListURL);
144 } else if (!directory_resource_id.empty()) { 134 } else if (!directory_resource_id.empty()) {
145 url = base_url_.Resolve( 135 url = base_url_.Resolve(
146 base::StringPrintf(kGetResourceListURLForDirectoryFormat, 136 base::StringPrintf(kContentURLFormat,
147 net::EscapePath( 137 net::EscapePath(
148 directory_resource_id).c_str())); 138 directory_resource_id).c_str()));
149 } else { 139 } else {
150 url = base_url_.Resolve(kGetResourceListURLForAllDocuments); 140 url = base_url_.Resolve(kResourceListRootURL);
151 } 141 }
152 return AddFeedUrlParams(url, max_docs, start_changestamp, search_string); 142 return AddFeedUrlParams(url, max_docs, start_changestamp, search_string);
153 } 143 }
154 144
155 GURL GDataWapiUrlGenerator::GenerateEditUrl( 145 GURL GDataWapiUrlGenerator::GenerateEditUrl(
156 const std::string& resource_id) const { 146 const std::string& resource_id) const {
157 return AddStandardUrlParams(GenerateEditUrlWithoutParams(resource_id)); 147 return AddStandardUrlParams(GenerateEditUrlWithoutParams(resource_id));
158 } 148 }
159 149
160 GURL GDataWapiUrlGenerator::GenerateEditUrlWithoutParams( 150 GURL GDataWapiUrlGenerator::GenerateEditUrlWithoutParams(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 bool include_installed_apps) const { 204 bool include_installed_apps) const {
215 GURL result = AddStandardUrlParams(base_url_.Resolve(kAccountMetadataURL)); 205 GURL result = AddStandardUrlParams(base_url_.Resolve(kAccountMetadataURL));
216 if (include_installed_apps) { 206 if (include_installed_apps) {
217 result = net::AppendOrReplaceQueryParameter( 207 result = net::AppendOrReplaceQueryParameter(
218 result, "include-installed-apps", "true"); 208 result, "include-installed-apps", "true");
219 } 209 }
220 return result; 210 return result;
221 } 211 }
222 212
223 } // namespace google_apis 213 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698