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

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

Issue 2021343003: MD Site Settings: Add five new top level categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 5e9054a8c51cbce5b874555d336da1cf10b6d373..37c27f415dc0ebc1b7bc9f73816cbb87ae1d24f5 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -136,11 +136,13 @@ void SiteSettingsHandler::HandleClearUsage(
CHECK_EQ(2U, args->GetSize());
std::string origin;
CHECK(args->GetString(0, &origin));
- double type;
- CHECK(args->GetDouble(1, &type));
+ std::string type;
+ CHECK(args->GetString(1, &type));
GURL url(origin);
+ LOG(ERROR) << url.spec().c_str() << " " << type;
if (url.is_valid()) {
+ LOG(ERROR) << "Clearing!";
clearing_origin_ = origin;
// Start by clearing the storage data asynchronously.
@@ -148,7 +150,8 @@ void SiteSettingsHandler::HandleClearUsage(
= new StorageInfoFetcher(profile_);
storage_info_fetcher->ClearStorage(
url.host(),
- static_cast<storage::StorageType>(static_cast<int>(type)),
+ static_cast<storage::StorageType>(static_cast<int>(
+ site_settings::ContentSettingsTypeFromGroupName(type))),
base::Bind(&SiteSettingsHandler::OnUsageInfoCleared,
base::Unretained(this)));
@@ -162,8 +165,8 @@ void SiteSettingsHandler::HandleClearUsage(
void SiteSettingsHandler::HandleSetDefaultValueForContentType(
const base::ListValue* args) {
CHECK_EQ(2U, args->GetSize());
- double content_type;
- CHECK(args->GetDouble(0, &content_type));
+ std::string content_type;
+ CHECK(args->GetString(0, &content_type));
std::string setting;
CHECK(args->GetString(1, &setting));
ContentSetting default_setting;
@@ -172,7 +175,8 @@ void SiteSettingsHandler::HandleSetDefaultValueForContentType(
HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile_);
map->SetDefaultContentSetting(
- static_cast<ContentSettingsType>(static_cast<int>(content_type)),
+ static_cast<ContentSettingsType>(static_cast<int>(
+ site_settings::ContentSettingsTypeFromGroupName(content_type))),
default_setting);
}
@@ -183,11 +187,12 @@ void SiteSettingsHandler::HandleGetDefaultValueForContentType(
CHECK_EQ(2U, args->GetSize());
const base::Value* callback_id;
CHECK(args->Get(0, &callback_id));
- double type;
- CHECK(args->GetDouble(1, &type));
+ std::string type;
+ CHECK(args->GetString(1, &type));
ContentSettingsType content_type =
- static_cast<ContentSettingsType>(static_cast<int>(type));
+ static_cast<ContentSettingsType>(static_cast<int>(
+ site_settings::ContentSettingsTypeFromGroupName(type)));
HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile_);
ContentSetting setting = map->GetDefaultContentSetting(content_type, nullptr);
@@ -208,10 +213,11 @@ void SiteSettingsHandler::HandleGetExceptionList(const base::ListValue* args) {
CHECK_EQ(2U, args->GetSize());
const base::Value* callback_id;
CHECK(args->Get(0, &callback_id));
- double type;
- CHECK(args->GetDouble(1, &type));
+ std::string type;
+ CHECK(args->GetString(1, &type));
ContentSettingsType content_type =
- static_cast<ContentSettingsType>(static_cast<int>(type));
+ static_cast<ContentSettingsType>(static_cast<int>(
+ site_settings::ContentSettingsTypeFromGroupName(type)));
HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile_);
@@ -228,11 +234,12 @@ void SiteSettingsHandler::HandleResetCategoryPermissionForOrigin(
CHECK(args->GetString(0, &primary_pattern));
std::string secondary_pattern;
CHECK(args->GetString(1, &secondary_pattern));
- double type;
- CHECK(args->GetDouble(2, &type));
+ std::string type;
+ CHECK(args->GetString(2, &type));
ContentSettingsType content_type =
- static_cast<ContentSettingsType>(static_cast<int>(type));
+ static_cast<ContentSettingsType>(static_cast<int>(
+ site_settings::ContentSettingsTypeFromGroupName(type)));
HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile_);
@@ -251,13 +258,14 @@ void SiteSettingsHandler::HandleSetCategoryPermissionForOrigin(
CHECK(args->GetString(0, &primary_pattern));
std::string secondary_pattern;
CHECK(args->GetString(1, &secondary_pattern));
- double type;
- CHECK(args->GetDouble(2, &type));
+ std::string type;
+ CHECK(args->GetString(2, &type));
std::string value;
CHECK(args->GetString(3, &value));
ContentSettingsType content_type =
- static_cast<ContentSettingsType>(static_cast<int>(type));
+ static_cast<ContentSettingsType>(static_cast<int>(
+ site_settings::ContentSettingsTypeFromGroupName(type)));
ContentSetting setting;
CHECK(content_settings::ContentSettingFromString(value, &setting));

Powered by Google App Engine
This is Rietveld 408576698