OLD | NEW |
---|---|
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 "base/strings/string_number_conversions.h" | |
9 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
10 #include "net/base/escape.h" | 11 #include "net/base/escape.h" |
11 #include "net/base/url_util.h" | 12 #include "net/base/url_util.h" |
12 | 13 |
13 namespace google_apis { | 14 namespace google_apis { |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Content URL for modification or resource list retrieval in a particular | 17 // Content URL for modification or resource list retrieval in a particular |
17 // directory specified by "%s" which will be replaced with its resource id. | 18 // directory specified by "%s" which will be replaced with its resource id. |
18 const char kContentURLFormat[] = "/feeds/default/private/full/%s/contents"; | 19 const char kContentURLFormat[] = "/feeds/default/private/full/%s/contents"; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 // static | 74 // static |
74 GURL GDataWapiUrlGenerator::AddFeedUrlParams( | 75 GURL GDataWapiUrlGenerator::AddFeedUrlParams( |
75 const GURL& url, | 76 const GURL& url, |
76 int num_items_to_fetch, | 77 int num_items_to_fetch, |
77 int changestamp, | 78 int changestamp, |
78 const std::string& search_string) { | 79 const std::string& search_string) { |
79 GURL result = AddStandardUrlParams(url); | 80 GURL result = AddStandardUrlParams(url); |
80 result = net::AppendOrReplaceQueryParameter(result, "showfolders", "true"); | 81 result = net::AppendOrReplaceQueryParameter(result, "showfolders", "true"); |
81 result = net::AppendOrReplaceQueryParameter(result, "include-shared", "true"); | 82 result = net::AppendOrReplaceQueryParameter(result, "include-shared", "true"); |
82 result = net::AppendOrReplaceQueryParameter( | 83 result = net::AppendOrReplaceQueryParameter( |
83 result, | 84 result, "max-results", base::IntToString(num_items_to_fetch)); |
84 "max-results", | |
85 base::StringPrintf("%d", num_items_to_fetch)); | |
86 result = net::AppendOrReplaceQueryParameter( | |
87 result, "include-installed-apps", "true"); | |
88 | 85 |
89 if (changestamp) { | 86 if (changestamp) { |
90 result = net::AppendQueryParameter(result, | 87 result = net::AppendQueryParameter( |
91 "start-index", | 88 result, "start-index", base::IntToString(changestamp)); |
kinaba
2013/04/18 09:47:45
This is not directly related to this patch, but I'
| |
92 base::StringPrintf("%d", changestamp)); | |
93 } | 89 } |
94 | 90 |
95 if (!search_string.empty()) { | 91 if (!search_string.empty()) { |
96 result = net::AppendOrReplaceQueryParameter(result, "q", search_string); | 92 result = net::AppendOrReplaceQueryParameter(result, "q", search_string); |
97 } | 93 } |
98 return result; | 94 return result; |
99 } | 95 } |
100 | 96 |
101 GDataWapiUrlGenerator::GDataWapiUrlGenerator(const GURL& base_url) | 97 GDataWapiUrlGenerator::GDataWapiUrlGenerator(const GURL& base_url) |
102 : base_url_(GURL(base_url)) { | 98 : base_url_(GURL(base_url)) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 bool include_installed_apps) const { | 194 bool include_installed_apps) const { |
199 GURL result = AddStandardUrlParams(base_url_.Resolve(kAccountMetadataURL)); | 195 GURL result = AddStandardUrlParams(base_url_.Resolve(kAccountMetadataURL)); |
200 if (include_installed_apps) { | 196 if (include_installed_apps) { |
201 result = net::AppendOrReplaceQueryParameter( | 197 result = net::AppendOrReplaceQueryParameter( |
202 result, "include-installed-apps", "true"); | 198 result, "include-installed-apps", "true"); |
203 } | 199 } |
204 return result; | 200 return result; |
205 } | 201 } |
206 | 202 |
207 } // namespace google_apis | 203 } // namespace google_apis |
OLD | NEW |