| 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/chromeos/drive/drive_file_system_util.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 // -1 to include 'drive'. | 272 // -1 to include 'drive'. |
| 273 base::FilePath extracted; | 273 base::FilePath extracted; |
| 274 for (size_t i = arraysize(kDriveMountPointPathComponents) - 1; | 274 for (size_t i = arraysize(kDriveMountPointPathComponents) - 1; |
| 275 i < components.size(); ++i) { | 275 i < components.size(); ++i) { |
| 276 extracted = extracted.Append(components[i]); | 276 extracted = extracted.Append(components[i]); |
| 277 } | 277 } |
| 278 return extracted; | 278 return extracted; |
| 279 } | 279 } |
| 280 | 280 |
| 281 base::FilePath ExtractDrivePathFromFileSystemUrl( |
| 282 const fileapi::FileSystemURL& url) { |
| 283 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) |
| 284 return base::FilePath(); |
| 285 return ExtractDrivePath(url.path()); |
| 286 } |
| 287 |
| 281 std::string EscapeCacheFileName(const std::string& filename) { | 288 std::string EscapeCacheFileName(const std::string& filename) { |
| 282 // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape | 289 // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape |
| 283 std::string escaped; | 290 std::string escaped; |
| 284 for (size_t i = 0; i < filename.size(); ++i) { | 291 for (size_t i = 0; i < filename.size(); ++i) { |
| 285 char c = filename[i]; | 292 char c = filename[i]; |
| 286 if (c == '%' || c == '.' || c == '/') { | 293 if (c == '%' || c == '.' || c == '/') { |
| 287 base::StringAppendF(&escaped, "%%%02X", c); | 294 base::StringAppendF(&escaped, "%%%02X", c); |
| 288 } else { | 295 } else { |
| 289 escaped.push_back(c); | 296 escaped.push_back(c); |
| 290 } | 297 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 proto->set_last_modified(file_info.last_modified.ToInternalValue()); | 443 proto->set_last_modified(file_info.last_modified.ToInternalValue()); |
| 437 proto->set_last_accessed(file_info.last_accessed.ToInternalValue()); | 444 proto->set_last_accessed(file_info.last_accessed.ToInternalValue()); |
| 438 proto->set_creation_time(file_info.creation_time.ToInternalValue()); | 445 proto->set_creation_time(file_info.creation_time.ToInternalValue()); |
| 439 } | 446 } |
| 440 | 447 |
| 441 void EmptyFileOperationCallback(DriveFileError error) { | 448 void EmptyFileOperationCallback(DriveFileError error) { |
| 442 } | 449 } |
| 443 | 450 |
| 444 } // namespace util | 451 } // namespace util |
| 445 } // namespace drive | 452 } // namespace drive |
| OLD | NEW |