[Code Health] Remove usage of DictionaryValue::GetBoolean() under components
Bug: 1187033 Change-Id: Ib40209840043f4c657129c49f776af5bda4a0bb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3261897 Commit-Queue: Nan Lin <linnan@chromium.org> Reviewed-by: Alan Screen <awscreen@chromium.org> Reviewed-by: manuk hovanesian <manukh@chromium.org> Reviewed-by: Marc Treib <treib@chromium.org> Reviewed-by: Kristi Park <kristipark@chromium.org> Reviewed-by: Alex Ilin <alexilin@chromium.org> Reviewed-by: Liquan (Max) Gu <maxlg@chromium.org> Reviewed-by: Alexander Alekseev <alemate@chromium.org> Reviewed-by: Kevin McNee <mcnee@chromium.org> Reviewed-by: Matt Jones <mdjones@chromium.org> Cr-Commit-Position: refs/heads/main@{#940940}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
a57e961811
commit
5e28dd263a
components
dom_distiller
core
guest_view
browser
ntp_tiles
omnibox
browser
payments
content
utility
printing
renderer
safe_search_api
safe_search
signin
internal
identity_manager
user_manager
@ -63,7 +63,10 @@ bool ParseResponse(const std::string& response, bool* is_porn) {
|
||||
}
|
||||
const base::DictionaryValue& classification_dict =
|
||||
base::Value::AsDictionaryValue(classification_value);
|
||||
classification_dict.GetBoolean("pornography", is_porn);
|
||||
absl::optional<bool> is_porn_opt =
|
||||
classification_dict.FindBoolKey("pornography");
|
||||
if (is_porn_opt.has_value())
|
||||
*is_porn = is_porn_opt.value();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user