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" | |
10 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
12 #include "chrome/browser/extensions/extension_system_factory.h" | 11 #include "chrome/browser/extensions/extension_system_factory.h" |
13 #include "chrome/browser/history/history_service.h" | 12 #include "chrome/browser/history/history_service.h" |
14 #include "chrome/browser/history/history_service_factory.h" | 13 #include "chrome/browser/history/history_service_factory.h" |
15 #if !defined(OS_ANDROID) | 14 #if !defined(OS_ANDROID) |
16 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 15 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
17 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" | 16 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service_fac
tory.h" |
18 #endif | 17 #endif |
19 #include "chrome/browser/prefs/pref_model_associator.h" | 18 #include "chrome/browser/prefs/pref_model_associator.h" |
20 #include "chrome/browser/prefs/pref_service_syncable.h" | 19 #include "chrome/browser/prefs/pref_service_syncable.h" |
21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/search_engines/template_url_service.h" | 21 #include "chrome/browser/search_engines/template_url_service.h" |
23 #include "chrome/browser/search_engines/template_url_service_factory.h" | 22 #include "chrome/browser/search_engines/template_url_service_factory.h" |
24 #include "chrome/browser/signin/signin_manager.h" | 23 #include "chrome/browser/signin/signin_manager.h" |
25 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
26 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 25 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
27 #include "chrome/browser/spellchecker/spellcheck_service.h" | 26 #include "chrome/browser/spellchecker/spellcheck_service.h" |
28 #include "chrome/browser/sync/glue/app_notification_data_type_controller.h" | |
29 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" | 27 #include "chrome/browser/sync/glue/autofill_data_type_controller.h" |
30 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" |
31 #include "chrome/browser/sync/glue/bookmark_change_processor.h" | 29 #include "chrome/browser/sync/glue/bookmark_change_processor.h" |
32 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" | 30 #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" |
33 #include "chrome/browser/sync/glue/bookmark_model_associator.h" | 31 #include "chrome/browser/sync/glue/bookmark_model_associator.h" |
34 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 32 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
35 #include "chrome/browser/sync/glue/data_type_manager_observer.h" | 33 #include "chrome/browser/sync/glue/data_type_manager_observer.h" |
36 #include "chrome/browser/sync/glue/extension_data_type_controller.h" | 34 #include "chrome/browser/sync/glue/extension_data_type_controller.h" |
37 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" | 35 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" |
38 #include "chrome/browser/sync/glue/generic_change_processor.h" | 36 #include "chrome/browser/sync/glue/generic_change_processor.h" |
(...skipping 19 matching lines...) Expand all Loading... |
58 #include "chrome/browser/themes/theme_syncable_service.h" | 56 #include "chrome/browser/themes/theme_syncable_service.h" |
59 #include "chrome/browser/webdata/autocomplete_syncable_service.h" | 57 #include "chrome/browser/webdata/autocomplete_syncable_service.h" |
60 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" | 58 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" |
61 #include "chrome/browser/webdata/web_data_service.h" | 59 #include "chrome/browser/webdata/web_data_service.h" |
62 #include "chrome/browser/webdata/web_data_service_factory.h" | 60 #include "chrome/browser/webdata/web_data_service_factory.h" |
63 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
64 #include "chrome/common/pref_names.h" | 62 #include "chrome/common/pref_names.h" |
65 #include "content/public/browser/browser_thread.h" | 63 #include "content/public/browser/browser_thread.h" |
66 #include "sync/api/syncable_service.h" | 64 #include "sync/api/syncable_service.h" |
67 | 65 |
68 using browser_sync::AppNotificationDataTypeController; | |
69 using browser_sync::AutofillDataTypeController; | 66 using browser_sync::AutofillDataTypeController; |
70 using browser_sync::AutofillProfileDataTypeController; | 67 using browser_sync::AutofillProfileDataTypeController; |
71 using browser_sync::BookmarkChangeProcessor; | 68 using browser_sync::BookmarkChangeProcessor; |
72 using browser_sync::BookmarkDataTypeController; | 69 using browser_sync::BookmarkDataTypeController; |
73 using browser_sync::BookmarkModelAssociator; | 70 using browser_sync::BookmarkModelAssociator; |
74 using browser_sync::DataTypeController; | 71 using browser_sync::DataTypeController; |
75 using browser_sync::DataTypeErrorHandler; | 72 using browser_sync::DataTypeErrorHandler; |
76 using browser_sync::DataTypeManager; | 73 using browser_sync::DataTypeManager; |
77 using browser_sync::DataTypeManagerImpl; | 74 using browser_sync::DataTypeManagerImpl; |
78 using browser_sync::DataTypeManagerObserver; | 75 using browser_sync::DataTypeManagerObserver; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 209 } |
213 | 210 |
214 // App setting sync is enabled by default. Register unless explicitly | 211 // App setting sync is enabled by default. Register unless explicitly |
215 // disabled. | 212 // disabled. |
216 if (!command_line_->HasSwitch(switches::kDisableSyncAppSettings)) { | 213 if (!command_line_->HasSwitch(switches::kDisableSyncAppSettings)) { |
217 pss->RegisterDataTypeController( | 214 pss->RegisterDataTypeController( |
218 new ExtensionSettingDataTypeController( | 215 new ExtensionSettingDataTypeController( |
219 syncer::APP_SETTINGS, this, profile_, pss)); | 216 syncer::APP_SETTINGS, this, profile_, pss)); |
220 } | 217 } |
221 | 218 |
222 // App notifications sync is enabled by default. Register unless explicitly | |
223 // disabled. | |
224 if (!command_line_->HasSwitch(switches::kDisableSyncAppNotifications)) { | |
225 pss->RegisterDataTypeController( | |
226 new AppNotificationDataTypeController(this, profile_, pss)); | |
227 } | |
228 | |
229 // Unless it is explicitly disabled, history delete directive sync is | 219 // Unless it is explicitly disabled, history delete directive sync is |
230 // enabled whenever full history sync is enabled. | 220 // enabled whenever full history sync is enabled. |
231 if (command_line_->HasSwitch(switches::kHistoryEnableFullHistorySync) && | 221 if (command_line_->HasSwitch(switches::kHistoryEnableFullHistorySync) && |
232 !command_line_->HasSwitch( | 222 !command_line_->HasSwitch( |
233 switches::kDisableSyncHistoryDeleteDirectives)) { | 223 switches::kDisableSyncHistoryDeleteDirectives)) { |
234 pss->RegisterDataTypeController( | 224 pss->RegisterDataTypeController( |
235 new UIDataTypeController( | 225 new UIDataTypeController( |
236 syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); | 226 syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); |
237 } | 227 } |
238 | 228 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 300 } |
311 case syncer::APPS: | 301 case syncer::APPS: |
312 case syncer::EXTENSIONS: | 302 case syncer::EXTENSIONS: |
313 return extension_system_->extension_service()->AsWeakPtr(); | 303 return extension_system_->extension_service()->AsWeakPtr(); |
314 case syncer::SEARCH_ENGINES: | 304 case syncer::SEARCH_ENGINES: |
315 return TemplateURLServiceFactory::GetForProfile(profile_)->AsWeakPtr(); | 305 return TemplateURLServiceFactory::GetForProfile(profile_)->AsWeakPtr(); |
316 case syncer::APP_SETTINGS: | 306 case syncer::APP_SETTINGS: |
317 case syncer::EXTENSION_SETTINGS: | 307 case syncer::EXTENSION_SETTINGS: |
318 return extension_system_->extension_service()->settings_frontend()-> | 308 return extension_system_->extension_service()->settings_frontend()-> |
319 GetBackendForSync(type)->AsWeakPtr(); | 309 GetBackendForSync(type)->AsWeakPtr(); |
320 case syncer::APP_NOTIFICATIONS: | |
321 return extension_system_->extension_service()-> | |
322 app_notification_manager()->AsWeakPtr(); | |
323 #if defined(ENABLE_THEMES) | 310 #if defined(ENABLE_THEMES) |
324 case syncer::THEMES: | 311 case syncer::THEMES: |
325 return ThemeServiceFactory::GetForProfile(profile_)-> | 312 return ThemeServiceFactory::GetForProfile(profile_)-> |
326 GetThemeSyncableService()->AsWeakPtr(); | 313 GetThemeSyncableService()->AsWeakPtr(); |
327 #endif | 314 #endif |
328 case syncer::HISTORY_DELETE_DIRECTIVES: { | 315 case syncer::HISTORY_DELETE_DIRECTIVES: { |
329 HistoryService* history = | 316 HistoryService* history = |
330 HistoryServiceFactory::GetForProfile( | 317 HistoryServiceFactory::GetForProfile( |
331 profile_, Profile::EXPLICIT_ACCESS); | 318 profile_, Profile::EXPLICIT_ACCESS); |
332 return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); | 319 return history ? history->AsWeakPtr() : base::WeakPtr<HistoryService>(); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 ProfileSyncComponentsFactory::SyncComponents | 405 ProfileSyncComponentsFactory::SyncComponents |
419 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( | 406 ProfileSyncComponentsFactoryImpl::CreateSessionSyncComponents( |
420 ProfileSyncService* profile_sync_service, | 407 ProfileSyncService* profile_sync_service, |
421 DataTypeErrorHandler* error_handler) { | 408 DataTypeErrorHandler* error_handler) { |
422 SessionModelAssociator* model_associator = | 409 SessionModelAssociator* model_associator = |
423 new SessionModelAssociator(profile_sync_service, error_handler); | 410 new SessionModelAssociator(profile_sync_service, error_handler); |
424 SessionChangeProcessor* change_processor = | 411 SessionChangeProcessor* change_processor = |
425 new SessionChangeProcessor(error_handler, model_associator); | 412 new SessionChangeProcessor(error_handler, model_associator); |
426 return SyncComponents(model_associator, change_processor); | 413 return SyncComponents(model_associator, change_processor); |
427 } | 414 } |
OLD | NEW |