Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: components/content_settings/core/browser/host_content_settings_map.cc

Issue 1991623005: Only Register() platform specific content settings types on different platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split the changes and register images, plugins, mouselock in this CL Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698