diff options
Diffstat (limited to 'chromium/google_apis/drive')
-rw-r--r-- | chromium/google_apis/drive/base_requests.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/chromium/google_apis/drive/base_requests.cc b/chromium/google_apis/drive/base_requests.cc index 5523b8afb5b..f71d9233ce5 100644 --- a/chromium/google_apis/drive/base_requests.cc +++ b/chromium/google_apis/drive/base_requests.cc @@ -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, |