| Index: components/content_settings/core/browser/content_settings_pref.cc
|
| diff --git a/components/content_settings/core/browser/content_settings_pref.cc b/components/content_settings/core/browser/content_settings_pref.cc
|
| index e1e2b332e5ac1b509780d02a937c906cf4c583a8..44a9f80b15092c45a7858f04e96f2fdb67ba3967 100644
|
| --- a/components/content_settings/core/browser/content_settings_pref.cc
|
| +++ b/components/content_settings/core/browser/content_settings_pref.cc
|
| @@ -107,6 +107,8 @@ bool ContentSettingsPref::SetWebsiteSetting(
|
| // At this point take the ownership of the |in_value|.
|
| scoped_ptr<base::Value> value(in_value);
|
|
|
| + ContentSetting previous_value = CONTENT_SETTING_DEFAULT;
|
| +
|
| // Update in memory value map.
|
| OriginIdentifierValueMap* map_to_modify = &incognito_value_map_;
|
| if (!is_incognito_)
|
| @@ -131,14 +133,14 @@ bool ContentSettingsPref::SetWebsiteSetting(
|
| }
|
| // Update the content settings preference.
|
| if (!is_incognito_) {
|
| - UpdatePref(primary_pattern,
|
| - secondary_pattern,
|
| - resource_identifier,
|
| - value.get());
|
| + previous_value = UpdatePref(primary_pattern,
|
| + secondary_pattern,
|
| + resource_identifier,
|
| + value.get());
|
| }
|
|
|
| - notify_callback_.Run(
|
| - primary_pattern, secondary_pattern, content_type_, resource_identifier);
|
| + notify_callback_.Run(primary_pattern, secondary_pattern, content_type_,
|
| + previous_value, resource_identifier);
|
|
|
| return true;
|
| }
|
| @@ -174,6 +176,7 @@ void ContentSettingsPref::ClearAllContentSettingsRules() {
|
| notify_callback_.Run(ContentSettingsPattern(),
|
| ContentSettingsPattern(),
|
| content_type_,
|
| + CONTENT_SETTING_DEFAULT,
|
| ResourceIdentifier());
|
| }
|
|
|
| @@ -376,10 +379,11 @@ void ContentSettingsPref::OnPrefChanged() {
|
| notify_callback_.Run(ContentSettingsPattern(),
|
| ContentSettingsPattern(),
|
| content_type_,
|
| + CONTENT_SETTING_DEFAULT,
|
| ResourceIdentifier());
|
| }
|
|
|
| -void ContentSettingsPref::UpdatePref(
|
| +ContentSetting ContentSettingsPref::UpdatePref(
|
| const ContentSettingsPattern& primary_pattern,
|
| const ContentSettingsPattern& secondary_pattern,
|
| const ResourceIdentifier& resource_identifier,
|
| @@ -388,6 +392,8 @@ void ContentSettingsPref::UpdatePref(
|
| // send out notifications (by |~DictionaryPrefUpdate|).
|
| AssertLockNotHeld();
|
|
|
| + ContentSetting old_content_setting = CONTENT_SETTING_DEFAULT;
|
| +
|
| base::AutoReset<bool> auto_reset(&updating_preferences_, true);
|
| {
|
| DictionaryPrefUpdate update(prefs_, pref_name_);
|
| @@ -407,6 +413,11 @@ void ContentSettingsPref::UpdatePref(
|
| }
|
|
|
| if (settings_dictionary) {
|
| + int old_setting = CONTENT_SETTING_DEFAULT;
|
| + settings_dictionary->GetIntegerWithoutPathExpansion(kSettingPath,
|
| + &old_setting);
|
| + old_content_setting = static_cast<ContentSetting>(old_setting);
|
| +
|
| if (SupportsResourceIdentifiers(content_type_) &&
|
| !resource_identifier.empty()) {
|
| base::DictionaryValue* resource_dictionary = NULL;
|
| @@ -414,7 +425,7 @@ void ContentSettingsPref::UpdatePref(
|
| kPerResourceIdentifierPrefName, &resource_dictionary);
|
| if (!found) {
|
| if (value == NULL)
|
| - return; // Nothing to remove. Exit early.
|
| + return old_content_setting; // Nothing to remove. Exit early.
|
| resource_dictionary = new base::DictionaryValue;
|
| settings_dictionary->Set(
|
| kPerResourceIdentifierPrefName, resource_dictionary);
|
| @@ -448,6 +459,8 @@ void ContentSettingsPref::UpdatePref(
|
| }
|
| }
|
| }
|
| +
|
| + return old_content_setting;
|
| }
|
|
|
| // static
|
|
|