| 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 "google_apis/drive/drive_api_url_generator.h" | 5 #include "google_apis/drive/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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 | 164 |
| 165 GURL DriveApiUrlGenerator::GetChildrenDeleteUrl( | 165 GURL DriveApiUrlGenerator::GetChildrenDeleteUrl( |
| 166 const std::string& child_id, const std::string& folder_id) const { | 166 const std::string& child_id, const std::string& folder_id) const { |
| 167 return base_url_.Resolve( | 167 return base_url_.Resolve( |
| 168 base::StringPrintf(kDriveV2ChildrenUrlForRemovalFormat, | 168 base::StringPrintf(kDriveV2ChildrenUrlForRemovalFormat, |
| 169 net::EscapePath(folder_id).c_str(), | 169 net::EscapePath(folder_id).c_str(), |
| 170 net::EscapePath(child_id).c_str())); | 170 net::EscapePath(child_id).c_str())); |
| 171 } | 171 } |
| 172 | 172 |
| 173 GURL DriveApiUrlGenerator::GetInitiateUploadNewFileUrl() const { | 173 GURL DriveApiUrlGenerator::GetInitiateUploadNewFileUrl( |
| 174 return AddResumableUploadParam( | 174 bool set_modified_date) const { |
| 175 GURL url = AddResumableUploadParam( |
| 175 base_url_.Resolve(kDriveV2InitiateUploadNewFileUrl)); | 176 base_url_.Resolve(kDriveV2InitiateUploadNewFileUrl)); |
| 177 |
| 178 // setModifiedDate is "false" by default. |
| 179 if (set_modified_date) |
| 180 url = net::AppendOrReplaceQueryParameter(url, "setModifiedDate", "true"); |
| 181 |
| 182 return url; |
| 176 } | 183 } |
| 177 | 184 |
| 178 GURL DriveApiUrlGenerator::GetInitiateUploadExistingFileUrl( | 185 GURL DriveApiUrlGenerator::GetInitiateUploadExistingFileUrl( |
| 179 const std::string& resource_id) const { | 186 const std::string& resource_id, |
| 180 const GURL& url = base_url_.Resolve( | 187 bool set_modified_date) const { |
| 188 GURL url = base_url_.Resolve( |
| 181 kDriveV2InitiateUploadExistingFileUrlPrefix + | 189 kDriveV2InitiateUploadExistingFileUrlPrefix + |
| 182 net::EscapePath(resource_id)); | 190 net::EscapePath(resource_id)); |
| 183 return AddResumableUploadParam(url); | 191 url = AddResumableUploadParam(url); |
| 192 |
| 193 // setModifiedDate is "false" by default. |
| 194 if (set_modified_date) |
| 195 url = net::AppendOrReplaceQueryParameter(url, "setModifiedDate", "true"); |
| 196 |
| 197 return url; |
| 184 } | 198 } |
| 185 | 199 |
| 186 GURL DriveApiUrlGenerator::GenerateDownloadFileUrl( | 200 GURL DriveApiUrlGenerator::GenerateDownloadFileUrl( |
| 187 const std::string& resource_id) const { | 201 const std::string& resource_id) const { |
| 188 return base_download_url_.Resolve(net::EscapePath(resource_id)); | 202 return base_download_url_.Resolve(net::EscapePath(resource_id)); |
| 189 } | 203 } |
| 190 | 204 |
| 191 } // namespace google_apis | 205 } // namespace google_apis |
| OLD | NEW |