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

Unified Diff: chrome/browser/ui/webui/options/website_settings_handler.cc

Issue 829333004: Add DictionaryValue::Set and ::SetWithoutPathExpansion fns (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « base/values_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/website_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/website_settings_handler.cc b/chrome/browser/ui/webui/options/website_settings_handler.cc
index 033f21c3417a85efd431a00c603204eb0edcf944..da57296ef9fa469ed3378b378f198adff7dcdbfe 100644
--- a/chrome/browser/ui/webui/options/website_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/website_settings_handler.cc
@@ -382,7 +382,7 @@ void WebsiteSettingsHandler::UpdateOrigins() {
base::Time last_usage = settings->GetLastUsageByPattern(
it->primary_pattern, it->secondary_pattern, last_setting);
- base::DictionaryValue* origin_entry = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> origin_entry(new base::DictionaryValue());
origin_entry->SetDoubleWithoutPathExpansion("usage",
last_usage.ToDoubleT());
base::string16 usage_string;
@@ -396,9 +396,9 @@ void WebsiteSettingsHandler::UpdateOrigins() {
GetReadableName(origin_url));
if (it->setting == CONTENT_SETTING_BLOCK)
- blocked_origins.SetWithoutPathExpansion(origin, origin_entry);
+ blocked_origins.SetWithoutPathExpansion(origin, origin_entry.Pass());
else
- allowed_origins.SetWithoutPathExpansion(origin, origin_entry);
+ allowed_origins.SetWithoutPathExpansion(origin, origin_entry.Pass());
}
bool is_globally_allowed = settings->GetContentSettingOverride(last_setting);
@@ -631,7 +631,7 @@ void WebsiteSettingsHandler::GetInfoForOrigin(const GURL& site_url,
ContentSettingsType permission_type = kValidTypes[i];
// Append the possible settings.
- base::ListValue* options = new base::ListValue;
+ scoped_ptr<base::ListValue> options(new base::ListValue());
ContentSetting default_value =
map->GetDefaultContentSetting(permission_type, NULL);
if (default_value != CONTENT_SETTING_ALLOW &&
@@ -675,14 +675,15 @@ void WebsiteSettingsHandler::GetInfoForOrigin(const GURL& site_url,
permission = content_settings::ValueToContentSetting(v.get());
}
- base::DictionaryValue* permission_info = new base::DictionaryValue;
+ scoped_ptr<base::DictionaryValue>
+ permission_info(new base::DictionaryValue());
permission_info->SetStringWithoutPathExpansion(
"setting", content_settings::ContentSettingToString(permission));
- permission_info->SetWithoutPathExpansion("options", options);
+ permission_info->SetWithoutPathExpansion("options", options.Pass());
permission_info->SetBooleanWithoutPathExpansion(
"editable", info.source == content_settings::SETTING_SOURCE_USER);
permissions->SetWithoutPathExpansion(
- content_settings::GetTypeName(permission_type), permission_info);
+ content_settings::GetTypeName(permission_type), permission_info.Pass());
}
base::Value* storage_used = new base::StringValue(l10n_util::GetStringFUTF16(
@@ -708,14 +709,14 @@ void WebsiteSettingsHandler::UpdateLocalStorage() {
if (origin.find(last_filter_) == base::string16::npos)
continue;
- base::DictionaryValue* origin_entry = new base::DictionaryValue();
- origin_entry->SetWithoutPathExpansion(
- "usage", new base::FundamentalValue(static_cast<double>(it->size)));
- origin_entry->SetWithoutPathExpansion(
- "usageString", new base::StringValue(ui::FormatBytes(it->size)));
+ scoped_ptr<base::DictionaryValue> origin_entry(new base::DictionaryValue());
+ origin_entry->SetDoubleWithoutPathExpansion(
+ "usage", static_cast<double>(it->size));
+ origin_entry->SetStringWithoutPathExpansion(
+ "usageString", ui::FormatBytes(it->size));
origin_entry->SetStringWithoutPathExpansion(
"readableName", GetReadableName(it->origin_url));
- local_storage_map.SetWithoutPathExpansion(origin, origin_entry);
+ local_storage_map.SetWithoutPathExpansion(origin, origin_entry.Pass());
}
web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins",
local_storage_map);
@@ -734,7 +735,7 @@ void WebsiteSettingsHandler::UpdateBatteryUsage() {
if (origin.find(last_filter_) == base::string16::npos)
continue;
- base::DictionaryValue* origin_entry = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> origin_entry(new base::DictionaryValue());
origin_entry->SetInteger("usage", it->second);
if (it->second == 0) {
origin_entry->SetString(
@@ -748,7 +749,7 @@ void WebsiteSettingsHandler::UpdateBatteryUsage() {
}
origin_entry->SetStringWithoutPathExpansion("readableName",
GetReadableName(it->first));
- power_map.SetWithoutPathExpansion(origin, origin_entry);
+ power_map.SetWithoutPathExpansion(origin, origin_entry.Pass());
}
web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins",
power_map);
« no previous file with comments | « base/values_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698