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 <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
365 // Fetches the user's Account Metadata to find out current quota information | 365 // Fetches the user's Account Metadata to find out current quota information |
366 // and returns it to the callback. | 366 // and returns it to the callback. |
367 virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0; | 367 virtual void GetAvailableSpace(const GetAvailableSpaceCallback& callback) = 0; |
368 | 368 |
369 // Pin or unpin file. | 369 // Pin or unpin file. |
370 virtual void SetPinState(const FilePath& file_path, bool to_pin, | 370 virtual void SetPinState(const FilePath& file_path, bool to_pin, |
371 const FileOperationCallback& callback) = 0; | 371 const FileOperationCallback& callback) = 0; |
372 | 372 |
373 // Creates a new file from |entry| under |virtual_dir_path|. Stored its | 373 // Creates a new file from |entry| under |virtual_dir_path|. Stored its |
374 // content from |file_content_path| into the cache. | 374 // content from |file_content_path| into the cache. |
375 virtual void AddUploadedFile( | 375 // |
376 const FilePath& virtual_dir_path, | 376 // Must be run on the UI thread. |callback| will be run on the thread this |
377 DocumentEntry* entry, | 377 // function is called. |
satorux1
2012/06/14 20:30:06
maybe:
|callback| will be called on the UI thread
hshi1
2012/06/14 20:47:27
Done. Yes the only thing callback does is to delet
| |
378 const FilePath& file_content_path, | 378 virtual void AddUploadedFile(const FilePath& virtual_dir_path, |
379 GDataCache::FileOperationType cache_operation) = 0; | 379 DocumentEntry* entry, |
380 const FilePath& file_content_path, | |
381 GDataCache::FileOperationType cache_operation, | |
382 const base::Closure& callback) = 0; | |
380 | 383 |
381 // Returns true if hosted documents should be hidden. | 384 // Returns true if hosted documents should be hidden. |
382 virtual bool hide_hosted_documents() = 0; | 385 virtual bool hide_hosted_documents() = 0; |
383 }; | 386 }; |
384 | 387 |
385 // The production implementation of GDataFileSystemInterface. | 388 // The production implementation of GDataFileSystemInterface. |
386 class GDataFileSystem : public GDataFileSystemInterface, | 389 class GDataFileSystem : public GDataFileSystemInterface, |
387 public content::NotificationObserver { | 390 public content::NotificationObserver { |
388 public: | 391 public: |
389 GDataFileSystem( | 392 GDataFileSystem( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 virtual void ReadDirectoryByPathAsync( | 454 virtual void ReadDirectoryByPathAsync( |
452 const FilePath& file_path, | 455 const FilePath& file_path, |
453 const ReadDirectoryCallback& callback) OVERRIDE; | 456 const ReadDirectoryCallback& callback) OVERRIDE; |
454 virtual void RequestDirectoryRefresh( | 457 virtual void RequestDirectoryRefresh( |
455 const FilePath& file_path) OVERRIDE; | 458 const FilePath& file_path) OVERRIDE; |
456 virtual void GetAvailableSpace( | 459 virtual void GetAvailableSpace( |
457 const GetAvailableSpaceCallback& callback) OVERRIDE; | 460 const GetAvailableSpaceCallback& callback) OVERRIDE; |
458 // Calls private Pin or Unpin methods with |callback|. | 461 // Calls private Pin or Unpin methods with |callback|. |
459 virtual void SetPinState(const FilePath& file_path, bool pin, | 462 virtual void SetPinState(const FilePath& file_path, bool pin, |
460 const FileOperationCallback& callback) OVERRIDE; | 463 const FileOperationCallback& callback) OVERRIDE; |
461 virtual void AddUploadedFile( | 464 virtual void AddUploadedFile(const FilePath& virtual_dir_path, |
462 const FilePath& virtual_dir_path, | 465 DocumentEntry* entry, |
463 DocumentEntry* entry, | 466 const FilePath& file_content_path, |
464 const FilePath& file_content_path, | 467 GDataCache::FileOperationType cache_operation, |
465 GDataCache::FileOperationType cache_operation) OVERRIDE; | 468 const base::Closure& callback) OVERRIDE; |
466 virtual bool hide_hosted_documents() OVERRIDE; | 469 virtual bool hide_hosted_documents() OVERRIDE; |
467 | 470 |
468 // content::NotificationObserver implementation. | 471 // content::NotificationObserver implementation. |
469 virtual void Observe(int type, | 472 virtual void Observe(int type, |
470 const content::NotificationSource& source, | 473 const content::NotificationSource& source, |
471 const content::NotificationDetails& details) OVERRIDE; | 474 const content::NotificationDetails& details) OVERRIDE; |
472 | 475 |
473 // Used in tests to inject mock document service. | 476 // Used in tests to inject mock document service. |
474 void SetDocumentsServiceForTesting(DocumentsServiceInterface* | 477 void SetDocumentsServiceForTesting(DocumentsServiceInterface* |
475 new_document_service) { | 478 new_document_service) { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
990 void NotifyInitialLoadFinished(); | 993 void NotifyInitialLoadFinished(); |
991 void NotifyDocumentFeedFetched(int num_accumulated_entries); | 994 void NotifyDocumentFeedFetched(int num_accumulated_entries); |
992 | 995 |
993 // Helper function that completes bookkeeping tasks related to | 996 // Helper function that completes bookkeeping tasks related to |
994 // completed file transfer. | 997 // completed file transfer. |
995 void OnTransferCompleted( | 998 void OnTransferCompleted( |
996 const FileOperationCallback& callback, | 999 const FileOperationCallback& callback, |
997 base::PlatformFileError error, | 1000 base::PlatformFileError error, |
998 UploadFileInfo* upload_file_info); | 1001 UploadFileInfo* upload_file_info); |
999 | 1002 |
1003 // Helper function called upon completion of AddUploadFile invoked by | |
1004 // OnTransferCompleted. | |
1005 void OnAddUploadFileCompleted( | |
1006 const FileOperationCallback& callback, | |
1007 base::PlatformFileError error, | |
1008 UploadFileInfo* upload_file_info); | |
1009 | |
1000 // Kicks off file upload once it receives |upload_file_info|. | 1010 // Kicks off file upload once it receives |upload_file_info|. |
1001 void StartFileUploadOnUIThread( | 1011 void StartFileUploadOnUIThread( |
1002 const FileOperationCallback& callback, | 1012 const FileOperationCallback& callback, |
1003 base::PlatformFileError* error, | 1013 base::PlatformFileError* error, |
1004 UploadFileInfo* upload_file_info); | 1014 UploadFileInfo* upload_file_info); |
1005 | 1015 |
1006 // Cache entry points from within GDataFileSystem. | 1016 // Cache entry points from within GDataFileSystem. |
1007 // The functionalities of GData blob cache include: | 1017 // The functionalities of GData blob cache include: |
1008 // - stores downloaded gdata files on disk, indexed by the resource_id and md5 | 1018 // - stores downloaded gdata files on disk, indexed by the resource_id and md5 |
1009 // of the gdata file. | 1019 // of the gdata file. |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1407 void RequestDirectoryRefreshOnUIThread( | 1417 void RequestDirectoryRefreshOnUIThread( |
1408 const FilePath& file_path); | 1418 const FilePath& file_path); |
1409 void OnRequestDirectoryRefresh(GetDocumentsParams* params, | 1419 void OnRequestDirectoryRefresh(GetDocumentsParams* params, |
1410 base::PlatformFileError error); | 1420 base::PlatformFileError error); |
1411 void GetCacheStateOnUIThread(const std::string& resource_id, | 1421 void GetCacheStateOnUIThread(const std::string& resource_id, |
1412 const std::string& md5, | 1422 const std::string& md5, |
1413 const GetCacheStateCallback& callback); | 1423 const GetCacheStateCallback& callback); |
1414 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); | 1424 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); |
1415 void SetPinStateOnUIThread(const FilePath& file_path, bool to_pin, | 1425 void SetPinStateOnUIThread(const FilePath& file_path, bool to_pin, |
1416 const FileOperationCallback& callback); | 1426 const FileOperationCallback& callback); |
1427 void SetMountedStateOnUIThread( | |
1428 const FilePath& file_path, | |
1429 bool to_mount, | |
1430 const SetMountedStateCallback& callback); | |
1431 void AddUploadedFileOnUIThread(const FilePath& virtual_dir_path, | |
1432 DocumentEntry* entry, | |
1433 const FilePath& file_content_path, | |
1434 GDataCache::FileOperationType cache_operation, | |
1435 const base::Closure& callback); | |
1417 | 1436 |
1418 scoped_ptr<GDataRootDirectory> root_; | 1437 scoped_ptr<GDataRootDirectory> root_; |
1419 | 1438 |
1420 // This guards regular states. | 1439 // This guards regular states. |
1421 base::Lock lock_; | 1440 base::Lock lock_; |
1422 | 1441 |
1423 // The profile hosts the GDataFileSystem via GDataSystemService. | 1442 // The profile hosts the GDataFileSystem via GDataSystemService. |
1424 Profile* profile_; | 1443 Profile* profile_; |
1425 | 1444 |
1426 // The cache owned by GDataSystemService. | 1445 // The cache owned by GDataSystemService. |
(...skipping 28 matching lines...) Expand all Loading... | |
1455 | 1474 |
1456 ObserverList<Observer> observers_; | 1475 ObserverList<Observer> observers_; |
1457 | 1476 |
1458 // The token is used to post tasks to the blocking pool in sequence. | 1477 // The token is used to post tasks to the blocking pool in sequence. |
1459 const base::SequencedWorkerPool::SequenceToken sequence_token_; | 1478 const base::SequencedWorkerPool::SequenceToken sequence_token_; |
1460 }; | 1479 }; |
1461 | 1480 |
1462 } // namespace gdata | 1481 } // namespace gdata |
1463 | 1482 |
1464 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 1483 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |