Chromium Code Reviews| 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_DRIVE_DRIVE_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "base/timer.h" | 14 #include "base/timer.h" |
| 15 #include "chrome/browser/chromeos/drive/drive_cache.h" | 15 #include "chrome/browser/chromeos/drive/drive_cache.h" |
| 16 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" | 16 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" |
| 17 #include "chrome/browser/chromeos/drive/gdata_wapi_feed_loader.h" | |
|
hashimoto
2012/10/12 04:57:46
Why did you add this include?
satorux1
2012/10/12 05:32:56
Removed. Fixed.
| |
| 17 #include "chrome/browser/chromeos/drive/gdata_wapi_feed_loader_observer.h" | 18 #include "chrome/browser/chromeos/drive/gdata_wapi_feed_loader_observer.h" |
| 18 #include "chrome/browser/google_apis/gdata_errorcode.h" | 19 #include "chrome/browser/google_apis/gdata_errorcode.h" |
| 19 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
| 20 | 21 |
| 21 class PrefChangeRegistrar; | 22 class PrefChangeRegistrar; |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 struct PlatformFileInfo; | 25 struct PlatformFileInfo; |
| 25 class SequencedTaskRunner; | 26 class SequencedTaskRunner; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace gdata { | 29 namespace gdata { |
| 30 class DocumentFeed; | |
| 31 struct LoadFeedParams; | |
| 32 } | |
| 29 | 33 |
| 30 class DocumentFeed; | 34 namespace drive { |
| 35 | |
| 31 class DriveFileSystemObserver; | 36 class DriveFileSystemObserver; |
| 32 class DriveFunctionRemove; | 37 class DriveFunctionRemove; |
| 33 class DriveResourceMetadata; | 38 class DriveResourceMetadata; |
| 34 class DriveServiceInterface; | 39 class DriveServiceInterface; |
| 35 class DriveScheduler; | 40 class DriveScheduler; |
| 36 class DriveUploaderInterface; | 41 class DriveUploaderInterface; |
| 37 class DriveWebAppsRegistryInterface; | 42 class DriveWebAppsRegistryInterface; |
| 38 class GDataWapiFeedLoader; | 43 class GDataWapiFeedLoader; |
| 39 struct LoadFeedParams; | |
| 40 | 44 |
| 41 namespace file_system { | 45 namespace file_system { |
| 42 class MoveOperation; | 46 class MoveOperation; |
| 43 class RemoveOperation; | 47 class RemoveOperation; |
| 44 } | 48 } |
| 45 | 49 |
| 46 // The production implementation of DriveFileSystemInterface. | 50 // The production implementation of DriveFileSystemInterface. |
| 47 class DriveFileSystem : public DriveFileSystemInterface, | 51 class DriveFileSystem : public DriveFileSystemInterface, |
| 48 public GDataWapiFeedLoaderObserver, | 52 public GDataWapiFeedLoaderObserver, |
| 49 public content::NotificationObserver { | 53 public content::NotificationObserver { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 virtual void CreateDirectory(const FilePath& directory_path, | 100 virtual void CreateDirectory(const FilePath& directory_path, |
| 97 bool is_exclusive, | 101 bool is_exclusive, |
| 98 bool is_recursive, | 102 bool is_recursive, |
| 99 const FileOperationCallback& callback) OVERRIDE; | 103 const FileOperationCallback& callback) OVERRIDE; |
| 100 virtual void CreateFile(const FilePath& file_path, | 104 virtual void CreateFile(const FilePath& file_path, |
| 101 bool is_exclusive, | 105 bool is_exclusive, |
| 102 const FileOperationCallback& callback) OVERRIDE; | 106 const FileOperationCallback& callback) OVERRIDE; |
| 103 virtual void GetFileByPath( | 107 virtual void GetFileByPath( |
| 104 const FilePath& file_path, | 108 const FilePath& file_path, |
| 105 const GetFileCallback& get_file_callback, | 109 const GetFileCallback& get_file_callback, |
| 106 const GetContentCallback& get_content_callback) OVERRIDE; | 110 const gdata::GetContentCallback& get_content_callback) OVERRIDE; |
| 107 virtual void GetFileByResourceId( | 111 virtual void GetFileByResourceId( |
| 108 const std::string& resource_id, | 112 const std::string& resource_id, |
| 109 const GetFileCallback& get_file_callback, | 113 const GetFileCallback& get_file_callback, |
| 110 const GetContentCallback& get_content_callback) OVERRIDE; | 114 const gdata::GetContentCallback& get_content_callback) OVERRIDE; |
| 111 virtual void UpdateFileByResourceId( | 115 virtual void UpdateFileByResourceId( |
| 112 const std::string& resource_id, | 116 const std::string& resource_id, |
| 113 const FileOperationCallback& callback) OVERRIDE; | 117 const FileOperationCallback& callback) OVERRIDE; |
| 114 virtual void GetEntryInfoByPath( | 118 virtual void GetEntryInfoByPath( |
| 115 const FilePath& file_path, | 119 const FilePath& file_path, |
| 116 const GetEntryInfoCallback& callback) OVERRIDE; | 120 const GetEntryInfoCallback& callback) OVERRIDE; |
| 117 virtual void ReadDirectoryByPath( | 121 virtual void ReadDirectoryByPath( |
| 118 const FilePath& directory_path, | 122 const FilePath& directory_path, |
| 119 const ReadDirectoryWithSettingCallback& callback) OVERRIDE; | 123 const ReadDirectoryWithSettingCallback& callback) OVERRIDE; |
| 120 virtual void RequestDirectoryRefresh( | 124 virtual void RequestDirectoryRefresh( |
| 121 const FilePath& directory_path) OVERRIDE; | 125 const FilePath& directory_path) OVERRIDE; |
| 122 virtual void GetAvailableSpace( | 126 virtual void GetAvailableSpace( |
| 123 const GetAvailableSpaceCallback& callback) OVERRIDE; | 127 const GetAvailableSpaceCallback& callback) OVERRIDE; |
| 124 virtual void AddUploadedFile(UploadMode upload_mode, | 128 virtual void AddUploadedFile(gdata::UploadMode upload_mode, |
| 125 const FilePath& directory_path, | 129 const FilePath& directory_path, |
| 126 scoped_ptr<DocumentEntry> doc_entry, | 130 scoped_ptr<gdata::DocumentEntry> doc_entry, |
| 127 const FilePath& file_content_path, | 131 const FilePath& file_content_path, |
| 128 DriveCache::FileOperationType cache_operation, | 132 DriveCache::FileOperationType cache_operation, |
| 129 const base::Closure& callback) OVERRIDE; | 133 const base::Closure& callback) OVERRIDE; |
| 130 virtual void UpdateEntryData(const std::string& resource_id, | 134 virtual void UpdateEntryData(const std::string& resource_id, |
| 131 const std::string& md5, | 135 const std::string& md5, |
| 132 scoped_ptr<DocumentEntry> entry, | 136 scoped_ptr<gdata::DocumentEntry> entry, |
| 133 const FilePath& file_content_path, | 137 const FilePath& file_content_path, |
| 134 const base::Closure& callback) OVERRIDE; | 138 const base::Closure& callback) OVERRIDE; |
| 135 | 139 |
| 136 // content::NotificationObserver implementation. | 140 // content::NotificationObserver implementation. |
| 137 virtual void Observe(int type, | 141 virtual void Observe(int type, |
| 138 const content::NotificationSource& source, | 142 const content::NotificationSource& source, |
| 139 const content::NotificationDetails& details) OVERRIDE; | 143 const content::NotificationDetails& details) OVERRIDE; |
| 140 | 144 |
| 141 // GDataWapiFeedLoader::Observer overrides. | 145 // GDataWapiFeedLoader::Observer overrides. |
| 142 // Used to propagate events from GDataWapiFeedLoader. | 146 // Used to propagate events from GDataWapiFeedLoader. |
| 143 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; | 147 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; |
| 144 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; | 148 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; |
| 145 virtual void OnFeedFromServerLoaded() OVERRIDE; | 149 virtual void OnFeedFromServerLoaded() OVERRIDE; |
| 146 | 150 |
| 147 DriveResourceMetadata* ResourceMetadata() { return resource_metadata_.get(); } | 151 DriveResourceMetadata* ResourceMetadata() { return resource_metadata_.get(); } |
| 148 | 152 |
| 149 // Used in tests to load the root feed from the cache. | 153 // Used in tests to load the root feed from the cache. |
| 150 void LoadRootFeedFromCacheForTesting(); | 154 void LoadRootFeedFromCacheForTesting(); |
| 151 | 155 |
| 152 // Used in tests to update the file system from |feed_list|. | 156 // Used in tests to update the file system from |feed_list|. |
| 153 // See also the comment at GDataWapiFeedLoader::UpdateFromFeed(). | 157 // See also the comment at GDataWapiFeedLoader::UpdateFromFeed(). |
| 154 DriveFileError UpdateFromFeedForTesting( | 158 DriveFileError UpdateFromFeedForTesting( |
| 155 const ScopedVector<DocumentFeed>& feed_list, | 159 const ScopedVector<gdata::DocumentFeed>& feed_list, |
| 156 int64 start_changestamp, | 160 int64 start_changestamp, |
| 157 int64 root_feed_changestamp); | 161 int64 root_feed_changestamp); |
| 158 | 162 |
| 159 private: | 163 private: |
| 160 friend class DriveFileSystemTest; | 164 friend class DriveFileSystemTest; |
| 161 FRIEND_TEST_ALL_PREFIXES(DriveFileSystemTest, | 165 FRIEND_TEST_ALL_PREFIXES(DriveFileSystemTest, |
| 162 FindFirstMissingParentDirectory); | 166 FindFirstMissingParentDirectory); |
| 163 // Defines possible search results of FindFirstMissingParentDirectory(). | 167 // Defines possible search results of FindFirstMissingParentDirectory(). |
| 164 enum FindFirstMissingParentDirectoryError { | 168 enum FindFirstMissingParentDirectoryError { |
| 165 // Target directory found, it's not a directory. | 169 // Target directory found, it's not a directory. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 const FileOperationCallback& callback, | 314 const FileOperationCallback& callback, |
| 311 DriveFileError result); | 315 DriveFileError result); |
| 312 | 316 |
| 313 // Invoked upon completion of GetEntryInfoByPath initiated by | 317 // Invoked upon completion of GetEntryInfoByPath initiated by |
| 314 // GetFileByPath. It then continues to invoke GetResolvedFileByPath. | 318 // GetFileByPath. It then continues to invoke GetResolvedFileByPath. |
| 315 // |get_file_callback| must not be null. | 319 // |get_file_callback| must not be null. |
| 316 // |get_content_callback| may be null. | 320 // |get_content_callback| may be null. |
| 317 void OnGetEntryInfoCompleteForGetFileByPath( | 321 void OnGetEntryInfoCompleteForGetFileByPath( |
| 318 const FilePath& file_path, | 322 const FilePath& file_path, |
| 319 const GetFileCallback& get_file_callback, | 323 const GetFileCallback& get_file_callback, |
| 320 const GetContentCallback& get_content_callback, | 324 const gdata::GetContentCallback& get_content_callback, |
| 321 DriveFileError error, | 325 DriveFileError error, |
| 322 scoped_ptr<DriveEntryProto> file_info); | 326 scoped_ptr<DriveEntryProto> file_info); |
| 323 | 327 |
| 324 // Invoked upon completion of GetEntryInfoByPath initiated by OpenFile. | 328 // Invoked upon completion of GetEntryInfoByPath initiated by OpenFile. |
| 325 // It then continues to invoke GetResolvedFileByPath and proceeds to | 329 // It then continues to invoke GetResolvedFileByPath and proceeds to |
| 326 // OnGetFileCompleteForOpenFile. | 330 // OnGetFileCompleteForOpenFile. |
| 327 void OnGetEntryInfoCompleteForOpenFile( | 331 void OnGetEntryInfoCompleteForOpenFile( |
| 328 const FilePath& file_path, | 332 const FilePath& file_path, |
| 329 const OpenFileCallback& callback, | 333 const OpenFileCallback& callback, |
| 330 DriveFileError error, | 334 DriveFileError error, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 // | 435 // |
| 432 // Must be called on UI thread. | 436 // Must be called on UI thread. |
| 433 void OnMarkDirtyInCacheCompleteForOpenFile(const OpenFileCallback& callback, | 437 void OnMarkDirtyInCacheCompleteForOpenFile(const OpenFileCallback& callback, |
| 434 DriveFileError error, | 438 DriveFileError error, |
| 435 const FilePath& cache_file_path); | 439 const FilePath& cache_file_path); |
| 436 | 440 |
| 437 // Callback for handling document copy attempt. | 441 // Callback for handling document copy attempt. |
| 438 // |callback| must not be null. | 442 // |callback| must not be null. |
| 439 void OnCopyDocumentCompleted(const FilePath& dir_path, | 443 void OnCopyDocumentCompleted(const FilePath& dir_path, |
| 440 const FileOperationCallback& callback, | 444 const FileOperationCallback& callback, |
| 441 GDataErrorCode status, | 445 gdata::GDataErrorCode status, |
| 442 scoped_ptr<base::Value> data); | 446 scoped_ptr<base::Value> data); |
| 443 | 447 |
| 444 // Callback for handling account metadata fetch. | 448 // Callback for handling account metadata fetch. |
| 445 void OnGetAvailableSpace(const GetAvailableSpaceCallback& callback, | 449 void OnGetAvailableSpace(const GetAvailableSpaceCallback& callback, |
| 446 GDataErrorCode status, | 450 gdata::GDataErrorCode status, |
| 447 scoped_ptr<base::Value> data); | 451 scoped_ptr<base::Value> data); |
| 448 | 452 |
| 449 // Callback for handling Drive V2 about resource fetch. | 453 // Callback for handling Drive V2 about resource fetch. |
| 450 void OnGetAboutResource(const GetAvailableSpaceCallback& callback, | 454 void OnGetAboutResource(const GetAvailableSpaceCallback& callback, |
| 451 GDataErrorCode status, | 455 gdata::GDataErrorCode status, |
| 452 scoped_ptr<base::Value> data); | 456 scoped_ptr<base::Value> data); |
| 453 | 457 |
| 454 // Callback for handling directory create requests. Adds the directory | 458 // Callback for handling directory create requests. Adds the directory |
| 455 // represented by |created_entry| to the local filesystem. | 459 // represented by |created_entry| to the local filesystem. |
| 456 void AddNewDirectory(const CreateDirectoryParams& params, | 460 void AddNewDirectory(const CreateDirectoryParams& params, |
| 457 GDataErrorCode status, | 461 gdata::GDataErrorCode status, |
| 458 scoped_ptr<base::Value> created_entry); | 462 scoped_ptr<base::Value> created_entry); |
| 459 | 463 |
| 460 // Callback for DriveResourceMetadata::AddEntryToDirectory. Continues the | 464 // Callback for DriveResourceMetadata::AddEntryToDirectory. Continues the |
| 461 // recursive creation of a directory path by calling CreateDirectory again. | 465 // recursive creation of a directory path by calling CreateDirectory again. |
| 462 void ContinueCreateDirectory( | 466 void ContinueCreateDirectory( |
| 463 const CreateDirectoryParams& params, | 467 const CreateDirectoryParams& params, |
| 464 DriveFileError error, | 468 DriveFileError error, |
| 465 const FilePath& moved_directory_path); | 469 const FilePath& moved_directory_path); |
| 466 | 470 |
| 467 // Callback for handling file downloading requests. | 471 // Callback for handling file downloading requests. |
| 468 void OnFileDownloaded(const GetFileFromCacheParams& params, | 472 void OnFileDownloaded(const GetFileFromCacheParams& params, |
| 469 GDataErrorCode status, | 473 gdata::GDataErrorCode status, |
| 470 const GURL& content_url, | 474 const GURL& content_url, |
| 471 const FilePath& downloaded_file_path); | 475 const FilePath& downloaded_file_path); |
| 472 | 476 |
| 473 // Unpins file if cache entry is pinned. | 477 // Unpins file if cache entry is pinned. |
| 474 void UnpinIfPinned(const std::string& resource_id, | 478 void UnpinIfPinned(const std::string& resource_id, |
| 475 const std::string& md5, | 479 const std::string& md5, |
| 476 bool success, | 480 bool success, |
| 477 const DriveCacheEntry& cache_entry); | 481 const DriveCacheEntry& cache_entry); |
| 478 | 482 |
| 479 // Similar to OnFileDownloaded() but takes |has_enough_space| so we report | 483 // Similar to OnFileDownloaded() but takes |has_enough_space| so we report |
| 480 // an error in case we don't have enough disk space. | 484 // an error in case we don't have enough disk space. |
| 481 void OnFileDownloadedAndSpaceChecked(const GetFileFromCacheParams& params, | 485 void OnFileDownloadedAndSpaceChecked(const GetFileFromCacheParams& params, |
| 482 GDataErrorCode status, | 486 gdata::GDataErrorCode status, |
| 483 const GURL& content_url, | 487 const GURL& content_url, |
| 484 const FilePath& downloaded_file_path, | 488 const FilePath& downloaded_file_path, |
| 485 bool* has_enough_space); | 489 bool* has_enough_space); |
| 486 | 490 |
| 487 // Callback for handling internal StoreToCache() calls after downloading | 491 // Callback for handling internal StoreToCache() calls after downloading |
| 488 // file content. | 492 // file content. |
| 489 void OnDownloadStoredToCache(DriveFileError error, | 493 void OnDownloadStoredToCache(DriveFileError error, |
| 490 const std::string& resource_id, | 494 const std::string& resource_id, |
| 491 const std::string& md5); | 495 const std::string& md5); |
| 492 | 496 |
| 493 // Moves entry specified by |file_path| to the directory specified by | 497 // Moves entry specified by |file_path| to the directory specified by |
| 494 // |dir_path| and calls |callback| asynchronously. | 498 // |dir_path| and calls |callback| asynchronously. |
| 495 // |callback| must not be null. | 499 // |callback| must not be null. |
| 496 void MoveEntryToDirectory(const FilePath& file_path, | 500 void MoveEntryToDirectory(const FilePath& file_path, |
| 497 const FilePath& directory_path, | 501 const FilePath& directory_path, |
| 498 const FileMoveCallback& callback, | 502 const FileMoveCallback& callback, |
| 499 GDataErrorCode status, | 503 gdata::GDataErrorCode status, |
| 500 const GURL& document_url); | 504 const GURL& document_url); |
| 501 | 505 |
| 502 // Callback when an entry is moved to another directory on the client side. | 506 // Callback when an entry is moved to another directory on the client side. |
| 503 // Notifies the directory change and runs |callback|. | 507 // Notifies the directory change and runs |callback|. |
| 504 // |callback| must not be null. | 508 // |callback| must not be null. |
| 505 void NotifyAndRunFileOperationCallback( | 509 void NotifyAndRunFileOperationCallback( |
| 506 const FileOperationCallback& callback, | 510 const FileOperationCallback& callback, |
| 507 DriveFileError error, | 511 DriveFileError error, |
| 508 const FilePath& moved_file_path); | 512 const FilePath& moved_file_path); |
| 509 | 513 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 // |callback| must not be null. | 557 // |callback| must not be null. |
| 554 void NotifyInitialLoadFinishedAndRun(const FileOperationCallback& callback, | 558 void NotifyInitialLoadFinishedAndRun(const FileOperationCallback& callback, |
| 555 DriveFileError error); | 559 DriveFileError error); |
| 556 | 560 |
| 557 // Helper function that completes bookkeeping tasks related to | 561 // Helper function that completes bookkeeping tasks related to |
| 558 // completed file transfer. | 562 // completed file transfer. |
| 559 void OnTransferCompleted(const FileOperationCallback& callback, | 563 void OnTransferCompleted(const FileOperationCallback& callback, |
| 560 DriveFileError error, | 564 DriveFileError error, |
| 561 const FilePath& drive_path, | 565 const FilePath& drive_path, |
| 562 const FilePath& file_path, | 566 const FilePath& file_path, |
| 563 scoped_ptr<DocumentEntry> document_entry); | 567 scoped_ptr<gdata::DocumentEntry> document_entry); |
| 564 | 568 |
| 565 // Kicks off file upload once it receives |file_size| and |content_type|. | 569 // Kicks off file upload once it receives |file_size| and |content_type|. |
| 566 void StartFileUploadOnUIThread(const StartFileUploadParams& params, | 570 void StartFileUploadOnUIThread(const StartFileUploadParams& params, |
| 567 DriveFileError* error, | 571 DriveFileError* error, |
| 568 int64* file_size, | 572 int64* file_size, |
| 569 std::string* content_type); | 573 std::string* content_type); |
| 570 | 574 |
| 571 // Part of StartFileUploadOnUIThread(). Called after GetEntryInfoByPath() | 575 // Part of StartFileUploadOnUIThread(). Called after GetEntryInfoByPath() |
| 572 // is complete. | 576 // is complete. |
| 573 void StartFileUploadOnUIThreadAfterGetEntryInfo( | 577 void StartFileUploadOnUIThreadAfterGetEntryInfo( |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 585 // GetFileByPath() request. | 589 // GetFileByPath() request. |
| 586 void OnGetFileFromCache(const GetFileFromCacheParams& params, | 590 void OnGetFileFromCache(const GetFileFromCacheParams& params, |
| 587 DriveFileError error, | 591 DriveFileError error, |
| 588 const FilePath& cache_file_path); | 592 const FilePath& cache_file_path); |
| 589 | 593 |
| 590 // Callback for |drive_service_->GetDocumentEntry|. | 594 // Callback for |drive_service_->GetDocumentEntry|. |
| 591 // It is called before file download. If GetDocumentEntry was successful, | 595 // It is called before file download. If GetDocumentEntry was successful, |
| 592 // file download procedure is started for the file. The file is downloaded | 596 // file download procedure is started for the file. The file is downloaded |
| 593 // from the content url extracted from the fetched metadata. | 597 // from the content url extracted from the fetched metadata. |
| 594 void OnGetDocumentEntry(const GetFileFromCacheParams& params, | 598 void OnGetDocumentEntry(const GetFileFromCacheParams& params, |
| 595 GDataErrorCode status, | 599 gdata::GDataErrorCode status, |
| 596 scoped_ptr<base::Value> data); | 600 scoped_ptr<base::Value> data); |
| 597 | 601 |
| 598 // Check available space using file size from the fetched metadata. Called | 602 // Check available space using file size from the fetched metadata. Called |
| 599 // from OnGetDocumentEntry after RefreshFile is complete. | 603 // from OnGetDocumentEntry after RefreshFile is complete. |
| 600 void CheckForSpaceBeforeDownload( | 604 void CheckForSpaceBeforeDownload( |
| 601 const GetFileFromCacheParams& params, | 605 const GetFileFromCacheParams& params, |
| 602 int64 file_size, | 606 int64 file_size, |
| 603 const GURL& content_url, | 607 const GURL& content_url, |
| 604 DriveFileError error, | 608 DriveFileError error, |
| 605 const FilePath& drive_file_path, | 609 const FilePath& drive_file_path, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 650 void LoadFeedIfNeeded(const FileOperationCallback& callback); | 654 void LoadFeedIfNeeded(const FileOperationCallback& callback); |
| 651 | 655 |
| 652 // Gets the file at |file_path| from the cache (if found in the cache), | 656 // Gets the file at |file_path| from the cache (if found in the cache), |
| 653 // or the server (if not found in the cache) after the file info is | 657 // or the server (if not found in the cache) after the file info is |
| 654 // already resolved with GetEntryInfoByPath() or GetEntryInfoByResourceId(). | 658 // already resolved with GetEntryInfoByPath() or GetEntryInfoByResourceId(). |
| 655 // |get_file_callback| must not be null. | 659 // |get_file_callback| must not be null. |
| 656 // |get_content_callback| may be null. | 660 // |get_content_callback| may be null. |
| 657 void GetResolvedFileByPath( | 661 void GetResolvedFileByPath( |
| 658 const FilePath& file_path, | 662 const FilePath& file_path, |
| 659 const GetFileCallback& get_file_callback, | 663 const GetFileCallback& get_file_callback, |
| 660 const GetContentCallback& get_content_callback, | 664 const gdata::GetContentCallback& get_content_callback, |
| 661 scoped_ptr<DriveEntryProto> entry_proto); | 665 scoped_ptr<DriveEntryProto> entry_proto); |
| 662 | 666 |
| 663 // Part of UpdateFileByResourceId(). Called when | 667 // Part of UpdateFileByResourceId(). Called when |
| 664 // DriveDirectory::GetEntryInfoByResourceId() is complete. | 668 // DriveDirectory::GetEntryInfoByResourceId() is complete. |
| 665 // |callback| must not be null. | 669 // |callback| must not be null. |
| 666 void UpdateFileByEntryInfo( | 670 void UpdateFileByEntryInfo( |
| 667 const FileOperationCallback& callback, | 671 const FileOperationCallback& callback, |
| 668 DriveFileError error, | 672 DriveFileError error, |
| 669 const FilePath& drive_file_path, | 673 const FilePath& drive_file_path, |
| 670 scoped_ptr<DriveEntryProto> entry_proto); | 674 scoped_ptr<DriveEntryProto> entry_proto); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 691 int64* file_size); | 695 int64* file_size); |
| 692 | 696 |
| 693 // Part of UpdateFileByResourceId(). | 697 // Part of UpdateFileByResourceId(). |
| 694 // Called when DriveUploader::UploadUpdatedFile() is completed for | 698 // Called when DriveUploader::UploadUpdatedFile() is completed for |
| 695 // UpdateFileByResourceId(). | 699 // UpdateFileByResourceId(). |
| 696 // |callback| must not be null. | 700 // |callback| must not be null. |
| 697 void OnUpdatedFileUploaded(const FileOperationCallback& callback, | 701 void OnUpdatedFileUploaded(const FileOperationCallback& callback, |
| 698 DriveFileError error, | 702 DriveFileError error, |
| 699 const FilePath& gdata_path, | 703 const FilePath& gdata_path, |
| 700 const FilePath& file_path, | 704 const FilePath& file_path, |
| 701 scoped_ptr<DocumentEntry> document_entry); | 705 scoped_ptr<gdata::DocumentEntry> document_entry); |
| 702 | 706 |
| 703 // The following functions are used to forward calls to asynchronous public | 707 // The following functions are used to forward calls to asynchronous public |
| 704 // member functions to UI thread. | 708 // member functions to UI thread. |
| 705 void SearchAsyncOnUIThread(const std::string& search_query, | 709 void SearchAsyncOnUIThread(const std::string& search_query, |
| 706 const GURL& next_feed, | 710 const GURL& next_feed, |
| 707 const SearchCallback& callback); | 711 const SearchCallback& callback); |
| 708 void OpenFileOnUIThread(const FilePath& file_path, | 712 void OpenFileOnUIThread(const FilePath& file_path, |
| 709 const OpenFileCallback& callback); | 713 const OpenFileCallback& callback); |
| 710 void CloseFileOnUIThread(const FilePath& file_path, | 714 void CloseFileOnUIThread(const FilePath& file_path, |
| 711 const FileOperationCallback& callback); | 715 const FileOperationCallback& callback); |
| 712 void CopyOnUIThread(const FilePath& src_file_path, | 716 void CopyOnUIThread(const FilePath& src_file_path, |
| 713 const FilePath& dest_file_path, | 717 const FilePath& dest_file_path, |
| 714 const FileOperationCallback& callback); | 718 const FileOperationCallback& callback); |
| 715 void MoveOnUIThread(const FilePath& src_file_path, | 719 void MoveOnUIThread(const FilePath& src_file_path, |
| 716 const FilePath& dest_file_path, | 720 const FilePath& dest_file_path, |
| 717 const FileOperationCallback& callback); | 721 const FileOperationCallback& callback); |
| 718 void RemoveOnUIThread(const FilePath& file_path, | 722 void RemoveOnUIThread(const FilePath& file_path, |
| 719 bool is_recursive, | 723 bool is_recursive, |
| 720 const FileOperationCallback& callback); | 724 const FileOperationCallback& callback); |
| 721 void CreateDirectoryOnUIThread(const FilePath& directory_path, | 725 void CreateDirectoryOnUIThread(const FilePath& directory_path, |
| 722 bool is_exclusive, | 726 bool is_exclusive, |
| 723 bool is_recursive, | 727 bool is_recursive, |
| 724 const FileOperationCallback& callback); | 728 const FileOperationCallback& callback); |
| 725 void CreateFileOnUIThread(const FilePath& file_path, | 729 void CreateFileOnUIThread(const FilePath& file_path, |
| 726 bool is_exclusive, | 730 bool is_exclusive, |
| 727 const FileOperationCallback& callback); | 731 const FileOperationCallback& callback); |
| 728 void GetFileByPathOnUIThread( | 732 void GetFileByPathOnUIThread( |
| 729 const FilePath& file_path, | 733 const FilePath& file_path, |
| 730 const GetFileCallback& get_file_callback, | 734 const GetFileCallback& get_file_callback, |
| 731 const GetContentCallback& get_content_callback); | 735 const gdata::GetContentCallback& get_content_callback); |
| 732 void GetFileByResourceIdOnUIThread( | 736 void GetFileByResourceIdOnUIThread( |
| 733 const std::string& resource_id, | 737 const std::string& resource_id, |
| 734 const GetFileCallback& get_file_callback, | 738 const GetFileCallback& get_file_callback, |
| 735 const GetContentCallback& get_content_callback); | 739 const gdata::GetContentCallback& get_content_callback); |
| 736 void UpdateFileByResourceIdOnUIThread(const std::string& resource_id, | 740 void UpdateFileByResourceIdOnUIThread(const std::string& resource_id, |
| 737 const FileOperationCallback& callback); | 741 const FileOperationCallback& callback); |
| 738 void GetEntryInfoByPathOnUIThread(const FilePath& file_path, | 742 void GetEntryInfoByPathOnUIThread(const FilePath& file_path, |
| 739 const GetEntryInfoCallback& callback); | 743 const GetEntryInfoCallback& callback); |
| 740 void GetEntryInfoByResourceIdOnUIThread( | 744 void GetEntryInfoByResourceIdOnUIThread( |
| 741 const std::string& resource_id, | 745 const std::string& resource_id, |
| 742 const GetEntryInfoWithFilePathCallback& callback); | 746 const GetEntryInfoWithFilePathCallback& callback); |
| 743 void ReadDirectoryByPathOnUIThread( | 747 void ReadDirectoryByPathOnUIThread( |
| 744 const FilePath& file_path, | 748 const FilePath& file_path, |
| 745 const ReadDirectoryWithSettingCallback& callback); | 749 const ReadDirectoryWithSettingCallback& callback); |
| 746 void RequestDirectoryRefreshOnUIThread(const FilePath& file_path); | 750 void RequestDirectoryRefreshOnUIThread(const FilePath& file_path); |
| 747 void OnRequestDirectoryRefresh(const FilePath& directory_path, | 751 void OnRequestDirectoryRefresh(const FilePath& directory_path, |
| 748 scoped_ptr<LoadFeedParams> params, | 752 scoped_ptr<LoadFeedParams> params, |
| 749 DriveFileError error); | 753 DriveFileError error); |
| 750 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); | 754 void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); |
| 751 void AddUploadedFileOnUIThread(UploadMode upload_mode, | 755 void AddUploadedFileOnUIThread(gdata::UploadMode upload_mode, |
| 752 const FilePath& directory_path, | 756 const FilePath& directory_path, |
| 753 scoped_ptr<DocumentEntry> doc_entry, | 757 scoped_ptr<gdata::DocumentEntry> doc_entry, |
| 754 const FilePath& file_content_path, | 758 const FilePath& file_content_path, |
| 755 DriveCache::FileOperationType cache_operation, | 759 DriveCache::FileOperationType cache_operation, |
| 756 const base::Closure& callback); | 760 const base::Closure& callback); |
| 757 void UpdateEntryDataOnUIThread(const UpdateEntryParams& params, | 761 void UpdateEntryDataOnUIThread(const UpdateEntryParams& params, |
| 758 scoped_ptr<DocumentEntry> entry); | 762 scoped_ptr<gdata::DocumentEntry> entry); |
| 759 | 763 |
| 760 // Part of CreateDirectory(). Called after | 764 // Part of CreateDirectory(). Called after |
| 761 // FindFirstMissingParentDirectory() is complete. | 765 // FindFirstMissingParentDirectory() is complete. |
| 762 // |callback| must not be null. | 766 // |callback| must not be null. |
| 763 void CreateDirectoryAfterFindFirstMissingPath( | 767 void CreateDirectoryAfterFindFirstMissingPath( |
| 764 const FilePath& directory_path, | 768 const FilePath& directory_path, |
| 765 bool is_exclusive, | 769 bool is_exclusive, |
| 766 bool is_recursive, | 770 bool is_recursive, |
| 767 const FileOperationCallback& callback, | 771 const FileOperationCallback& callback, |
| 768 const FindFirstMissingParentDirectoryResult& result); | 772 const FindFirstMissingParentDirectoryResult& result); |
| 769 | 773 |
| 770 // Part of GetEntryInfoByResourceId(). Called after | 774 // Part of GetEntryInfoByResourceId(). Called after |
| 771 // DriveResourceMetadata::GetEntryInfoByResourceId() is complete. | 775 // DriveResourceMetadata::GetEntryInfoByResourceId() is complete. |
| 772 // |callback| must not be null. | 776 // |callback| must not be null. |
| 773 void GetEntryInfoByResourceIdAfterGetEntry( | 777 void GetEntryInfoByResourceIdAfterGetEntry( |
| 774 const GetEntryInfoWithFilePathCallback& callback, | 778 const GetEntryInfoWithFilePathCallback& callback, |
| 775 DriveFileError error, | 779 DriveFileError error, |
| 776 const FilePath& file_path, | 780 const FilePath& file_path, |
| 777 scoped_ptr<DriveEntryProto> entry_proto); | 781 scoped_ptr<DriveEntryProto> entry_proto); |
| 778 | 782 |
| 779 // Part of GetFileByResourceIdOnUIThread(). Called after | 783 // Part of GetFileByResourceIdOnUIThread(). Called after |
| 780 // DriveResourceMetadata::GetEntryInfoByResourceId() is complete. | 784 // DriveResourceMetadata::GetEntryInfoByResourceId() is complete. |
| 781 // |get_file_callback| must not be null. | 785 // |get_file_callback| must not be null. |
| 782 // |get_content_callback| may be null. | 786 // |get_content_callback| may be null. |
| 783 void GetFileByResourceIdAfterGetEntry( | 787 void GetFileByResourceIdAfterGetEntry( |
| 784 const GetFileCallback& get_file_callback, | 788 const GetFileCallback& get_file_callback, |
| 785 const GetContentCallback& get_content_callback, | 789 const gdata::GetContentCallback& get_content_callback, |
| 786 DriveFileError error, | 790 DriveFileError error, |
| 787 const FilePath& file_path, | 791 const FilePath& file_path, |
| 788 scoped_ptr<DriveEntryProto> entry_proto); | 792 scoped_ptr<DriveEntryProto> entry_proto); |
| 789 | 793 |
| 790 // Part of CopyOnUIThread(). Called after GetEntryInfoPairByPaths() is | 794 // Part of CopyOnUIThread(). Called after GetEntryInfoPairByPaths() is |
| 791 // complete. |callback| must not be null. | 795 // complete. |callback| must not be null. |
| 792 void CopyOnUIThreadAfterGetEntryInfoPair( | 796 void CopyOnUIThreadAfterGetEntryInfoPair( |
| 793 const FilePath& dest_file_path, | 797 const FilePath& dest_file_path, |
| 794 const FileOperationCallback& callback, | 798 const FileOperationCallback& callback, |
| 795 scoped_ptr<EntryInfoPairResult> result); | 799 scoped_ptr<EntryInfoPairResult> result); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 | 878 |
| 875 // WeakPtrFactory and WeakPtr bound to the UI thread. | 879 // WeakPtrFactory and WeakPtr bound to the UI thread. |
| 876 // Note: These should remain the last member so they'll be destroyed and | 880 // Note: These should remain the last member so they'll be destroyed and |
| 877 // invalidate the weak pointers before any other members are destroyed. | 881 // invalidate the weak pointers before any other members are destroyed. |
| 878 base::WeakPtrFactory<DriveFileSystem> ui_weak_ptr_factory_; | 882 base::WeakPtrFactory<DriveFileSystem> ui_weak_ptr_factory_; |
| 879 // Unlike other classes, we need this as we need this to redirect a task | 883 // Unlike other classes, we need this as we need this to redirect a task |
| 880 // from IO thread to UI thread. | 884 // from IO thread to UI thread. |
| 881 base::WeakPtr<DriveFileSystem> ui_weak_ptr_; | 885 base::WeakPtr<DriveFileSystem> ui_weak_ptr_; |
| 882 }; | 886 }; |
| 883 | 887 |
| 884 } // namespace gdata | 888 } // namespace drive |
| 885 | 889 |
| 886 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_H_ | 890 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_H_ |
| OLD | NEW |