| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 7 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
| 9 #include "chrome/browser/extensions/app_notification_manager.h" | 9 #include "chrome/browser/extensions/app_notification_manager.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_system.h" | 11 #include "chrome/browser/extensions/extension_system.h" |
| 12 #include "chrome/browser/extensions/extension_system_factory.h" | 12 #include "chrome/browser/extensions/extension_system_factory.h" |
| 13 #include "chrome/browser/history/history_service.h" | 13 #include "chrome/browser/history/history_service.h" |
| 14 #include "chrome/browser/history/history_service_factory.h" | 14 #include "chrome/browser/history/history_service_factory.h" |
| 15 #if !defined(OS_ANDROID) |
| 16 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
| 17 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" |
| 18 #endif |
| 15 #include "chrome/browser/prefs/pref_model_associator.h" | 19 #include "chrome/browser/prefs/pref_model_associator.h" |
| 16 #include "chrome/browser/prefs/pref_service_syncable.h" | 20 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/search_engines/template_url_service.h" | 22 #include "chrome/browser/search_engines/template_url_service.h" |
| 19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 23 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 20 #include "chrome/browser/signin/signin_manager.h" | 24 #include "chrome/browser/signin/signin_manager.h" |
| 21 #include "chrome/browser/signin/signin_manager_factory.h" | 25 #include "chrome/browser/signin/signin_manager_factory.h" |
| 22 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 26 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
| 23 #include "chrome/browser/spellchecker/spellcheck_service.h" | 27 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 24 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 // Unless it is explicitly disabled, history delete directive sync is | 234 // Unless it is explicitly disabled, history delete directive sync is |
| 231 // enabled whenever full history sync is enabled. | 235 // enabled whenever full history sync is enabled. |
| 232 if (command_line_->HasSwitch(switches::kHistoryEnableFullHistorySync) && | 236 if (command_line_->HasSwitch(switches::kHistoryEnableFullHistorySync) && |
| 233 !command_line_->HasSwitch( | 237 !command_line_->HasSwitch( |
| 234 switches::kDisableSyncHistoryDeleteDirectives)) { | 238 switches::kDisableSyncHistoryDeleteDirectives)) { |
| 235 pss->RegisterDataTypeController( | 239 pss->RegisterDataTypeController( |
| 236 new UIDataTypeController( | 240 new UIDataTypeController( |
| 237 syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); | 241 syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); |
| 238 } | 242 } |
| 239 | 243 |
| 244 // Synced Notifications sync is disabled by default. |
| 245 // TODO(petewil): Switch to enabled by default once datatype support is done. |
| 246 if (command_line_->HasSwitch(switches::kEnableSyncSyncedNotifications)) { |
| 247 #if !defined(OS_ANDROID) |
| 248 pss->RegisterDataTypeController( |
| 249 new UIDataTypeController( |
| 250 syncer::SYNCED_NOTIFICATIONS, this, profile_, pss)); |
| 251 #endif |
| 252 } |
| 253 |
| 240 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) | 254 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) |
| 241 // Dictionary sync is enabled by default. | 255 // Dictionary sync is enabled by default. |
| 242 if (!command_line_->HasSwitch(switches::kDisableSyncDictionary)) { | 256 if (!command_line_->HasSwitch(switches::kDisableSyncDictionary)) { |
| 243 pss->RegisterDataTypeController( | 257 pss->RegisterDataTypeController( |
| 244 new UIDataTypeController(syncer::DICTIONARY, this, profile_, pss)); | 258 new UIDataTypeController(syncer::DICTIONARY, this, profile_, pss)); |
| 245 } | 259 } |
| 246 #endif | 260 #endif |
| 261 |
| 247 } | 262 } |
| 248 | 263 |
| 249 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( | 264 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( |
| 250 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 265 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
| 251 debug_info_listener, | 266 debug_info_listener, |
| 252 SyncBackendHost* backend, | 267 SyncBackendHost* backend, |
| 253 const DataTypeController::TypeMap* controllers, | 268 const DataTypeController::TypeMap* controllers, |
| 254 DataTypeManagerObserver* observer, | 269 DataTypeManagerObserver* observer, |
| 255 const FailedDatatypesHandler* failed_datatypes_handler) { | 270 const FailedDatatypesHandler* failed_datatypes_handler) { |
| 256 return new DataTypeManagerImpl(debug_info_listener, | 271 return new DataTypeManagerImpl(debug_info_listener, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 case syncer::THEMES: | 329 case syncer::THEMES: |
| 315 return ThemeServiceFactory::GetForProfile(profile_)-> | 330 return ThemeServiceFactory::GetForProfile(profile_)-> |
| 316 GetThemeSyncableService()->AsWeakPtr(); | 331 GetThemeSyncableService()->AsWeakPtr(); |
| 317 #endif | 332 #endif |
| 318 case syncer::HISTORY_DELETE_DIRECTIVES: { | 333 case syncer::HISTORY_DELETE_DIRECTIVES: { |
| 319 HistoryService* history = | 334 HistoryService* history = |
| 320 HistoryServiceFactory::GetForProfile( | 335 HistoryServiceFactory::GetForProfile( |
| 321 profile_, Profile::EXPLICIT_ACCESS); | 336 profile_, Profile::EXPLICIT_ACCESS); |
| 322 return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); | 337 return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); |
| 323 } | 338 } |
| 339 |
| 340 #if !defined(OS_ANDROID) |
| 341 case syncer::SYNCED_NOTIFICATIONS: { |
| 342 notifier::ChromeNotifierService* notifier_service = |
| 343 notifier::ChromeNotifierServiceFactory::GetForProfile( |
| 344 profile_, Profile::EXPLICIT_ACCESS); |
| 345 return notifier_service ? notifier_service->AsWeakPtr() |
| 346 : base::WeakPtr<syncer::SyncableService>(); |
| 347 } |
| 348 #endif |
| 349 |
| 324 case syncer::DICTIONARY: | 350 case syncer::DICTIONARY: |
| 325 return SpellcheckServiceFactory::GetForProfile(profile_)-> | 351 return SpellcheckServiceFactory::GetForProfile(profile_)-> |
| 326 GetCustomDictionary()->AsWeakPtr(); | 352 GetCustomDictionary()->AsWeakPtr(); |
| 353 |
| 327 default: | 354 default: |
| 328 // The following datatypes still need to be transitioned to the | 355 // The following datatypes still need to be transitioned to the |
| 329 // syncer::SyncableService API: | 356 // syncer::SyncableService API: |
| 330 // Bookmarks | 357 // Bookmarks |
| 331 // Passwords | 358 // Passwords |
| 332 // Sessions | 359 // Sessions |
| 333 // Typed URLs | 360 // Typed URLs |
| 334 NOTREACHED(); | 361 NOTREACHED(); |
| 335 return base::WeakPtr<syncer::SyncableService>(); | 362 return base::WeakPtr<syncer::SyncableService>(); |
| 336 } | 363 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 ProfileSyncComponentsFactory::SyncComponents | 423 ProfileSyncComponentsFactory::SyncComponents |
| 397 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( | 424 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( |
| 398 ProfileSyncService* profile_sync_service, | 425 ProfileSyncService* profile_sync_service, |
| 399 DataTypeErrorHandler* error_handler) { | 426 DataTypeErrorHandler* error_handler) { |
| 400 SessionModelAssociator* model_associator = | 427 SessionModelAssociator* model_associator = |
| 401 new SessionModelAssociator(profile_sync_service, error_handler); | 428 new SessionModelAssociator(profile_sync_service, error_handler); |
| 402 SessionChangeProcessor* change_processor = | 429 SessionChangeProcessor* change_processor = |
| 403 new SessionChangeProcessor(error_handler, model_associator); | 430 new SessionChangeProcessor(error_handler, model_associator); |
| 404 return SyncComponents(model_associator, change_processor); | 431 return SyncComponents(model_associator, change_processor); |
| 405 } | 432 } |
| OLD | NEW |