| 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 23 matching lines...) Expand all Loading... |
| 34 namespace leveldb { | 34 namespace leveldb { |
| 35 class Env; | 35 class Env; |
| 36 } | 36 } |
| 37 | 37 |
| 38 namespace sync_file_system { | 38 namespace sync_file_system { |
| 39 | 39 |
| 40 class RemoteChangeProcessor; | 40 class RemoteChangeProcessor; |
| 41 | 41 |
| 42 namespace drive_backend { | 42 namespace drive_backend { |
| 43 | 43 |
| 44 class DriveServiceWrapper; |
| 44 class LocalToRemoteSyncer; | 45 class LocalToRemoteSyncer; |
| 45 class MetadataDatabase; | 46 class MetadataDatabase; |
| 46 class RemoteToLocalSyncer; | 47 class RemoteToLocalSyncer; |
| 47 class SyncEngineInitializer; | 48 class SyncEngineInitializer; |
| 48 class SyncTaskManager; | 49 class SyncTaskManager; |
| 49 class SyncWorker; | 50 class SyncWorker; |
| 50 | 51 |
| 51 class SyncEngine : public RemoteFileSyncService, | 52 class SyncEngine : public RemoteFileSyncService, |
| 52 public LocalChangeProcessor, | 53 public LocalChangeProcessor, |
| 53 public drive::DriveNotificationObserver, | 54 public drive::DriveNotificationObserver, |
| 54 public drive::DriveServiceObserver, | 55 public drive::DriveServiceObserver, |
| 55 public net::NetworkChangeNotifier::NetworkChangeObserver { | 56 public net::NetworkChangeNotifier::NetworkChangeObserver { |
| 56 public: | 57 public: |
| 57 typedef Observer SyncServiceObserver; | 58 typedef Observer SyncServiceObserver; |
| 58 | 59 |
| 59 static scoped_ptr<SyncEngine> CreateForBrowserContext( | 60 static scoped_ptr<SyncEngine> CreateForBrowserContext( |
| 60 content::BrowserContext* context); | 61 content::BrowserContext* context); |
| 61 static void AppendDependsOnFactories( | 62 static void AppendDependsOnFactories( |
| 62 std::set<BrowserContextKeyedServiceFactory*>* factories); | 63 std::set<BrowserContextKeyedServiceFactory*>* factories); |
| 63 | 64 |
| 64 virtual ~SyncEngine(); | 65 virtual ~SyncEngine(); |
| 65 | 66 |
| 66 void Initialize(const base::FilePath& base_dir, | 67 void Initialize(const base::FilePath& base_dir, |
| 67 base::SequencedTaskRunner* file_task_runner, | 68 base::SequencedTaskRunner* file_task_runner, |
| 69 bool pass_service_to_worker, |
| 68 leveldb::Env* env_override); | 70 leveldb::Env* env_override); |
| 69 | 71 |
| 70 // RemoteFileSyncService overrides. | 72 // RemoteFileSyncService overrides. |
| 71 virtual void AddServiceObserver(SyncServiceObserver* observer) OVERRIDE; | 73 virtual void AddServiceObserver(SyncServiceObserver* observer) OVERRIDE; |
| 72 virtual void AddFileStatusObserver(FileStatusObserver* observer) OVERRIDE; | 74 virtual void AddFileStatusObserver(FileStatusObserver* observer) OVERRIDE; |
| 73 virtual void RegisterOrigin( | 75 virtual void RegisterOrigin( |
| 74 const GURL& origin, | 76 const GURL& origin, |
| 75 const SyncStatusCallback& callback) OVERRIDE; | 77 const SyncStatusCallback& callback) OVERRIDE; |
| 76 virtual void EnableOrigin( | 78 virtual void EnableOrigin( |
| 77 const GURL& origin, | 79 const GURL& origin, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const fileapi::FileSystemURL& url); | 158 const fileapi::FileSystemURL& url); |
| 157 void DidApplyLocalChange(sync_file_system::SyncAction sync_action, | 159 void DidApplyLocalChange(sync_file_system::SyncAction sync_action, |
| 158 const fileapi::FileSystemURL& url, | 160 const fileapi::FileSystemURL& url, |
| 159 const base::FilePath& target_path, | 161 const base::FilePath& target_path, |
| 160 SyncStatusCode status); | 162 SyncStatusCode status); |
| 161 void UpdateServiceState(const std::string& description); | 163 void UpdateServiceState(const std::string& description); |
| 162 void UpdateRegisteredApps(); | 164 void UpdateRegisteredApps(); |
| 163 void NotifyLastOperationStatus(); | 165 void NotifyLastOperationStatus(); |
| 164 | 166 |
| 165 scoped_ptr<drive::DriveServiceInterface> drive_service_; | 167 scoped_ptr<drive::DriveServiceInterface> drive_service_; |
| 168 scoped_ptr<DriveServiceWrapper> drive_service_wrapper_; |
| 166 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; | 169 scoped_ptr<drive::DriveUploaderInterface> drive_uploader_; |
| 167 | 170 |
| 168 // These external services are not owned by SyncEngine. | 171 // These external services are not owned by SyncEngine. |
| 169 // The owner of the SyncEngine is responsible for their lifetime. | 172 // The owner of the SyncEngine is responsible for their lifetime. |
| 170 // I.e. the owner should declare the dependency explicitly by calling | 173 // I.e. the owner should declare the dependency explicitly by calling |
| 171 // KeyedService::DependsOn(). | 174 // KeyedService::DependsOn(). |
| 172 drive::DriveNotificationManager* notification_manager_; | 175 drive::DriveNotificationManager* notification_manager_; |
| 173 ExtensionServiceInterface* extension_service_; | 176 ExtensionServiceInterface* extension_service_; |
| 174 SigninManagerBase* signin_manager_; | 177 SigninManagerBase* signin_manager_; |
| 175 | 178 |
| 176 ObserverList<SyncServiceObserver> service_observers_; | 179 ObserverList<SyncServiceObserver> service_observers_; |
| 177 ObserverList<FileStatusObserver> file_status_observers_; | 180 ObserverList<FileStatusObserver> file_status_observers_; |
| 178 | 181 |
| 179 scoped_ptr<SyncWorker> sync_worker_; | 182 scoped_ptr<SyncWorker> sync_worker_; |
| 180 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; | 183 scoped_refptr<base::SequencedTaskRunner> worker_task_runner_; |
| 181 | 184 |
| 182 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; | 185 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; |
| 183 DISALLOW_COPY_AND_ASSIGN(SyncEngine); | 186 DISALLOW_COPY_AND_ASSIGN(SyncEngine); |
| 184 }; | 187 }; |
| 185 | 188 |
| 186 } // namespace drive_backend | 189 } // namespace drive_backend |
| 187 } // namespace sync_file_system | 190 } // namespace sync_file_system |
| 188 | 191 |
| 189 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ | 192 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
| OLD | NEW |