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 // Callback similar to FileOperationCallback but with a given |file_path|. | |
175 typedef base::Callback<void(GDataFileError error, | |
176 const FilePath& file_path)> | |
177 FilePathUpdateCallback; | |
178 | 174 |
179 // Struct used for StartFileUploadOnUIThread(). | 175 // Struct used for StartFileUploadOnUIThread(). |
180 struct StartFileUploadParams; | 176 struct StartFileUploadParams; |
181 | 177 |
182 // Callback passed to |LoadFeedFromServer| from |Search| method. | 178 // Callback passed to |LoadFeedFromServer| from |Search| method. |
183 // |callback| is that should be run with data received from | 179 // |callback| is that should be run with data received from |
184 // |LoadFeedFromServer|. | 180 // |LoadFeedFromServer|. |
185 // |params| params used for getting document feed for content search. | 181 // |params| params used for getting document feed for content search. |
186 // |error| error code returned by |LoadFeedFromServer|. | 182 // |error| error code returned by |LoadFeedFromServer|. |
187 void OnSearch(const SearchCallback& callback, | 183 void OnSearch(const SearchCallback& callback, |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 const FilePath& downloaded_file_path, | 478 const FilePath& downloaded_file_path, |
483 bool* has_enough_space); | 479 bool* has_enough_space); |
484 | 480 |
485 // Callback for handling internal StoreToCache() calls after downloading | 481 // Callback for handling internal StoreToCache() calls after downloading |
486 // file content. | 482 // file content. |
487 void OnDownloadStoredToCache(GDataFileError error, | 483 void OnDownloadStoredToCache(GDataFileError error, |
488 const std::string& resource_id, | 484 const std::string& resource_id, |
489 const std::string& md5); | 485 const std::string& md5); |
490 | 486 |
491 // Renames a file or directory at |file_path| on in-memory snapshot | 487 // Renames a file or directory at |file_path| on in-memory snapshot |
492 // of the file system. Returns PLATFORM_FILE_OK if successful. | 488 // of the file system. |
493 GDataFileError RenameFileOnFilesystem( | 489 void RenameFileOnFilesystem(const FilePath& file_path, |
494 const FilePath& file_path, const FilePath::StringType& new_name, | 490 const FilePath::StringType& new_name, |
495 FilePath* updated_file_path); | 491 const FilePathUpdateCallback& callback); |
496 | 492 |
497 // Adds an |entry| to another directory at |dir_path| on in-memory snapshot | 493 // Removes a file or directory at |file_path| and moves it to root on |
498 // of the file system. Returns PLATFORM_FILE_OK if successful. | 494 // in-memory snapshot of the file system. |
499 GDataFileError AddEntryToDirectoryOnFilesystem( | 495 void RemoveEntryFromDirectoryOnFilesystem( |
500 GDataEntry* entry, const FilePath& dir_path); | 496 const FilePath& file_path, |
501 | 497 const FilePathUpdateCallback& callback); |
502 // Removes a file or directory at |file_path| from another directory at | |
503 // |dir_path| on in-memory snapshot of the file system. | |
504 // Returns PLATFORM_FILE_OK if successful. | |
505 GDataFileError RemoveEntryFromDirectoryOnFilesystem( | |
506 const FilePath& file_path, const FilePath& dir_path, | |
507 FilePath* updated_file_path); | |
508 | 498 |
509 // Removes a file or directory under |file_path| from in-memory snapshot of | 499 // Removes a file or directory under |file_path| from in-memory snapshot of |
510 // the file system and the corresponding file from cache if it exists. | 500 // the file system and the corresponding file from cache if it exists. |
511 // Return PLATFORM_FILE_OK if successful. | 501 // Return PLATFORM_FILE_OK if successful. |
512 GDataFileError RemoveEntryFromFileSystem(const FilePath& file_path); | 502 GDataFileError RemoveEntryFromFileSystem(const FilePath& file_path); |
513 | 503 |
504 // Callback for GDataDirectoryService::AddEntryToDirectory. | |
505 void OnAddEntryToDirectory(const FilePathUpdateCallback& callback, | |
506 GDataFileError error, | |
507 const FilePath& updated_file_path); | |
508 | |
509 // Callback for GDataDirectoryService::AddEntryToDirectory. | |
510 void OnAddEntryToDirectory2(const FileOperationCallback& callback, | |
satorux1
2012/08/08 16:04:10
This does not look like a good name. What about:
achuithb
2012/08/08 22:08:41
Thanks for the suggestion. I didn't have the coura
| |
511 GDataFileError error, | |
512 const FilePath& updated_file_path); | |
513 | |
514 // Callback for GetEntryByResourceIdAsync. | 514 // Callback for GetEntryByResourceIdAsync. |
515 // Removes stale entry upon upload of file. | 515 // Removes stale entry upon upload of file. |
516 static void RemoveStaleEntryOnUpload(const std::string& resource_id, | 516 static void RemoveStaleEntryOnUpload(const std::string& resource_id, |
517 GDataDirectory* parent_dir, | 517 GDataDirectory* parent_dir, |
518 GDataEntry* existing_entry); | 518 GDataEntry* existing_entry); |
519 | 519 |
520 // Converts |entry_value| into GFileDocument instance and adds it | 520 // Converts |entry_value| into GFileDocument instance and adds it |
521 // to virtual file system at |directory_path|. | 521 // to virtual file system at |directory_path|. |
522 GDataFileError AddNewDirectory(const FilePath& directory_path, | 522 GDataFileError AddNewDirectory(const FilePath& directory_path, |
523 base::Value* entry_value); | 523 base::Value* entry_value); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
811 // invalidate the weak pointers before any other members are destroyed. | 811 // invalidate the weak pointers before any other members are destroyed. |
812 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 812 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
813 // Unlike other classes, we need this as we need this to redirect a task | 813 // Unlike other classes, we need this as we need this to redirect a task |
814 // from IO thread to UI thread. | 814 // from IO thread to UI thread. |
815 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 815 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
816 }; | 816 }; |
817 | 817 |
818 } // namespace gdata | 818 } // namespace gdata |
819 | 819 |
820 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 820 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
OLD | NEW |