| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
| 7 #include "chrome/browser/sync/glue/app_data_type_controller.h" | 7 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
| 8 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 8 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
| 9 #include "chrome/browser/sync/glue/autofill_change_processor2.h" | 9 #include "chrome/browser/sync/glue/autofill_change_processor2.h" |
| 10 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 10 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
| 11 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 11 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
| 12 #include "chrome/browser/sync/glue/autofill_model_associator2.h" | 12 #include "chrome/browser/sync/glue/autofill_model_associator2.h" |
| 13 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" |
| 14 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
| 15 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" |
| 13 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 16 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
| 14 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 17 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
| 15 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 18 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
| 16 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 19 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
| 17 #include "chrome/browser/sync/glue/extension_change_processor.h" | 20 #include "chrome/browser/sync/glue/extension_change_processor.h" |
| 18 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 21 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
| 19 #include "chrome/browser/sync/glue/extension_model_associator.h" | 22 #include "chrome/browser/sync/glue/extension_model_associator.h" |
| 20 #include "chrome/browser/sync/glue/extension_sync_traits.h" | 23 #include "chrome/browser/sync/glue/extension_sync_traits.h" |
| 21 #include "chrome/browser/sync/glue/password_change_processor.h" | 24 #include "chrome/browser/sync/glue/password_change_processor.h" |
| 22 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 25 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
| 23 #include "chrome/browser/sync/glue/password_model_associator.h" | 26 #include "chrome/browser/sync/glue/password_model_associator.h" |
| 24 #include "chrome/browser/sync/glue/preference_change_processor.h" | 27 #include "chrome/browser/sync/glue/preference_change_processor.h" |
| 25 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
| 26 #include "chrome/browser/sync/glue/preference_model_associator.h" | 29 #include "chrome/browser/sync/glue/preference_model_associator.h" |
| 27 #include "chrome/browser/sync/glue/session_change_processor.h" | 30 #include "chrome/browser/sync/glue/session_change_processor.h" |
| 28 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 31 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
| 29 #include "chrome/browser/sync/glue/session_model_associator.h" | 32 #include "chrome/browser/sync/glue/session_model_associator.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" |
| 36 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 39 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
| 37 #include "chrome/browser/sync/profile_sync_service.h" | 40 #include "chrome/browser/sync/profile_sync_service.h" |
| 38 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 41 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
| 39 #include "chrome/browser/webdata/web_data_service.h" | 42 #include "chrome/browser/webdata/web_data_service.h" |
| 40 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
| 44 #include "chrome/common/pref_names.h" |
| 41 | 45 |
| 42 using browser_sync::AppDataTypeController; | 46 using browser_sync::AppDataTypeController; |
| 43 using browser_sync::AutofillChangeProcessor; | 47 using browser_sync::AutofillChangeProcessor; |
| 44 using browser_sync::AutofillChangeProcessor2; | 48 using browser_sync::AutofillChangeProcessor2; |
| 49 using browser_sync::AutofillProfileChangeProcessor; |
| 45 using browser_sync::AutofillDataTypeController; | 50 using browser_sync::AutofillDataTypeController; |
| 51 using browser_sync::AutofillProfileDataTypeController; |
| 46 using browser_sync::AutofillModelAssociator; | 52 using browser_sync::AutofillModelAssociator; |
| 47 using browser_sync::AutofillModelAssociator2; | 53 using browser_sync::AutofillModelAssociator2; |
| 54 using browser_sync::AutofillProfileModelAssociator; |
| 48 using browser_sync::BookmarkChangeProcessor; | 55 using browser_sync::BookmarkChangeProcessor; |
| 49 using browser_sync::BookmarkDataTypeController; | 56 using browser_sync::BookmarkDataTypeController; |
| 50 using browser_sync::BookmarkModelAssociator; | 57 using browser_sync::BookmarkModelAssociator; |
| 51 using browser_sync::DataTypeController; | 58 using browser_sync::DataTypeController; |
| 52 using browser_sync::DataTypeManager; | 59 using browser_sync::DataTypeManager; |
| 53 using browser_sync::DataTypeManagerImpl; | 60 using browser_sync::DataTypeManagerImpl; |
| 54 using browser_sync::ExtensionChangeProcessor; | 61 using browser_sync::ExtensionChangeProcessor; |
| 55 using browser_sync::ExtensionDataTypeController; | 62 using browser_sync::ExtensionDataTypeController; |
| 56 using browser_sync::ExtensionModelAssociator; | 63 using browser_sync::ExtensionModelAssociator; |
| 57 using browser_sync::PasswordChangeProcessor; | 64 using browser_sync::PasswordChangeProcessor; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 pss->RegisterDataTypeController( | 145 pss->RegisterDataTypeController( |
| 139 new TypedUrlDataTypeController(this, profile_, pss)); | 146 new TypedUrlDataTypeController(this, profile_, pss)); |
| 140 } | 147 } |
| 141 | 148 |
| 142 // Session sync is disabled by default. Register only if explicitly | 149 // Session sync is disabled by default. Register only if explicitly |
| 143 // enabled. | 150 // enabled. |
| 144 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { | 151 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { |
| 145 pss->RegisterDataTypeController( | 152 pss->RegisterDataTypeController( |
| 146 new SessionDataTypeController(this, pss)); | 153 new SessionDataTypeController(this, pss)); |
| 147 } | 154 } |
| 155 |
| 156 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile) && |
| 157 command_line_->HasSwitch(switches::kEnableSyncNewAutofill)) { |
| 158 pss->RegisterDataTypeController(new AutofillProfileDataTypeController( |
| 159 this, profile_, pss)); |
| 160 } |
| 148 return pss; | 161 return pss; |
| 149 } | 162 } |
| 150 | 163 |
| 151 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 164 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
| 152 SyncBackendHost* backend, | 165 SyncBackendHost* backend, |
| 153 const DataTypeController::TypeMap& controllers) { | 166 const DataTypeController::TypeMap& controllers) { |
| 154 return new DataTypeManagerImpl(backend, controllers); | 167 return new DataTypeManagerImpl(backend, controllers); |
| 155 } | 168 } |
| 156 | 169 |
| 157 ProfileSyncFactory::SyncComponents | 170 ProfileSyncFactory::SyncComponents |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 AutofillChangeProcessor2* change_processor = | 208 AutofillChangeProcessor2* change_processor = |
| 196 new AutofillChangeProcessor2(model_associator, | 209 new AutofillChangeProcessor2(model_associator, |
| 197 web_database, | 210 web_database, |
| 198 personal_data, | 211 personal_data, |
| 199 error_handler); | 212 error_handler); |
| 200 return SyncComponents(model_associator, change_processor); | 213 return SyncComponents(model_associator, change_processor); |
| 201 } | 214 } |
| 202 } | 215 } |
| 203 | 216 |
| 204 ProfileSyncFactory::SyncComponents | 217 ProfileSyncFactory::SyncComponents |
| 218 ProfileSyncFactoryImpl::CreateAutofillProfileSyncComponents( |
| 219 ProfileSyncService* profile_sync_service, |
| 220 WebDatabase* web_database, |
| 221 PersonalDataManager* personal_data, |
| 222 browser_sync::UnrecoverableErrorHandler* error_handler) { |
| 223 |
| 224 AutofillProfileModelAssociator* model_associator = |
| 225 new AutofillProfileModelAssociator(profile_sync_service, |
| 226 web_database, |
| 227 personal_data); |
| 228 AutofillProfileChangeProcessor* change_processor = |
| 229 new AutofillProfileChangeProcessor(model_associator, |
| 230 web_database, |
| 231 personal_data, |
| 232 error_handler); |
| 233 return SyncComponents(model_associator, change_processor); |
| 234 } |
| 235 |
| 236 ProfileSyncFactory::SyncComponents |
| 205 ProfileSyncFactoryImpl::CreateBookmarkSyncComponents( | 237 ProfileSyncFactoryImpl::CreateBookmarkSyncComponents( |
| 206 ProfileSyncService* profile_sync_service, | 238 ProfileSyncService* profile_sync_service, |
| 207 UnrecoverableErrorHandler* error_handler) { | 239 UnrecoverableErrorHandler* error_handler) { |
| 208 BookmarkModelAssociator* model_associator = | 240 BookmarkModelAssociator* model_associator = |
| 209 new BookmarkModelAssociator(profile_sync_service, | 241 new BookmarkModelAssociator(profile_sync_service, |
| 210 error_handler); | 242 error_handler); |
| 211 BookmarkChangeProcessor* change_processor = | 243 BookmarkChangeProcessor* change_processor = |
| 212 new BookmarkChangeProcessor(model_associator, | 244 new BookmarkChangeProcessor(model_associator, |
| 213 error_handler); | 245 error_handler); |
| 214 return SyncComponents(model_associator, change_processor); | 246 return SyncComponents(model_associator, change_processor); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 ProfileSyncFactory::SyncComponents | 315 ProfileSyncFactory::SyncComponents |
| 284 ProfileSyncFactoryImpl::CreateSessionSyncComponents( | 316 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
| 285 ProfileSyncService* profile_sync_service, | 317 ProfileSyncService* profile_sync_service, |
| 286 UnrecoverableErrorHandler* error_handler) { | 318 UnrecoverableErrorHandler* error_handler) { |
| 287 SessionModelAssociator* model_associator = | 319 SessionModelAssociator* model_associator = |
| 288 new SessionModelAssociator(profile_sync_service); | 320 new SessionModelAssociator(profile_sync_service); |
| 289 SessionChangeProcessor* change_processor = | 321 SessionChangeProcessor* change_processor = |
| 290 new SessionChangeProcessor(error_handler, model_associator); | 322 new SessionChangeProcessor(error_handler, model_associator); |
| 291 return SyncComponents(model_associator, change_processor); | 323 return SyncComponents(model_associator, change_processor); |
| 292 } | 324 } |
| OLD | NEW |