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/device_info_data_type_controller.h" |
27 #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" |
28 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
29 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" | 30 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" |
30 #include "chrome/browser/sync/glue/history_delete_directives_data_type_controlle
r.h" | 31 #include "chrome/browser/sync/glue/history_delete_directives_data_type_controlle
r.h" |
31 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" | 32 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" |
32 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 33 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
33 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" | 34 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" |
34 #include "chrome/browser/sync/glue/sync_backend_host.h" | 35 #include "chrome/browser/sync/glue/sync_backend_host.h" |
35 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" | 36 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
36 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 37 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 98 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
98 #include "chrome/browser/spellchecker/spellcheck_service.h" | 99 #include "chrome/browser/spellchecker/spellcheck_service.h" |
99 #endif | 100 #endif |
100 | 101 |
101 using browser_sync::AutofillDataTypeController; | 102 using browser_sync::AutofillDataTypeController; |
102 using browser_sync::AutofillProfileDataTypeController; | 103 using browser_sync::AutofillProfileDataTypeController; |
103 using browser_sync::BookmarkChangeProcessor; | 104 using browser_sync::BookmarkChangeProcessor; |
104 using browser_sync::BookmarkDataTypeController; | 105 using browser_sync::BookmarkDataTypeController; |
105 using browser_sync::BookmarkModelAssociator; | 106 using browser_sync::BookmarkModelAssociator; |
106 using browser_sync::ChromeReportUnrecoverableError; | 107 using browser_sync::ChromeReportUnrecoverableError; |
| 108 using browser_sync::DeviceInfoDataTypeController; |
107 using browser_sync::ExtensionBackedDataTypeController; | 109 using browser_sync::ExtensionBackedDataTypeController; |
108 using browser_sync::ExtensionDataTypeController; | 110 using browser_sync::ExtensionDataTypeController; |
109 using browser_sync::ExtensionSettingDataTypeController; | 111 using browser_sync::ExtensionSettingDataTypeController; |
110 using browser_sync::HistoryDeleteDirectivesDataTypeController; | 112 using browser_sync::HistoryDeleteDirectivesDataTypeController; |
111 using browser_sync::PasswordDataTypeController; | 113 using browser_sync::PasswordDataTypeController; |
112 using browser_sync::SearchEngineDataTypeController; | 114 using browser_sync::SearchEngineDataTypeController; |
113 using browser_sync::SessionDataTypeController; | 115 using browser_sync::SessionDataTypeController; |
114 using browser_sync::SyncBackendHost; | 116 using browser_sync::SyncBackendHost; |
115 using browser_sync::ThemeDataTypeController; | 117 using browser_sync::ThemeDataTypeController; |
116 using browser_sync::TypedUrlChangeProcessor; | 118 using browser_sync::TypedUrlChangeProcessor; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 RegisterCommonDataTypes(disabled_types, enabled_types, pss); | 180 RegisterCommonDataTypes(disabled_types, enabled_types, pss); |
179 #if !defined(OS_ANDROID) | 181 #if !defined(OS_ANDROID) |
180 RegisterDesktopDataTypes(disabled_types, enabled_types, pss); | 182 RegisterDesktopDataTypes(disabled_types, enabled_types, pss); |
181 #endif | 183 #endif |
182 } | 184 } |
183 | 185 |
184 void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( | 186 void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( |
185 syncer::ModelTypeSet disabled_types, | 187 syncer::ModelTypeSet disabled_types, |
186 syncer::ModelTypeSet enabled_types, | 188 syncer::ModelTypeSet enabled_types, |
187 ProfileSyncService* pss) { | 189 ProfileSyncService* pss) { |
| 190 // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes? |
| 191 pss->RegisterDataTypeController(new DeviceInfoDataTypeController( |
| 192 this, pss->GetLocalDeviceInfoProvider())); |
| 193 |
188 // Autofill sync is enabled by default. Register unless explicitly | 194 // Autofill sync is enabled by default. Register unless explicitly |
189 // disabled. | 195 // disabled. |
190 if (!disabled_types.Has(syncer::AUTOFILL)) { | 196 if (!disabled_types.Has(syncer::AUTOFILL)) { |
191 pss->RegisterDataTypeController( | 197 pss->RegisterDataTypeController( |
192 new AutofillDataTypeController(this, profile_)); | 198 new AutofillDataTypeController(this, profile_)); |
193 } | 199 } |
194 | 200 |
195 // Autofill profile sync is enabled by default. Register unless explicitly | 201 // Autofill profile sync is enabled by default. Register unless explicitly |
196 // disabled. | 202 // disabled. |
197 if (!disabled_types.Has(syncer::AUTOFILL_PROFILE)) { | 203 if (!disabled_types.Has(syncer::AUTOFILL_PROFILE)) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 return scoped_ptr<browser_sync::LocalDeviceInfoProvider>( | 442 return scoped_ptr<browser_sync::LocalDeviceInfoProvider>( |
437 new browser_sync::LocalDeviceInfoProviderImpl()); | 443 new browser_sync::LocalDeviceInfoProviderImpl()); |
438 } | 444 } |
439 | 445 |
440 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: | 446 base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl:: |
441 GetSyncableServiceForType(syncer::ModelType type) { | 447 GetSyncableServiceForType(syncer::ModelType type) { |
442 if (!profile_) { // For tests. | 448 if (!profile_) { // For tests. |
443 return base::WeakPtr<syncer::SyncableService>(); | 449 return base::WeakPtr<syncer::SyncableService>(); |
444 } | 450 } |
445 switch (type) { | 451 switch (type) { |
| 452 case syncer::DEVICE_INFO: |
| 453 return ProfileSyncServiceFactory::GetForProfile(profile_) |
| 454 ->GetDeviceInfoSyncableService() |
| 455 ->AsWeakPtr(); |
446 case syncer::PREFERENCES: | 456 case syncer::PREFERENCES: |
447 return PrefServiceSyncable::FromProfile( | 457 return PrefServiceSyncable::FromProfile( |
448 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); | 458 profile_)->GetSyncableService(syncer::PREFERENCES)->AsWeakPtr(); |
449 case syncer::PRIORITY_PREFERENCES: | 459 case syncer::PRIORITY_PREFERENCES: |
450 return PrefServiceSyncable::FromProfile(profile_)->GetSyncableService( | 460 return PrefServiceSyncable::FromProfile(profile_)->GetSyncableService( |
451 syncer::PRIORITY_PREFERENCES)->AsWeakPtr(); | 461 syncer::PRIORITY_PREFERENCES)->AsWeakPtr(); |
452 case syncer::AUTOFILL: | 462 case syncer::AUTOFILL: |
453 case syncer::AUTOFILL_PROFILE: { | 463 case syncer::AUTOFILL_PROFILE: { |
454 if (!web_data_service_.get()) | 464 if (!web_data_service_.get()) |
455 return base::WeakPtr<syncer::SyncableService>(); | 465 return base::WeakPtr<syncer::SyncableService>(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 new TypedUrlModelAssociator(profile_sync_service, | 692 new TypedUrlModelAssociator(profile_sync_service, |
683 history_backend, | 693 history_backend, |
684 error_handler); | 694 error_handler); |
685 TypedUrlChangeProcessor* change_processor = | 695 TypedUrlChangeProcessor* change_processor = |
686 new TypedUrlChangeProcessor(profile_, | 696 new TypedUrlChangeProcessor(profile_, |
687 model_associator, | 697 model_associator, |
688 history_backend, | 698 history_backend, |
689 error_handler); | 699 error_handler); |
690 return SyncComponents(model_associator, change_processor); | 700 return SyncComponents(model_associator, change_processor); |
691 } | 701 } |
OLD | NEW |