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