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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 // Callback for handling results of ReloadFeedFromServerIfNeeded() initiated | 536 // Callback for handling results of ReloadFeedFromServerIfNeeded() initiated |
537 // from CheckForUpdates(). This callback checks whether feed is successfully | 537 // from CheckForUpdates(). This callback checks whether feed is successfully |
538 // reloaded, and in case of failure, restores the content origin of the root | 538 // reloaded, and in case of failure, restores the content origin of the root |
539 // directory. | 539 // directory. |
540 void OnUpdateChecked(ContentOrigin initial_origin, | 540 void OnUpdateChecked(ContentOrigin initial_origin, |
541 GDataFileError error, | 541 GDataFileError error, |
542 GDataEntry* entry); | 542 GDataEntry* entry); |
543 | 543 |
544 // Runs the callback and notifies that the initial load is finished. | 544 // Runs the callback and notifies that the initial load is finished. |
| 545 // |callback| must not be null. |
545 void RunAndNotifyInitialLoadFinished(const FindEntryCallback& callback, | 546 void RunAndNotifyInitialLoadFinished(const FindEntryCallback& callback, |
546 GDataFileError error, | 547 GDataFileError error, |
547 GDataEntry* entry); | 548 GDataEntry* entry); |
548 | 549 |
549 // Helper function that completes bookkeeping tasks related to | 550 // Helper function that completes bookkeeping tasks related to |
550 // completed file transfer. | 551 // completed file transfer. |
551 void OnTransferCompleted(const FileOperationCallback& callback, | 552 void OnTransferCompleted(const FileOperationCallback& callback, |
552 GDataFileError error, | 553 GDataFileError error, |
553 scoped_ptr<UploadFileInfo> upload_file_info); | 554 scoped_ptr<UploadFileInfo> upload_file_info); |
554 | 555 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 scoped_ptr<base::Value> data); | 592 scoped_ptr<base::Value> data); |
592 | 593 |
593 // Starts downloading a file if we have enough disk space indicated by | 594 // Starts downloading a file if we have enough disk space indicated by |
594 // |has_enough_space|. | 595 // |has_enough_space|. |
595 void StartDownloadFileIfEnoughSpace(const GetFileFromCacheParams& params, | 596 void StartDownloadFileIfEnoughSpace(const GetFileFromCacheParams& params, |
596 const GURL& content_url, | 597 const GURL& content_url, |
597 const FilePath& cache_file_path, | 598 const FilePath& cache_file_path, |
598 bool* has_enough_space); | 599 bool* has_enough_space); |
599 | 600 |
600 // Helper function used to perform synchronous file search on UI thread. | 601 // Helper function used to perform synchronous file search on UI thread. |
| 602 // |callback| must not be null. |
601 void FindEntryByPathSyncOnUIThread(const FilePath& search_file_path, | 603 void FindEntryByPathSyncOnUIThread(const FilePath& search_file_path, |
602 const FindEntryCallback& callback); | 604 const FindEntryCallback& callback); |
603 | 605 |
604 // Changes state of hosted documents visibility, triggers directory refresh. | 606 // Changes state of hosted documents visibility, triggers directory refresh. |
605 void SetHideHostedDocuments(bool hide); | 607 void SetHideHostedDocuments(bool hide); |
606 | 608 |
607 // Initializes preference change observer. | 609 // Initializes preference change observer. |
608 void InitializePreferenceObserver(); | 610 void InitializePreferenceObserver(); |
609 | 611 |
610 // Called when an entry is found for GetEntryInfoByPath(). | 612 // Called when an entry is found for GetEntryInfoByPath(). |
| 613 // |callback| must not be null. |
611 void OnGetEntryInfo(const GetEntryInfoCallback& callback, | 614 void OnGetEntryInfo(const GetEntryInfoCallback& callback, |
612 GDataFileError error, | 615 GDataFileError error, |
613 GDataEntry* entry); | 616 GDataEntry* entry); |
614 | 617 |
615 // Called when an entry is found for ReadDirectoryByPath(). | 618 // Called when an entry is found for ReadDirectoryByPath(). |
| 619 // |callback| must not be null. |
616 void OnReadDirectory(const ReadDirectoryWithSettingCallback& callback, | 620 void OnReadDirectory(const ReadDirectoryWithSettingCallback& callback, |
617 GDataFileError error, | 621 GDataFileError error, |
618 GDataEntry* entry); | 622 GDataEntry* entry); |
619 | 623 |
620 // Finds file info by using virtual |file_path|. This call will also | 624 // Finds file info by using virtual |file_path|. This call will also |
621 // retrieve and refresh file system content from server and disk cache. | 625 // retrieve and refresh file system content from server and disk cache. |
| 626 // |callback| must not be null. |
622 void FindEntryByPathAsyncOnUIThread(const FilePath& search_file_path, | 627 void FindEntryByPathAsyncOnUIThread(const FilePath& search_file_path, |
623 const FindEntryCallback& callback); | 628 const FindEntryCallback& callback); |
624 | 629 |
625 // Gets |file_path| from the file system after the file info is already | 630 // Gets |file_path| from the file system after the file info is already |
626 // resolved with GetEntryInfoByPath(). This function is called by | 631 // resolved with GetEntryInfoByPath(). This function is called by |
627 // OnGetEntryInfoCompleteForGetFileByPath and | 632 // OnGetEntryInfoCompleteForGetFileByPath and |
628 // OnGetEntryInfoCompleteForOpenFile. | 633 // OnGetEntryInfoCompleteForOpenFile. |
629 void GetResolvedFileByPath( | 634 void GetResolvedFileByPath( |
630 const FilePath& file_path, | 635 const FilePath& file_path, |
631 const GetFileCallback& get_file_callback, | 636 const GetFileCallback& get_file_callback, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 // Part of RequestDirectoryRefreshOnUIThread(). Called after | 761 // Part of RequestDirectoryRefreshOnUIThread(). Called after |
757 // GetEntryInfoByPath() is complete. | 762 // GetEntryInfoByPath() is complete. |
758 void RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( | 763 void RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( |
759 const FilePath& file_path, | 764 const FilePath& file_path, |
760 GDataFileError error, | 765 GDataFileError error, |
761 scoped_ptr<GDataEntryProto> entry_proto); | 766 scoped_ptr<GDataEntryProto> entry_proto); |
762 | 767 |
763 // Part of GetEntryByResourceId and GetEntryByPath. Checks whether there is a | 768 // Part of GetEntryByResourceId and GetEntryByPath. Checks whether there is a |
764 // local dirty cache for the entry, and if there is, replace the | 769 // local dirty cache for the entry, and if there is, replace the |
765 // PlatformFileInfo part of the |entry_proto| with the locally modified info. | 770 // PlatformFileInfo part of the |entry_proto| with the locally modified info. |
| 771 // |callback| must not be null. |
766 void CheckLocalModificationAndRun(scoped_ptr<GDataEntryProto> entry_proto, | 772 void CheckLocalModificationAndRun(scoped_ptr<GDataEntryProto> entry_proto, |
767 const GetEntryInfoCallback& callback); | 773 const GetEntryInfoCallback& callback); |
768 void CheckLocalModificationAndRunAfterGetCacheEntry( | 774 void CheckLocalModificationAndRunAfterGetCacheEntry( |
769 scoped_ptr<GDataEntryProto> entry_proto, | 775 scoped_ptr<GDataEntryProto> entry_proto, |
770 const GetEntryInfoCallback& callback, | 776 const GetEntryInfoCallback& callback, |
771 bool success, | 777 bool success, |
772 const GDataCacheEntry& cache_entry); | 778 const GDataCacheEntry& cache_entry); |
773 void CheckLocalModificationAndRunAfterGetCacheFile( | 779 void CheckLocalModificationAndRunAfterGetCacheFile( |
774 scoped_ptr<GDataEntryProto> entry_proto, | 780 scoped_ptr<GDataEntryProto> entry_proto, |
775 const GetEntryInfoCallback& callback, | 781 const GetEntryInfoCallback& callback, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 // invalidate the weak pointers before any other members are destroyed. | 831 // invalidate the weak pointers before any other members are destroyed. |
826 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 832 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
827 // Unlike other classes, we need this as we need this to redirect a task | 833 // Unlike other classes, we need this as we need this to redirect a task |
828 // from IO thread to UI thread. | 834 // from IO thread to UI thread. |
829 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 835 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
830 }; | 836 }; |
831 | 837 |
832 } // namespace gdata | 838 } // namespace gdata |
833 | 839 |
834 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 840 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |