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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.h

Issue 10704214: [Sync] Refactor sync manager into interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Comments Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
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_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 16 matching lines...) Expand all
27 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" 27 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h"
28 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" 28 #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
29 #include "sync/internal_api/public/util/weak_handle.h" 29 #include "sync/internal_api/public/util/weak_handle.h"
30 #include "sync/notifier/sync_notifier_factory.h" 30 #include "sync/notifier/sync_notifier_factory.h"
31 #include "sync/protocol/encryption.pb.h" 31 #include "sync/protocol/encryption.pb.h"
32 #include "sync/protocol/sync_protocol_error.h" 32 #include "sync/protocol/sync_protocol_error.h"
33 33
34 class MessageLoop; 34 class MessageLoop;
35 class Profile; 35 class Profile;
36 36
37 namespace syncer {
38 class SyncManagerFactory;
39 }
40
37 namespace browser_sync { 41 namespace browser_sync {
38 42
39 class ChangeProcessor; 43 class ChangeProcessor;
40 struct Experiments; 44 struct Experiments;
41 class InvalidatorStorage; 45 class InvalidatorStorage;
42 class JsBackend; 46 class JsBackend;
43 class JsEventHandler; 47 class JsEventHandler;
44 class SyncBackendRegistrar; 48 class SyncBackendRegistrar;
45 class SyncPrefs; 49 class SyncPrefs;
46 50
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Optionally delete the Sync Data folder (if it's corrupt). 166 // Optionally delete the Sync Data folder (if it's corrupt).
163 // |report_unrecoverable_error_function| can be NULL. 167 // |report_unrecoverable_error_function| can be NULL.
164 // Note: |unrecoverable_error_handler| may be invoked from any thread. 168 // Note: |unrecoverable_error_handler| may be invoked from any thread.
165 void Initialize( 169 void Initialize(
166 SyncFrontend* frontend, 170 SyncFrontend* frontend,
167 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 171 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
168 const GURL& service_url, 172 const GURL& service_url,
169 syncer::ModelTypeSet initial_types, 173 syncer::ModelTypeSet initial_types,
170 const syncer::SyncCredentials& credentials, 174 const syncer::SyncCredentials& credentials,
171 bool delete_sync_data_folder, 175 bool delete_sync_data_folder,
176 syncer::SyncManagerFactory* sync_manager_factory,
172 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, 177 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler,
173 syncer::ReportUnrecoverableErrorFunction 178 syncer::ReportUnrecoverableErrorFunction
174 report_unrecoverable_error_function); 179 report_unrecoverable_error_function);
175 180
176 // Called from |frontend_loop| to update SyncCredentials. 181 // Called from |frontend_loop| to update SyncCredentials.
177 void UpdateCredentials(const syncer::SyncCredentials& credentials); 182 void UpdateCredentials(const syncer::SyncCredentials& credentials);
178 183
179 // This starts the SyncerThread running a Syncer object to communicate with 184 // This starts the SyncerThread running a Syncer object to communicate with
180 // sync servers. Until this is called, no changes will leave or enter this 185 // sync servers. Until this is called, no changes will leave or enter this
181 // browser from the cloud / sync servers. 186 // browser from the cloud / sync servers.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 273
269 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out) const; 274 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out) const;
270 275
271 protected: 276 protected:
272 // The types and functions below are protected so that test 277 // The types and functions below are protected so that test
273 // subclasses can use them. 278 // subclasses can use them.
274 // 279 //
275 // TODO(akalin): Figure out a better way for tests to hook into 280 // TODO(akalin): Figure out a better way for tests to hook into
276 // SyncBackendHost. 281 // SyncBackendHost.
277 282
278 typedef base::Callback<syncer::HttpPostProviderFactory*(void)> 283 typedef base::Callback<scoped_ptr<syncer::HttpPostProviderFactory>(void)>
279 MakeHttpBridgeFactoryFn; 284 MakeHttpBridgeFactoryFn;
280 285
281 struct DoInitializeOptions { 286 struct DoInitializeOptions {
282 DoInitializeOptions( 287 DoInitializeOptions(
283 MessageLoop* sync_loop, 288 MessageLoop* sync_loop,
284 SyncBackendRegistrar* registrar, 289 SyncBackendRegistrar* registrar,
285 const syncer::ModelSafeRoutingInfo& routing_info, 290 const syncer::ModelSafeRoutingInfo& routing_info,
286 const std::vector<syncer::ModelSafeWorker*>& workers, 291 const std::vector<syncer::ModelSafeWorker*>& workers,
287 syncer::ExtensionsActivityMonitor* extensions_activity_monitor, 292 syncer::ExtensionsActivityMonitor* extensions_activity_monitor,
288 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 293 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
289 const GURL& service_url, 294 const GURL& service_url,
290 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn, 295 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn,
291 const syncer::SyncCredentials& credentials, 296 const syncer::SyncCredentials& credentials,
292 ChromeSyncNotificationBridge* chrome_sync_notification_bridge, 297 ChromeSyncNotificationBridge* chrome_sync_notification_bridge,
293 syncer::SyncNotifierFactory* sync_notifier_factory, 298 syncer::SyncNotifierFactory* sync_notifier_factory,
299 syncer::SyncManagerFactory* sync_manager_factory,
294 bool delete_sync_data_folder, 300 bool delete_sync_data_folder,
295 const std::string& restored_key_for_bootstrapping, 301 const std::string& restored_key_for_bootstrapping,
296 syncer::SyncManager::TestingMode testing_mode, 302 syncer::SyncManager::TestingMode testing_mode,
297 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, 303 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler,
298 syncer::ReportUnrecoverableErrorFunction 304 syncer::ReportUnrecoverableErrorFunction
299 report_unrecoverable_error_function); 305 report_unrecoverable_error_function);
300 ~DoInitializeOptions(); 306 ~DoInitializeOptions();
301 307
302 MessageLoop* sync_loop; 308 MessageLoop* sync_loop;
303 SyncBackendRegistrar* registrar; 309 SyncBackendRegistrar* registrar;
304 syncer::ModelSafeRoutingInfo routing_info; 310 syncer::ModelSafeRoutingInfo routing_info;
305 std::vector<syncer::ModelSafeWorker*> workers; 311 std::vector<syncer::ModelSafeWorker*> workers;
306 syncer::ExtensionsActivityMonitor* extensions_activity_monitor; 312 syncer::ExtensionsActivityMonitor* extensions_activity_monitor;
307 syncer::WeakHandle<syncer::JsEventHandler> event_handler; 313 syncer::WeakHandle<syncer::JsEventHandler> event_handler;
308 GURL service_url; 314 GURL service_url;
309 // Overridden by tests. 315 // Overridden by tests.
310 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn; 316 MakeHttpBridgeFactoryFn make_http_bridge_factory_fn;
311 syncer::SyncCredentials credentials; 317 syncer::SyncCredentials credentials;
312 ChromeSyncNotificationBridge* const chrome_sync_notification_bridge; 318 ChromeSyncNotificationBridge* const chrome_sync_notification_bridge;
313 syncer::SyncNotifierFactory* const sync_notifier_factory; 319 syncer::SyncNotifierFactory* const sync_notifier_factory;
320 syncer::SyncManagerFactory* const sync_manager_factory;
314 std::string lsid; 321 std::string lsid;
315 bool delete_sync_data_folder; 322 bool delete_sync_data_folder;
316 std::string restored_key_for_bootstrapping; 323 std::string restored_key_for_bootstrapping;
317 syncer::SyncManager::TestingMode testing_mode; 324 syncer::SyncManager::TestingMode testing_mode;
318 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler; 325 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler;
319 syncer::ReportUnrecoverableErrorFunction 326 syncer::ReportUnrecoverableErrorFunction
320 report_unrecoverable_error_function; 327 report_unrecoverable_error_function;
321 }; 328 };
322 329
323 // Allows tests to perform alternate core initialization work. 330 // Allows tests to perform alternate core initialization work.
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 502
496 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. 503 // UI-thread cache of the last SyncSessionSnapshot received from syncapi.
497 syncer::sessions::SyncSessionSnapshot last_snapshot_; 504 syncer::sessions::SyncSessionSnapshot last_snapshot_;
498 505
499 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 506 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
500 }; 507 };
501 508
502 } // namespace browser_sync 509 } // namespace browser_sync
503 510
504 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 511 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698