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(
bool CustomizationDocument::LoadManifestFromString(
const std::string& manifest) {
int error_code = 0;
std::string error;
std::unique_ptr<base::Value> root =
base::JSONReader::ReadAndReturnErrorDeprecated(
manifest, base::JSON_ALLOW_TRAILING_COMMAS, &error_code, &error);
if (error_code != base::JSONReader::JSON_NO_ERROR)
LOG(ERROR) << error;
if (!root) {
base::JSONReader::ValueWithError parsed_json =
base::JSONReader::ReadAndReturnValueWithError(
manifest, base::JSON_ALLOW_TRAILING_COMMAS);
if (!parsed_json.value) {
LOG(ERROR) << parsed_json.error_message;
NOTREACHED();
return false;
}
std::unique_ptr<base::Value> root =
base::Value::ToUniquePtrValue(std::move(*parsed_json.value));
root_ = base::DictionaryValue::From(std::move(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