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.h" | 13 #include "chrome/browser/history/history.h" |
14 #include "chrome/browser/history/history_service_factory.h" | 14 #include "chrome/browser/history/history_service_factory.h" |
| 15 #include "chrome/browser/notifier/chrome_notifier_service.h" |
| 16 #include "chrome/browser/notifier/chrome_notifier_service_factory.h" |
15 #include "chrome/browser/prefs/pref_model_associator.h" | 17 #include "chrome/browser/prefs/pref_model_associator.h" |
16 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/search_engines/template_url_service.h" | 20 #include "chrome/browser/search_engines/template_url_service.h" |
19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 21 #include "chrome/browser/search_engines/template_url_service_factory.h" |
20 #include "chrome/browser/signin/signin_manager.h" | 22 #include "chrome/browser/signin/signin_manager.h" |
21 #include "chrome/browser/signin/signin_manager_factory.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h" | 24 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h" |
23 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 25 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
24 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 26 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 218 |
217 // Unless it is explicitly disabled, history delete directive sync is | 219 // Unless it is explicitly disabled, history delete directive sync is |
218 // enabled whenever full history sync is enabled. | 220 // enabled whenever full history sync is enabled. |
219 if (command_line_->HasSwitch(switches::kHistoryEnableFullHistorySync) && | 221 if (command_line_->HasSwitch(switches::kHistoryEnableFullHistorySync) && |
220 !command_line_->HasSwitch( | 222 !command_line_->HasSwitch( |
221 switches::kDisableSyncHistoryDeleteDirectives)) { | 223 switches::kDisableSyncHistoryDeleteDirectives)) { |
222 pss->RegisterDataTypeController( | 224 pss->RegisterDataTypeController( |
223 new UIDataTypeController( | 225 new UIDataTypeController( |
224 syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); | 226 syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); |
225 } | 227 } |
| 228 |
| 229 // Synced Notifications sync is enabled by default. Register unless |
| 230 // explicitly disabled. |
| 231 if (!command_line_->HasSwitch(switches::kDisableSyncSyncedNotifications)) { |
| 232 pss->RegisterDataTypeController( |
| 233 new UIDataTypeController( |
| 234 syncer::SYNCED_NOTIFICATIONS, this, profile_, pss)); |
| 235 } |
| 236 |
226 } | 237 } |
227 | 238 |
228 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( | 239 DataTypeManager* ProfileSyncComponentsFactoryImpl::CreateDataTypeManager( |
229 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 240 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
230 debug_info_listener, | 241 debug_info_listener, |
231 SyncBackendHost* backend, | 242 SyncBackendHost* backend, |
232 const DataTypeController::TypeMap* controllers, | 243 const DataTypeController::TypeMap* controllers, |
233 DataTypeManagerObserver* observer) { | 244 DataTypeManagerObserver* observer) { |
234 return new DataTypeManagerImpl(debug_info_listener, | 245 return new DataTypeManagerImpl(debug_info_listener, |
235 backend, | 246 backend, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 case syncer::THEMES: | 301 case syncer::THEMES: |
291 return ThemeServiceFactory::GetForProfile(profile_)-> | 302 return ThemeServiceFactory::GetForProfile(profile_)-> |
292 GetThemeSyncableService()->AsWeakPtr(); | 303 GetThemeSyncableService()->AsWeakPtr(); |
293 #endif | 304 #endif |
294 case syncer::HISTORY_DELETE_DIRECTIVES: { | 305 case syncer::HISTORY_DELETE_DIRECTIVES: { |
295 HistoryService* history = | 306 HistoryService* history = |
296 HistoryServiceFactory::GetForProfile( | 307 HistoryServiceFactory::GetForProfile( |
297 profile_, Profile::EXPLICIT_ACCESS); | 308 profile_, Profile::EXPLICIT_ACCESS); |
298 return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); | 309 return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); |
299 } | 310 } |
| 311 |
| 312 case syncer::SYNCED_NOTIFICATIONS: { |
| 313 ChromeNotifierService* notifier = |
| 314 ChromeNotifierServiceFactory::GetForProfile( |
| 315 profile_, Profile::EXPLICIT_ACCESS); |
| 316 return notifier ? notifier->AsWeakPtr() |
| 317 : base::WeakPtr<ChromeNotifierService>(); |
| 318 } |
| 319 |
300 default: | 320 default: |
301 // The following datatypes still need to be transitioned to the | 321 // The following datatypes still need to be transitioned to the |
302 // syncer::SyncableService API: | 322 // syncer::SyncableService API: |
303 // Bookmarks | 323 // Bookmarks |
304 // Passwords | 324 // Passwords |
305 // Sessions | 325 // Sessions |
306 // Typed URLs | 326 // Typed URLs |
307 NOTREACHED(); | 327 NOTREACHED(); |
308 return base::WeakPtr<syncer::SyncableService>(); | 328 return base::WeakPtr<syncer::SyncableService>(); |
309 } | 329 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 ProfileSyncComponentsFactory::SyncComponents | 389 ProfileSyncComponentsFactory::SyncComponents |
370 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( | 390 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( |
371 ProfileSyncService* profile_sync_service, | 391 ProfileSyncService* profile_sync_service, |
372 DataTypeErrorHandler* error_handler) { | 392 DataTypeErrorHandler* error_handler) { |
373 SessionModelAssociator* model_associator = | 393 SessionModelAssociator* model_associator = |
374 new SessionModelAssociator(profile_sync_service, error_handler); | 394 new SessionModelAssociator(profile_sync_service, error_handler); |
375 SessionChangeProcessor* change_processor = | 395 SessionChangeProcessor* change_processor = |
376 new SessionChangeProcessor(error_handler, model_associator); | 396 new SessionChangeProcessor(error_handler, model_associator); |
377 return SyncComponents(model_associator, change_processor); | 397 return SyncComponents(model_associator, change_processor); |
378 } | 398 } |
OLD | NEW |