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/bookmarks/enhanced_bookmarks_features.h" | 8 #include "chrome/browser/bookmarks/enhanced_bookmarks_features.h" |
9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" | 9 #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" |
10 #include "chrome/browser/history/history_service.h" | 10 #include "chrome/browser/history/history_service.h" |
11 #include "chrome/browser/history/history_service_factory.h" | 11 #include "chrome/browser/history/history_service_factory.h" |
12 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | |
13 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" | |
14 #include "chrome/browser/password_manager/password_store_factory.h" | 12 #include "chrome/browser/password_manager/password_store_factory.h" |
15 #include "chrome/browser/pref_service_flags_storage.h" | 13 #include "chrome/browser/pref_service_flags_storage.h" |
16 #include "chrome/browser/prefs/pref_model_associator.h" | 14 #include "chrome/browser/prefs/pref_model_associator.h" |
17 #include "chrome/browser/prefs/pref_service_syncable.h" | 15 #include "chrome/browser/prefs/pref_service_syncable.h" |
18 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 17 #include "chrome/browser/search_engines/template_url_service_factory.h" |
20 #include "chrome/browser/signin/signin_manager_factory.h" | 18 #include "chrome/browser/signin/signin_manager_factory.h" |
21 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 19 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
22 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 20 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
23 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 21 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #include "sync/internal_api/public/attachments/attachment_uploader_impl.h" | 67 #include "sync/internal_api/public/attachments/attachment_uploader_impl.h" |
70 | 68 |
71 #if defined(ENABLE_APP_LIST) | 69 #if defined(ENABLE_APP_LIST) |
72 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 70 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
73 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 71 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
74 #include "ui/app_list/app_list_switches.h" | 72 #include "ui/app_list/app_list_switches.h" |
75 #endif | 73 #endif |
76 | 74 |
77 #if defined(ENABLE_EXTENSIONS) | 75 #if defined(ENABLE_EXTENSIONS) |
78 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" | 76 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" |
79 #include "chrome/browser/extensions/api/synced_notifications_private/synced_noti
fications_shim.h" | |
80 #include "chrome/browser/extensions/extension_sync_service.h" | 77 #include "chrome/browser/extensions/extension_sync_service.h" |
81 #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" | 78 #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" |
82 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 79 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
83 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" | 80 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" |
84 #endif | 81 #endif |
85 | 82 |
86 #if defined(ENABLE_SUPERVISED_USERS) | 83 #if defined(ENABLE_SUPERVISED_USERS) |
87 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" | 84 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
88 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" | 85 #include "chrome/browser/supervised_user/supervised_user_settings_service_factor
y.h" |
89 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
.h" | 86 #include "chrome/browser/supervised_user/supervised_user_shared_settings_service
.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 syncer::ModelTypeSet disabled_types; | 133 syncer::ModelTypeSet disabled_types; |
137 std::string disabled_types_str = | 134 std::string disabled_types_str = |
138 command_line.GetSwitchValueASCII(switches::kDisableSyncTypes); | 135 command_line.GetSwitchValueASCII(switches::kDisableSyncTypes); |
139 disabled_types = syncer::ModelTypeSetFromString(disabled_types_str); | 136 disabled_types = syncer::ModelTypeSetFromString(disabled_types_str); |
140 return disabled_types; | 137 return disabled_types; |
141 } | 138 } |
142 | 139 |
143 syncer::ModelTypeSet GetEnabledTypesFromCommandLine( | 140 syncer::ModelTypeSet GetEnabledTypesFromCommandLine( |
144 const CommandLine& command_line) { | 141 const CommandLine& command_line) { |
145 syncer::ModelTypeSet enabled_types; | 142 syncer::ModelTypeSet enabled_types; |
146 if (command_line.HasSwitch(switches::kEnableSyncSyncedNotifications)) { | |
147 enabled_types.Put(syncer::SYNCED_NOTIFICATIONS); | |
148 } | |
149 return enabled_types; | 143 return enabled_types; |
150 } | 144 } |
151 | 145 |
152 } // namespace | 146 } // namespace |
153 | 147 |
154 ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( | 148 ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl( |
155 Profile* profile, | 149 Profile* profile, |
156 CommandLine* command_line, | 150 CommandLine* command_line, |
157 const GURL& sync_service_url, | 151 const GURL& sync_service_url, |
158 OAuth2TokenService* token_service, | 152 OAuth2TokenService* token_service, |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 if (app_list::switches::IsAppListSyncEnabled()) { | 361 if (app_list::switches::IsAppListSyncEnabled()) { |
368 pss->RegisterDataTypeController( | 362 pss->RegisterDataTypeController( |
369 new UIDataTypeController( | 363 new UIDataTypeController( |
370 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 364 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
371 base::Bind(&ChromeReportUnrecoverableError), | 365 base::Bind(&ChromeReportUnrecoverableError), |
372 syncer::APP_LIST, | 366 syncer::APP_LIST, |
373 this)); | 367 this)); |
374 } | 368 } |
375 #endif | 369 #endif |
376 | 370 |
377 // Synced Notifications are disabled by default. | |
378 #if defined(ENABLE_EXTENSIONS) && defined(ENABLE_NOTIFICATIONS) | |
379 if (enabled_types.Has(syncer::SYNCED_NOTIFICATIONS)) { | |
380 pss->RegisterDataTypeController( | |
381 new ExtensionBackedDataTypeController( | |
382 syncer::SYNCED_NOTIFICATIONS, | |
383 "", // TODO(dewittj): pass the extension hash here. | |
384 this, | |
385 profile_)); | |
386 | |
387 pss->RegisterDataTypeController( | |
388 new ExtensionBackedDataTypeController( | |
389 syncer::SYNCED_NOTIFICATION_APP_INFO, | |
390 "", // TODO(dewittj): pass the extension hash here. | |
391 this, | |
392 profile_)); | |
393 } | |
394 #endif | |
395 | |
396 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) | 371 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) |
397 // Dictionary sync is enabled by default. | 372 // Dictionary sync is enabled by default. |
398 if (!disabled_types.Has(syncer::DICTIONARY)) { | 373 if (!disabled_types.Has(syncer::DICTIONARY)) { |
399 pss->RegisterDataTypeController( | 374 pss->RegisterDataTypeController( |
400 new UIDataTypeController( | 375 new UIDataTypeController( |
401 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), | 376 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
402 base::Bind(&ChromeReportUnrecoverableError), | 377 base::Bind(&ChromeReportUnrecoverableError), |
403 syncer::DICTIONARY, | 378 syncer::DICTIONARY, |
404 this)); | 379 this)); |
405 } | 380 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 case syncer::THEMES: | 474 case syncer::THEMES: |
500 return ThemeServiceFactory::GetForProfile(profile_)-> | 475 return ThemeServiceFactory::GetForProfile(profile_)-> |
501 GetThemeSyncableService()->AsWeakPtr(); | 476 GetThemeSyncableService()->AsWeakPtr(); |
502 #endif | 477 #endif |
503 case syncer::HISTORY_DELETE_DIRECTIVES: { | 478 case syncer::HISTORY_DELETE_DIRECTIVES: { |
504 HistoryService* history = | 479 HistoryService* history = |
505 HistoryServiceFactory::GetForProfile( | 480 HistoryServiceFactory::GetForProfile( |
506 profile_, Profile::EXPLICIT_ACCESS); | 481 profile_, Profile::EXPLICIT_ACCESS); |
507 return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); | 482 return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); |
508 } | 483 } |
509 #if defined(ENABLE_EXTENSIONS) | |
510 case syncer::SYNCED_NOTIFICATIONS: | |
511 case syncer::SYNCED_NOTIFICATION_APP_INFO: { | |
512 return notifier::ChromeNotifierServiceFactory::GetForProfile( | |
513 profile_, Profile::IMPLICIT_ACCESS) | |
514 ->GetSyncedNotificationsShim() | |
515 ->AsWeakPtr(); | |
516 } | |
517 #endif | |
518 #if defined(ENABLE_SPELLCHECK) | 484 #if defined(ENABLE_SPELLCHECK) |
519 case syncer::DICTIONARY: | 485 case syncer::DICTIONARY: |
520 return SpellcheckServiceFactory::GetForContext(profile_)-> | 486 return SpellcheckServiceFactory::GetForContext(profile_)-> |
521 GetCustomDictionary()->AsWeakPtr(); | 487 GetCustomDictionary()->AsWeakPtr(); |
522 #endif | 488 #endif |
523 case syncer::FAVICON_IMAGES: | 489 case syncer::FAVICON_IMAGES: |
524 case syncer::FAVICON_TRACKING: { | 490 case syncer::FAVICON_TRACKING: { |
525 browser_sync::FaviconCache* favicons = | 491 browser_sync::FaviconCache* favicons = |
526 ProfileSyncServiceFactory::GetForProfile(profile_)-> | 492 ProfileSyncServiceFactory::GetForProfile(profile_)-> |
527 GetFaviconCache(); | 493 GetFaviconCache(); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 new TypedUrlModelAssociator(profile_sync_service, | 665 new TypedUrlModelAssociator(profile_sync_service, |
700 history_backend, | 666 history_backend, |
701 error_handler); | 667 error_handler); |
702 TypedUrlChangeProcessor* change_processor = | 668 TypedUrlChangeProcessor* change_processor = |
703 new TypedUrlChangeProcessor(profile_, | 669 new TypedUrlChangeProcessor(profile_, |
704 model_associator, | 670 model_associator, |
705 history_backend, | 671 history_backend, |
706 error_handler); | 672 error_handler); |
707 return SyncComponents(model_associator, change_processor); | 673 return SyncComponents(model_associator, change_processor); |
708 } | 674 } |
OLD | NEW |