Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/sync_engine.h

Issue 213473008: [SyncFS] Split SyncEngine and SyncEngineContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 drive::DriveServiceInterface* GetDriveService();
135 virtual drive::DriveServiceInterface* GetDriveService() OVERRIDE; 134 drive::DriveUploaderInterface* GetDriveUploader();
136 virtual drive::DriveUploaderInterface* GetDriveUploader() OVERRIDE; 135 MetadataDatabase* GetMetadataDatabase();
137 virtual MetadataDatabase* GetMetadataDatabase() OVERRIDE; 136 RemoteChangeProcessor* GetRemoteChangeProcessor();
138 virtual RemoteChangeProcessor* GetRemoteChangeProcessor() OVERRIDE; 137 base::SequencedTaskRunner* GetBlockingTaskRunner();
139 virtual base::SequencedTaskRunner* GetBlockingTaskRunner() OVERRIDE;
140 138
141 private: 139 private:
142 friend class DriveBackendSyncTest; 140 friend class DriveBackendSyncTest;
143 friend class SyncEngineTest; 141 friend class SyncEngineTest;
144 142
145 SyncEngine(const base::FilePath& base_dir, 143 SyncEngine(const base::FilePath& base_dir,
146 base::SequencedTaskRunner* task_runner, 144 base::SequencedTaskRunner* task_runner,
147 scoped_ptr<drive::DriveServiceInterface> drive_service, 145 scoped_ptr<drive::DriveServiceInterface> drive_service,
148 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, 146 scoped_ptr<drive::DriveUploaderInterface> drive_uploader,
149 drive::DriveNotificationManager* notification_manager, 147 drive::DriveNotificationManager* notification_manager,
(...skipping 22 matching lines...) Expand all
172 170
173 void UpdateServiceStateFromSyncStatusCode(SyncStatusCode state, 171 void UpdateServiceStateFromSyncStatusCode(SyncStatusCode state,
174 bool used_network); 172 bool used_network);
175 void UpdateServiceState(RemoteServiceState state, 173 void UpdateServiceState(RemoteServiceState state,
176 const std::string& description); 174 const std::string& description);
177 void UpdateRegisteredApps(); 175 void UpdateRegisteredApps();
178 176
179 base::FilePath base_dir_; 177 base::FilePath base_dir_;
180 base::FilePath temporary_file_dir_; 178 base::FilePath temporary_file_dir_;
181 179
182 scoped_refptr<base::SequencedTaskRunner> task_runner_;
183 leveldb::Env* env_override_; 180 leveldb::Env* env_override_;
184 181
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. 182 // These external services are not owned by SyncEngine.
190 // The owner of the SyncEngine is responsible for their lifetime. 183 // The owner of the SyncEngine is responsible for their lifetime.
191 // I.e. the owner should declare the dependency explicitly by calling 184 // I.e. the owner should declare the dependency explicitly by calling
192 // KeyedService::DependsOn(). 185 // KeyedService::DependsOn().
193 drive::DriveNotificationManager* notification_manager_; 186 drive::DriveNotificationManager* notification_manager_;
194 ExtensionServiceInterface* extension_service_; 187 ExtensionServiceInterface* extension_service_;
195 SigninManagerBase* signin_manager_; 188 SigninManagerBase* signin_manager_;
196 189
197 ObserverList<SyncServiceObserver> service_observers_; 190 ObserverList<SyncServiceObserver> service_observers_;
198 ObserverList<FileStatusObserver> file_status_observers_; 191 ObserverList<FileStatusObserver> file_status_observers_;
199 RemoteChangeProcessor* remote_change_processor_;
200 192
201 RemoteServiceState service_state_; 193 RemoteServiceState service_state_;
202 194
203 bool should_check_conflict_; 195 bool should_check_conflict_;
204 bool should_check_remote_change_; 196 bool should_check_remote_change_;
205 bool listing_remote_changes_; 197 bool listing_remote_changes_;
206 base::TimeTicks time_to_check_changes_; 198 base::TimeTicks time_to_check_changes_;
207 199
208 bool sync_enabled_; 200 bool sync_enabled_;
209 ConflictResolutionPolicy default_conflict_resolution_policy_; 201 ConflictResolutionPolicy default_conflict_resolution_policy_;
210 bool network_available_; 202 bool network_available_;
211 203
212 scoped_ptr<SyncTaskManager> task_manager_; 204 scoped_ptr<SyncTaskManager> task_manager_;
213 205
206 scoped_ptr<SyncEngineContext> context_;
214 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; 207 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_;
215 208
216 DISALLOW_COPY_AND_ASSIGN(SyncEngine); 209 DISALLOW_COPY_AND_ASSIGN(SyncEngine);
217 }; 210 };
218 211
219 } // namespace drive_backend 212 } // namespace drive_backend
220 } // namespace sync_file_system 213 } // namespace sync_file_system
221 214
222 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ 215 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698