summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/profile_sync_factory_impl.cc
diff options
context:
space:
mode:
authormunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 21:59:26 +0000
committermunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 21:59:26 +0000
commitaae9eeb10159ca2e345408f74d8425a41bb81ab4 (patch)
treea1843a6f019e1f08f214ac4e11e8346a6614ec8a /chrome/browser/sync/profile_sync_factory_impl.cc
parent4e57c88872d08f8e98ee1bae3258ba38e4694d87 (diff)
downloadchromium_src-aae9eeb10159ca2e345408f74d8425a41bb81ab4.zip
chromium_src-aae9eeb10159ca2e345408f74d8425a41bb81ab4.tar.gz
chromium_src-aae9eeb10159ca2e345408f74d8425a41bb81ab4.tar.bz2
Implement sync data type controller and UI for syncing notifications:
- Add class AppNotificationDataTypeController - Add resources and other things needed for sync UI for app notifications - Add command line flag to enable/disable app notifications sync. Review URL: http://codereview.chromium.org/8320017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/profile_sync_factory_impl.cc')
-rw-r--r--chrome/browser/sync/profile_sync_factory_impl.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/chrome/browser/sync/profile_sync_factory_impl.cc b/chrome/browser/sync/profile_sync_factory_impl.cc
index ede961c..c219624 100644
--- a/chrome/browser/sync/profile_sync_factory_impl.cc
+++ b/chrome/browser/sync/profile_sync_factory_impl.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "chrome/browser/extensions/app_notification_manager.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_settings_backend.h"
#include "chrome/browser/prefs/pref_model_associator.h"
@@ -11,6 +12,7 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/sync/api/syncable_service.h"
#include "chrome/browser/sync/glue/app_data_type_controller.h"
+#include "chrome/browser/sync/glue/app_notification_data_type_controller.h"
#include "chrome/browser/sync/glue/autofill_change_processor.h"
#include "chrome/browser/sync/glue/autofill_data_type_controller.h"
#include "chrome/browser/sync/glue/autofill_model_associator.h"
@@ -49,6 +51,7 @@
#include "content/browser/browser_thread.h"
using browser_sync::AppDataTypeController;
+using browser_sync::AppNotificationDataTypeController;
using browser_sync::AutofillChangeProcessor;
using browser_sync::AutofillDataTypeController;
using browser_sync::AutofillProfileDataTypeController;
@@ -177,6 +180,13 @@ void ProfileSyncFactoryImpl::RegisterDataTypes(ProfileSyncService* pss) {
pss->RegisterDataTypeController(
new SearchEngineDataTypeController(this, profile_, pss));
}
+
+ // App notifications sync is disabled by default. Register only if
+ // explicitly enabled.
+ if (command_line_->HasSwitch(switches::kEnableSyncAppNotifications)) {
+ pss->RegisterDataTypeController(
+ new AppNotificationDataTypeController(this, profile_, pss));
+ }
}
DataTypeManager* ProfileSyncFactoryImpl::CreateDataTypeManager(
@@ -383,3 +393,22 @@ ProfileSyncFactoryImpl::CreateSearchEngineSyncComponents(
change_processor);
return SyncComponents(sync_service_adapter, change_processor);
}
+
+ProfileSyncFactory::SyncComponents
+ProfileSyncFactoryImpl::CreateAppNotificationSyncComponents(
+ ProfileSyncService* profile_sync_service,
+ browser_sync::UnrecoverableErrorHandler* error_handler) {
+ base::WeakPtr<SyncableService> notif_sync_service =
+ profile_->GetExtensionService()->app_notification_manager()->AsWeakPtr();
+ DCHECK(notif_sync_service);
+ sync_api::UserShare* user_share = profile_sync_service->GetUserShare();
+ GenericChangeProcessor* change_processor =
+ new GenericChangeProcessor(error_handler,
+ notif_sync_service,
+ user_share);
+ SyncableServiceAdapter* sync_service_adapter =
+ new SyncableServiceAdapter(syncable::APP_NOTIFICATIONS,
+ notif_sync_service,
+ change_processor);
+ return SyncComponents(sync_service_adapter, change_processor);
+}