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 |