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

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

Issue 23757004: Refactor InsertResourceRequest and DeleteResourceRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 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/drive_api_url_generator.h" 5 #include "chrome/browser/google_apis/drive_api_url_generator.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/base/escape.h" 10 #include "net/base/escape.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (!page_token.empty()) 156 if (!page_token.empty())
157 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token); 157 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token);
158 158
159 if (start_change_id > 0) 159 if (start_change_id > 0)
160 url = net::AppendOrReplaceQueryParameter( 160 url = net::AppendOrReplaceQueryParameter(
161 url, "startChangeId", base::Int64ToString(start_change_id)); 161 url, "startChangeId", base::Int64ToString(start_change_id));
162 162
163 return url; 163 return url;
164 } 164 }
165 165
166 GURL DriveApiUrlGenerator::GetChildrenUrl( 166 GURL DriveApiUrlGenerator::GetChildrenInsertUrl(
167 const std::string& resource_id) const { 167 const std::string& file_id) const {
168 return base_url_.Resolve( 168 return base_url_.Resolve(base::StringPrintf(
169 base::StringPrintf(kDriveV2ChildrenUrlFormat, 169 kDriveV2ChildrenUrlFormat, net::EscapePath(file_id).c_str()));
170 net::EscapePath(resource_id).c_str()));
171 } 170 }
172 171
173 GURL DriveApiUrlGenerator::GetChildrenUrlForRemoval( 172 GURL DriveApiUrlGenerator::GetChildrenDeleteUrl(
174 const std::string& folder_id, const std::string& child_id) const { 173 const std::string& child_id, const std::string& folder_id) const {
175 return base_url_.Resolve( 174 return base_url_.Resolve(
176 base::StringPrintf(kDriveV2ChildrenUrlForRemovalFormat, 175 base::StringPrintf(kDriveV2ChildrenUrlForRemovalFormat,
177 net::EscapePath(folder_id).c_str(), 176 net::EscapePath(folder_id).c_str(),
178 net::EscapePath(child_id).c_str())); 177 net::EscapePath(child_id).c_str()));
179 } 178 }
180 179
181 GURL DriveApiUrlGenerator::GetInitiateUploadNewFileUrl() const { 180 GURL DriveApiUrlGenerator::GetInitiateUploadNewFileUrl() const {
182 return AddResumableUploadParam( 181 return AddResumableUploadParam(
183 base_url_.Resolve(kDriveV2InitiateUploadNewFileUrl)); 182 base_url_.Resolve(kDriveV2InitiateUploadNewFileUrl));
184 } 183 }
185 184
186 GURL DriveApiUrlGenerator::GetInitiateUploadExistingFileUrl( 185 GURL DriveApiUrlGenerator::GetInitiateUploadExistingFileUrl(
187 const std::string& resource_id) const { 186 const std::string& resource_id) const {
188 const GURL& url = base_url_.Resolve( 187 const GURL& url = base_url_.Resolve(
189 kDriveV2InitiateUploadExistingFileUrlPrefix + 188 kDriveV2InitiateUploadExistingFileUrlPrefix +
190 net::EscapePath(resource_id)); 189 net::EscapePath(resource_id));
191 return AddResumableUploadParam(url); 190 return AddResumableUploadParam(url);
192 } 191 }
193 192
194 GURL DriveApiUrlGenerator::GenerateDownloadFileUrl( 193 GURL DriveApiUrlGenerator::GenerateDownloadFileUrl(
195 const std::string& resource_id) const { 194 const std::string& resource_id) const {
196 return base_download_url_.Resolve(net::EscapePath(resource_id)); 195 return base_download_url_.Resolve(net::EscapePath(resource_id));
197 } 196 }
198 197
199 } // namespace google_apis 198 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/drive_api_url_generator.h ('k') | chrome/browser/google_apis/drive_api_url_generator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698