0

Use base::JSONReader::ReadDeprecated() in components/.

This is part of the process to help migrate base::JSONReader::Read() to
return base::Optional<base::Value>.

Do the same for ReadAndReturnError() and ReadToValue().

BUG=925165
TBR=sdefresne@chromium.org

Change-Id: I3a6b5b5d581ece4771f1525e465aae7af20afddf
Reviewed-on: https://chromium-review.googlesource.com/c/1476093
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632876}
This commit is contained in:
Lei Zhang
2019-02-16 02:31:55 +00:00
committed by Commit Bot
parent 2966042b00
commit db28ad35e3
77 changed files with 213 additions and 157 deletions
components
arc
autofill
autofill_assistant
browser
cast_channel
cloud_devices
content_settings
cronet
dom_distiller
domain_reliability
heap_profiling
history
invalidation
language
mirroring
nacl
net_log
network_time
ntp_snippets
ntp_tiles
omnibox
password_manager
core
browser
site_affiliation
payments
policy
quirks
safe_browsing
safe_search_api
search_engines
search_provider_logos
services
signin
spellcheck
subresource_filter
sync_preferences
tracing
translate
viz
webcrypto

@@ -52,7 +52,8 @@ std::string BuildRequestData(const std::string& api_key,
// Parses a SafeSearch API |response| and stores the result in |is_porn|.
// On errors, returns false and doesn't set |is_porn|.
bool ParseResponse(const std::string& response, bool* is_porn) {
std::unique_ptr<base::Value> value = base::JSONReader::Read(response);
std::unique_ptr<base::Value> value =
base::JSONReader::ReadDeprecated(response);
const base::DictionaryValue* dict = nullptr;
if (!value || !value->GetAsDictionary(&dict)) {
DLOG(WARNING) << "ParseResponse failed to parse global dictionary";