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

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

Issue 23514007: Refactor TrashResourceRequest. (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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 if (!page_token.empty()) 109 if (!page_token.empty())
110 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token); 110 url = net::AppendOrReplaceQueryParameter(url, "pageToken", page_token);
111 111
112 if (!q.empty()) 112 if (!q.empty())
113 url = net::AppendOrReplaceQueryParameter(url, "q", q); 113 url = net::AppendOrReplaceQueryParameter(url, "q", q);
114 114
115 return url; 115 return url;
116 } 116 }
117 117
118 GURL DriveApiUrlGenerator::GetFilesTrashUrl(const std::string& file_id) const {
119 return base_url_.Resolve(base::StringPrintf(
120 kDriveV2FileTrashUrlFormat, net::EscapePath(file_id).c_str()));
121 }
122
118 GURL DriveApiUrlGenerator::GetFileTouchUrl( 123 GURL DriveApiUrlGenerator::GetFileTouchUrl(
119 const std::string& resource_id) const { 124 const std::string& resource_id) const {
120 GURL url = base_url_.Resolve( 125 GURL url = base_url_.Resolve(
121 kDriveV2FileUrlPrefix + net::EscapePath(resource_id)); 126 kDriveV2FileUrlPrefix + net::EscapePath(resource_id));
122 127
123 // This parameter is needed to set the modified date. 128 // This parameter is needed to set the modified date.
124 url = net::AppendOrReplaceQueryParameter(url, "setModifiedDate", "true"); 129 url = net::AppendOrReplaceQueryParameter(url, "setModifiedDate", "true");
125 130
126 // This parameter is needed to set the last viewed by me date. Otherwise 131 // This parameter is needed to set the last viewed by me date. Otherwise
127 // the current time is set automatically. 132 // the current time is set automatically.
128 url = net::AppendOrReplaceQueryParameter(url, "updateViewedDate", "false"); 133 url = net::AppendOrReplaceQueryParameter(url, "updateViewedDate", "false");
129 134
130 return url; 135 return url;
131 } 136 }
132 137
133 GURL DriveApiUrlGenerator::GetFileTrashUrl(const std::string& file_id) const {
134 return base_url_.Resolve(
135 base::StringPrintf(kDriveV2FileTrashUrlFormat,
136 net::EscapePath(file_id).c_str()));
137 }
138
139 GURL DriveApiUrlGenerator::GetChangesListUrl(bool include_deleted, 138 GURL DriveApiUrlGenerator::GetChangesListUrl(bool include_deleted,
140 int max_results, 139 int max_results,
141 const std::string& page_token, 140 const std::string& page_token,
142 int64 start_change_id) const { 141 int64 start_change_id) const {
143 DCHECK_GE(start_change_id, 0); 142 DCHECK_GE(start_change_id, 0);
144 143
145 GURL url = base_url_.Resolve(kDriveV2ChangelistUrl); 144 GURL url = base_url_.Resolve(kDriveV2ChangelistUrl);
146 145
147 // includeDeleted is "true" by default. 146 // includeDeleted is "true" by default.
148 if (!include_deleted) 147 if (!include_deleted)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 net::EscapePath(resource_id)); 190 net::EscapePath(resource_id));
192 return AddResumableUploadParam(url); 191 return AddResumableUploadParam(url);
193 } 192 }
194 193
195 GURL DriveApiUrlGenerator::GenerateDownloadFileUrl( 194 GURL DriveApiUrlGenerator::GenerateDownloadFileUrl(
196 const std::string& resource_id) const { 195 const std::string& resource_id) const {
197 return base_download_url_.Resolve(net::EscapePath(resource_id)); 196 return base_download_url_.Resolve(net::EscapePath(resource_id));
198 } 197 }
199 198
200 } // namespace google_apis 199 } // 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