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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 this)); | 246 this)); |
246 } | 247 } |
247 | 248 |
248 // Session sync is enabled by default. Register unless explicitly disabled. | 249 // Session sync is enabled by default. Register unless explicitly disabled. |
249 if (!disabled_types.Has(syncer::PROXY_TABS)) { | 250 if (!disabled_types.Has(syncer::PROXY_TABS)) { |
250 pss->RegisterDataTypeController(new ProxyDataTypeController( | 251 pss->RegisterDataTypeController(new ProxyDataTypeController( |
251 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 252 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
252 syncer::PROXY_TABS)); | 253 syncer::PROXY_TABS)); |
253 pss->RegisterDataTypeController( | 254 pss->RegisterDataTypeController( |
254 new SessionDataTypeController( | 255 new SessionDataTypeController( |
255 this, profile_, MakeDisableCallbackFor(syncer::SESSIONS))); | 256 this, |
| 257 profile_, |
| 258 pss->GetSyncedWindowDelegatesGetter(), |
| 259 pss->GetLocalDeviceInfoProvider(), |
| 260 MakeDisableCallbackFor(syncer::SESSIONS))); |
256 } | 261 } |
257 | 262 |
258 // Favicon sync is enabled by default. Register unless explicitly disabled. | 263 // Favicon sync is enabled by default. Register unless explicitly disabled. |
259 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && | 264 if (!disabled_types.Has(syncer::FAVICON_IMAGES) && |
260 !disabled_types.Has(syncer::FAVICON_TRACKING)) { | 265 !disabled_types.Has(syncer::FAVICON_TRACKING)) { |
261 pss->RegisterDataTypeController( | 266 pss->RegisterDataTypeController( |
262 new UIDataTypeController( | 267 new UIDataTypeController( |
263 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 268 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
264 base::Bind(&ChromeReportUnrecoverableError), | 269 base::Bind(&ChromeReportUnrecoverableError), |
265 MakeDisableCallbackFor(syncer::FAVICON_IMAGES), | 270 MakeDisableCallbackFor(syncer::FAVICON_IMAGES), |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 ProfileSyncComponentsFactoryImpl::CreateSyncBackendHost( | 467 ProfileSyncComponentsFactoryImpl::CreateSyncBackendHost( |
463 const std::string& name, | 468 const std::string& name, |
464 Profile* profile, | 469 Profile* profile, |
465 invalidation::InvalidationService* invalidator, | 470 invalidation::InvalidationService* invalidator, |
466 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 471 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |
467 const base::FilePath& sync_folder) { | 472 const base::FilePath& sync_folder) { |
468 return new browser_sync::SyncBackendHostImpl(name, profile, invalidator, | 473 return new browser_sync::SyncBackendHostImpl(name, profile, invalidator, |
469 sync_prefs, sync_folder); | 474 sync_prefs, sync_folder); |
470 } | 475 } |
471 | 476 |
| 477 scoped_ptr<browser_sync::LocalDeviceInfoProvider> |
| 478 ProfileSyncComponentsFactoryImpl::CreateLocalDeviceInfoProvider() { |
| 479 return scoped_ptr<browser_sync::LocalDeviceInfoProvider>( |
| 480 new browser_sync::LocalDeviceInfoProviderImpl()); |
| 481 } |
| 482 |
472 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: | 483 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: |
473 GetSyncableServiceForType(syncer::ModelType type) { | 484 GetSyncableServiceForType(syncer::ModelType type) { |
474 if (!profile_) { // For tests. | 485 if (!profile_) { // For tests. |
475 return base::WeakPtr<syncer::SyncableService>(); | 486 return base::WeakPtr<syncer::SyncableService>(); |
476 } | 487 } |
477 switch (type) { | 488 switch (type) { |
478 case syncer::PREFERENCES: | 489 case syncer::PREFERENCES: |
479 return PrefServiceSyncable::FromProfile( | 490 return PrefServiceSyncable::FromProfile( |
480 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); | 491 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); |
481 case syncer::PRIORITY_PREFERENCES: | 492 case syncer::PRIORITY_PREFERENCES: |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 new TypedUrlModelAssociator(profile_sync_service, | 720 new TypedUrlModelAssociator(profile_sync_service, |
710 history_backend, | 721 history_backend, |
711 error_handler); | 722 error_handler); |
712 TypedUrlChangeProcessor* change_processor = | 723 TypedUrlChangeProcessor* change_processor = |
713 new TypedUrlChangeProcessor(profile_, | 724 new TypedUrlChangeProcessor(profile_, |
714 model_associator, | 725 model_associator, |
715 history_backend, | 726 history_backend, |
716 error_handler); | 727 error_handler); |
717 return SyncComponents(model_associator, change_processor); | 728 return SyncComponents(model_associator, change_processor); |
718 } | 729 } |
OLD | NEW |