| Index: components/content_settings/core/browser/host_content_settings_map.cc
|
| diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc
|
| index d028999d5cd94d80b2e790c30a6bc3a2d68f8012..fb595f9b2bf84f980e8411d0f13af2d7d82f5112 100644
|
| --- a/components/content_settings/core/browser/host_content_settings_map.cc
|
| +++ b/components/content_settings/core/browser/host_content_settings_map.cc
|
| @@ -459,32 +459,40 @@ void HostContentSettingsMap::SetContentSettingDefaultScope(
|
| }
|
|
|
| void HostContentSettingsMap::MigrateKeygenSettings() {
|
| - ContentSettingsForOneType settings;
|
| - GetSettingsForOneType(CONTENT_SETTINGS_TYPE_KEYGEN, std::string(), &settings);
|
| + const content_settings::ContentSettingsInfo* info =
|
| + content_settings::ContentSettingsRegistry::GetInstance()->Get(
|
| + CONTENT_SETTINGS_TYPE_KEYGEN);
|
| + if (info) {
|
| + ContentSettingsForOneType settings;
|
| + GetSettingsForOneType(CONTENT_SETTINGS_TYPE_KEYGEN, std::string(),
|
| + &settings);
|
|
|
| - for (const ContentSettingPatternSource& setting_entry : settings) {
|
| - // Migrate user preference settings only.
|
| - if (setting_entry.source != "preference")
|
| - continue;
|
| - // Migrate old-format settings only.
|
| - if (setting_entry.secondary_pattern != ContentSettingsPattern::Wildcard()) {
|
| - GURL url(setting_entry.primary_pattern.ToString());
|
| - // Pull out the value of the old-format setting. Only do this if the
|
| - // patterns are as we expect them to be, otherwise the setting will just
|
| - // be removed for safety.
|
| - ContentSetting content_setting = CONTENT_SETTING_DEFAULT;
|
| - if (setting_entry.primary_pattern == setting_entry.secondary_pattern &&
|
| - url.is_valid()) {
|
| - content_setting = GetContentSetting(
|
| - url, url, CONTENT_SETTINGS_TYPE_KEYGEN, std::string());
|
| + for (const ContentSettingPatternSource& setting_entry : settings) {
|
| + // Migrate user preference settings only.
|
| + if (setting_entry.source != "preference")
|
| + continue;
|
| + // Migrate old-format settings only.
|
| + if (setting_entry.secondary_pattern !=
|
| + ContentSettingsPattern::Wildcard()) {
|
| + GURL url(setting_entry.primary_pattern.ToString());
|
| + // Pull out the value of the old-format setting. Only do this if the
|
| + // patterns are as we expect them to be, otherwise the setting will just
|
| + // be removed for safety.
|
| + ContentSetting content_setting = CONTENT_SETTING_DEFAULT;
|
| + if (setting_entry.primary_pattern == setting_entry.secondary_pattern &&
|
| + url.is_valid()) {
|
| + content_setting = GetContentSetting(
|
| + url, url, CONTENT_SETTINGS_TYPE_KEYGEN, std::string());
|
| + }
|
| + // Remove the old pattern.
|
| + SetContentSettingCustomScope(setting_entry.primary_pattern,
|
| + setting_entry.secondary_pattern,
|
| + CONTENT_SETTINGS_TYPE_KEYGEN,
|
| + std::string(), CONTENT_SETTING_DEFAULT);
|
| + // Set the new pattern.
|
| + SetContentSettingDefaultScope(url, GURL(), CONTENT_SETTINGS_TYPE_KEYGEN,
|
| + std::string(), content_setting);
|
| }
|
| - // Remove the old pattern.
|
| - SetContentSettingCustomScope(
|
| - setting_entry.primary_pattern, setting_entry.secondary_pattern,
|
| - CONTENT_SETTINGS_TYPE_KEYGEN, std::string(), CONTENT_SETTING_DEFAULT);
|
| - // Set the new pattern.
|
| - SetContentSettingDefaultScope(url, GURL(), CONTENT_SETTINGS_TYPE_KEYGEN,
|
| - std::string(), content_setting);
|
| }
|
| }
|
| }
|
|
|