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_GDATA_GDATA_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 const std::string& mime_type, | 68 const std::string& mime_type, |
69 GDataFileType file_type)> | 69 GDataFileType file_type)> |
70 GetFileCallback; | 70 GetFileCallback; |
71 | 71 |
72 // Used to get file info from the file system. | 72 // Used to get file info from the file system. |
73 // If |error| is not PLATFORM_FILE_OK, |file_info| is set to NULL. | 73 // If |error| is not PLATFORM_FILE_OK, |file_info| is set to NULL. |
74 typedef base::Callback<void(base::PlatformFileError error, | 74 typedef base::Callback<void(base::PlatformFileError error, |
75 scoped_ptr<GDataFileProto> file_proto)> | 75 scoped_ptr<GDataFileProto> file_proto)> |
76 GetFileInfoCallback; | 76 GetFileInfoCallback; |
77 | 77 |
| 78 // Used to get entry info from the file system. |
| 79 // If |error| is not PLATFORM_FILE_OK, |entry_info| is set to NULL. |
| 80 typedef base::Callback<void(base::PlatformFileError error, |
| 81 scoped_ptr<GDataEntryProto> entry_proto)> |
| 82 GetEntryInfoCallback; |
| 83 |
78 // Used to read a directory from the file system. | 84 // Used to read a directory from the file system. |
79 // If |error| is not PLATFORM_FILE_OK, |file_info| is set to NULL. | 85 // If |error| is not PLATFORM_FILE_OK, |directory_info| is set to NULL. |
80 typedef base::Callback<void(base::PlatformFileError error, | 86 typedef base::Callback<void(base::PlatformFileError error, |
81 scoped_ptr<GDataDirectoryProto> directory_proto)> | 87 scoped_ptr<GDataDirectoryProto> directory_proto)> |
82 ReadDirectoryCallback; | 88 ReadDirectoryCallback; |
83 | 89 |
84 // Callback for SetMountedState. | 90 // Callback for SetMountedState. |
85 typedef base::Callback<void(base::PlatformFileError error, | 91 typedef base::Callback<void(base::PlatformFileError error, |
86 const FilePath& file_path)> | 92 const FilePath& file_path)> |
87 SetMountedStateCallback; | 93 SetMountedStateCallback; |
88 | 94 |
89 // Used for file operations like removing files. | 95 // Used for file operations like removing files. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // Gets the cache state of file corresponding to |resource_id| and |md5| if it | 318 // Gets the cache state of file corresponding to |resource_id| and |md5| if it |
313 // exists on disk. | 319 // exists on disk. |
314 // Initializes cache if it has not been initialized. | 320 // Initializes cache if it has not been initialized. |
315 // Upon completion, |callback| is invoked on the thread where this method was | 321 // Upon completion, |callback| is invoked on the thread where this method was |
316 // called with the cache state if file exists in cache or CACHE_STATE_NONE | 322 // called with the cache state if file exists in cache or CACHE_STATE_NONE |
317 // otherwise. | 323 // otherwise. |
318 virtual void GetCacheState(const std::string& resource_id, | 324 virtual void GetCacheState(const std::string& resource_id, |
319 const std::string& md5, | 325 const std::string& md5, |
320 const GetCacheStateCallback& callback) = 0; | 326 const GetCacheStateCallback& callback) = 0; |
321 | 327 |
| 328 // Finds an entry (a file or a directory) by |file_path|. This call will also |
| 329 // retrieve and refresh file system content from server and disk cache. |
| 330 // |
| 331 // Can be called from UI/IO thread. |callback| is run on the calling thread. |
| 332 virtual void GetEntryInfoByPathAsync( |
| 333 const FilePath& file_path, |
| 334 const GetEntryInfoCallback& callback) = 0; |
| 335 |
322 // Finds a file (not a directory) by |file_path|. This call will also | 336 // Finds a file (not a directory) by |file_path|. This call will also |
323 // retrieve and refresh file system content from server and disk cache. | 337 // retrieve and refresh file system content from server and disk cache. |
324 // | 338 // |
325 // Can be called from UI/IO thread. |callback| is run on the calling thread. | 339 // Can be called from UI/IO thread. |callback| is run on the calling thread. |
326 virtual void GetFileInfoByPathAsync(const FilePath& file_path, | 340 virtual void GetFileInfoByPathAsync(const FilePath& file_path, |
327 const GetFileInfoCallback& callback) = 0; | 341 const GetFileInfoCallback& callback) = 0; |
328 | 342 |
329 // Finds and reads a directory by |file_path|. This call will also retrieve | 343 // Finds and reads a directory by |file_path|. This call will also retrieve |
330 // and refresh file system content from server and disk cache. | 344 // and refresh file system content from server and disk cache. |
331 // | 345 // |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 const GetFileCallback& get_file_callback, | 433 const GetFileCallback& get_file_callback, |
420 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; | 434 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; |
421 virtual void GetFileByResourceId( | 435 virtual void GetFileByResourceId( |
422 const std::string& resource_id, | 436 const std::string& resource_id, |
423 const GetFileCallback& get_file_callback, | 437 const GetFileCallback& get_file_callback, |
424 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; | 438 const GetDownloadDataCallback& get_download_data_callback) OVERRIDE; |
425 virtual GDataOperationRegistry* GetOperationRegistry() OVERRIDE; | 439 virtual GDataOperationRegistry* GetOperationRegistry() OVERRIDE; |
426 virtual void GetCacheState(const std::string& resource_id, | 440 virtual void GetCacheState(const std::string& resource_id, |
427 const std::string& md5, | 441 const std::string& md5, |
428 const GetCacheStateCallback& callback) OVERRIDE; | 442 const GetCacheStateCallback& callback) OVERRIDE; |
| 443 virtual void GetEntryInfoByPathAsync( |
| 444 const FilePath& file_path, |
| 445 const GetEntryInfoCallback& callback) OVERRIDE; |
429 virtual void GetFileInfoByPathAsync( | 446 virtual void GetFileInfoByPathAsync( |
430 const FilePath& file_path, | 447 const FilePath& file_path, |
431 const GetFileInfoCallback& callback) OVERRIDE; | 448 const GetFileInfoCallback& callback) OVERRIDE; |
432 virtual void ReadDirectoryByPathAsync( | 449 virtual void ReadDirectoryByPathAsync( |
433 const FilePath& file_path, | 450 const FilePath& file_path, |
434 const ReadDirectoryCallback& callback) OVERRIDE; | 451 const ReadDirectoryCallback& callback) OVERRIDE; |
435 virtual bool GetFileInfoByPath(const FilePath& file_path, | 452 virtual bool GetFileInfoByPath(const FilePath& file_path, |
436 GDataFileProperties* properties) OVERRIDE; | 453 GDataFileProperties* properties) OVERRIDE; |
437 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const OVERRIDE; | 454 virtual bool IsUnderGDataCacheDirectory(const FilePath& path) const OVERRIDE; |
438 virtual FilePath GetCacheDirectoryPath( | 455 virtual FilePath GetCacheDirectoryPath( |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 base::PlatformFileError error, | 1240 base::PlatformFileError error, |
1224 const std::string& resource_id, | 1241 const std::string& resource_id, |
1225 const std::string& md5); | 1242 const std::string& md5); |
1226 | 1243 |
1227 // Changes state of hosted documents visibility, triggers directory refresh. | 1244 // Changes state of hosted documents visibility, triggers directory refresh. |
1228 void SetHideHostedDocuments(bool hide); | 1245 void SetHideHostedDocuments(bool hide); |
1229 | 1246 |
1230 // Initializes preference change observer. | 1247 // Initializes preference change observer. |
1231 void InitializePreferenceObserver(); | 1248 void InitializePreferenceObserver(); |
1232 | 1249 |
| 1250 // Called when an entry is found for GetEntryInfoByPathAsync(). |
| 1251 void OnGetEntryInfo(const GetEntryInfoCallback& callback, |
| 1252 base::PlatformFileError error, |
| 1253 const FilePath& entry_path, |
| 1254 GDataEntry* entry); |
| 1255 |
1233 // Called when an entry is found for GetFileInfoByPathAsync(). | 1256 // Called when an entry is found for GetFileInfoByPathAsync(). |
1234 void OnGetFileInfo(const GetFileInfoCallback& callback, | 1257 void OnGetFileInfo(const GetFileInfoCallback& callback, |
1235 base::PlatformFileError error, | 1258 base::PlatformFileError error, |
1236 const FilePath& directory_path, | 1259 const FilePath& directory_path, |
1237 GDataEntry* entry); | 1260 GDataEntry* entry); |
1238 | 1261 |
1239 // Called when an entry is found for ReadDirectoryByPathAsync(). | 1262 // Called when an entry is found for ReadDirectoryByPathAsync(). |
1240 void OnReadDirectory(const ReadDirectoryCallback& callback, | 1263 void OnReadDirectory(const ReadDirectoryCallback& callback, |
1241 base::PlatformFileError error, | 1264 base::PlatformFileError error, |
1242 const FilePath& directory_path, | 1265 const FilePath& directory_path, |
(...skipping 17 matching lines...) Expand all Loading... |
1260 bool is_recursive, | 1283 bool is_recursive, |
1261 const FileOperationCallback& callback); | 1284 const FileOperationCallback& callback); |
1262 void GetFileByPathOnUIThread( | 1285 void GetFileByPathOnUIThread( |
1263 const FilePath& file_path, | 1286 const FilePath& file_path, |
1264 const GetFileCallback& get_file_callback, | 1287 const GetFileCallback& get_file_callback, |
1265 const GetDownloadDataCallback& get_download_data_callback); | 1288 const GetDownloadDataCallback& get_download_data_callback); |
1266 void GetFileByResourceIdOnUIThread( | 1289 void GetFileByResourceIdOnUIThread( |
1267 const std::string& resource_id, | 1290 const std::string& resource_id, |
1268 const GetFileCallback& get_file_callback, | 1291 const GetFileCallback& get_file_callback, |
1269 const GetDownloadDataCallback& get_download_data_callback); | 1292 const GetDownloadDataCallback& get_download_data_callback); |
| 1293 void GetEntryInfoByPathAsyncOnUIThread( |
| 1294 const FilePath& file_path, |
| 1295 const GetEntryInfoCallback& callback); |
1270 void GetFileInfoByPathAsyncOnUIThread( | 1296 void GetFileInfoByPathAsyncOnUIThread( |
1271 const FilePath& file_path, | 1297 const FilePath& file_path, |
1272 const GetFileInfoCallback& callback); | 1298 const GetFileInfoCallback& callback); |
1273 void ReadDirectoryByPathAsyncOnUIThread( | 1299 void ReadDirectoryByPathAsyncOnUIThread( |
1274 const FilePath& file_path, | 1300 const FilePath& file_path, |
1275 const ReadDirectoryCallback& callback); | 1301 const ReadDirectoryCallback& callback); |
1276 void GetCacheStateOnUIThread(const std::string& resource_id, | 1302 void GetCacheStateOnUIThread(const std::string& resource_id, |
1277 const std::string& md5, | 1303 const std::string& md5, |
1278 const GetCacheStateCallback& callback); | 1304 const GetCacheStateCallback& callback); |
1279 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); | 1305 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 }; | 1371 }; |
1346 | 1372 |
1347 // Sets the free disk space getter for testing. | 1373 // Sets the free disk space getter for testing. |
1348 // The existing getter is deleted. | 1374 // The existing getter is deleted. |
1349 void SetFreeDiskSpaceGetterForTesting( | 1375 void SetFreeDiskSpaceGetterForTesting( |
1350 FreeDiskSpaceGetterInterface* getter); | 1376 FreeDiskSpaceGetterInterface* getter); |
1351 | 1377 |
1352 } // namespace gdata | 1378 } // namespace gdata |
1353 | 1379 |
1354 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 1380 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |