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/prefs/public/pref_observer.h" |
14 #include "base/timer.h" | 15 #include "base/timer.h" |
15 #include "chrome/browser/chromeos/drive/drive_cache.h" | 16 #include "chrome/browser/chromeos/drive/drive_cache.h" |
16 #include "chrome/browser/chromeos/drive/drive_feed_loader_observer.h" | 17 #include "chrome/browser/chromeos/drive/drive_feed_loader_observer.h" |
17 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" | 18 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" |
18 #include "chrome/browser/chromeos/drive/file_system/drive_operations.h" | 19 #include "chrome/browser/chromeos/drive/file_system/drive_operations.h" |
19 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 20 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
20 #include "chrome/browser/google_apis/gdata_errorcode.h" | 21 #include "chrome/browser/google_apis/gdata_errorcode.h" |
21 #include "content/public/browser/notification_observer.h" | |
22 | 22 |
23 class PrefChangeRegistrar; | 23 class PrefChangeRegistrar; |
24 | 24 |
25 namespace base { | 25 namespace base { |
26 struct PlatformFileInfo; | 26 struct PlatformFileInfo; |
27 class SequencedTaskRunner; | 27 class SequencedTaskRunner; |
28 } | 28 } |
29 | 29 |
30 namespace google_apis { | 30 namespace google_apis { |
31 class DocumentFeed; | 31 class DocumentFeed; |
(...skipping 14 matching lines...) Expand all Loading... |
46 namespace file_system { | 46 namespace file_system { |
47 class CopyOperation; | 47 class CopyOperation; |
48 class MoveOperation; | 48 class MoveOperation; |
49 class RemoveOperation; | 49 class RemoveOperation; |
50 } | 50 } |
51 | 51 |
52 // The production implementation of DriveFileSystemInterface. | 52 // The production implementation of DriveFileSystemInterface. |
53 class DriveFileSystem : public DriveFileSystemInterface, | 53 class DriveFileSystem : public DriveFileSystemInterface, |
54 public DriveFeedLoaderObserver, | 54 public DriveFeedLoaderObserver, |
55 public file_system::OperationObserver, | 55 public file_system::OperationObserver, |
56 public content::NotificationObserver { | 56 public PrefObserver { |
57 public: | 57 public: |
58 DriveFileSystem(Profile* profile, | 58 DriveFileSystem(Profile* profile, |
59 DriveCache* cache, | 59 DriveCache* cache, |
60 google_apis::DriveServiceInterface* drive_service, | 60 google_apis::DriveServiceInterface* drive_service, |
61 google_apis::DriveUploaderInterface* uploader, | 61 google_apis::DriveUploaderInterface* uploader, |
62 DriveWebAppsRegistryInterface* webapps_registry, | 62 DriveWebAppsRegistryInterface* webapps_registry, |
63 base::SequencedTaskRunner* blocking_task_runner); | 63 base::SequencedTaskRunner* blocking_task_runner); |
64 virtual ~DriveFileSystem(); | 64 virtual ~DriveFileSystem(); |
65 | 65 |
66 // DriveFileSystem overrides. | 66 // DriveFileSystem overrides. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 DriveCache::FileOperationType cache_operation, | 136 DriveCache::FileOperationType cache_operation, |
137 const base::Closure& callback) OVERRIDE; | 137 const base::Closure& callback) OVERRIDE; |
138 virtual void UpdateEntryData(const std::string& resource_id, | 138 virtual void UpdateEntryData(const std::string& resource_id, |
139 const std::string& md5, | 139 const std::string& md5, |
140 scoped_ptr<google_apis::DocumentEntry> entry, | 140 scoped_ptr<google_apis::DocumentEntry> entry, |
141 const FilePath& file_content_path, | 141 const FilePath& file_content_path, |
142 const base::Closure& callback) OVERRIDE; | 142 const base::Closure& callback) OVERRIDE; |
143 virtual DriveFileSystemMetadata GetMetadata() const OVERRIDE; | 143 virtual DriveFileSystemMetadata GetMetadata() const OVERRIDE; |
144 virtual void Reload() OVERRIDE; | 144 virtual void Reload() OVERRIDE; |
145 | 145 |
146 // content::NotificationObserver implementation. | 146 // PrefObserver implementation. |
147 virtual void Observe(int type, | 147 virtual void OnPreferenceChanged(PrefServiceBase* service, |
148 const content::NotificationSource& source, | 148 const std::string& pref_name) OVERRIDE; |
149 const content::NotificationDetails& details) OVERRIDE; | |
150 | 149 |
151 // file_system::OperationObserver overrides. | 150 // file_system::OperationObserver overrides. |
152 virtual void OnDirectoryChangedByOperation( | 151 virtual void OnDirectoryChangedByOperation( |
153 const FilePath& directory_path) OVERRIDE; | 152 const FilePath& directory_path) OVERRIDE; |
154 | 153 |
155 // DriveFeedLoader::Observer overrides. | 154 // DriveFeedLoader::Observer overrides. |
156 // Used to propagate events from DriveFeedLoader. | 155 // Used to propagate events from DriveFeedLoader. |
157 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; | 156 virtual void OnDirectoryChanged(const FilePath& directory_path) OVERRIDE; |
158 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; | 157 virtual void OnDocumentFeedFetched(int num_accumulated_entries) OVERRIDE; |
159 virtual void OnFeedFromServerLoaded() OVERRIDE; | 158 virtual void OnFeedFromServerLoaded() OVERRIDE; |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 // invalidate the weak pointers before any other members are destroyed. | 763 // invalidate the weak pointers before any other members are destroyed. |
765 base::WeakPtrFactory<DriveFileSystem> ui_weak_ptr_factory_; | 764 base::WeakPtrFactory<DriveFileSystem> ui_weak_ptr_factory_; |
766 // Unlike other classes, we need this as we need this to redirect a task | 765 // Unlike other classes, we need this as we need this to redirect a task |
767 // from IO thread to UI thread. | 766 // from IO thread to UI thread. |
768 base::WeakPtr<DriveFileSystem> ui_weak_ptr_; | 767 base::WeakPtr<DriveFileSystem> ui_weak_ptr_; |
769 }; | 768 }; |
770 | 769 |
771 } // namespace drive | 770 } // namespace drive |
772 | 771 |
773 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_H_ | 772 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FILE_SYSTEM_H_ |
OLD | NEW |