| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/drive/file_system_core_util.h" | 5 #include "components/drive/file_system_core_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 return grand_root_path; | 73 return grand_root_path; |
| 74 } | 74 } |
| 75 | 75 |
| 76 const base::FilePath& GetDriveMyDriveRootPath() { | 76 const base::FilePath& GetDriveMyDriveRootPath() { |
| 77 CR_DEFINE_STATIC_LOCAL( | 77 CR_DEFINE_STATIC_LOCAL( |
| 78 base::FilePath, drive_root_path, | 78 base::FilePath, drive_root_path, |
| 79 (GetDriveGrandRootPath().AppendASCII(kDriveMyDriveRootDirName))); | 79 (GetDriveGrandRootPath().AppendASCII(kDriveMyDriveRootDirName))); |
| 80 return drive_root_path; | 80 return drive_root_path; |
| 81 } | 81 } |
| 82 | 82 |
| 83 const base::FilePath& GetDriveTeamDrivesRootPath() { |
| 84 CR_DEFINE_STATIC_LOCAL( |
| 85 base::FilePath, team_drives_root_path, |
| 86 (GetDriveGrandRootPath().AppendASCII(kDriveTeamDrivesDirName))); |
| 87 return team_drives_root_path; |
| 88 } |
| 89 |
| 83 std::string EscapeCacheFileName(const std::string& filename) { | 90 std::string EscapeCacheFileName(const std::string& filename) { |
| 84 // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape | 91 // This is based on net/base/escape.cc: net::(anonymous namespace)::Escape |
| 85 std::string escaped; | 92 std::string escaped; |
| 86 for (size_t i = 0; i < filename.size(); ++i) { | 93 for (size_t i = 0; i < filename.size(); ++i) { |
| 87 char c = filename[i]; | 94 char c = filename[i]; |
| 88 if (c == '%' || c == '.' || c == '/') { | 95 if (c == '%' || c == '.' || c == '/') { |
| 89 base::StringAppendF(&escaped, "%%%02X", c); | 96 base::StringAppendF(&escaped, "%%%02X", c); |
| 90 } else { | 97 } else { |
| 91 escaped.push_back(c); | 98 escaped.push_back(c); |
| 92 } | 99 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 GURL ReadUrlFromGDocFile(const base::FilePath& file_path) { | 143 GURL ReadUrlFromGDocFile(const base::FilePath& file_path) { |
| 137 return GURL(ReadStringFromGDocFile(file_path, "url")); | 144 return GURL(ReadStringFromGDocFile(file_path, "url")); |
| 138 } | 145 } |
| 139 | 146 |
| 140 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path) { | 147 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path) { |
| 141 return ReadStringFromGDocFile(file_path, "resource_id"); | 148 return ReadStringFromGDocFile(file_path, "resource_id"); |
| 142 } | 149 } |
| 143 | 150 |
| 144 } // namespace util | 151 } // namespace util |
| 145 } // namespace drive | 152 } // namespace drive |
| OLD | NEW |