Chromium Code Reviews| 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/defaults.h" | 6 #include "chrome/browser/defaults.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/sync/glue/app_data_type_controller.h" | 8 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
| 9 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 9 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
| 10 #include "chrome/browser/sync/glue/autofill_change_processor2.h" | 10 #include "chrome/browser/sync/glue/autofill_change_processor2.h" |
| 11 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" | |
| 11 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 12 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
| 13 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | |
|
tim (not reviewing)
2010/12/13 19:24:33
alphabetical
lipalani
2010/12/15 09:08:33
Done.
| |
| 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_model_associator2.h" | 15 #include "chrome/browser/sync/glue/autofill_model_associator2.h" |
| 16 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" | |
| 14 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 17 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
| 15 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 18 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
| 16 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 19 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
| 17 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 20 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
| 18 #include "chrome/browser/sync/glue/extension_change_processor.h" | 21 #include "chrome/browser/sync/glue/extension_change_processor.h" |
| 19 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 22 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
| 20 #include "chrome/browser/sync/glue/extension_model_associator.h" | 23 #include "chrome/browser/sync/glue/extension_model_associator.h" |
| 21 #include "chrome/browser/sync/glue/extension_sync_traits.h" | 24 #include "chrome/browser/sync/glue/extension_sync_traits.h" |
| 22 #include "chrome/browser/sync/glue/password_change_processor.h" | 25 #include "chrome/browser/sync/glue/password_change_processor.h" |
| 23 #include "chrome/browser/sync/glue/password_data_type_controller.h" | 26 #include "chrome/browser/sync/glue/password_data_type_controller.h" |
| 24 #include "chrome/browser/sync/glue/password_model_associator.h" | 27 #include "chrome/browser/sync/glue/password_model_associator.h" |
| 25 #include "chrome/browser/sync/glue/preference_change_processor.h" | 28 #include "chrome/browser/sync/glue/preference_change_processor.h" |
| 26 #include "chrome/browser/sync/glue/preference_data_type_controller.h" | 29 #include "chrome/browser/sync/glue/preference_data_type_controller.h" |
| 27 #include "chrome/browser/sync/glue/preference_model_associator.h" | 30 #include "chrome/browser/sync/glue/preference_model_associator.h" |
| 28 #include "chrome/browser/sync/glue/session_change_processor.h" | 31 #include "chrome/browser/sync/glue/session_change_processor.h" |
| 29 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 32 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
| 30 #include "chrome/browser/sync/glue/session_model_associator.h" | 33 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 31 #include "chrome/browser/sync/glue/sync_backend_host.h" | 34 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 32 #include "chrome/browser/sync/glue/theme_change_processor.h" | 35 #include "chrome/browser/sync/glue/theme_change_processor.h" |
| 33 #include "chrome/browser/sync/glue/theme_data_type_controller.h" | 36 #include "chrome/browser/sync/glue/theme_data_type_controller.h" |
| 34 #include "chrome/browser/sync/glue/theme_model_associator.h" | 37 #include "chrome/browser/sync/glue/theme_model_associator.h" |
| 35 #include "chrome/browser/sync/glue/typed_url_change_processor.h" | 38 #include "chrome/browser/sync/glue/typed_url_change_processor.h" |
| 36 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" | 39 #include "chrome/browser/sync/glue/typed_url_data_type_controller.h" |
| 37 #include "chrome/browser/sync/glue/typed_url_model_associator.h" | 40 #include "chrome/browser/sync/glue/typed_url_model_associator.h" |
| 38 #include "chrome/browser/sync/profile_sync_service.h" | 41 #include "chrome/browser/sync/profile_sync_service.h" |
| 39 #include "chrome/browser/sync/profile_sync_factory_impl.h" | 42 #include "chrome/browser/sync/profile_sync_factory_impl.h" |
| 40 #include "chrome/browser/webdata/web_data_service.h" | 43 #include "chrome/browser/webdata/web_data_service.h" |
| 41 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
| 45 #include "chrome/common/pref_names.h" | |
| 42 | 46 |
| 43 using browser_sync::AppDataTypeController; | 47 using browser_sync::AppDataTypeController; |
| 44 using browser_sync::AutofillChangeProcessor; | 48 using browser_sync::AutofillChangeProcessor; |
| 45 using browser_sync::AutofillChangeProcessor2; | 49 using browser_sync::AutofillChangeProcessor2; |
| 50 using browser_sync::AutofillProfileChangeProcessor; | |
| 46 using browser_sync::AutofillDataTypeController; | 51 using browser_sync::AutofillDataTypeController; |
| 52 using browser_sync::AutofillProfileDataTypeController; | |
| 47 using browser_sync::AutofillModelAssociator; | 53 using browser_sync::AutofillModelAssociator; |
| 48 using browser_sync::AutofillModelAssociator2; | 54 using browser_sync::AutofillModelAssociator2; |
| 55 using browser_sync::AutofillProfileModelAssociator; | |
| 49 using browser_sync::BookmarkChangeProcessor; | 56 using browser_sync::BookmarkChangeProcessor; |
| 50 using browser_sync::BookmarkDataTypeController; | 57 using browser_sync::BookmarkDataTypeController; |
| 51 using browser_sync::BookmarkModelAssociator; | 58 using browser_sync::BookmarkModelAssociator; |
| 52 using browser_sync::DataTypeController; | 59 using browser_sync::DataTypeController; |
| 53 using browser_sync::DataTypeManager; | 60 using browser_sync::DataTypeManager; |
| 54 using browser_sync::DataTypeManagerImpl; | 61 using browser_sync::DataTypeManagerImpl; |
| 55 using browser_sync::ExtensionChangeProcessor; | 62 using browser_sync::ExtensionChangeProcessor; |
| 56 using browser_sync::ExtensionDataTypeController; | 63 using browser_sync::ExtensionDataTypeController; |
| 57 using browser_sync::ExtensionModelAssociator; | 64 using browser_sync::ExtensionModelAssociator; |
| 58 using browser_sync::PasswordChangeProcessor; | 65 using browser_sync::PasswordChangeProcessor; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 pss->RegisterDataTypeController( | 146 pss->RegisterDataTypeController( |
| 140 new TypedUrlDataTypeController(this, profile_, pss)); | 147 new TypedUrlDataTypeController(this, profile_, pss)); |
| 141 } | 148 } |
| 142 | 149 |
| 143 // Session sync is disabled by default. Register only if explicitly | 150 // Session sync is disabled by default. Register only if explicitly |
| 144 // enabled. | 151 // enabled. |
| 145 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { | 152 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { |
| 146 pss->RegisterDataTypeController( | 153 pss->RegisterDataTypeController( |
| 147 new SessionDataTypeController(this, pss)); | 154 new SessionDataTypeController(this, pss)); |
| 148 } | 155 } |
| 156 | |
| 157 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile) && | |
| 158 command_line_->HasSwitch(switches::kEnableSyncNewAutofill)) { | |
| 159 pss->RegisterDataTypeController(new AutofillProfileDataTypeController( | |
| 160 this, profile_, pss)); | |
| 161 } | |
| 149 return pss; | 162 return pss; |
| 150 } | 163 } |
| 151 | 164 |
| 152 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 165 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
| 153 SyncBackendHost* backend, | 166 SyncBackendHost* backend, |
| 154 const DataTypeController::TypeMap& controllers) { | 167 const DataTypeController::TypeMap& controllers) { |
| 155 return new DataTypeManagerImpl(backend, controllers); | 168 return new DataTypeManagerImpl(backend, controllers); |
| 156 } | 169 } |
| 157 | 170 |
| 158 ProfileSyncFactory::SyncComponents | 171 ProfileSyncFactory::SyncComponents |
| 159 ProfileSyncFactoryImpl::CreateAppSyncComponents( | 172 ProfileSyncFactoryImpl::CreateAppSyncComponents( |
| 160 ProfileSyncService* profile_sync_service, | 173 ProfileSyncService* profile_sync_service, |
| 161 UnrecoverableErrorHandler* error_handler) { | 174 UnrecoverableErrorHandler* error_handler) { |
| 162 browser_sync::ExtensionSyncTraits traits = browser_sync::GetAppSyncTraits(); | 175 browser_sync::ExtensionSyncTraits traits = browser_sync::GetAppSyncTraits(); |
| 163 // For now we simply use extensions sync objects with the app sync | 176 // For now we simply use extensions sync objects with the app sync |
| 164 // traits. If apps become more than simply extensions, we may have | 177 // traits. If apps become more than simply extensions, we may have |
| 165 // to write our own apps model associator and/or change processor. | 178 // to write our own apps model associator and/or change processor. |
| 166 ExtensionModelAssociator* model_associator = | 179 ExtensionModelAssociator* model_associator = |
| 167 new ExtensionModelAssociator(traits, profile_sync_service); | 180 new ExtensionModelAssociator(traits, profile_sync_service); |
| 168 ExtensionChangeProcessor* change_processor = | 181 ExtensionChangeProcessor* change_processor = |
| 169 new ExtensionChangeProcessor(traits, error_handler); | 182 new ExtensionChangeProcessor(traits, error_handler); |
| 170 return SyncComponents(model_associator, change_processor); | 183 return SyncComponents(model_associator, change_processor); |
| 171 } | 184 } |
| 172 | 185 |
| 186 | |
|
tim (not reviewing)
2010/12/13 19:24:33
extra newlines
lipalani
2010/12/14 21:05:57
Done.
| |
| 187 | |
| 173 ProfileSyncFactory::SyncComponents | 188 ProfileSyncFactory::SyncComponents |
| 174 ProfileSyncFactoryImpl::CreateAutofillSyncComponents( | 189 ProfileSyncFactoryImpl::CreateAutofillSyncComponents( |
| 175 ProfileSyncService* profile_sync_service, | 190 ProfileSyncService* profile_sync_service, |
| 176 WebDatabase* web_database, | 191 WebDatabase* web_database, |
| 177 PersonalDataManager* personal_data, | 192 PersonalDataManager* personal_data, |
| 178 browser_sync::UnrecoverableErrorHandler* error_handler) { | 193 browser_sync::UnrecoverableErrorHandler* error_handler) { |
| 179 | 194 |
| 180 if (command_line_->HasSwitch(switches::kEnableSyncNewAutofill)) { | 195 if (command_line_->HasSwitch(switches::kEnableSyncNewAutofill)) { |
| 181 AutofillModelAssociator* model_associator = | 196 AutofillModelAssociator* model_associator = |
| 182 new AutofillModelAssociator(profile_sync_service, | 197 new AutofillModelAssociator(profile_sync_service, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 196 AutofillChangeProcessor2* change_processor = | 211 AutofillChangeProcessor2* change_processor = |
| 197 new AutofillChangeProcessor2(model_associator, | 212 new AutofillChangeProcessor2(model_associator, |
| 198 web_database, | 213 web_database, |
| 199 personal_data, | 214 personal_data, |
| 200 error_handler); | 215 error_handler); |
| 201 return SyncComponents(model_associator, change_processor); | 216 return SyncComponents(model_associator, change_processor); |
| 202 } | 217 } |
| 203 } | 218 } |
| 204 | 219 |
| 205 ProfileSyncFactory::SyncComponents | 220 ProfileSyncFactory::SyncComponents |
| 221 ProfileSyncFactoryImpl::CreateAutofillProfileSyncComponents( | |
| 222 ProfileSyncService* profile_sync_service, | |
| 223 WebDatabase* web_database, | |
| 224 PersonalDataManager* personal_data, | |
| 225 browser_sync::UnrecoverableErrorHandler* error_handler) { | |
| 226 | |
| 227 AutofillProfileModelAssociator* model_associator = | |
| 228 new AutofillProfileModelAssociator(profile_sync_service, | |
| 229 web_database, | |
| 230 personal_data); | |
| 231 AutofillProfileChangeProcessor* change_processor = | |
| 232 new AutofillProfileChangeProcessor(model_associator, | |
| 233 web_database, | |
| 234 personal_data, | |
| 235 error_handler); | |
| 236 return SyncComponents(model_associator, change_processor); | |
| 237 } | |
| 238 | |
| 239 ProfileSyncFactory::SyncComponents | |
| 206 ProfileSyncFactoryImpl::CreateBookmarkSyncComponents( | 240 ProfileSyncFactoryImpl::CreateBookmarkSyncComponents( |
| 207 ProfileSyncService* profile_sync_service, | 241 ProfileSyncService* profile_sync_service, |
| 208 UnrecoverableErrorHandler* error_handler) { | 242 UnrecoverableErrorHandler* error_handler) { |
| 209 BookmarkModelAssociator* model_associator = | 243 BookmarkModelAssociator* model_associator = |
| 210 new BookmarkModelAssociator(profile_sync_service, | 244 new BookmarkModelAssociator(profile_sync_service, |
| 211 error_handler); | 245 error_handler); |
| 212 BookmarkChangeProcessor* change_processor = | 246 BookmarkChangeProcessor* change_processor = |
| 213 new BookmarkChangeProcessor(model_associator, | 247 new BookmarkChangeProcessor(model_associator, |
| 214 error_handler); | 248 error_handler); |
| 215 return SyncComponents(model_associator, change_processor); | 249 return SyncComponents(model_associator, change_processor); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 ProfileSyncFactory::SyncComponents | 318 ProfileSyncFactory::SyncComponents |
| 285 ProfileSyncFactoryImpl::CreateSessionSyncComponents( | 319 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
| 286 ProfileSyncService* profile_sync_service, | 320 ProfileSyncService* profile_sync_service, |
| 287 UnrecoverableErrorHandler* error_handler) { | 321 UnrecoverableErrorHandler* error_handler) { |
| 288 SessionModelAssociator* model_associator = | 322 SessionModelAssociator* model_associator = |
| 289 new SessionModelAssociator(profile_sync_service); | 323 new SessionModelAssociator(profile_sync_service); |
| 290 SessionChangeProcessor* change_processor = | 324 SessionChangeProcessor* change_processor = |
| 291 new SessionChangeProcessor(error_handler, model_associator); | 325 new SessionChangeProcessor(error_handler, model_associator); |
| 292 return SyncComponents(model_associator, change_processor); | 326 return SyncComponents(model_associator, change_processor); |
| 293 } | 327 } |
| OLD | NEW |