Issue metadata
Sign in to add a comment
|
content_settings::Observers should get the actual changed value when a setting changes |
||||||||||||||||||||||
Issue description
Proposed nrew API:
virtual void OnContentSettingChanged(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type,
std::string resource_identifier,
ContentSetting changed_setting) = 0;
The use case this fixes is observers who want to observe changes where the pattern is a wildcard, and is not matched by e.g. the web contents' current URL.
Note: I am not sure at this point if the observer also tracks website settings. If so, the changed_setting would likely need to be a base::Value or std::unique_ptr<base::Value>.
,
Apr 10 2017
Seems legit. Assigning back to reporter to get out of triage queue.
,
Apr 10 2017
Changing to available. I asked csharrison@ to document this problem, but he should feel no obligation to fix it :)
,
Nov 10 2017
,
Nov 13 2017
I'll take this one. I'll replace the existing content_settings::Observer::OnContentSettingChanged method in-place.
,
Dec 27 2017
Due to a recent reorg, I'm unlikely to be able to take this now.
,
Feb 18 2018
,
May 31 2018
Circling back to this one.
My new proposed API is this:
virtual void OnContentSettingChanged(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type,
std::string resource_identifier,
const base::Value& old_value,
const base::Value& new_value) = 0;
It seems that this API is called quite often if a setting is "changed" to the same exact value, so my use-case would first compare old_value to new_value and make sure the change was semantically meaningful.
,
Jun 4 2018
Some OnContentSettingChanged calls don't correspond to individual changes. old_value and new_value wouldn't be defined in these cases. How could we represent this? base::Optional<base::Value>? If we are only interested in changed values of actual ContentSettings, we could also pass base::Optional<ContentSetting>? E.g. https://cs.chromium.org/chromium/src/chrome/browser/extensions/api/content_settings/content_settings_custom_extension_provider.cc?l=49&rcl=974d9b8cd88fdb46a4f9a783311696253f183edc or https://cs.chromium.org/chromium/src/components/content_settings/core/browser/content_settings_policy_provider.cc?l=461&rcl=f355f667c9ec1f618568af2e60d755f74cefe903
,
Jun 4 2018
dullweber: Yeah I'm not 100% confident about the internal implementation of the API, but for changes which span multiple content settings types, I could imagine a separate observer method. It looks like in the two links you posted, we are changing the default setting type, but I'm not sure exactly what that means :)
,
Jun 4 2018
I think these calls just mean "something might have changed" e.g. because an extension was uninstalled that controlled content settings or a policy was changed. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by msramek@chromium.org
, Mar 28 2017