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

Unified Diff: chrome/browser/ui/webui/settings/site_settings_handler.cc

Issue 1882793002: Site Settings: Use only string values for permissions on the JS side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 8 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: chrome/browser/ui/webui/settings/site_settings_handler.cc
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc
index 60c6da20f99a5c0a81cff4dce585e9e84b79f445..23508276dc880007bd0b8e252a67175498fadb51 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -154,14 +154,16 @@ void SiteSettingsHandler::HandleSetDefaultValueForContentType(
CHECK_EQ(2U, args->GetSize());
double content_type;
CHECK(args->GetDouble(0, &content_type));
- double default_setting;
- CHECK(args->GetDouble(1, &default_setting));
+ std::string setting;
+ CHECK(args->GetString(1, &setting));
+ ContentSetting default_setting;
+ CHECK(content_settings::ContentSettingFromString(setting, &default_setting));
HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile_);
map->SetDefaultContentSetting(
static_cast<ContentSettingsType>(static_cast<int>(content_type)),
- static_cast<ContentSetting>(static_cast<int>(default_setting)));
+ default_setting);
}
void SiteSettingsHandler::HandleGetDefaultValueForContentType(
@@ -237,12 +239,13 @@ void SiteSettingsHandler::HandleSetCategoryPermissionForOrigin(
CHECK(args->GetString(1, &secondary_pattern));
double type;
CHECK(args->GetDouble(2, &type));
- double value;
- CHECK(args->GetDouble(3, &value));
+ std::string value;
+ CHECK(args->GetString(3, &value));
ContentSettingsType content_type =
static_cast<ContentSettingsType>(static_cast<int>(type));
- ContentSetting setting = static_cast<ContentSetting>(static_cast<int>(value));
+ ContentSetting setting;
+ CHECK(content_settings::ContentSettingFromString(value, &setting));
HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile_);

Powered by Google App Engine
This is Rietveld 408576698