| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 const FileOperationCallback& callback, | 383 const FileOperationCallback& callback, |
| 384 GDataFileError error, | 384 GDataFileError error, |
| 385 const FilePath& file_path); | 385 const FilePath& file_path); |
| 386 | 386 |
| 387 // Part of MoveEntryFromRootDirectory(). Called after | 387 // Part of MoveEntryFromRootDirectory(). Called after |
| 388 // GetEntryInfoPairByPaths() is complete. |callback| must not be null. | 388 // GetEntryInfoPairByPaths() is complete. |callback| must not be null. |
| 389 void MoveEntryFromRootDirectoryAfterGetEntryInfoPair( | 389 void MoveEntryFromRootDirectoryAfterGetEntryInfoPair( |
| 390 const FileOperationCallback& callback, | 390 const FileOperationCallback& callback, |
| 391 scoped_ptr<EntryInfoPairResult> result); | 391 scoped_ptr<EntryInfoPairResult> result); |
| 392 | 392 |
| 393 // Removes a file or directory at |file_path| from the directory at | 393 // Removes a file or directory at |file_path| from the current directory if |
| 394 // |dir_path| and moves it to the root directory. | 394 // it's not in the root directory. This essentially moves an entry to the |
| 395 // root directory on the server side. |
| 395 // | 396 // |
| 396 // Can be called from UI thread. |callback| is run on the calling thread. | 397 // Can be called from UI thread. |callback| is run on the calling thread. |
| 397 void RemoveEntryFromDirectory(const FilePath& dir_path, | 398 // |callback| must not be null. |
| 398 const FileMoveCallback& callback, | 399 void RemoveEntryFromNonRootDirectory(const FileMoveCallback& callback, |
| 399 GDataFileError error, | 400 GDataFileError error, |
| 400 const FilePath& file_path); | 401 const FilePath& file_path); |
| 401 | 402 |
| 402 // Removes file under |file_path| from in-memory snapshot of the file system. | 403 // Removes file under |file_path| on the client side. |
| 403 // |resource_id| contains the resource id of the removed file if it was a | 404 // |resource_id| contains the resource id of the removed file if it was a |
| 404 // file. | 405 // file. |
| 405 // Return PLATFORM_FILE_OK if successful. | 406 // Return PLATFORM_FILE_OK if successful. |
| 406 GDataFileError RemoveEntryFromGData(const FilePath& file_path, | 407 GDataFileError RemoveEntryLocally(const FilePath& file_path, |
| 407 std::string* resource_id); | 408 std::string* resource_id); |
| 408 | 409 |
| 409 // A pass-through callback used for bridging from | 410 // A pass-through callback used for bridging from |
| 410 // FileMoveCallback to FileOperationCallback. | 411 // FileMoveCallback to FileOperationCallback. |
| 411 void OnFilePathUpdated(const FileOperationCallback& cllback, | 412 void OnFilePathUpdated(const FileOperationCallback& cllback, |
| 412 GDataFileError error, | 413 GDataFileError error, |
| 413 const FilePath& file_path); | 414 const FilePath& file_path); |
| 414 | 415 |
| 415 // Invoked upon completion of MarkDirtyInCache initiated by OpenFile. Invokes | 416 // Invoked upon completion of MarkDirtyInCache initiated by OpenFile. Invokes |
| 416 // |callback| with |cache_file_path|, which is the path of the cache file | 417 // |callback| with |cache_file_path|, which is the path of the cache file |
| 417 // ready for modification. | 418 // ready for modification. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 const FilePath& downloaded_file_path, | 492 const FilePath& downloaded_file_path, |
| 492 bool* has_enough_space); | 493 bool* has_enough_space); |
| 493 | 494 |
| 494 // Callback for handling internal StoreToCache() calls after downloading | 495 // Callback for handling internal StoreToCache() calls after downloading |
| 495 // file content. | 496 // file content. |
| 496 void OnDownloadStoredToCache(GDataFileError error, | 497 void OnDownloadStoredToCache(GDataFileError error, |
| 497 const std::string& resource_id, | 498 const std::string& resource_id, |
| 498 const std::string& md5); | 499 const std::string& md5); |
| 499 | 500 |
| 500 // Callback for handling resource rename attempt. Renames a file or | 501 // Callback for handling resource rename attempt. Renames a file or |
| 501 // directory at |file_path| on in-memory snapshot of the file system. | 502 // directory at |file_path| on the client side. |
| 502 void RenameFileOnFileSystem(const FilePath& file_path, | 503 // |callback| must not be null. |
| 503 const FilePath::StringType& new_name, | 504 void RenameEntryLocally(const FilePath& file_path, |
| 504 const FileMoveCallback& callback, | 505 const FilePath::StringType& new_name, |
| 505 GDataErrorCode status, | 506 const FileMoveCallback& callback, |
| 506 const GURL& document_url); | 507 GDataErrorCode status, |
| 508 const GURL& document_url); |
| 507 | 509 |
| 508 // Callback for handling an attempt to remove a file or directory from | 510 // Callback for handling an attempt to remove a file or directory from |
| 509 // another directory. Removes a file or directory at |file_path| and moves it | 511 // another directory. Moves a file or directory at |file_path| to root on |
| 510 // to root on in-memory snapshot of the file system. | 512 // the client side. |
| 511 void RemoveEntryFromDirectoryOnFileSystem( | 513 // |callback| must not be null. |
| 514 void MoveEntryToRootDirectoryLocally( |
| 512 const FileMoveCallback& callback, | 515 const FileMoveCallback& callback, |
| 513 const FilePath& file_path, | 516 const FilePath& file_path, |
| 514 const FilePath& dir_path, | 517 const FilePath& dir_path, |
| 515 GDataErrorCode status, | 518 GDataErrorCode status, |
| 516 const GURL& document_url); | 519 const GURL& document_url); |
| 517 | 520 |
| 518 // Removes a file or directory under |file_path| from in-memory snapshot of | 521 // Removes a file or directory under |file_path| on the client side and the |
| 519 // the file system and the corresponding file from cache if it exists. | 522 // corresponding file from cache if it exists. Returns PLATFORM_FILE_OK if |
| 520 // Return PLATFORM_FILE_OK if successful. | 523 // successful. |
| 521 GDataFileError RemoveEntryFromFileSystem(const FilePath& file_path); | 524 GDataFileError RemoveEntryAndCacheLocally(const FilePath& file_path); |
| 522 | 525 |
| 523 // Callback for GDataDirectoryService::MoveEntryToDirectory with | 526 // Callback when an entry is moved to another directory on the client side. |
| 524 // FileMoveCallback. | 527 // Notifies the directory change and runs |callback|. |
| 525 void OnMoveEntryToDirectoryWithFileMoveCallback( | 528 // |callback| must not be null. |
| 529 void NotifyAndRunFileMoveCallback( |
| 526 const FileMoveCallback& callback, | 530 const FileMoveCallback& callback, |
| 527 GDataFileError error, | 531 GDataFileError error, |
| 528 const FilePath& moved_file_path); | 532 const FilePath& moved_file_path); |
| 529 | 533 |
| 530 // Callback for GDataDirectoryService::MoveEntryToDirectory with | 534 // Callback when an entry is moved to another directory on the client side. |
| 531 // FileOperationCallback. | 535 // Notifies the directory change and runs |callback|. |
| 532 // |callback| must not be null. | 536 // |callback| must not be null. |
| 533 void OnMoveEntryToDirectoryWithFileOperationCallback( | 537 void NotifyAndRunFileOperationCallback( |
| 534 const FileOperationCallback& callback, | 538 const FileOperationCallback& callback, |
| 535 GDataFileError error, | 539 GDataFileError error, |
| 536 const FilePath& moved_file_path); | 540 const FilePath& moved_file_path); |
| 537 | 541 |
| 538 // Callback for GetEntryByResourceIdAsync. | 542 // Callback for GetEntryByResourceIdAsync. |
| 539 // Removes stale entry upon upload of file. | 543 // Removes stale entry upon upload of file. |
| 540 static void RemoveStaleEntryOnUpload(const std::string& resource_id, | 544 static void RemoveStaleEntryOnUpload(const std::string& resource_id, |
| 541 GDataDirectory* parent_dir, | 545 GDataDirectory* parent_dir, |
| 542 GDataEntry* existing_entry); | 546 GDataEntry* existing_entry); |
| 543 | 547 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 // invalidate the weak pointers before any other members are destroyed. | 859 // invalidate the weak pointers before any other members are destroyed. |
| 856 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; | 860 base::WeakPtrFactory<GDataFileSystem> ui_weak_ptr_factory_; |
| 857 // Unlike other classes, we need this as we need this to redirect a task | 861 // Unlike other classes, we need this as we need this to redirect a task |
| 858 // from IO thread to UI thread. | 862 // from IO thread to UI thread. |
| 859 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; | 863 base::WeakPtr<GDataFileSystem> ui_weak_ptr_; |
| 860 }; | 864 }; |
| 861 | 865 |
| 862 } // namespace gdata | 866 } // namespace gdata |
| 863 | 867 |
| 864 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ | 868 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_H_ |
| OLD | NEW |