| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 base::FilePath GetCacheRootPath(Profile* profile); | 144 base::FilePath GetCacheRootPath(Profile* profile); |
| 145 | 145 |
| 146 // Migrates cache files from old "persistent" and "tmp" directories to the new | 146 // Migrates cache files from old "persistent" and "tmp" directories to the new |
| 147 // "files" directory (see crbug.com/248905). | 147 // "files" directory (see crbug.com/248905). |
| 148 // TODO(hashimoto): Remove this function at some point. | 148 // TODO(hashimoto): Remove this function at some point. |
| 149 void MigrateCacheFilesFromOldDirectories( | 149 void MigrateCacheFilesFromOldDirectories( |
| 150 const base::FilePath& cache_root_directory); | 150 const base::FilePath& cache_root_directory); |
| 151 | 151 |
| 152 // Callback type for PrepareWritableFileAndRun. | 152 // Callback type for PrepareWritableFileAndRun. |
| 153 typedef base::Callback<void (FileError, const base::FilePath& path)> | 153 typedef base::Callback<void (FileError, const base::FilePath& path)> |
| 154 OpenFileCallback; | 154 PrepareWritableFileCallback; |
| 155 | 155 |
| 156 // Invokes |callback| on blocking thread pool, after converting virtual |path| | 156 // Invokes |callback| on blocking thread pool, after converting virtual |path| |
| 157 // string like "/special/drive/foo.txt" to the concrete local cache file path. | 157 // string like "/special/drive/foo.txt" to the concrete local cache file path. |
| 158 // After |callback| returns, the written content is synchronized to the server. | 158 // After |callback| returns, the written content is synchronized to the server. |
| 159 // | 159 // |
| 160 // If |path| is not a Drive path, it is regarded as a local path and no path | 160 // The |path| must be a path under Drive. Must be called from UI thread. |
| 161 // conversion takes place. | |
| 162 // | |
| 163 // Must be called from UI thread. | |
| 164 void PrepareWritableFileAndRun(Profile* profile, | 161 void PrepareWritableFileAndRun(Profile* profile, |
| 165 const base::FilePath& path, | 162 const base::FilePath& path, |
| 166 const OpenFileCallback& callback); | 163 const PrepareWritableFileCallback& callback); |
| 167 | 164 |
| 168 // Ensures the existence of |directory| of '/special/drive/foo'. This will | 165 // Ensures the existence of |directory| of '/special/drive/foo'. This will |
| 169 // create |directory| and its ancestors if they don't exist. |callback| is | 166 // create |directory| and its ancestors if they don't exist. |callback| is |
| 170 // invoked after making sure that |directory| exists. |callback| should | 167 // invoked after making sure that |directory| exists. |callback| should |
| 171 // interpret error codes of either FILE_ERROR_OK or FILE_ERROR_EXISTS as | 168 // interpret error codes of either FILE_ERROR_OK or FILE_ERROR_EXISTS as |
| 172 // indicating that |directory| now exists. | 169 // indicating that |directory| now exists. |
| 173 // | 170 // |
| 174 // If |directory| is not a Drive path, it won't check the existence and just | 171 // If |directory| is not a Drive path, it won't check the existence and just |
| 175 // runs |callback|. | 172 // runs |callback|. |
| 176 // | 173 // |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path); | 207 std::string ReadResourceIdFromGDocFile(const base::FilePath& file_path); |
| 211 | 208 |
| 212 // Returns the (base-16 encoded) MD5 digest of the file content at |file_path|, | 209 // Returns the (base-16 encoded) MD5 digest of the file content at |file_path|, |
| 213 // or an empty string if an error is found. | 210 // or an empty string if an error is found. |
| 214 std::string GetMd5Digest(const base::FilePath& file_path); | 211 std::string GetMd5Digest(const base::FilePath& file_path); |
| 215 | 212 |
| 216 } // namespace util | 213 } // namespace util |
| 217 } // namespace drive | 214 } // namespace drive |
| 218 | 215 |
| 219 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 216 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ |
| OLD | NEW |