Commit 4a31cefd authored by Nigel Tao's avatar Nigel Tao Committed by Commit Bot

Upgrade customization from deprecated base::JSONReader API

Bug: 1070409
Change-Id: I6eb0a4789232b48e66f45e7f81c96c12f718f413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212231Reviewed-by: default avatarSatoru Takabayashi <satorux@chromium.org>
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773140}
parent e387b972
...@@ -240,17 +240,16 @@ bool CustomizationDocument::LoadManifestFromFile( ...@@ -240,17 +240,16 @@ bool CustomizationDocument::LoadManifestFromFile(
bool CustomizationDocument::LoadManifestFromString( bool CustomizationDocument::LoadManifestFromString(
const std::string& manifest) { const std::string& manifest) {
int error_code = 0; base::JSONReader::ValueWithError parsed_json =
std::string error; base::JSONReader::ReadAndReturnValueWithError(
std::unique_ptr<base::Value> root = manifest, base::JSON_ALLOW_TRAILING_COMMAS);
base::JSONReader::ReadAndReturnErrorDeprecated( if (!parsed_json.value) {
manifest, base::JSON_ALLOW_TRAILING_COMMAS, &error_code, &error); LOG(ERROR) << parsed_json.error_message;
if (error_code != base::JSONReader::JSON_NO_ERROR)
LOG(ERROR) << error;
if (!root) {
NOTREACHED(); NOTREACHED();
return false; return false;
} }
std::unique_ptr<base::Value> root =
base::Value::ToUniquePtrValue(std::move(*parsed_json.value));
root_ = base::DictionaryValue::From(std::move(root)); root_ = base::DictionaryValue::From(std::move(root));
if (!root_) { if (!root_) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment