| 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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 // Escapes forward slashes from file names with magic unicode character | 140 // Escapes forward slashes from file names with magic unicode character |
| 141 // \u2215 pretty much looks the same in UI. | 141 // \u2215 pretty much looks the same in UI. |
| 142 std::string EscapeUtf8FileName(const std::string& input); | 142 std::string EscapeUtf8FileName(const std::string& input); |
| 143 | 143 |
| 144 // Gets the cache root path (i.e. <user_profile_dir>/GCache/v1) from the | 144 // Gets the cache root path (i.e. <user_profile_dir>/GCache/v1) from the |
| 145 // profile. | 145 // profile. |
| 146 base::FilePath GetCacheRootPath(Profile* profile); | 146 base::FilePath GetCacheRootPath(Profile* profile); |
| 147 | 147 |
| 148 // Extracts resource_id, md5, and extra_extension from cache path. | 148 // Extracts resource_id, md5, and extra_extension from cache path. |
| 149 // Case 1: Pinned and outgoing symlinks only have resource_id. | 149 // Case 1: Normal files have both resource_id and md5. |
| 150 // Example: path="/user/GCache/v1/pinned/pdf:a1b2" => | |
| 151 // resource_id="pdf:a1b2", md5="", extra_extension=""; | |
| 152 // Case 2: Normal files have both resource_id and md5. | |
| 153 // Example: path="/user/GCache/v1/tmp/pdf:a1b2.01234567" => | 150 // Example: path="/user/GCache/v1/tmp/pdf:a1b2.01234567" => |
| 154 // resource_id="pdf:a1b2", md5="01234567", extra_extension=""; | 151 // resource_id="pdf:a1b2", md5="01234567", extra_extension=""; |
| 155 // Case 3: Mounted files have all three parts. | 152 // Case 2: Mounted files have all three parts. |
| 156 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => | 153 // Example: path="/user/GCache/v1/persistent/pdf:a1b2.01234567.mounted" => |
| 157 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". | 154 // resource_id="pdf:a1b2", md5="01234567", extra_extension="mounted". |
| 158 void ParseCacheFilePath(const base::FilePath& path, | 155 void ParseCacheFilePath(const base::FilePath& path, |
| 159 std::string* resource_id, | 156 std::string* resource_id, |
| 160 std::string* md5, | 157 std::string* md5, |
| 161 std::string* extra_extension); | 158 std::string* extra_extension); |
| 162 | 159 |
| 163 // Callback type for PrepareWritableFileAndRun. | 160 // Callback type for PrepareWritableFileAndRun. |
| 164 typedef base::Callback<void (FileError, const base::FilePath& path)> | 161 typedef base::Callback<void (FileError, const base::FilePath& path)> |
| 165 OpenFileCallback; | 162 OpenFileCallback; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // Reads URL from a GDoc file. | 227 // Reads URL from a GDoc file. |
| 231 GURL ReadUrlFromGDocFile(const base::FilePath& file_path); | 228 GURL ReadUrlFromGDocFile(const base::FilePath& file_path); |
| 232 | 229 |
| 233 // Reads resource ID from a GDoc file. | 230 // Reads resource ID from a GDoc file. |
| 234 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path); | 231 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path); |
| 235 | 232 |
| 236 } // namespace util | 233 } // namespace util |
| 237 } // namespace drive | 234 } // namespace drive |
| 238 | 235 |
| 239 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 236 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ |
| OLD | NEW |