Chromium Code Reviews| Index: chrome/browser/content_settings/content_settings_pref_provider.cc |
| diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc |
| index 7c09a6b82414b120b7ab1d5a762ac7c063aa5c4b..3c61ca876f0fe7c716f5396eaed830909242d6db 100644 |
| --- a/chrome/browser/content_settings/content_settings_pref_provider.cc |
| +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc |
| @@ -49,7 +49,7 @@ const ContentSetting kDefaultSettings[] = { |
| CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS |
| CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS |
| CONTENT_SETTING_ASK, // Not used for Geolocation |
| - CONTENT_SETTING_ASK, // Not used for Notifications |
| + CONTENT_SETTING_ASK, // CONTENT_SETTINGS_TYPE_NOTIFICATIONS |
| CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PRERENDER |
| }; |
| COMPILE_ASSERT(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, |
| @@ -71,6 +71,17 @@ const char* kTypeNames[] = { |
| COMPILE_ASSERT(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, |
| type_names_incorrect_size); |
| +void SetDefaultContentSettings(DictionaryValue* default_settings) { |
| + default_settings->Clear(); |
| + |
| + for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| + if (kTypeNames[i] != NULL) { |
| + default_settings->SetInteger(std::string(kTypeNames[i]), |
|
kkania
2011/04/12 16:42:42
remove std::string
markusheintz_
2011/04/12 17:21:49
Done.
|
| + kDefaultSettings[i]); |
| + } |
| + } |
| +} |
| + |
| } // namespace |
| namespace content_settings { |
| @@ -284,7 +295,20 @@ void PrefDefaultProvider::MigrateObsoleteNotificationPref(PrefService* prefs) { |
| // static |
| void PrefDefaultProvider::RegisterUserPrefs(PrefService* prefs) { |
| - prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings); |
| + // If no default values are set explicitely for the |
| + // prefs::kDefaultContentSettings preference an empty dictionary will be used |
| + // as default value instead. This has some issues. For example pyauto tests |
| + // can't get the default values for content settings as the default value of |
| + // the preference prefs::kDefaultContentSettings is an empty dictionary. To |
| + // prevent that functional tests need to know the default content settings |
| + // expliciatly we set them here. |
|
kkania
2011/04/12 16:42:42
this comment is a bit wordy yet confusing; part of
markusheintz_
2011/04/12 17:21:49
Done.
|
| + // TODO(markusheintz): Write pyauto hooks for the content settings map, as the |
| + // content settings map should be used as exclusive source for content |
| + // settings. |
| + DictionaryValue* default_content_settings = new DictionaryValue(); |
| + SetDefaultContentSettings(default_content_settings); |
| + prefs->RegisterDictionaryPref(prefs::kDefaultContentSettings, |
| + default_content_settings); |
| // Obsolete prefs, for migrations: |
| prefs->RegisterIntegerPref( |