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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 GURL* last_dir_content_url, | 550 GURL* last_dir_content_url, |
551 FilePath* first_missing_parent_path); | 551 FilePath* first_missing_parent_path); |
552 | 552 |
553 // Callback for handling results of ReloadFeedFromServerIfNeeded() initiated | 553 // Callback for handling results of ReloadFeedFromServerIfNeeded() initiated |
554 // from CheckForUpdates(). This callback checks whether feed is successfully | 554 // from CheckForUpdates(). This callback checks whether feed is successfully |
555 // reloaded, and in case of failure, restores the content origin of the root | 555 // reloaded, and in case of failure, restores the content origin of the root |
556 // directory. | 556 // directory. |
557 void OnUpdateChecked(ContentOrigin initial_origin, | 557 void OnUpdateChecked(ContentOrigin initial_origin, |
558 GDataFileError error); | 558 GDataFileError error); |
559 | 559 |
560 // Finds the entry for |search_file_path| synchronously and runs the | 560 // Notifies that the initial load is finished and runs |callback|. |
561 // callback, then notifies that the initial load is finished. | |
562 // |callback| must not be null. | 561 // |callback| must not be null. |
563 void FindAndNotifyInitialLoadFinished(const FilePath& search_file_path, | 562 void NotifyInitialLoadFinishedAndRun(const FileOperationCallback& callback, |
564 const FindEntryCallback& callback, | 563 GDataFileError error); |
565 GDataFileError error); | |
566 | 564 |
567 // Helper function that completes bookkeeping tasks related to | 565 // Helper function that completes bookkeeping tasks related to |
568 // completed file transfer. | 566 // completed file transfer. |
569 void OnTransferCompleted(const FileOperationCallback& callback, | 567 void OnTransferCompleted(const FileOperationCallback& callback, |
570 GDataFileError error, | 568 GDataFileError error, |
571 scoped_ptr<UploadFileInfo> upload_file_info); | 569 scoped_ptr<UploadFileInfo> upload_file_info); |
572 | 570 |
573 // Kicks off file upload once it receives |file_size| and |content_type|. | 571 // Kicks off file upload once it receives |file_size| and |content_type|. |
574 void StartFileUploadOnUIThread(const StartFileUploadParams& params, | 572 void StartFileUploadOnUIThread(const StartFileUploadParams& params, |
575 GDataFileError* error, | 573 GDataFileError* error, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 GDataErrorCode status, | 606 GDataErrorCode status, |
609 scoped_ptr<base::Value> data); | 607 scoped_ptr<base::Value> data); |
610 | 608 |
611 // Starts downloading a file if we have enough disk space indicated by | 609 // Starts downloading a file if we have enough disk space indicated by |
612 // |has_enough_space|. | 610 // |has_enough_space|. |
613 void StartDownloadFileIfEnoughSpace(const GetFileFromCacheParams& params, | 611 void StartDownloadFileIfEnoughSpace(const GetFileFromCacheParams& params, |
614 const GURL& content_url, | 612 const GURL& content_url, |
615 const FilePath& cache_file_path, | 613 const FilePath& cache_file_path, |
616 bool* has_enough_space); | 614 bool* has_enough_space); |
617 | 615 |
618 // Helper function used to perform synchronous file search on UI thread. | |
619 // |callback| must not be null. | |
620 void FindEntryByPathSyncOnUIThread(const FilePath& search_file_path, | |
621 const FindEntryCallback& callback); | |
622 | |
623 // Changes state of hosted documents visibility, triggers directory refresh. | 616 // Changes state of hosted documents visibility, triggers directory refresh. |
624 void SetHideHostedDocuments(bool hide); | 617 void SetHideHostedDocuments(bool hide); |
625 | 618 |
626 // Initializes preference change observer. | 619 // Initializes preference change observer. |
627 void InitializePreferenceObserver(); | 620 void InitializePreferenceObserver(); |
628 | 621 |
629 // Called when an entry is found for GetEntryInfoByPath(). | 622 // Part of GetEntryInfoByPathOnUIThread() |
| 623 // 1) Called when the feed is loaded. |
| 624 // 2) Called when an entry is found. |
630 // |callback| must not be null. | 625 // |callback| must not be null. |
631 void OnGetEntryInfo(const GetEntryInfoCallback& callback, | 626 void GetEntryInfoByPathOnUIThreadAfterLoad( |
632 GDataFileError error, | 627 const FilePath& file_path, |
633 GDataEntry* entry); | 628 const GetEntryInfoCallback& callback, |
| 629 GDataFileError error); |
| 630 void GetEntryInfoByPathOnUIThreadAfterGetEntry( |
| 631 const GetEntryInfoCallback& callback, |
| 632 GDataFileError error, |
| 633 scoped_ptr<GDataEntryProto> entry_proto); |
634 | 634 |
635 // Called when an entry is found for ReadDirectoryByPath(). | 635 // Part of ReadDirectoryByPathOnUIThread() |
| 636 // 1) Called when the feed is loaded. |
| 637 // 2) Called when an entry is found. |
636 // |callback| must not be null. | 638 // |callback| must not be null. |
637 void OnReadDirectory(const ReadDirectoryWithSettingCallback& callback, | 639 void ReadDirectoryByPathOnUIThreadAfterLoad( |
638 GDataFileError error, | 640 const FilePath& file_path, |
639 GDataEntry* entry); | 641 const ReadDirectoryWithSettingCallback& callback, |
| 642 GDataFileError error); |
| 643 void ReadDirectoryByPathOnUIThreadAfterRead( |
| 644 const ReadDirectoryWithSettingCallback& callback, |
| 645 GDataFileError error, |
| 646 scoped_ptr<GDataEntryProtoVector> entries); |
640 | 647 |
641 // Finds file info by using virtual |file_path|. This call will also | 648 // Loads the feed from the cache or the server if not yet loaded. Runs |
642 // retrieve and refresh file system content from server and disk cache. | 649 // |callback| upon the completion with the error code. |
643 // |callback| must not be null. | 650 // |callback| must not be null. |
644 void FindEntryByPathAsyncOnUIThread(const FilePath& search_file_path, | 651 void LoadFeedIfNeeded(const FileOperationCallback& callback); |
645 const FindEntryCallback& callback); | |
646 | 652 |
647 // Gets |file_path| from the file system after the file info is already | 653 // Gets |file_path| from the file system after the file info is already |
648 // resolved with GetEntryInfoByPath(). This function is called by | 654 // resolved with GetEntryInfoByPath(). This function is called by |
649 // OnGetEntryInfoCompleteForGetFileByPath and | 655 // OnGetEntryInfoCompleteForGetFileByPath and |
650 // OnGetEntryInfoCompleteForOpenFile. | 656 // OnGetEntryInfoCompleteForOpenFile. |
651 void GetResolvedFileByPath( | 657 void GetResolvedFileByPath( |
652 const FilePath& file_path, | 658 const FilePath& file_path, |
653 const GetFileCallback& get_file_callback, | 659 const GetFileCallback& get_file_callback, |
654 const GetContentCallback& get_content_callback, | 660 const GetContentCallback& get_content_callback, |
655 GDataFileError error, | 661 GDataFileError error, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 const GetFileCallback& get_file_callback, | 728 const GetFileCallback& get_file_callback, |
723 const GetContentCallback& get_content_callback, | 729 const GetContentCallback& get_content_callback, |
724 GDataEntry* entry); | 730 GDataEntry* entry); |
725 void GetEntryInfoByEntryOnUIThread( | 731 void GetEntryInfoByEntryOnUIThread( |
726 const GetEntryInfoWithFilePathCallback& callback, | 732 const GetEntryInfoWithFilePathCallback& callback, |
727 GDataEntry* entry); | 733 GDataEntry* entry); |
728 void UpdateFileByResourceIdOnUIThread(const std::string& resource_id, | 734 void UpdateFileByResourceIdOnUIThread(const std::string& resource_id, |
729 const FileOperationCallback& callback); | 735 const FileOperationCallback& callback); |
730 void UpdateFileByEntryOnUIThread(const FileOperationCallback& callback, | 736 void UpdateFileByEntryOnUIThread(const FileOperationCallback& callback, |
731 GDataEntry* entry); | 737 GDataEntry* entry); |
732 void GetEntryInfoByPathAsyncOnUIThread(const FilePath& file_path, | 738 void GetEntryInfoByPathOnUIThread(const FilePath& file_path, |
733 const GetEntryInfoCallback& callback); | 739 const GetEntryInfoCallback& callback); |
734 void GetEntryInfoByResourceIdOnUIThread( | 740 void GetEntryInfoByResourceIdOnUIThread( |
735 const std::string& resource_id, | 741 const std::string& resource_id, |
736 const GetEntryInfoWithFilePathCallback& callback); | 742 const GetEntryInfoWithFilePathCallback& callback); |
737 void ReadDirectoryByPathAsyncOnUIThread( | 743 void ReadDirectoryByPathOnUIThread( |
738 const FilePath& file_path, | 744 const FilePath& file_path, |
739 const ReadDirectoryWithSettingCallback& callback); | 745 const ReadDirectoryWithSettingCallback& callback); |
740 void RequestDirectoryRefreshOnUIThread(const FilePath& file_path); | 746 void RequestDirectoryRefreshOnUIThread(const FilePath& file_path); |
741 void OnRequestDirectoryRefresh(const FilePath& directory_path, | 747 void OnRequestDirectoryRefresh(const FilePath& directory_path, |
742 GetDocumentsParams* params, | 748 GetDocumentsParams* params, |
743 GDataFileError error); | 749 GDataFileError error); |
744 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); | 750 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); |
745 void AddUploadedFileOnUIThread(UploadMode upload_mode, | 751 void AddUploadedFileOnUIThread(UploadMode upload_mode, |
746 const FilePath& virtual_dir_path, | 752 const FilePath& virtual_dir_path, |
747 scoped_ptr<DocumentEntry> entry, | 753 scoped_ptr<DocumentEntry> entry, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 // invalidate the weak pointers before any other members are destroyed. | 851 // invalidate the weak pointers before any other members are destroyed. |
846 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 852 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
847 // Unlike other classes, we need this as we need this to redirect a task | 853 // Unlike other classes, we need this as we need this to redirect a task |
848 // from IO thread to UI thread. | 854 // from IO thread to UI thread. |
849 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 855 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
850 }; | 856 }; |
851 | 857 |
852 } // namespace gdata | 858 } // namespace gdata |
853 | 859 |
854 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 860 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |