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_SYSTEM_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYSTEM_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYSTEM_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYSTEM_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
16 #include "chrome/browser/chromeos/drive/drive_file_error.h" | 16 #include "chrome/browser/chromeos/drive/drive_file_error.h" |
17 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" | 17 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
| 18 #include "chrome/browser/chromeos/drive/drive_scheduler.h" |
18 #include "chrome/browser/profiles/profile_keyed_service.h" | 19 #include "chrome/browser/profiles/profile_keyed_service.h" |
19 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 20 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
20 #include "sync/notifier/invalidation_handler.h" | 21 #include "sync/notifier/invalidation_handler.h" |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class FilePath; | 24 class FilePath; |
24 } | 25 } |
25 | 26 |
26 namespace google_apis { | 27 namespace google_apis { |
27 class DriveServiceInterface; | 28 class DriveServiceInterface; |
28 } | 29 } |
29 | 30 |
30 namespace drive { | 31 namespace drive { |
31 | 32 |
32 class DriveCache; | 33 class DriveCache; |
33 class DriveDownloadHandler; | 34 class DriveDownloadHandler; |
34 class DriveFileSystemInterface; | 35 class DriveFileSystemInterface; |
35 class DriveFileSystemProxy; | 36 class DriveFileSystemProxy; |
36 class DriveWebAppsRegistry; | 37 class DriveWebAppsRegistry; |
37 class DriveSyncClient; | 38 class DriveSyncClient; |
38 class DrivePrefetcher; | 39 class DrivePrefetcher; |
39 class DriveResourceMetadata; | 40 class DriveResourceMetadata; |
40 class EventLogger; | 41 class EventLogger; |
41 class FileWriteHelper; | 42 class FileWriteHelper; |
| 43 class JobListInterface; |
42 class StaleCacheFilesRemover; | 44 class StaleCacheFilesRemover; |
43 | 45 |
44 // Interface for classes that need to observe events from DriveSystemService. | 46 // Interface for classes that need to observe events from DriveSystemService. |
45 // All events are notified on UI thread. | 47 // All events are notified on UI thread. |
46 class DriveSystemServiceObserver { | 48 class DriveSystemServiceObserver { |
47 public: | 49 public: |
48 // Triggered when the file system is mounted. | 50 // Triggered when the file system is mounted. |
49 virtual void OnFileSystemMounted() { | 51 virtual void OnFileSystemMounted() { |
50 } | 52 } |
51 | 53 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 google_apis::DriveServiceInterface* drive_service() { | 91 google_apis::DriveServiceInterface* drive_service() { |
90 return drive_service_.get(); | 92 return drive_service_.get(); |
91 } | 93 } |
92 | 94 |
93 DriveCache* cache() { return cache_.get(); } | 95 DriveCache* cache() { return cache_.get(); } |
94 DriveFileSystemInterface* file_system() { return file_system_.get(); } | 96 DriveFileSystemInterface* file_system() { return file_system_.get(); } |
95 FileWriteHelper* file_write_helper() { return file_write_helper_.get(); } | 97 FileWriteHelper* file_write_helper() { return file_write_helper_.get(); } |
96 DriveDownloadHandler* download_handler() { return download_handler_.get(); } | 98 DriveDownloadHandler* download_handler() { return download_handler_.get(); } |
97 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } | 99 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } |
98 EventLogger* event_logger() { return event_logger_.get(); } | 100 EventLogger* event_logger() { return event_logger_.get(); } |
| 101 JobListInterface* job_list() { return scheduler_.get(); } |
99 | 102 |
100 // Clears all the local cache files and in-memory data, and remounts the | 103 // Clears all the local cache files and in-memory data, and remounts the |
101 // file system. |callback| is called with true when this operation is done | 104 // file system. |callback| is called with true when this operation is done |
102 // successfully. Otherwise, |callback| is called with false. | 105 // successfully. Otherwise, |callback| is called with false. |
103 // |callback| must not be null. | 106 // |callback| must not be null. |
104 void ClearCacheAndRemountFileSystem( | 107 void ClearCacheAndRemountFileSystem( |
105 const base::Callback<void(bool)>& callback); | 108 const base::Callback<void(bool)>& callback); |
106 | 109 |
107 // Reloads and remounts the file system. | 110 // Reloads and remounts the file system. |
108 void ReloadAndRemountFileSystem(); | 111 void ReloadAndRemountFileSystem(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // True if Drive is disabled due to initialization errors. | 159 // True if Drive is disabled due to initialization errors. |
157 bool drive_disabled_; | 160 bool drive_disabled_; |
158 | 161 |
159 // True once this is registered to listen to the Drive updates. | 162 // True once this is registered to listen to the Drive updates. |
160 bool push_notification_registered_; | 163 bool push_notification_registered_; |
161 | 164 |
162 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 165 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
163 scoped_ptr<EventLogger> event_logger_; | 166 scoped_ptr<EventLogger> event_logger_; |
164 scoped_ptr<DriveCache, util::DestroyHelper> cache_; | 167 scoped_ptr<DriveCache, util::DestroyHelper> cache_; |
165 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; | 168 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; |
| 169 scoped_ptr<DriveScheduler> scheduler_; |
166 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; | 170 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; |
167 scoped_ptr<DriveResourceMetadata, util::DestroyHelper> resource_metadata_; | 171 scoped_ptr<DriveResourceMetadata, util::DestroyHelper> resource_metadata_; |
168 scoped_ptr<DriveFileSystemInterface> file_system_; | 172 scoped_ptr<DriveFileSystemInterface> file_system_; |
169 scoped_ptr<FileWriteHelper> file_write_helper_; | 173 scoped_ptr<FileWriteHelper> file_write_helper_; |
170 scoped_ptr<DriveDownloadHandler> download_handler_; | 174 scoped_ptr<DriveDownloadHandler> download_handler_; |
171 scoped_ptr<DriveSyncClient> sync_client_; | 175 scoped_ptr<DriveSyncClient> sync_client_; |
172 scoped_ptr<DrivePrefetcher> prefetcher_; | 176 scoped_ptr<DrivePrefetcher> prefetcher_; |
173 scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_; | 177 scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_; |
174 scoped_refptr<DriveFileSystemProxy> file_system_proxy_; | 178 scoped_refptr<DriveFileSystemProxy> file_system_proxy_; |
175 | 179 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // ProfileKeyedServiceFactory: | 231 // ProfileKeyedServiceFactory: |
228 virtual ProfileKeyedService* BuildServiceInstanceFor( | 232 virtual ProfileKeyedService* BuildServiceInstanceFor( |
229 Profile* profile) const OVERRIDE; | 233 Profile* profile) const OVERRIDE; |
230 | 234 |
231 FactoryCallback factory_for_test_; | 235 FactoryCallback factory_for_test_; |
232 }; | 236 }; |
233 | 237 |
234 } // namespace drive | 238 } // namespace drive |
235 | 239 |
236 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYSTEM_SERVICE_H_ | 240 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYSTEM_SERVICE_H_ |
OLD | NEW |