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/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
15 #include "chrome/browser/chromeos/drive/drive_file_error.h" | 15 #include "chrome/browser/chromeos/drive/drive_file_error.h" |
| 16 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" |
16 #include "chrome/browser/profiles/profile_keyed_service.h" | 17 #include "chrome/browser/profiles/profile_keyed_service.h" |
17 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 18 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
18 #include "sync/notifier/invalidation_handler.h" | 19 #include "sync/notifier/invalidation_handler.h" |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class FilePath; | 22 class FilePath; |
22 } | 23 } |
23 | 24 |
24 namespace google_apis { | 25 namespace google_apis { |
25 class DriveServiceInterface; | 26 class DriveServiceInterface; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // Reloads and remounts the file system. | 87 // Reloads and remounts the file system. |
87 void ReloadAndRemountFileSystem(); | 88 void ReloadAndRemountFileSystem(); |
88 | 89 |
89 // syncer::InvalidationHandler implementation. | 90 // syncer::InvalidationHandler implementation. |
90 virtual void OnInvalidatorStateChange( | 91 virtual void OnInvalidatorStateChange( |
91 syncer::InvalidatorState state) OVERRIDE; | 92 syncer::InvalidatorState state) OVERRIDE; |
92 virtual void OnIncomingInvalidation( | 93 virtual void OnIncomingInvalidation( |
93 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE; | 94 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE; |
94 | 95 |
95 private: | 96 private: |
96 // Used to destroy DriveCache with scoped_ptr. | |
97 struct DriveCacheDeleter { | |
98 public: | |
99 void operator()(DriveCache* cache) const; | |
100 }; | |
101 | |
102 // Returns true if Drive is enabled. | 97 // Returns true if Drive is enabled. |
103 // Must be called on UI thread. | 98 // Must be called on UI thread. |
104 bool IsDriveEnabled(); | 99 bool IsDriveEnabled(); |
105 | 100 |
106 // Registers remote file system proxy for drive mount point. | 101 // Registers remote file system proxy for drive mount point. |
107 void AddDriveMountPoint(); | 102 void AddDriveMountPoint(); |
108 // Unregisters drive mount point from File API. | 103 // Unregisters drive mount point from File API. |
109 void RemoveDriveMountPoint(); | 104 void RemoveDriveMountPoint(); |
110 | 105 |
111 // Adds back the drive mount point. Used to implement ClearCache(). | 106 // Adds back the drive mount point. Used to implement ClearCache(). |
(...skipping 13 matching lines...) Expand all Loading... |
125 | 120 |
126 Profile* profile_; | 121 Profile* profile_; |
127 // True if Drive is disabled due to initialization errors. | 122 // True if Drive is disabled due to initialization errors. |
128 bool drive_disabled_; | 123 bool drive_disabled_; |
129 | 124 |
130 // True once this is registered to listen to the Drive updates. | 125 // True once this is registered to listen to the Drive updates. |
131 bool push_notification_registered_; | 126 bool push_notification_registered_; |
132 | 127 |
133 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 128 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
134 scoped_ptr<EventLogger> event_logger_; | 129 scoped_ptr<EventLogger> event_logger_; |
135 scoped_ptr<DriveCache, DriveCacheDeleter> cache_; | 130 scoped_ptr<DriveCache, util::DestroyHelper> cache_; |
136 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; | 131 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; |
137 scoped_ptr<google_apis::DriveUploader> uploader_; | 132 scoped_ptr<google_apis::DriveUploader> uploader_; |
138 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; | 133 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; |
139 scoped_ptr<DriveFileSystemInterface> file_system_; | 134 scoped_ptr<DriveFileSystemInterface> file_system_; |
140 scoped_ptr<FileWriteHelper> file_write_helper_; | 135 scoped_ptr<FileWriteHelper> file_write_helper_; |
141 scoped_ptr<DriveDownloadHandler> download_handler_; | 136 scoped_ptr<DriveDownloadHandler> download_handler_; |
142 scoped_ptr<DriveSyncClient> sync_client_; | 137 scoped_ptr<DriveSyncClient> sync_client_; |
143 scoped_ptr<DrivePrefetcher> prefetcher_; | 138 scoped_ptr<DrivePrefetcher> prefetcher_; |
144 scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_; | 139 scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_; |
145 scoped_refptr<DriveFileSystemProxy> file_system_proxy_; | 140 scoped_refptr<DriveFileSystemProxy> file_system_proxy_; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // ProfileKeyedServiceFactory: | 191 // ProfileKeyedServiceFactory: |
197 virtual ProfileKeyedService* BuildServiceInstanceFor( | 192 virtual ProfileKeyedService* BuildServiceInstanceFor( |
198 Profile* profile) const OVERRIDE; | 193 Profile* profile) const OVERRIDE; |
199 | 194 |
200 FactoryCallback factory_for_test_; | 195 FactoryCallback factory_for_test_; |
201 }; | 196 }; |
202 | 197 |
203 } // namespace drive | 198 } // namespace drive |
204 | 199 |
205 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYSTEM_SERVICE_H_ | 200 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SYSTEM_SERVICE_H_ |
OLD | NEW |