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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" | 8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
10 #include "chrome/browser/history/history_service.h" | 10 #include "chrome/browser/history/history_service.h" |
11 #include "chrome/browser/history/history_service_factory.h" | 11 #include "chrome/browser/history/history_service_factory.h" |
12 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 12 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
13 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" | 13 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" |
14 #include "chrome/browser/password_manager/password_store_factory.h" | 14 #include "chrome/browser/password_manager/password_store_factory.h" |
15 #include "chrome/browser/pref_service_flags_storage.h" | 15 #include "chrome/browser/pref_service_flags_storage.h" |
16 #include "chrome/browser/prefs/pref_model_associator.h" | 16 #include "chrome/browser/prefs/pref_model_associator.h" |
17 #include "chrome/browser/prefs/pref_service_syncable.h" | 17 #include "chrome/browser/prefs/pref_service_syncable.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 19 #include "chrome/browser/search_engines/template_url_service_factory.h" |
20 #include "chrome/browser/signin/signin_manager_factory.h" | 20 #include "chrome/browser/signin/signin_manager_factory.h" |
21 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 21 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
22 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 22 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
23 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 23 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
24 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 24 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
25 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 25 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
26 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" | 26 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
27 #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" | 27 #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" |
28 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
29 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" |
| 30 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" |
30 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 31 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
31 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" | 32 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" |
32 #include "chrome/browser/sync/glue/sync_backend_host.h" | 33 #include "chrome/browser/sync/glue/sync_backend_host.h" |
33 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 34 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
34 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 35 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
35 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 36 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
36 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 37 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
37 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 38 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
38 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | 39 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
39 #include "chrome/browser/sync/profile_sync_service.h" | 40 #include "chrome/browser/sync/profile_sync_service.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 this)); | 244 this)); |
244 } | 245 } |
245 | 246 |
246 // Session sync is enabled by default. Register unless explicitly disabled. | 247 // Session sync is enabled by default. Register unless explicitly disabled. |
247 if (!disabled_types.Has(syncer::PROXY_TABS)) { | 248 if (!disabled_types.Has(syncer::PROXY_TABS)) { |
248 pss->RegisterDataTypeController(new ProxyDataTypeController( | 249 pss->RegisterDataTypeController(new ProxyDataTypeController( |
249 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 250 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
250 syncer::PROXY_TABS)); | 251 syncer::PROXY_TABS)); |
251 pss->RegisterDataTypeController( | 252 pss->RegisterDataTypeController( |
252 new SessionDataTypeController( | 253 new SessionDataTypeController( |
253 this, profile_, MakeDisableCallbackFor(syncer::SESSIONS))); | 254 this, |
| 255 profile_, |
| 256 pss->GetSyncedWindowDelegatesGetter(), |
| 257 pss->GetLocalDeviceInfoProvider(), |
| 258 MakeDisableCallbackFor(syncer::SESSIONS))); |
254 } | 259 } |
255 | 260 |
256 // Favicon sync is enabled by default. Register unless explicitly disabled. | 261 // Favicon sync is enabled by default. Register unless explicitly disabled. |
257 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && | 262 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && |
258 !disabled_types.Has(syncer::FAVICON_TRACKING)) { | 263 !disabled_types.Has(syncer::FAVICON_TRACKING)) { |
259 pss->RegisterDataTypeController( | 264 pss->RegisterDataTypeController( |
260 new UIDataTypeController( | 265 new UIDataTypeController( |
261 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 266 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
262 base::Bind(&ChromeReportUnrecoverableError), | 267 base::Bind(&ChromeReportUnrecoverableError), |
263 MakeDisableCallbackFor(syncer::FAVICON_IMAGES), | 268 MakeDisableCallbackFor(syncer::FAVICON_IMAGES), |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 ProfileSyncComponentsFactoryImpl::CreateSyncBackendHost( | 465 ProfileSyncComponentsFactoryImpl::CreateSyncBackendHost( |
461 const std::string& name, | 466 const std::string& name, |
462 Profile* profile, | 467 Profile* profile, |
463 invalidation::InvalidationService* invalidator, | 468 invalidation::InvalidationService* invalidator, |
464 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 469 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |
465 const base::FilePath& sync_folder) { | 470 const base::FilePath& sync_folder) { |
466 return new browser_sync::SyncBackendHostImpl(name, profile, invalidator, | 471 return new browser_sync::SyncBackendHostImpl(name, profile, invalidator, |
467 sync_prefs, sync_folder); | 472 sync_prefs, sync_folder); |
468 } | 473 } |
469 | 474 |
| 475 scoped_ptr<browser_sync::LocalDeviceInfoProvider> |
| 476 ProfileSyncComponentsFactoryImpl::CreateLocalDeviceInfoProvider() { |
| 477 return scoped_ptr<browser_sync::LocalDeviceInfoProvider>( |
| 478 new browser_sync::LocalDeviceInfoProviderImpl()); |
| 479 } |
| 480 |
470 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: | 481 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: |
471 GetSyncableServiceForType(syncer::ModelType type) { | 482 GetSyncableServiceForType(syncer::ModelType type) { |
472 if (!profile_) { // For tests. | 483 if (!profile_) { // For tests. |
473 return base::WeakPtr<syncer::SyncableService>(); | 484 return base::WeakPtr<syncer::SyncableService>(); |
474 } | 485 } |
475 switch (type) { | 486 switch (type) { |
476 case syncer::PREFERENCES: | 487 case syncer::PREFERENCES: |
477 return PrefServiceSyncable::FromProfile( | 488 return PrefServiceSyncable::FromProfile( |
478 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); | 489 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); |
479 case syncer::PRIORITY_PREFERENCES: | 490 case syncer::PRIORITY_PREFERENCES: |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 new TypedUrlModelAssociator(profile_sync_service, | 718 new TypedUrlModelAssociator(profile_sync_service, |
708 history_backend, | 719 history_backend, |
709 error_handler); | 720 error_handler); |
710 TypedUrlChangeProcessor* change_processor = | 721 TypedUrlChangeProcessor* change_processor = |
711 new TypedUrlChangeProcessor(profile_, | 722 new TypedUrlChangeProcessor(profile_, |
712 model_associator, | 723 model_associator, |
713 history_backend, | 724 history_backend, |
714 error_handler); | 725 error_handler); |
715 return SyncComponents(model_associator, change_processor); | 726 return SyncComponents(model_associator, change_processor); |
716 } | 727 } |
OLD | NEW |