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

Unified Diff: chrome/browser/ui/webui/quota_internals/quota_internals_types.cc

Issue 2086763002: Don't use deprecated ListValue::Append(Value*) overload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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/quota_internals/quota_internals_types.cc
diff --git a/chrome/browser/ui/webui/quota_internals/quota_internals_types.cc b/chrome/browser/ui/webui/quota_internals/quota_internals_types.cc
index 071362b9dd68bbc6846fec3007ec370d9a8f1887..d481c56c3222a0266b1fc87ff59d5f13b3347a65 100644
--- a/chrome/browser/ui/webui/quota_internals/quota_internals_types.cc
+++ b/chrome/browser/ui/webui/quota_internals/quota_internals_types.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/webui/quota_internals/quota_internals_types.h"
-#include <memory>
+#include <utility>
#include "base/logging.h"
#include "base/values.h"
@@ -38,10 +38,10 @@ GlobalStorageInfo::GlobalStorageInfo(storage::StorageType type)
GlobalStorageInfo::~GlobalStorageInfo() {}
-base::Value* GlobalStorageInfo::NewValue() const {
+std::unique_ptr<base::Value> GlobalStorageInfo::NewValue() const {
// TODO(tzik): Add CreateLongIntegerValue to base/values.h and remove
// all static_cast<double> in this file.
- base::DictionaryValue* dict = new base::DictionaryValue;
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetString("type", StorageTypeToString(type_));
if (usage_ >= 0)
dict->SetDouble("usage", static_cast<double>(usage_));
@@ -49,7 +49,7 @@ base::Value* GlobalStorageInfo::NewValue() const {
dict->SetDouble("unlimitedUsage", static_cast<double>(unlimited_usage_));
if (quota_ >= 0)
dict->SetDouble("quota", static_cast<double>(quota_));
- return dict;
+ return std::move(dict);
}
PerHostStorageInfo::PerHostStorageInfo(const std::string& host,
@@ -59,8 +59,8 @@ PerHostStorageInfo::PerHostStorageInfo(const std::string& host,
PerHostStorageInfo::~PerHostStorageInfo() {}
-base::Value* PerHostStorageInfo::NewValue() const {
- base::DictionaryValue* dict = new base::DictionaryValue;
+std::unique_ptr<base::Value> PerHostStorageInfo::NewValue() const {
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
DCHECK(!host_.empty());
dict->SetString("host", host_);
dict->SetString("type", StorageTypeToString(type_));
@@ -68,7 +68,7 @@ base::Value* PerHostStorageInfo::NewValue() const {
dict->SetDouble("usage", static_cast<double>(usage_));
if (quota_ >= 0)
dict->SetDouble("quota", static_cast<double>(quota_));
- return dict;
+ return std::move(dict);
}
PerOriginStorageInfo::PerOriginStorageInfo(const GURL& origin,
@@ -85,8 +85,8 @@ PerOriginStorageInfo::PerOriginStorageInfo(const PerOriginStorageInfo& other) =
PerOriginStorageInfo::~PerOriginStorageInfo() {}
-base::Value* PerOriginStorageInfo::NewValue() const {
- base::DictionaryValue* dict = new base::DictionaryValue;
+std::unique_ptr<base::Value> PerOriginStorageInfo::NewValue() const {
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
DCHECK(!origin_.is_empty());
DCHECK(!host_.empty());
dict->SetString("origin", origin_.spec());
@@ -102,7 +102,7 @@ base::Value* PerOriginStorageInfo::NewValue() const {
dict->SetDouble("lastModifiedTime",
last_modified_time_.ToDoubleT() * 1000.0);
}
- return dict;
+ return std::move(dict);
}
} // namespace quota_internals

Powered by Google App Engine
This is Rietveld 408576698