Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Unified Diff: chrome/browser/sync/profile_sync_components_factory_impl.cc

Issue 10829019: [sync] Refactor how default sync datatypes are set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Registering extension prefs and using standard constructor Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/profile_sync_components_factory_impl.cc
diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc
index 15047b045c6c69b89e4118a14c8418902dd65166..14aa13c4937f6731195ab6ee829c6f07f601806e 100644
--- a/chrome/browser/sync/profile_sync_components_factory_impl.cc
+++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc
@@ -98,6 +98,38 @@ ProfileSyncComponentsFactoryImpl::~ProfileSyncComponentsFactoryImpl() {
void ProfileSyncComponentsFactoryImpl::RegisterDataTypes(
ProfileSyncService* pss) {
+ RegisterCommonDataTypes(pss);
+#if !defined(OS_ANDROID)
+ RegisterDesktopDataTypes(pss);
+#endif
+}
+
+void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes(
+ ProfileSyncService* pss) {
+ // Bookmark sync is enabled by default. Register unless explicitly
+ // disabled.
+ if (!command_line_->HasSwitch(switches::kDisableSyncBookmarks)) {
+ pss->RegisterDataTypeController(
+ new BookmarkDataTypeController(this, profile_, pss));
+ }
+
+ // TypedUrl sync is enabled by default. Register unless explicitly disabled,
+ // or if saving history is disabled.
+ if (!profile_->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) &&
+ !command_line_->HasSwitch(switches::kDisableSyncTypedUrls)) {
+ pss->RegisterDataTypeController(
+ new TypedUrlDataTypeController(this, profile_, pss));
+ }
+
+ // Session sync is enabled by default. Register unless explicitly disabled.
+ if (!command_line_->HasSwitch(switches::kDisableSyncTabs)) {
+ pss->RegisterDataTypeController(
+ new SessionDataTypeController(this, profile_, pss));
+ }
+}
+
+void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes(
+ ProfileSyncService* pss) {
// App sync is enabled by default. Register unless explicitly
// disabled.
if (!command_line_->HasSwitch(switches::kDisableSyncApps)) {
@@ -112,13 +144,6 @@ void ProfileSyncComponentsFactoryImpl::RegisterDataTypes(
new AutofillDataTypeController(this, profile_, pss));
}
- // Bookmark sync is enabled by default. Register unless explicitly
- // disabled.
- if (!command_line_->HasSwitch(switches::kDisableSyncBookmarks)) {
- pss->RegisterDataTypeController(
- new BookmarkDataTypeController(this, profile_, pss));
- }
-
// Extension sync is enabled by default. Register unless explicitly
// disabled.
if (!command_line_->HasSwitch(switches::kDisableSyncExtensions)) {
@@ -149,14 +174,6 @@ void ProfileSyncComponentsFactoryImpl::RegisterDataTypes(
}
#endif
- // TypedUrl sync is enabled by default. Register unless explicitly disabled,
- // or if saving history is disabled.
- if (!profile_->GetPrefs()->GetBoolean(prefs::kSavingBrowserHistoryDisabled) &&
- !command_line_->HasSwitch(switches::kDisableSyncTypedUrls)) {
- pss->RegisterDataTypeController(
- new TypedUrlDataTypeController(this, profile_, pss));
- }
-
// Search Engine sync is enabled by default. Register only if explicitly
// disabled.
if (!command_line_->HasSwitch(switches::kDisableSyncSearchEngines)) {
@@ -164,12 +181,6 @@ void ProfileSyncComponentsFactoryImpl::RegisterDataTypes(
new SearchEngineDataTypeController(this, profile_, pss));
}
- // Session sync is enabled by default. Register unless explicitly disabled.
- if (!command_line_->HasSwitch(switches::kDisableSyncTabs)) {
- pss->RegisterDataTypeController(
- new SessionDataTypeController(this, profile_, pss));
- }
-
// Extension setting sync is enabled by default. Register unless explicitly
// disabled.
if (!command_line_->HasSwitch(switches::kDisableSyncExtensionSettings)) {
@@ -247,8 +258,14 @@ base::WeakPtr<syncer::SyncableService> ProfileSyncComponentsFactoryImpl::
return TemplateURLServiceFactory::GetForProfile(profile_)->AsWeakPtr();
case syncer::APP_SETTINGS:
case syncer::EXTENSION_SETTINGS:
+#if defined(OS_ANDROID)
+ // Android does not sync application or extension settings.
+ NOTREACHED();
+ return base::WeakPtr<syncer::SyncableService>();
nilesh 2012/08/01 16:43:20 Now that we are initializing extension system, I t
nyquist 2012/08/02 18:28:17 Verified that it still builds and you can sign in
+#else
return extension_system_->extension_service()->settings_frontend()->
GetBackendForSync(type)->AsWeakPtr();
+#endif
case syncer::APP_NOTIFICATIONS:
return extension_system_->extension_service()->
app_notification_manager()->AsWeakPtr();

Powered by Google App Engine
This is Rietveld 408576698