Commit 96a5cb26 authored by Nigel Tao's avatar Nigel Tao Committed by Commit Bot

Upgrade drive from deprecated base::JSONReader API

Bug: 1070409
Change-Id: Ib26b5d5d9a6ddf20da57c9e11be43de9cfb1d7be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212117Reviewed-by: default avatarStuart Langley <slangley@chromium.org>
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771531}
parent 7246c3b4
......@@ -175,13 +175,9 @@ void CloseFile(base::File file) {}
namespace google_apis {
std::unique_ptr<base::Value> ParseJson(const std::string& json) {
int error_code = -1;
std::string error_message;
std::unique_ptr<base::Value> value =
base::JSONReader::ReadAndReturnErrorDeprecated(
json, base::JSON_PARSE_RFC, &error_code, &error_message);
if (!value.get()) {
base::JSONReader::ValueWithError parsed_json =
base::JSONReader::ReadAndReturnValueWithError(json);
if (!parsed_json.value) {
std::string trimmed_json;
if (json.size() < 80) {
trimmed_json = json;
......@@ -192,10 +188,12 @@ std::unique_ptr<base::Value> ParseJson(const std::string& json) {
base::NumberToString(json.size() - 60).c_str(),
json.substr(json.size() - 10).c_str());
}
LOG(WARNING) << "Error while parsing entry response: " << error_message
<< ", code: " << error_code << ", json:\n" << trimmed_json;
LOG(WARNING) << "Error while parsing entry response: "
<< parsed_json.error_message << ", json:\n"
<< trimmed_json;
return nullptr;
}
return value;
return base::Value::ToUniquePtrValue(std::move(*parsed_json.value));
}
void GenerateMultipartBody(MultipartType multipart_type,
......
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