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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 // Invokes |callback| on blocking thread pool, after converting virtual |path| | 147 // Invokes |callback| on blocking thread pool, after converting virtual |path| |
148 // string like "/special/drive/foo.txt" to the concrete local cache file path. | 148 // string like "/special/drive/foo.txt" to the concrete local cache file path. |
149 // After |callback| returns, the written content is synchronized to the server. | 149 // After |callback| returns, the written content is synchronized to the server. |
150 // | 150 // |
151 // The |path| must be a path under Drive. Must be called from UI thread. | 151 // The |path| must be a path under Drive. Must be called from UI thread. |
152 void PrepareWritableFileAndRun(Profile* profile, | 152 void PrepareWritableFileAndRun(Profile* profile, |
153 const base::FilePath& path, | 153 const base::FilePath& path, |
154 const PrepareWritableFileCallback& callback); | 154 const PrepareWritableFileCallback& callback); |
155 | 155 |
| 156 // Checks whether a directory exists at the given Drive path |directory|. |
| 157 // Must be called from UI thread. The result will be called back to |callback|. |
| 158 void CheckDirectoryExists(Profile* profile, |
| 159 const base::FilePath& directory, |
| 160 const FileOperationCallback& callback); |
| 161 |
156 // Ensures the existence of |directory| of '/special/drive/foo'. This will | 162 // Ensures the existence of |directory| of '/special/drive/foo'. This will |
157 // create |directory| and its ancestors if they don't exist. |callback| is | 163 // create |directory| and its ancestors if they don't exist. |callback| is |
158 // invoked after making sure that |directory| exists. |callback| should | 164 // invoked after making sure that |directory| exists. |callback| should |
159 // interpret error codes of either FILE_ERROR_OK or FILE_ERROR_EXISTS as | 165 // interpret error codes of either FILE_ERROR_OK or FILE_ERROR_EXISTS as |
160 // indicating that |directory| now exists. | 166 // indicating that |directory| now exists. |
161 // | 167 // |
162 // If |directory| is not a Drive path, it won't check the existence and just | 168 // If |directory| is not a Drive path, it won't check the existence and just |
163 // runs |callback|. | 169 // runs |callback|. |
164 // | 170 // |
165 // Must be called from UI thread. | 171 // Must be called from UI thread. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 DRIVE_CONNECTED, | 222 DRIVE_CONNECTED, |
217 }; | 223 }; |
218 | 224 |
219 // Returns the Drive connection status for the |profile|. | 225 // Returns the Drive connection status for the |profile|. |
220 ConnectionStatusType GetDriveConnectionStatus(Profile* profile); | 226 ConnectionStatusType GetDriveConnectionStatus(Profile* profile); |
221 | 227 |
222 } // namespace util | 228 } // namespace util |
223 } // namespace drive | 229 } // namespace drive |
224 | 230 |
225 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ | 231 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_UTIL_H_ |
OLD | NEW |