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

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),
+ IsNotificationsInitialSetupDone(extension_id),
+ IsNotificationsDisabled(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()),
+ IsNotificationsInitialSetupDone(extension.id()),
+ IsNotificationsDisabled(extension.id()));
SyncChangeList sync_change_list(1, extension_sync_data.GetSyncChange(
sync_bundle->HasExtensionId(extension.id()) ?
@@ -1912,7 +1918,9 @@
sync_data_list->push_back(
ExtensionSyncData(extension,
IsExtensionEnabled(extension.id()),
- IsIncognitoEnabled(extension.id())));
+ IsIncognitoEnabled(extension.id()),
+ IsNotificationsInitialSetupDone(extension.id()),
+ IsNotificationsDisabled(extension.id())));
}
}
}
@@ -2036,6 +2044,34 @@
SyncExtensionChangeIfNeeded(*extension);
}
+bool ExtensionService::IsNotificationsInitialSetupDone(
+ const std::string& extension_id) const {
+ return extension_prefs_->IsNotificationsInitialSetupDone(extension_id);
+}
+
+void ExtensionService::SetNotificationsInitialSetupDone(
+ const std::string& extension_id,
+ bool value) {
+ extension_prefs_->SetNotificationsInitialSetupDone(extension_id, value);
asargent_no_longer_on_chrome 2011/10/27 16:52:21 nit: probably not worth writing this into the pref
Munjal (Google) 2011/10/27 18:35:05 Done. I have one question though - is it possible
asargent_no_longer_on_chrome 2011/10/27 19:49:41 A race condition is unlikely to happen - the way t
Munjal (Google) 2011/10/27 20:01:50 Great, good to know.
+ const Extension* extension = GetInstalledExtension(extension_id);
+ if (extension)
+ SyncExtensionChangeIfNeeded(*extension);
+}
+
+bool ExtensionService::IsNotificationsDisabled(
+ const std::string& extension_id) const {
+ return extension_prefs_->IsNotificationsDisabled(extension_id);
+}
+
+void ExtensionService::SetNotificationsDisabled(
+ const std::string& extension_id,
+ bool value) {
+ extension_prefs_->SetNotificationsDisabled(extension_id, value);
+ const Extension* extension = GetInstalledExtension(extension_id);
+ if (extension)
asargent_no_longer_on_chrome 2011/10/27 16:52:21 same thing here about bailing out if the extension
Munjal (Google) 2011/10/27 18:35:05 Done.
+ 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