CodeHealth: Remove use of Value::GetAsString from //components
This change removes the use of Value::GetAsString and replaces with
Value::is_string, Value::GetString(), Value::GetIfString().
This CL was uploaded by git cl split.
[email protected]
Bug: 1187007
Change-Id: I61b7c10fb044e3b88f2b26b3f533db46349df50b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3033523
Auto-Submit: Thomas Lukaszewicz <[email protected]>
Reviewed-by: Dominic Battré <[email protected]>
Commit-Queue: Dominic Battré <[email protected]>
Cr-Commit-Position: refs/heads/master@{#902413}
diff --git a/components/url_matcher/url_matcher_factory.cc b/components/url_matcher/url_matcher_factory.cc
index a996856..aab8cb0e 100644
--- a/components/url_matcher/url_matcher_factory.cc
+++ b/components/url_matcher/url_matcher_factory.cc
@@ -188,12 +188,12 @@
const std::string& condition_attribute_name,
const base::Value* value,
std::string* error) {
- std::string str_value;
- if (!value->GetAsString(&str_value)) {
+ if (!value->is_string()) {
*error = base::StringPrintf(kAttributeExpectedString,
condition_attribute_name.c_str());
return URLMatcherCondition();
}
+ const std::string& str_value = value->GetString();
if (condition_attribute_name == keys::kHostContainsKey ||
condition_attribute_name == keys::kHostPrefixKey ||
condition_attribute_name == keys::kHostSuffixKey ||