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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 8399022: Add a couple of notifications related settings to app/extensions sync: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/extensions/extension_service.cc
===================================================================
--- chrome/browser/extensions/extension_service.cc (revision 107300)
+++ chrome/browser/extensions/extension_service.cc (working copy)
@@ -906,9 +906,12 @@
SyncChange sync_change;
if (sync_bundle) {
- ExtensionSyncData extension_sync_data(*extension,
- IsExtensionEnabled(extension_id),
- IsIncognitoEnabled(extension_id));
+ ExtensionSyncData extension_sync_data(
+ *extension,
+ IsExtensionEnabled(extension_id),
+ IsIncognitoEnabled(extension_id),
+ extension_prefs_->IsAppNotificationSetupDone(extension_id),
+ extension_prefs_->IsAppNotificationDisabled(extension_id));
sync_change = extension_sync_data.GetSyncChange(SyncChange::ACTION_DELETE);
}
@@ -1747,9 +1750,12 @@
void ExtensionService::SyncExtensionChangeIfNeeded(const Extension& extension) {
SyncBundle* sync_bundle = GetSyncBundleForExtension(extension);
if (sync_bundle) {
- ExtensionSyncData extension_sync_data(extension,
- IsExtensionEnabled(extension.id()),
- IsIncognitoEnabled(extension.id()));
+ ExtensionSyncData extension_sync_data(
+ extension,
+ IsExtensionEnabled(extension.id()),
+ IsIncognitoEnabled(extension.id()),
+ extension_prefs_->IsAppNotificationSetupDone(extension.id()),
+ extension_prefs_->IsAppNotificationDisabled(extension.id()));
SyncChangeList sync_change_list(1, extension_sync_data.GetSyncChange(
sync_bundle->HasExtensionId(extension.id()) ?
@@ -1909,10 +1915,12 @@
// version is out of date. We'll sync back the version we got from
// sync.
!bundle.HasPendingExtensionId(extension.id())) {
- sync_data_list->push_back(
- ExtensionSyncData(extension,
- IsExtensionEnabled(extension.id()),
- IsIncognitoEnabled(extension.id())));
+ sync_data_list->push_back(ExtensionSyncData(
+ extension,
+ IsExtensionEnabled(extension.id()),
+ IsIncognitoEnabled(extension.id()),
+ extension_prefs_->IsAppNotificationSetupDone(extension.id()),
+ extension_prefs_->IsAppNotificationDisabled(extension.id())));
}
}
}
@@ -2036,6 +2044,35 @@
SyncExtensionChangeIfNeeded(*extension);
}
+void ExtensionService::SetAppNotificationSetupDone(
+ const std::string& extension_id,
+ bool value) {
+ const Extension* extension = GetInstalledExtension(extension_id);
+ // This method is called when the user sets up app notifications.
+ // So it is not expected to be called until the extension is installed.
+ if (!extension) {
+ NOTREACHED();
+ return;
+ }
+ extension_prefs_->SetAppNotificationSetupDone(extension_id, value);
+ SyncExtensionChangeIfNeeded(*extension);
+}
+
+void ExtensionService::SetAppNotificationDisabled(
+ const std::string& extension_id,
+ bool value) {
+ const Extension* extension = GetInstalledExtension(extension_id);
+ // This method is called when the user enables/disables app notifications.
+ // So it is not expected to be called until the extension is installed.
+ if (!extension) {
+ NOTREACHED();
+ return;
+ }
+
+ extension_prefs_->SetAppNotificationDisabled(extension_id, value);
+ SyncExtensionChangeIfNeeded(*extension);
+}
+
bool ExtensionService::CanCrossIncognito(const Extension* extension) {
// We allow the extension to see events and data from another profile iff it
// uses "spanning" behavior and it has incognito access. "split" mode

Powered by Google App Engine
This is Rietveld 408576698