Chromium Code Reviews| Index: components/autofill/content/renderer/password_form_conversion_utils.cc |
| diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc |
| index 317807fd18e5b0608bbb6647c5bb662659792dab..a5bce11c3f632fd8abd8d2e2ff1a7f09c57d84e7 100644 |
| --- a/components/autofill/content/renderer/password_form_conversion_utils.cc |
| +++ b/components/autofill/content/renderer/password_form_conversion_utils.cc |
| @@ -13,9 +13,11 @@ |
| #include "base/lazy_instance.h" |
| #include "base/macros.h" |
| #include "base/metrics/histogram_macros.h" |
| +#include "base/stl_util.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "components/autofill/content/renderer/form_autofill_util.h" |
| +#include "components/autofill/core/common/autofill_util.h" |
| #include "components/autofill/core/common/password_form.h" |
| #include "components/autofill/core/common/password_form_field_prediction_map.h" |
| #include "google_apis/gaia/gaia_urls.h" |
| @@ -702,9 +704,13 @@ std::unique_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements( |
| bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, |
| const char* value_in_lowercase) { |
| - return base::LowerCaseEqualsASCII( |
| - base::StringPiece16(element.getAttribute("autocomplete")), |
| - value_in_lowercase); |
| + base::string16 autocomplete_attribute(element.getAttribute("autocomplete")); |
|
vabr (Chromium)
2016/10/13 12:49:31
Please
#include "base/strings/string16.h"
jdoerrie
2016/10/13 13:45:07
Done.
|
| + // Lowercase and tokenize attribute string. Convert to UTF8 beforehand. |
|
vabr (Chromium)
2016/10/13 12:49:31
Your comments here and on line 712 are correct and
jdoerrie
2016/10/13 13:45:07
Done.
|
| + std::vector<std::string> tokens = LowercaseAndTokenizeAttributeString( |
| + base::UTF16ToUTF8(autocomplete_attribute)); |
| + |
| + // Return if any of the obtained attribute tokens equals the value. |
|
vabr (Chromium)
2016/10/13 12:49:31
optional nit: if -> whether
jdoerrie
2016/10/13 13:45:07
Acknowledged.
|
| + return base::ContainsValue(tokens, value_in_lowercase); |
| } |
| } // namespace autofill |