OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... | |
41 class LocalToRemoteSyncer; | 41 class LocalToRemoteSyncer; |
42 class MetadataDatabase; | 42 class MetadataDatabase; |
43 class RemoteToLocalSyncer; | 43 class RemoteToLocalSyncer; |
44 class SyncEngineInitializer; | 44 class SyncEngineInitializer; |
45 | 45 |
46 class SyncEngine : public RemoteFileSyncService, | 46 class SyncEngine : public RemoteFileSyncService, |
47 public LocalChangeProcessor, | 47 public LocalChangeProcessor, |
48 public SyncTaskManager::Client, | 48 public SyncTaskManager::Client, |
49 public drive::DriveNotificationObserver, | 49 public drive::DriveNotificationObserver, |
50 public drive::DriveServiceObserver, | 50 public drive::DriveServiceObserver, |
51 public net::NetworkChangeNotifier::NetworkChangeObserver, | 51 public net::NetworkChangeNotifier::NetworkChangeObserver { |
52 public SyncEngineContext { | |
53 public: | 52 public: |
54 typedef Observer SyncServiceObserver; | 53 typedef Observer SyncServiceObserver; |
55 | 54 |
56 static scoped_ptr<SyncEngine> CreateForBrowserContext( | 55 static scoped_ptr<SyncEngine> CreateForBrowserContext( |
57 content::BrowserContext* context); | 56 content::BrowserContext* context); |
58 static void AppendDependsOnFactories( | 57 static void AppendDependsOnFactories( |
59 std::set<BrowserContextKeyedServiceFactory*>* factories); | 58 std::set<BrowserContextKeyedServiceFactory*>* factories); |
60 | 59 |
61 virtual ~SyncEngine(); | 60 virtual ~SyncEngine(); |
62 | 61 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 virtual void OnPushNotificationEnabled(bool enabled) OVERRIDE; | 123 virtual void OnPushNotificationEnabled(bool enabled) OVERRIDE; |
125 | 124 |
126 // drive::DriveServiceObserver overrides. | 125 // drive::DriveServiceObserver overrides. |
127 virtual void OnReadyToSendRequests() OVERRIDE; | 126 virtual void OnReadyToSendRequests() OVERRIDE; |
128 virtual void OnRefreshTokenInvalid() OVERRIDE; | 127 virtual void OnRefreshTokenInvalid() OVERRIDE; |
129 | 128 |
130 // net::NetworkChangeNotifier::NetworkChangeObserver overrides. | 129 // net::NetworkChangeNotifier::NetworkChangeObserver overrides. |
131 virtual void OnNetworkChanged( | 130 virtual void OnNetworkChanged( |
132 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; | 131 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
133 | 132 |
134 // SyncEngineContext overrides. | 133 // SyncEngineContext overrides. |
tzik
2014/03/27 07:41:03
drop this comment?
peria
2014/03/27 10:14:37
Done.
| |
135 virtual drive::DriveServiceInterface* GetDriveService() OVERRIDE; | 134 drive::DriveServiceInterface* GetDriveService(); |
136 virtual drive::DriveUploaderInterface* GetDriveUploader() OVERRIDE; | 135 drive::DriveUploaderInterface* GetDriveUploader(); |
137 virtual MetadataDatabase* GetMetadataDatabase() OVERRIDE; | 136 MetadataDatabase* GetMetadataDatabase(); |
138 virtual RemoteChangeProcessor* GetRemoteChangeProcessor() OVERRIDE; | 137 RemoteChangeProcessor* GetRemoteChangeProcessor(); |
139 virtual base::SequencedTaskRunner* GetBlockingTaskRunner() OVERRIDE; | 138 base::SequencedTaskRunner* GetBlockingTaskRunner(); |
140 | 139 |
141 private: | 140 private: |
142 friend class DriveBackendSyncTest; | 141 friend class DriveBackendSyncTest; |
143 friend class SyncEngineTest; | 142 friend class SyncEngineTest; |
144 | 143 |
145 SyncEngine(const base::FilePath& base_dir, | 144 SyncEngine(const base::FilePath& base_dir, |
146 base::SequencedTaskRunner* task_runner, | 145 base::SequencedTaskRunner* task_runner, |
147 scoped_ptr<drive::DriveServiceInterface> drive_service, | 146 scoped_ptr<drive::DriveServiceInterface> drive_service, |
148 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, | 147 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, |
149 drive::DriveNotificationManager* notification_manager, | 148 drive::DriveNotificationManager* notification_manager, |
(...skipping 22 matching lines...) Expand all Loading... | |
172 | 171 |
173 void UpdateServiceStateFromSyncStatusCode(SyncStatusCode state, | 172 void UpdateServiceStateFromSyncStatusCode(SyncStatusCode state, |
174 bool used_network); | 173 bool used_network); |
175 void UpdateServiceState(RemoteServiceState state, | 174 void UpdateServiceState(RemoteServiceState state, |
176 const std::string& description); | 175 const std::string& description); |
177 void UpdateRegisteredApps(); | 176 void UpdateRegisteredApps(); |
178 | 177 |
179 base::FilePath base_dir_; | 178 base::FilePath base_dir_; |
180 base::FilePath temporary_file_dir_; | 179 base::FilePath temporary_file_dir_; |
181 | 180 |
182 scoped_refptr<base::SequencedTaskRunner> task_runner_; | |
183 leveldb::Env* env_override_; | 181 leveldb::Env* env_override_; |
184 | 182 |
185 scoped_ptr<drive::DriveServiceInterface> drive_service_; | |
186 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; | |
187 scoped_ptr<MetadataDatabase> metadata_database_; | |
188 | |
189 // These external services are not owned by SyncEngine. | 183 // These external services are not owned by SyncEngine. |
190 // The owner of the SyncEngine is responsible for their lifetime. | 184 // The owner of the SyncEngine is responsible for their lifetime. |
191 // I.e. the owner should declare the dependency explicitly by calling | 185 // I.e. the owner should declare the dependency explicitly by calling |
192 // KeyedService::DependsOn(). | 186 // KeyedService::DependsOn(). |
193 drive::DriveNotificationManager* notification_manager_; | 187 drive::DriveNotificationManager* notification_manager_; |
194 ExtensionServiceInterface* extension_service_; | 188 ExtensionServiceInterface* extension_service_; |
195 SigninManagerBase* signin_manager_; | 189 SigninManagerBase* signin_manager_; |
196 | 190 |
197 ObserverList<SyncServiceObserver> service_observers_; | 191 ObserverList<SyncServiceObserver> service_observers_; |
198 ObserverList<FileStatusObserver> file_status_observers_; | 192 ObserverList<FileStatusObserver> file_status_observers_; |
199 RemoteChangeProcessor* remote_change_processor_; | 193 RemoteChangeProcessor* remote_change_processor_; |
200 | 194 |
201 RemoteServiceState service_state_; | 195 RemoteServiceState service_state_; |
202 | 196 |
203 bool should_check_conflict_; | 197 bool should_check_conflict_; |
204 bool should_check_remote_change_; | 198 bool should_check_remote_change_; |
205 bool listing_remote_changes_; | 199 bool listing_remote_changes_; |
206 base::TimeTicks time_to_check_changes_; | 200 base::TimeTicks time_to_check_changes_; |
207 | 201 |
208 bool sync_enabled_; | 202 bool sync_enabled_; |
209 ConflictResolutionPolicy default_conflict_resolution_policy_; | 203 ConflictResolutionPolicy default_conflict_resolution_policy_; |
210 bool network_available_; | 204 bool network_available_; |
211 | 205 |
212 scoped_ptr<SyncTaskManager> task_manager_; | 206 scoped_ptr<SyncTaskManager> task_manager_; |
213 | 207 |
208 scoped_ptr<SyncEngineContext> context_; | |
214 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; | 209 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; |
215 | 210 |
216 DISALLOW_COPY_AND_ASSIGN(SyncEngine); | 211 DISALLOW_COPY_AND_ASSIGN(SyncEngine); |
217 }; | 212 }; |
218 | 213 |
219 } // namespace drive_backend | 214 } // namespace drive_backend |
220 } // namespace sync_file_system | 215 } // namespace sync_file_system |
221 | 216 |
222 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ | 217 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
OLD | NEW |