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_data_type_controller.h" | 11 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
10 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 12 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
11 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 13 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
12 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 14 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
13 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" | 15 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" |
14 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 16 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
15 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" | 17 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" |
16 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 18 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
17 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 19 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
18 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 20 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
19 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 21 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
20 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 22 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
21 #include "chrome/browser/sync/glue/generic_change_processor.h" | 23 #include "chrome/browser/sync/glue/generic_change_processor.h" |
22 #include "chrome/browser/sync/glue/password_change_processor.h" | 24 #include "chrome/browser/sync/glue/password_change_processor.h" |
23 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 25 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
24 #include "chrome/browser/sync/glue/password_model_associator.h" | 26 #include "chrome/browser/sync/glue/password_model_associator.h" |
25 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 27 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
| 28 #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" |
26 #include "chrome/browser/sync/glue/session_change_processor.h" | 29 #include "chrome/browser/sync/glue/session_change_processor.h" |
27 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 30 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
28 #include "chrome/browser/sync/glue/session_model_associator.h" | 31 #include "chrome/browser/sync/glue/session_model_associator.h" |
29 #include "chrome/browser/sync/glue/syncable_service_adapter.h" | 32 #include "chrome/browser/sync/glue/syncable_service_adapter.h" |
30 #include "chrome/browser/sync/glue/sync_backend_host.h" | 33 #include "chrome/browser/sync/glue/sync_backend_host.h" |
31 #include "chrome/browser/sync/glue/theme_change_processor.h" | 34 #include "chrome/browser/sync/glue/theme_change_processor.h" |
32 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 35 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
33 #include "chrome/browser/sync/glue/theme_model_associator.h" | 36 #include "chrome/browser/sync/glue/theme_model_associator.h" |
34 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 37 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
35 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 38 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
(...skipping 17 matching lines...) Expand all Loading... |
53 using browser_sync::BookmarkModelAssociator; | 56 using browser_sync::BookmarkModelAssociator; |
54 using browser_sync::DataTypeController; | 57 using browser_sync::DataTypeController; |
55 using browser_sync::DataTypeManager; | 58 using browser_sync::DataTypeManager; |
56 using browser_sync::DataTypeManagerImpl; | 59 using browser_sync::DataTypeManagerImpl; |
57 using browser_sync::ExtensionDataTypeController; | 60 using browser_sync::ExtensionDataTypeController; |
58 using browser_sync::GenericChangeProcessor; | 61 using browser_sync::GenericChangeProcessor; |
59 using browser_sync::PasswordChangeProcessor; | 62 using browser_sync::PasswordChangeProcessor; |
60 using browser_sync::PasswordDataTypeController; | 63 using browser_sync::PasswordDataTypeController; |
61 using browser_sync::PasswordModelAssociator; | 64 using browser_sync::PasswordModelAssociator; |
62 using browser_sync::PreferenceDataTypeController; | 65 using browser_sync::PreferenceDataTypeController; |
| 66 using browser_sync::SearchEngineDataTypeController; |
63 using browser_sync::SessionChangeProcessor; | 67 using browser_sync::SessionChangeProcessor; |
64 using browser_sync::SessionDataTypeController; | 68 using browser_sync::SessionDataTypeController; |
65 using browser_sync::SessionModelAssociator; | 69 using browser_sync::SessionModelAssociator; |
| 70 using browser_sync::SyncableServiceAdapter; |
66 using browser_sync::SyncBackendHost; | 71 using browser_sync::SyncBackendHost; |
67 using browser_sync::ThemeChangeProcessor; | 72 using browser_sync::ThemeChangeProcessor; |
68 using browser_sync::ThemeDataTypeController; | 73 using browser_sync::ThemeDataTypeController; |
69 using browser_sync::ThemeModelAssociator; | 74 using browser_sync::ThemeModelAssociator; |
70 using browser_sync::TypedUrlChangeProcessor; | 75 using browser_sync::TypedUrlChangeProcessor; |
71 using browser_sync::TypedUrlDataTypeController; | 76 using browser_sync::TypedUrlDataTypeController; |
72 using browser_sync::TypedUrlModelAssociator; | 77 using browser_sync::TypedUrlModelAssociator; |
73 using browser_sync::UnrecoverableErrorHandler; | 78 using browser_sync::UnrecoverableErrorHandler; |
74 | 79 |
75 ProfileSyncFactoryImpl::ProfileSyncFactoryImpl(Profile* profile, | 80 ProfileSyncFactoryImpl::ProfileSyncFactoryImpl(Profile* profile, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // enabled. | 152 // enabled. |
148 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { | 153 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { |
149 pss->RegisterDataTypeController( | 154 pss->RegisterDataTypeController( |
150 new SessionDataTypeController(this, profile_, pss)); | 155 new SessionDataTypeController(this, profile_, pss)); |
151 } | 156 } |
152 | 157 |
153 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { | 158 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { |
154 pss->RegisterDataTypeController( | 159 pss->RegisterDataTypeController( |
155 new AutofillProfileDataTypeController(this, profile_)); | 160 new AutofillProfileDataTypeController(this, profile_)); |
156 } | 161 } |
| 162 |
| 163 // Search Engine sync is disabled by default. Register only if explicitly |
| 164 // enabled. |
| 165 if (command_line_->HasSwitch(switches::kEnableSyncSearchEngines)) { |
| 166 pss->RegisterDataTypeController( |
| 167 new SearchEngineDataTypeController(this, profile_, pss)); |
| 168 } |
157 } | 169 } |
158 | 170 |
159 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 171 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
160 SyncBackendHost* backend, | 172 SyncBackendHost* backend, |
161 const DataTypeController::TypeMap& controllers) { | 173 const DataTypeController::TypeMap& controllers) { |
162 return new DataTypeManagerImpl(backend, controllers); | 174 return new DataTypeManagerImpl(backend, controllers); |
163 } | 175 } |
164 | 176 |
165 ProfileSyncFactory::SyncComponents | 177 ProfileSyncFactory::SyncComponents |
166 ProfileSyncFactoryImpl::CreateAppSyncComponents( | 178 ProfileSyncFactoryImpl::CreateAppSyncComponents( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 279 |
268 ProfileSyncFactory::SyncComponents | 280 ProfileSyncFactory::SyncComponents |
269 ProfileSyncFactoryImpl::CreatePreferenceSyncComponents( | 281 ProfileSyncFactoryImpl::CreatePreferenceSyncComponents( |
270 ProfileSyncService* profile_sync_service, | 282 ProfileSyncService* profile_sync_service, |
271 UnrecoverableErrorHandler* error_handler) { | 283 UnrecoverableErrorHandler* error_handler) { |
272 SyncableService* pref_sync_service = | 284 SyncableService* pref_sync_service = |
273 profile_->GetPrefs()->GetSyncableService(); | 285 profile_->GetPrefs()->GetSyncableService(); |
274 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 286 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
275 GenericChangeProcessor* change_processor = | 287 GenericChangeProcessor* change_processor = |
276 new GenericChangeProcessor(pref_sync_service, error_handler, user_share); | 288 new GenericChangeProcessor(pref_sync_service, error_handler, user_share); |
277 browser_sync::SyncableServiceAdapter* sync_service_adapter = | 289 SyncableServiceAdapter* sync_service_adapter = |
278 new browser_sync::SyncableServiceAdapter(syncable::PREFERENCES, | 290 new SyncableServiceAdapter(syncable::PREFERENCES, |
279 pref_sync_service, | 291 pref_sync_service, |
280 change_processor); | 292 change_processor); |
281 return SyncComponents(sync_service_adapter, change_processor); | 293 return SyncComponents(sync_service_adapter, change_processor); |
282 } | 294 } |
283 | 295 |
284 ProfileSyncFactory::SyncComponents | 296 ProfileSyncFactory::SyncComponents |
285 ProfileSyncFactoryImpl::CreateThemeSyncComponents( | 297 ProfileSyncFactoryImpl::CreateThemeSyncComponents( |
286 ProfileSyncService* profile_sync_service, | 298 ProfileSyncService* profile_sync_service, |
287 UnrecoverableErrorHandler* error_handler) { | 299 UnrecoverableErrorHandler* error_handler) { |
288 ThemeModelAssociator* model_associator = | 300 ThemeModelAssociator* model_associator = |
289 new ThemeModelAssociator(profile_sync_service); | 301 new ThemeModelAssociator(profile_sync_service); |
290 ThemeChangeProcessor* change_processor = | 302 ThemeChangeProcessor* change_processor = |
(...skipping 19 matching lines...) Expand all Loading... |
310 ProfileSyncFactory::SyncComponents | 322 ProfileSyncFactory::SyncComponents |
311 ProfileSyncFactoryImpl::CreateSessionSyncComponents( | 323 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
312 ProfileSyncService* profile_sync_service, | 324 ProfileSyncService* profile_sync_service, |
313 UnrecoverableErrorHandler* error_handler) { | 325 UnrecoverableErrorHandler* error_handler) { |
314 SessionModelAssociator* model_associator = | 326 SessionModelAssociator* model_associator = |
315 new SessionModelAssociator(profile_sync_service); | 327 new SessionModelAssociator(profile_sync_service); |
316 SessionChangeProcessor* change_processor = | 328 SessionChangeProcessor* change_processor = |
317 new SessionChangeProcessor(error_handler, model_associator); | 329 new SessionChangeProcessor(error_handler, model_associator); |
318 return SyncComponents(model_associator, change_processor); | 330 return SyncComponents(model_associator, change_processor); |
319 } | 331 } |
| 332 |
| 333 ProfileSyncFactory::SyncComponents |
| 334 ProfileSyncFactoryImpl::CreateSearchEngineSyncComponents( |
| 335 ProfileSyncService* profile_sync_service, |
| 336 UnrecoverableErrorHandler* error_handler) { |
| 337 SyncableService* se_sync_service = |
| 338 TemplateURLServiceFactory::GetForProfile(profile_); |
| 339 DCHECK(se_sync_service); |
| 340 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
| 341 GenericChangeProcessor* change_processor = |
| 342 new GenericChangeProcessor(se_sync_service, error_handler, user_share); |
| 343 SyncableServiceAdapter* sync_service_adapter = |
| 344 new SyncableServiceAdapter(syncable::SEARCH_ENGINES, |
| 345 se_sync_service, |
| 346 change_processor); |
| 347 return SyncComponents(sync_service_adapter, change_processor); |
| 348 } |
OLD | NEW |