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

Unified Diff: chromeos/network/onc/onc_translator_shill_to_onc.cc

Issue 1328233002: Ramove use of JSONReader::DeprecatedRead from chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ignore_result's Created 5 years, 3 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 | « chromeos/network/network_connection_handler_unittest.cc ('k') | chromeos/network/onc/onc_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_translator_shill_to_onc.cc
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index ad20482ace48a8a0b1383e5f8d016ff83e5c6415..f91950f534e12ab10524246e4ade547b386b820f 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -31,18 +31,16 @@ namespace {
// returns NULL.
scoped_ptr<base::Value> ConvertStringToValue(const std::string& str,
base::Value::Type type) {
- base::Value* value;
+ scoped_ptr<base::Value> value;
if (type == base::Value::TYPE_STRING) {
- value = new base::StringValue(str);
+ value.reset(new base::StringValue(str));
} else {
- value = base::JSONReader::DeprecatedRead(str);
+ value = base::JSONReader::Read(str);
}
+ if (value && value->GetType() != type)
+ return nullptr;
- if (value == NULL || value->GetType() != type) {
- delete value;
- value = NULL;
- }
- return make_scoped_ptr(value);
+ return value;
}
// This class implements the translation of properties from the given
« no previous file with comments | « chromeos/network/network_connection_handler_unittest.cc ('k') | chromeos/network/onc/onc_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698