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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 struct CreateDirectoryParams; | 164 struct CreateDirectoryParams; |
165 | 165 |
166 // Defines set of parameters passed to an intermediate callback | 166 // Defines set of parameters passed to an intermediate callback |
167 // OnGetFileCompleteForOpen, during execution of OpenFile() method. | 167 // OnGetFileCompleteForOpen, during execution of OpenFile() method. |
168 struct GetFileCompleteForOpenParams; | 168 struct GetFileCompleteForOpenParams; |
169 | 169 |
170 // Defines set of parameters passed to intermediate callbacks during | 170 // Defines set of parameters passed to intermediate callbacks during |
171 // execution of GetFileByPath() method. | 171 // execution of GetFileByPath() method. |
172 struct GetFileFromCacheParams; | 172 struct GetFileFromCacheParams; |
173 | 173 |
174 | |
175 // Struct used for StartFileUploadOnUIThread(). | 174 // Struct used for StartFileUploadOnUIThread(). |
176 struct StartFileUploadParams; | 175 struct StartFileUploadParams; |
177 | 176 |
| 177 // Struct used for AddUploadedFile. |
| 178 struct AddUploadedFileParams; |
| 179 |
178 // Callback passed to |LoadFeedFromServer| from |Search| method. | 180 // Callback passed to |LoadFeedFromServer| from |Search| method. |
179 // |callback| is that should be run with data received from | 181 // |callback| is that should be run with data received from |
180 // |LoadFeedFromServer|. | 182 // |LoadFeedFromServer|. |
181 // |params| params used for getting document feed for content search. | 183 // |params| params used for getting document feed for content search. |
182 // |error| error code returned by |LoadFeedFromServer|. | 184 // |error| error code returned by |LoadFeedFromServer|. |
183 void OnSearch(const SearchCallback& callback, | 185 void OnSearch(const SearchCallback& callback, |
184 GetDocumentsParams* params, | 186 GetDocumentsParams* params, |
185 GDataFileError error); | 187 GDataFileError error); |
186 | 188 |
187 // Part of TransferFileFromLocalToRemote(). Called after | 189 // Part of TransferFileFromLocalToRemote(). Called after |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 GDataErrorCode status, | 496 GDataErrorCode status, |
495 const GURL& document_url); | 497 const GURL& document_url); |
496 | 498 |
497 // Removes a file or directory under |file_path| on the client side and the | 499 // Removes a file or directory under |file_path| on the client side and the |
498 // corresponding file from cache if it exists. Returns PLATFORM_FILE_OK if | 500 // corresponding file from cache if it exists. Returns PLATFORM_FILE_OK if |
499 // successful. | 501 // successful. |
500 GDataFileError RemoveEntryAndCacheLocally(const FilePath& file_path); | 502 GDataFileError RemoveEntryAndCacheLocally(const FilePath& file_path); |
501 | 503 |
502 // Callback when an entry is moved to another directory on the client side. | 504 // Callback when an entry is moved to another directory on the client side. |
503 // Notifies the directory change and runs |callback|. | 505 // Notifies the directory change and runs |callback|. |
504 // |callback| must not be null. | 506 // |callback| may be null. |
505 void NotifyAndRunFileMoveCallback( | 507 void NotifyAndRunFileMoveCallback( |
506 const FileMoveCallback& callback, | 508 const FileMoveCallback& callback, |
507 GDataFileError error, | 509 GDataFileError error, |
508 const FilePath& moved_file_path); | 510 const FilePath& moved_file_path); |
509 | 511 |
510 // Callback when an entry is moved to another directory on the client side. | 512 // Callback when an entry is moved to another directory on the client side. |
511 // Notifies the directory change and runs |callback|. | 513 // Notifies the directory change and runs |callback|. |
512 // |callback| must not be null. | 514 // |callback| must not be null. |
513 void NotifyAndRunFileOperationCallback( | 515 void NotifyAndRunFileOperationCallback( |
514 const FileOperationCallback& callback, | 516 const FileOperationCallback& callback, |
515 GDataFileError error, | 517 GDataFileError error, |
516 const FilePath& moved_file_path); | 518 const FilePath& moved_file_path); |
517 | 519 |
| 520 // FileMoveCallback for directory changes. |
| 521 void OnDirectoryChangeFileMoveCallback( |
| 522 GDataFileError error, |
| 523 const FilePath& directory_path); |
| 524 |
518 // Callback for GetEntryByResourceIdAsync. | 525 // Callback for GetEntryByResourceIdAsync. |
519 // Removes stale entry upon upload of file. | 526 // Removes stale entry upon upload of file. |
520 static void RemoveStaleEntryOnUpload(const std::string& resource_id, | 527 void RemoveStaleEntryOnUpload(const std::string& resource_id, |
521 GDataDirectory* parent_dir, | 528 GDataDirectory* parent_dir, |
522 GDataEntry* existing_entry); | 529 const FileMoveCallback& callback, |
| 530 GDataEntry* existing_entry); |
| 531 |
| 532 // Continues to add an uploaded file after existing entry has been deleted. |
| 533 void ContinueAddUploadedFile(AddUploadedFileParams* params, |
| 534 GDataFileError error, |
| 535 const FilePath& file_path); |
| 536 |
| 537 // Adds the uploaded file to the cache. |
| 538 void AddUploadedFileToCache(AddUploadedFileParams* params, |
| 539 GDataFileError error, |
| 540 const FilePath& file_path); |
523 | 541 |
524 // Converts |entry_value| into GFileDocument instance and adds it | 542 // Converts |entry_value| into GFileDocument instance and adds it |
525 // to virtual file system at |directory_path|. | 543 // to virtual file system at |directory_path|. |
526 GDataFileError AddNewDirectory(const FilePath& directory_path, | 544 GDataFileError AddNewDirectory(const FilePath& directory_path, |
527 base::Value* entry_value); | 545 base::Value* entry_value); |
528 | 546 |
529 // Given non-existing |directory_path|, finds the first missing parent | 547 // Given non-existing |directory_path|, finds the first missing parent |
530 // directory of |directory_path|. | 548 // directory of |directory_path|. |
531 FindMissingDirectoryResult FindFirstMissingParentDirectory( | 549 FindMissingDirectoryResult FindFirstMissingParentDirectory( |
532 const FilePath& directory_path, | 550 const FilePath& directory_path, |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 const GetEntryInfoCallback& callback); | 734 const GetEntryInfoCallback& callback); |
717 void GetEntryInfoByResourceIdOnUIThread( | 735 void GetEntryInfoByResourceIdOnUIThread( |
718 const std::string& resource_id, | 736 const std::string& resource_id, |
719 const GetEntryInfoWithFilePathCallback& callback); | 737 const GetEntryInfoWithFilePathCallback& callback); |
720 void ReadDirectoryByPathAsyncOnUIThread( | 738 void ReadDirectoryByPathAsyncOnUIThread( |
721 const FilePath& file_path, | 739 const FilePath& file_path, |
722 const ReadDirectoryWithSettingCallback& callback); | 740 const ReadDirectoryWithSettingCallback& callback); |
723 void RequestDirectoryRefreshOnUIThread(const FilePath& file_path); | 741 void RequestDirectoryRefreshOnUIThread(const FilePath& file_path); |
724 void OnRequestDirectoryRefresh(GetDocumentsParams* params, | 742 void OnRequestDirectoryRefresh(GetDocumentsParams* params, |
725 GDataFileError error); | 743 GDataFileError error); |
726 void RequestDirectoryRefreshByEntry(const FilePath& directory_path, | |
727 const std::string& directory_resource_id, | |
728 const FileResourceIdMap& file_map, | |
729 GDataEntry* directory_entry); | |
730 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); | 744 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); |
731 void AddUploadedFileOnUIThread(UploadMode upload_mode, | 745 void AddUploadedFileOnUIThread(UploadMode upload_mode, |
732 const FilePath& virtual_dir_path, | 746 const FilePath& virtual_dir_path, |
733 scoped_ptr<DocumentEntry> entry, | 747 scoped_ptr<DocumentEntry> entry, |
734 const FilePath& file_content_path, | 748 const FilePath& file_content_path, |
735 GDataCache::FileOperationType cache_operation, | 749 GDataCache::FileOperationType cache_operation, |
736 const base::Closure& callback); | 750 const base::Closure& callback); |
737 | 751 |
738 // Part of CopyOnUIThread(). Called after GetEntryInfoPairByPaths() is | 752 // Part of CopyOnUIThread(). Called after GetEntryInfoPairByPaths() is |
739 // complete. |callback| must not be null. | 753 // complete. |callback| must not be null. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 // invalidate the weak pointers before any other members are destroyed. | 845 // invalidate the weak pointers before any other members are destroyed. |
832 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 846 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
833 // Unlike other classes, we need this as we need this to redirect a task | 847 // Unlike other classes, we need this as we need this to redirect a task |
834 // from IO thread to UI thread. | 848 // from IO thread to UI thread. |
835 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 849 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
836 }; | 850 }; |
837 | 851 |
838 } // namespace gdata | 852 } // namespace gdata |
839 | 853 |
840 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 854 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |