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

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: Removed unused include 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
« no previous file with comments | « chrome/browser/sync/profile_sync_components_factory_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cae2d688116ac004b582dc387355954fb3f98ffc 100644
--- a/chrome/browser/sync/profile_sync_components_factory_impl.cc
+++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc
@@ -87,10 +87,14 @@ ProfileSyncComponentsFactoryImpl::ProfileSyncComponentsFactoryImpl(
Profile* profile, CommandLine* command_line)
: profile_(profile),
command_line_(command_line),
+#if defined(OS_ANDROID)
+ extension_system_(NULL) {
nilesh 2012/07/27 00:59:07 I think we include ExtensionSystemFactory and this
+#else
extension_system_(
extensions::ExtensionSystemFactory::GetForProfile(profile)),
web_data_service_(WebDataServiceFactory::GetForProfile(
profile_, Profile::IMPLICIT_ACCESS)) {
+#endif
}
ProfileSyncComponentsFactoryImpl::~ProfileSyncComponentsFactoryImpl() {
@@ -98,6 +102,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 +148,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 +178,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 +185,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 +262,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>();
+#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();
« no previous file with comments | « chrome/browser/sync/profile_sync_components_factory_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698