Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_service.h" | 6 #include "chrome/browser/extensions/extension_service.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/search_engines/template_url_service.h" | |
| 9 #include "chrome/browser/search_engines/template_url_service_factory.h" | |
| 8 #include "chrome/browser/sync/api/syncable_service.h" | 10 #include "chrome/browser/sync/api/syncable_service.h" |
| 9 #include "chrome/browser/sync/glue/app_change_processor.h" | 11 #include "chrome/browser/sync/glue/app_change_processor.h" |
| 10 #include "chrome/browser/sync/glue/app_data_type_controller.h" | 12 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
| 11 #include "chrome/browser/sync/glue/app_model_associator.h" | 13 #include "chrome/browser/sync/glue/app_model_associator.h" |
| 12 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 14 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
| 13 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 15 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
| 14 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 16 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
| 15 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" | 17 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" |
| 16 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 18 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
| 17 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" | 19 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" |
| 18 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 20 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
| 19 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 21 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
| 20 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 22 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
| 21 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 23 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
| 22 #include "chrome/browser/sync/glue/extension_change_processor.h" | 24 #include "chrome/browser/sync/glue/extension_change_processor.h" |
| 23 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 25 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
| 24 #include "chrome/browser/sync/glue/extension_model_associator.h" | 26 #include "chrome/browser/sync/glue/extension_model_associator.h" |
| 25 #include "chrome/browser/sync/glue/extension_sync_traits.h" | 27 #include "chrome/browser/sync/glue/extension_sync_traits.h" |
| 26 #include "chrome/browser/sync/glue/generic_change_processor.h" | 28 #include "chrome/browser/sync/glue/generic_change_processor.h" |
| 27 #include "chrome/browser/sync/glue/password_change_processor.h" | 29 #include "chrome/browser/sync/glue/password_change_processor.h" |
| 28 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 30 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
| 29 #include "chrome/browser/sync/glue/password_model_associator.h" | 31 #include "chrome/browser/sync/glue/password_model_associator.h" |
| 30 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 32 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
| 33 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" | |
| 31 #include "chrome/browser/sync/glue/session_change_processor.h" | 34 #include "chrome/browser/sync/glue/session_change_processor.h" |
| 32 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 35 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
| 33 #include "chrome/browser/sync/glue/session_model_associator.h" | 36 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 34 #include "chrome/browser/sync/glue/syncable_service_adapter.h" | 37 #include "chrome/browser/sync/glue/syncable_service_adapter.h" |
| 35 #include "chrome/browser/sync/glue/sync_backend_host.h" | 38 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 36 #include "chrome/browser/sync/glue/theme_change_processor.h" | 39 #include "chrome/browser/sync/glue/theme_change_processor.h" |
| 37 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 40 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
| 38 #include "chrome/browser/sync/glue/theme_model_associator.h" | 41 #include "chrome/browser/sync/glue/theme_model_associator.h" |
| 39 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 42 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
| 40 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 43 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 62 using browser_sync::DataTypeManager; | 65 using browser_sync::DataTypeManager; |
| 63 using browser_sync::DataTypeManagerImpl; | 66 using browser_sync::DataTypeManagerImpl; |
| 64 using browser_sync::ExtensionChangeProcessor; | 67 using browser_sync::ExtensionChangeProcessor; |
| 65 using browser_sync::ExtensionDataTypeController; | 68 using browser_sync::ExtensionDataTypeController; |
| 66 using browser_sync::ExtensionModelAssociator; | 69 using browser_sync::ExtensionModelAssociator; |
| 67 using browser_sync::GenericChangeProcessor; | 70 using browser_sync::GenericChangeProcessor; |
| 68 using browser_sync::PasswordChangeProcessor; | 71 using browser_sync::PasswordChangeProcessor; |
| 69 using browser_sync::PasswordDataTypeController; | 72 using browser_sync::PasswordDataTypeController; |
| 70 using browser_sync::PasswordModelAssociator; | 73 using browser_sync::PasswordModelAssociator; |
| 71 using browser_sync::PreferenceDataTypeController; | 74 using browser_sync::PreferenceDataTypeController; |
| 75 using browser_sync::SearchEngineDataTypeController; | |
| 72 using browser_sync::SessionChangeProcessor; | 76 using browser_sync::SessionChangeProcessor; |
| 73 using browser_sync::SessionDataTypeController; | 77 using browser_sync::SessionDataTypeController; |
| 74 using browser_sync::SessionModelAssociator; | 78 using browser_sync::SessionModelAssociator; |
| 75 using browser_sync::SyncBackendHost; | 79 using browser_sync::SyncBackendHost; |
| 76 using browser_sync::ThemeChangeProcessor; | 80 using browser_sync::ThemeChangeProcessor; |
| 77 using browser_sync::ThemeDataTypeController; | 81 using browser_sync::ThemeDataTypeController; |
| 78 using browser_sync::ThemeModelAssociator; | 82 using browser_sync::ThemeModelAssociator; |
| 79 using browser_sync::TypedUrlChangeProcessor; | 83 using browser_sync::TypedUrlChangeProcessor; |
| 80 using browser_sync::TypedUrlDataTypeController; | 84 using browser_sync::TypedUrlDataTypeController; |
| 81 using browser_sync::TypedUrlModelAssociator; | 85 using browser_sync::TypedUrlModelAssociator; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 // enabled. | 160 // enabled. |
| 157 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { | 161 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { |
| 158 pss->RegisterDataTypeController( | 162 pss->RegisterDataTypeController( |
| 159 new SessionDataTypeController(this, profile_, pss)); | 163 new SessionDataTypeController(this, profile_, pss)); |
| 160 } | 164 } |
| 161 | 165 |
| 162 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { | 166 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { |
| 163 pss->RegisterDataTypeController( | 167 pss->RegisterDataTypeController( |
| 164 new AutofillProfileDataTypeController(this, profile_)); | 168 new AutofillProfileDataTypeController(this, profile_)); |
| 165 } | 169 } |
| 170 | |
| 171 // Search Engine sync is disabled by default. Register only if explicitly | |
| 172 // enabled. | |
| 173 if (command_line_->HasSwitch(switches::kEnableSyncSearchEngines)) { | |
| 174 pss->RegisterDataTypeController( | |
| 175 new SearchEngineDataTypeController(this, profile_, pss)); | |
| 176 } | |
| 166 } | 177 } |
| 167 | 178 |
| 168 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 179 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
| 169 SyncBackendHost* backend, | 180 SyncBackendHost* backend, |
| 170 const DataTypeController::TypeMap& controllers) { | 181 const DataTypeController::TypeMap& controllers) { |
| 171 return new DataTypeManagerImpl(backend, controllers); | 182 return new DataTypeManagerImpl(backend, controllers); |
| 172 } | 183 } |
| 173 | 184 |
| 174 ProfileSyncFactory::SyncComponents | 185 ProfileSyncFactory::SyncComponents |
| 175 ProfileSyncFactoryImpl::CreateAppSyncComponents( | 186 ProfileSyncFactoryImpl::CreateAppSyncComponents( |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 ProfileSyncFactory::SyncComponents | 328 ProfileSyncFactory::SyncComponents |
| 318 ProfileSyncFactoryImpl::CreateSessionSyncComponents( | 329 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
| 319 ProfileSyncService* profile_sync_service, | 330 ProfileSyncService* profile_sync_service, |
| 320 UnrecoverableErrorHandler* error_handler) { | 331 UnrecoverableErrorHandler* error_handler) { |
| 321 SessionModelAssociator* model_associator = | 332 SessionModelAssociator* model_associator = |
| 322 new SessionModelAssociator(profile_sync_service); | 333 new SessionModelAssociator(profile_sync_service); |
| 323 SessionChangeProcessor* change_processor = | 334 SessionChangeProcessor* change_processor = |
| 324 new SessionChangeProcessor(error_handler, model_associator); | 335 new SessionChangeProcessor(error_handler, model_associator); |
| 325 return SyncComponents(model_associator, change_processor); | 336 return SyncComponents(model_associator, change_processor); |
| 326 } | 337 } |
| 338 | |
| 339 ProfileSyncFactory::SyncComponents | |
| 340 ProfileSyncFactoryImpl::CreateSearchEngineSyncComponents( | |
| 341 ProfileSyncService* profile_sync_service, | |
| 342 UnrecoverableErrorHandler* error_handler) { | |
| 343 SyncableService* se_sync_service = | |
| 344 TemplateURLServiceFactory::GetForProfile(profile_); | |
| 345 DCHECK(se_sync_service); | |
| 346 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | |
| 347 GenericChangeProcessor* change_processor = | |
| 348 new GenericChangeProcessor(se_sync_service, error_handler, user_share); | |
| 349 browser_sync::SyncableServiceAdapter* sync_service_adapter = | |
|
Nicolas Zea
2011/08/19 18:32:39
may as well add SyncableServiceAdapter to the "usi
SteveT
2011/08/22 18:33:42
Done.
| |
| 350 new browser_sync::SyncableServiceAdapter(syncable::SEARCH_ENGINES, | |
| 351 se_sync_service, | |
| 352 change_processor); | |
| 353 return SyncComponents(sync_service_adapter, change_processor); | |
| 354 } | |
| OLD | NEW |