| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 5 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/i18n/case_conversion.h" | 12 #include "base/i18n/case_conversion.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/stl_util.h" |
| 17 #include "base/strings/string16.h" |
| 16 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 18 #include "components/autofill/content/renderer/form_autofill_util.h" | 20 #include "components/autofill/content/renderer/form_autofill_util.h" |
| 21 #include "components/autofill/core/common/autofill_util.h" |
| 19 #include "components/autofill/core/common/password_form.h" | 22 #include "components/autofill/core/common/password_form.h" |
| 20 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 23 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
| 21 #include "google_apis/gaia/gaia_urls.h" | 24 #include "google_apis/gaia/gaia_urls.h" |
| 22 #include "third_party/WebKit/public/platform/WebString.h" | 25 #include "third_party/WebKit/public/platform/WebString.h" |
| 23 #include "third_party/WebKit/public/platform/WebVector.h" | 26 #include "third_party/WebKit/public/platform/WebVector.h" |
| 24 #include "third_party/WebKit/public/web/WebDocument.h" | 27 #include "third_party/WebKit/public/web/WebDocument.h" |
| 25 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 28 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
| 26 #include "third_party/WebKit/public/web/WebFrame.h" | 29 #include "third_party/WebKit/public/web/WebFrame.h" |
| 27 #include "third_party/WebKit/public/web/WebInputElement.h" | 30 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 28 #include "third_party/re2/src/re2/re2.h" | 31 #include "third_party/re2/src/re2/re2.h" |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 return std::unique_ptr<PasswordForm>(); | 698 return std::unique_ptr<PasswordForm>(); |
| 696 | 699 |
| 697 // No actual action on the form, so use the the origin as the action. | 700 // No actual action on the form, so use the the origin as the action. |
| 698 password_form->action = password_form->origin; | 701 password_form->action = password_form->origin; |
| 699 | 702 |
| 700 return password_form; | 703 return password_form; |
| 701 } | 704 } |
| 702 | 705 |
| 703 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, | 706 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, |
| 704 const char* value_in_lowercase) { | 707 const char* value_in_lowercase) { |
| 705 return base::LowerCaseEqualsASCII( | 708 base::string16 autocomplete_attribute(element.getAttribute("autocomplete")); |
| 706 base::StringPiece16(element.getAttribute("autocomplete")), | 709 std::vector<std::string> tokens = LowercaseAndTokenizeAttributeString( |
| 707 value_in_lowercase); | 710 base::UTF16ToUTF8(autocomplete_attribute)); |
| 711 |
| 712 return base::ContainsValue(tokens, value_in_lowercase); |
| 708 } | 713 } |
| 709 | 714 |
| 710 } // namespace autofill | 715 } // namespace autofill |
| OLD | NEW |