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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 namespace drive { | 24 namespace drive { |
25 | 25 |
26 class DriveAppRegistry; | 26 class DriveAppRegistry; |
27 class DriveServiceInterface; | 27 class DriveServiceInterface; |
28 class FileSystemInterface; | 28 class FileSystemInterface; |
29 class ResourceEntry; | 29 class ResourceEntry; |
30 | 30 |
31 namespace util { | 31 namespace util { |
32 | 32 |
33 // Path constants. | |
34 | |
35 // Name of the directory used to store metadata. | |
36 const base::FilePath::CharType kMetadataDirectory[] = FILE_PATH_LITERAL("meta"); | |
37 | |
38 // Name of the directory used to store cached files. | |
39 const base::FilePath::CharType kCacheFileDirectory[] = | |
40 FILE_PATH_LITERAL("files"); | |
41 | |
42 // Name of the directory used to store temporary files. | |
43 const base::FilePath::CharType kTemporaryFileDirectory[] = | |
44 FILE_PATH_LITERAL("tmp"); | |
45 | |
46 // Special resource IDs introduced to manage pseudo directory tree locally. | 33 // Special resource IDs introduced to manage pseudo directory tree locally. |
47 // These strings are supposed to be different from any resource ID used on the | 34 // These strings are supposed to be different from any resource ID used on the |
48 // server, and are never sent to the server. Practical resource IDs used so far | 35 // server, and are never sent to the server. Practical resource IDs used so far |
49 // have only alphabets/numbers ([a-zA-Z0-9]) and ':'. | 36 // have only alphabets/numbers ([a-zA-Z0-9]) and ':'. |
50 // Hence '<' and '>' around the directory name have been added to make them | 37 // Hence '<' and '>' around the directory name have been added to make them |
51 // different from normal server-side IDs. | 38 // different from normal server-side IDs. |
52 const char kDriveGrandRootSpecialResourceId[] = "<drive>"; | 39 const char kDriveGrandRootSpecialResourceId[] = "<drive>"; |
53 | 40 |
54 const char kDriveOtherDirSpecialResourceId[] = "<other>"; | 41 const char kDriveOtherDirSpecialResourceId[] = "<other>"; |
55 | 42 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 std::string NormalizeFileName(const std::string& input); | 138 std::string NormalizeFileName(const std::string& input); |
152 | 139 |
153 // Gets the cache root path (i.e. <user_profile_dir>/GCache/v1) from the | 140 // Gets the cache root path (i.e. <user_profile_dir>/GCache/v1) from the |
154 // profile. | 141 // profile. |
155 base::FilePath GetCacheRootPath(Profile* profile); | 142 base::FilePath GetCacheRootPath(Profile* profile); |
156 | 143 |
157 // Migrates cache files from old "persistent" and "tmp" directories to the new | 144 // Migrates cache files from old "persistent" and "tmp" directories to the new |
158 // "files" directory (see crbug.com/248905). | 145 // "files" directory (see crbug.com/248905). |
159 // TODO(hashimoto): Remove this function at some point. | 146 // TODO(hashimoto): Remove this function at some point. |
160 void MigrateCacheFilesFromOldDirectories( | 147 void MigrateCacheFilesFromOldDirectories( |
161 const base::FilePath& cache_root_directory); | 148 const base::FilePath& cache_root_directory, |
| 149 const base::FilePath::StringType& cache_file_directory_name); |
162 | 150 |
163 // Callback type for PrepareWritableFileAndRun. | 151 // Callback type for PrepareWritableFileAndRun. |
164 typedef base::Callback<void (FileError, const base::FilePath& path)> | 152 typedef base::Callback<void (FileError, const base::FilePath& path)> |
165 PrepareWritableFileCallback; | 153 PrepareWritableFileCallback; |
166 | 154 |
167 // Invokes |callback| on blocking thread pool, after converting virtual |path| | 155 // Invokes |callback| on blocking thread pool, after converting virtual |path| |
168 // string like "/special/drive/foo.txt" to the concrete local cache file path. | 156 // string like "/special/drive/foo.txt" to the concrete local cache file path. |
169 // After |callback| returns, the written content is synchronized to the server. | 157 // After |callback| returns, the written content is synchronized to the server. |
170 // | 158 // |
171 // The |path| must be a path under Drive. Must be called from UI thread. | 159 // The |path| must be a path under Drive. Must be called from UI thread. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // or an empty string if an error is found. | 209 // or an empty string if an error is found. |
222 std::string GetMd5Digest(const base::FilePath& file_path); | 210 std::string GetMd5Digest(const base::FilePath& file_path); |
223 | 211 |
224 // Returns true if Drive is enabled for the given Profile. | 212 // Returns true if Drive is enabled for the given Profile. |
225 bool IsDriveEnabledForProfile(Profile* profile); | 213 bool IsDriveEnabledForProfile(Profile* profile); |
226 | 214 |
227 } // namespace util | 215 } // namespace util |
228 } // namespace drive | 216 } // namespace drive |
229 | 217 |
230 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 218 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ |
OLD | NEW |