Chromium Code Reviews| Index: chrome/browser/content_settings/host_content_settings_map.cc |
| diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc |
| index 49f7700e7f74bcde4d8608c7f0029d24782cfe00..d796d3402ed7a1b047ee4f1c87c0ed483f7d02cb 100644 |
| --- a/chrome/browser/content_settings/host_content_settings_map.cc |
| +++ b/chrome/browser/content_settings/host_content_settings_map.cc |
| @@ -70,7 +70,8 @@ bool ContentTypeHasCompoundValue(ContentSettingsType type) { |
| // Values for content type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE are |
| // of type dictionary/map. Compound types like dictionaries can't be mapped to |
| // the type |ContentSetting|. |
| - return type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE; |
| + return (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE || |
| + type == CONTENT_SETTINGS_TYPE_MEDIASTREAM); |
| } |
| // Returns true if the |content_type| supports a resource identifier. |
| @@ -185,8 +186,6 @@ ContentSetting HostContentSettingsMap::GetDefaultContentSettingFromProvider( |
| ContentSetting HostContentSettingsMap::GetDefaultContentSetting( |
| ContentSettingsType content_type, |
| std::string* provider_id) const { |
| - DCHECK(!ContentTypeHasCompoundValue(content_type)); |
|
Bernhard Bauer
2012/06/18 17:38:14
Are you sure about this? This method is supposed t
no longer working on chromium
2012/06/19 12:23:16
I assume the default values are only "ask/allow/bl
Bernhard Bauer
2012/06/19 14:33:34
Hm, ok. I guess it's fair to say that a content ty
|
| - |
| // Iterate through the list of providers and return the first non-NULL value |
| // that matches |primary_url| and |secondary_url|. |
| for (ConstProviderIterator provider = content_settings_providers_.begin(); |
| @@ -255,7 +254,6 @@ void HostContentSettingsMap::GetSettingsForOneType( |
| void HostContentSettingsMap::SetDefaultContentSetting( |
| ContentSettingsType content_type, |
| ContentSetting setting) { |
| - DCHECK(!ContentTypeHasCompoundValue(content_type)); |
|
Bernhard Bauer
2012/06/18 17:38:14
In this case it's easier; we can replace calls to
no longer working on chromium
2012/06/19 12:23:16
See reply above.
|
| DCHECK(IsSettingAllowedForType(prefs_, setting, content_type)); |
| base::Value* value = NULL; |
| @@ -346,7 +344,7 @@ void HostContentSettingsMap::ClearSettingsForOneType( |
| bool HostContentSettingsMap::IsValueAllowedForType( |
| PrefService* prefs, const base::Value* value, ContentSettingsType type) { |
| - return IsSettingAllowedForType( |
| + return ContentTypeHasCompoundValue(type) || IsSettingAllowedForType( |
| prefs, content_settings::ValueToContentSetting(value), type); |
| } |
| @@ -381,6 +379,7 @@ bool HostContentSettingsMap::IsSettingAllowedForType( |
| case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| case CONTENT_SETTINGS_TYPE_INTENTS: |
| case CONTENT_SETTINGS_TYPE_MOUSELOCK: |
| + case CONTENT_SETTINGS_TYPE_MEDIASTREAM: |
| return setting == CONTENT_SETTING_ASK; |
| default: |
| return false; |
| @@ -482,9 +481,17 @@ void HostContentSettingsMap::AddSettingsForOneType( |
| incognito)); |
| while (rule_iterator->HasNext()) { |
| const content_settings::Rule& rule = rule_iterator->Next(); |
| + ContentSetting setting_value = CONTENT_SETTING_DEFAULT; |
|
Bernhard Bauer
2012/06/18 17:38:14
Can you add a TODO(bauerb) that we should return r
no longer working on chromium
2012/06/19 12:23:16
Done.
|
| + // For the cases using compound value, we assume it is valid as long as |
| + // the value is not NULL. |
| + if (ContentTypeHasCompoundValue(content_type) && rule.value.get()) { |
| + setting_value = CONTENT_SETTING_ALLOW; |
| + } else { |
| + setting_value = content_settings::ValueToContentSetting(rule.value.get()); |
| + } |
| settings->push_back(ContentSettingPatternSource( |
| rule.primary_pattern, rule.secondary_pattern, |
| - content_settings::ValueToContentSetting(rule.value.get()), |
| + setting_value, |
| kProviderNames[provider_type], |
| incognito)); |
| } |