summaryrefslogtreecommitdiffstats
path: root/chrome/browser/host_content_settings_map.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 20:42:33 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 20:42:33 +0000
commit4d5e7a6b1a52c7af83aa3d88bf92cf59f5007ff5 (patch)
tree5b17d645f1fe16347b96a0fef182c2f3f84880b9 /chrome/browser/host_content_settings_map.cc
parent173faf0ddde61b477b1a033e99a3d7c737e88082 (diff)
downloadchromium_src-4d5e7a6b1a52c7af83aa3d88bf92cf59f5007ff5.zip
chromium_src-4d5e7a6b1a52c7af83aa3d88bf92cf59f5007ff5.tar.gz
chromium_src-4d5e7a6b1a52c7af83aa3d88bf92cf59f5007ff5.tar.bz2
Adds a geolocation tab in the content settings dialog (on Windows). Also refactors the various views for this dialog in hopes of simplifying a few things.
BUG=none TEST=Open content settings dialog, observe Location tab. (Note: Exceptions button is not wired up.) Review URL: http://codereview.chromium.org/1526004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/host_content_settings_map.cc')
-rw-r--r--chrome/browser/host_content_settings_map.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc
index 2508f6cc..a45dc8e 100644
--- a/chrome/browser/host_content_settings_map.cc
+++ b/chrome/browser/host_content_settings_map.cc
@@ -23,6 +23,7 @@ const wchar_t*
L"javascript",
L"plugins",
L"popups",
+ NULL, // Not used for Geolocation
};
// static
@@ -33,6 +34,7 @@ const ContentSetting
CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_JAVASCRIPT
CONTENT_SETTING_ALLOW, // CONTENT_SETTINGS_TYPE_PLUGINS
CONTENT_SETTING_BLOCK, // CONTENT_SETTINGS_TYPE_POPUPS
+ CONTENT_SETTING_ASK, // Not used for Geolocation
};
HostContentSettingsMap::HostContentSettingsMap(Profile* profile)
@@ -187,6 +189,7 @@ void HostContentSettingsMap::GetSettingsForOneType(
void HostContentSettingsMap::SetDefaultContentSetting(
ContentSettingsType content_type,
ContentSetting setting) {
+ DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DictionaryValue* default_settings_dictionary =
@@ -214,6 +217,7 @@ void HostContentSettingsMap::SetDefaultContentSetting(
void HostContentSettingsMap::SetContentSetting(const std::string& host,
ContentSettingsType content_type,
ContentSetting setting) {
+ DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
bool early_exit = false;
@@ -250,7 +254,8 @@ void HostContentSettingsMap::SetContentSetting(const std::string& host,
}
std::wstring dictionary_path(kTypeNames[content_type]);
if (setting == CONTENT_SETTING_DEFAULT) {
- host_settings_dictionary->RemoveWithoutPathExpansion(dictionary_path, NULL);
+ host_settings_dictionary->RemoveWithoutPathExpansion(dictionary_path,
+ NULL);
} else {
host_settings_dictionary->SetWithoutPathExpansion(
dictionary_path, Value::CreateIntegerValue(setting));
@@ -262,6 +267,7 @@ void HostContentSettingsMap::SetContentSetting(const std::string& host,
void HostContentSettingsMap::ClearSettingsForOneType(
ContentSettingsType content_type) {
+ DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation.
{
AutoLock auto_lock(lock_);
for (HostContentSettings::iterator i(host_content_settings_.begin());
@@ -351,7 +357,8 @@ void HostContentSettingsMap::GetSettingsFromDictionary(
&setting);
DCHECK(found);
for (size_t type = 0; type < arraysize(kTypeNames); ++type) {
- if (std::wstring(kTypeNames[type]) == content_type) {
+ if ((kTypeNames[type] != NULL) &&
+ (std::wstring(kTypeNames[type]) == content_type)) {
settings->settings[type] = IntToContentSetting(setting);
break;
}