| 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/extensions/extension_settings.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/sync/api/syncable_service.h" | 9 #include "chrome/browser/sync/api/syncable_service.h" |
| 9 #include "chrome/browser/sync/glue/app_change_processor.h" | 10 #include "chrome/browser/sync/glue/app_change_processor.h" |
| 10 #include "chrome/browser/sync/glue/app_data_type_controller.h" | 11 #include "chrome/browser/sync/glue/app_data_type_controller.h" |
| 11 #include "chrome/browser/sync/glue/app_model_associator.h" | 12 #include "chrome/browser/sync/glue/app_model_associator.h" |
| 12 #include "chrome/browser/sync/glue/autofill_change_processor.h" | 13 #include "chrome/browser/sync/glue/autofill_change_processor.h" |
| 13 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 14 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
| 14 #include "chrome/browser/sync/glue/autofill_model_associator.h" | 15 #include "chrome/browser/sync/glue/autofill_model_associator.h" |
| 15 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" | 16 #include "chrome/browser/sync/glue/autofill_profile_change_processor.h" |
| 16 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 17 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
| 17 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" | 18 #include "chrome/browser/sync/glue/autofill_profile_model_associator.h" |
| 18 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 19 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
| 19 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 20 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
| 20 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 21 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
| 21 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 22 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
| 22 #include "chrome/browser/sync/glue/extension_change_processor.h" | 23 #include "chrome/browser/sync/glue/extension_change_processor.h" |
| 23 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 24 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
| 24 #include "chrome/browser/sync/glue/extension_model_associator.h" | 25 #include "chrome/browser/sync/glue/extension_model_associator.h" |
| 26 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.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" |
| 31 #include "chrome/browser/sync/glue/session_change_processor.h" | 33 #include "chrome/browser/sync/glue/session_change_processor.h" |
| 32 #include "chrome/browser/sync/glue/session_data_type_controller.h" | 34 #include "chrome/browser/sync/glue/session_data_type_controller.h" |
| 33 #include "chrome/browser/sync/glue/session_model_associator.h" | 35 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 34 #include "chrome/browser/sync/glue/syncable_service_adapter.h" | 36 #include "chrome/browser/sync/glue/syncable_service_adapter.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 57 using browser_sync::AutofillProfileModelAssociator; | 59 using browser_sync::AutofillProfileModelAssociator; |
| 58 using browser_sync::BookmarkChangeProcessor; | 60 using browser_sync::BookmarkChangeProcessor; |
| 59 using browser_sync::BookmarkDataTypeController; | 61 using browser_sync::BookmarkDataTypeController; |
| 60 using browser_sync::BookmarkModelAssociator; | 62 using browser_sync::BookmarkModelAssociator; |
| 61 using browser_sync::DataTypeController; | 63 using browser_sync::DataTypeController; |
| 62 using browser_sync::DataTypeManager; | 64 using browser_sync::DataTypeManager; |
| 63 using browser_sync::DataTypeManagerImpl; | 65 using browser_sync::DataTypeManagerImpl; |
| 64 using browser_sync::ExtensionChangeProcessor; | 66 using browser_sync::ExtensionChangeProcessor; |
| 65 using browser_sync::ExtensionDataTypeController; | 67 using browser_sync::ExtensionDataTypeController; |
| 66 using browser_sync::ExtensionModelAssociator; | 68 using browser_sync::ExtensionModelAssociator; |
| 69 using browser_sync::ExtensionSettingDataTypeController; |
| 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; |
| 72 using browser_sync::SessionChangeProcessor; | 75 using browser_sync::SessionChangeProcessor; |
| 73 using browser_sync::SessionDataTypeController; | 76 using browser_sync::SessionDataTypeController; |
| 74 using browser_sync::SessionModelAssociator; | 77 using browser_sync::SessionModelAssociator; |
| 75 using browser_sync::SyncBackendHost; | 78 using browser_sync::SyncBackendHost; |
| 76 using browser_sync::ThemeChangeProcessor; | 79 using browser_sync::ThemeChangeProcessor; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 new TypedUrlDataTypeController(this, profile_)); | 155 new TypedUrlDataTypeController(this, profile_)); |
| 153 } | 156 } |
| 154 | 157 |
| 155 // Session sync is disabled by default. Register only if explicitly | 158 // Session sync is disabled by default. Register only if explicitly |
| 156 // enabled. | 159 // enabled. |
| 157 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { | 160 if (command_line_->HasSwitch(switches::kEnableSyncSessions)) { |
| 158 pss->RegisterDataTypeController( | 161 pss->RegisterDataTypeController( |
| 159 new SessionDataTypeController(this, profile_, pss)); | 162 new SessionDataTypeController(this, profile_, pss)); |
| 160 } | 163 } |
| 161 | 164 |
| 165 // Extension setting sync is disabled by default. Register only if |
| 166 // explicitly enabled. |
| 167 if (command_line_->HasSwitch(switches::kEnableSyncExtensionSettings)) { |
| 168 pss->RegisterDataTypeController( |
| 169 new ExtensionSettingDataTypeController(this, profile_, pss)); |
| 170 } |
| 171 |
| 162 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { | 172 if (!command_line_->HasSwitch(switches::kDisableSyncAutofillProfile)) { |
| 163 pss->RegisterDataTypeController( | 173 pss->RegisterDataTypeController( |
| 164 new AutofillProfileDataTypeController(this, profile_)); | 174 new AutofillProfileDataTypeController(this, profile_)); |
| 165 } | 175 } |
| 166 } | 176 } |
| 167 | 177 |
| 168 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( | 178 DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager( |
| 169 SyncBackendHost* backend, | 179 SyncBackendHost* backend, |
| 170 const DataTypeController::TypeMap& controllers) { | 180 const DataTypeController::TypeMap& controllers) { |
| 171 return new DataTypeManagerImpl(backend, controllers); | 181 return new DataTypeManagerImpl(backend, controllers); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 new BookmarkModelAssociator(bookmark_model, | 247 new BookmarkModelAssociator(bookmark_model, |
| 238 user_share, | 248 user_share, |
| 239 error_handler); | 249 error_handler); |
| 240 BookmarkChangeProcessor* change_processor = | 250 BookmarkChangeProcessor* change_processor = |
| 241 new BookmarkChangeProcessor(model_associator, | 251 new BookmarkChangeProcessor(model_associator, |
| 242 error_handler); | 252 error_handler); |
| 243 return SyncComponents(model_associator, change_processor); | 253 return SyncComponents(model_associator, change_processor); |
| 244 } | 254 } |
| 245 | 255 |
| 246 ProfileSyncFactory::SyncComponents | 256 ProfileSyncFactory::SyncComponents |
| 257 ProfileSyncFactoryImpl::CreateExtensionSettingSyncComponents( |
| 258 ProfileSyncService* profile_sync_service, |
| 259 UnrecoverableErrorHandler* error_handler) { |
| 260 SyncableService* sync_service = |
| 261 profile_->GetExtensionService()->extension_settings(); |
| 262 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
| 263 GenericChangeProcessor* change_processor = |
| 264 new GenericChangeProcessor(sync_service, error_handler, user_share); |
| 265 browser_sync::SyncableServiceAdapter* sync_service_adapter = |
| 266 new browser_sync::SyncableServiceAdapter(syncable::EXTENSION_SETTINGS, |
| 267 sync_service, |
| 268 change_processor); |
| 269 return SyncComponents(sync_service_adapter, change_processor); |
| 270 } |
| 271 |
| 272 ProfileSyncFactory::SyncComponents |
| 247 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( | 273 ProfileSyncFactoryImpl::CreateExtensionSyncComponents( |
| 248 ProfileSyncService* profile_sync_service, | 274 ProfileSyncService* profile_sync_service, |
| 249 UnrecoverableErrorHandler* error_handler) { | 275 UnrecoverableErrorHandler* error_handler) { |
| 250 ExtensionServiceInterface* extension_service = | 276 ExtensionServiceInterface* extension_service = |
| 251 profile_sync_service->profile()->GetExtensionService(); | 277 profile_sync_service->profile()->GetExtensionService(); |
| 252 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); | 278 sync_api::UserShare* user_share = profile_sync_service->GetUserShare(); |
| 253 ExtensionModelAssociator* model_associator = | 279 ExtensionModelAssociator* model_associator = |
| 254 new ExtensionModelAssociator(extension_service, user_share); | 280 new ExtensionModelAssociator(extension_service, user_share); |
| 255 ExtensionChangeProcessor* change_processor = | 281 ExtensionChangeProcessor* change_processor = |
| 256 new ExtensionChangeProcessor(error_handler); | 282 new ExtensionChangeProcessor(error_handler); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 ProfileSyncFactory::SyncComponents | 343 ProfileSyncFactory::SyncComponents |
| 318 ProfileSyncFactoryImpl::CreateSessionSyncComponents( | 344 ProfileSyncFactoryImpl::CreateSessionSyncComponents( |
| 319 ProfileSyncService* profile_sync_service, | 345 ProfileSyncService* profile_sync_service, |
| 320 UnrecoverableErrorHandler* error_handler) { | 346 UnrecoverableErrorHandler* error_handler) { |
| 321 SessionModelAssociator* model_associator = | 347 SessionModelAssociator* model_associator = |
| 322 new SessionModelAssociator(profile_sync_service); | 348 new SessionModelAssociator(profile_sync_service); |
| 323 SessionChangeProcessor* change_processor = | 349 SessionChangeProcessor* change_processor = |
| 324 new SessionChangeProcessor(error_handler, model_associator); | 350 new SessionChangeProcessor(error_handler, model_associator); |
| 325 return SyncComponents(model_associator, change_processor); | 351 return SyncComponents(model_associator, change_processor); |
| 326 } | 352 } |
| OLD | NEW |