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> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "components/autofill/core/common/autofill_regex_constants.h" | 22 #include "components/autofill/core/common/autofill_regex_constants.h" |
23 #include "components/autofill/core/common/autofill_regexes.h" | 23 #include "components/autofill/core/common/autofill_regexes.h" |
24 #include "components/autofill/core/common/autofill_util.h" | 24 #include "components/autofill/core/common/autofill_util.h" |
25 #include "components/autofill/core/common/password_form.h" | 25 #include "components/autofill/core/common/password_form.h" |
26 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 26 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
27 #include "google_apis/gaia/gaia_urls.h" | 27 #include "google_apis/gaia/gaia_urls.h" |
28 #include "third_party/WebKit/public/platform/WebString.h" | 28 #include "third_party/WebKit/public/platform/WebString.h" |
29 #include "third_party/WebKit/public/platform/WebVector.h" | 29 #include "third_party/WebKit/public/platform/WebVector.h" |
30 #include "third_party/WebKit/public/web/WebDocument.h" | 30 #include "third_party/WebKit/public/web/WebDocument.h" |
31 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 31 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
32 #include "third_party/WebKit/public/web/WebFrame.h" | |
33 #include "third_party/WebKit/public/web/WebInputElement.h" | 32 #include "third_party/WebKit/public/web/WebInputElement.h" |
| 33 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
34 #include "third_party/re2/src/re2/re2.h" | 34 #include "third_party/re2/src/re2/re2.h" |
35 | 35 |
36 using blink::WebDocument; | 36 using blink::WebDocument; |
37 using blink::WebFormControlElement; | 37 using blink::WebFormControlElement; |
38 using blink::WebFormElement; | 38 using blink::WebFormElement; |
39 using blink::WebFrame; | |
40 using blink::WebInputElement; | 39 using blink::WebInputElement; |
| 40 using blink::WebLocalFrame; |
41 using blink::WebString; | 41 using blink::WebString; |
42 | 42 |
43 namespace autofill { | 43 namespace autofill { |
44 namespace { | 44 namespace { |
45 | 45 |
46 // PasswordForms can be constructed for both WebFormElements and for collections | 46 // PasswordForms can be constructed for both WebFormElements and for collections |
47 // of WebInputElements that are not in a WebFormElement. This intermediate | 47 // of WebInputElements that are not in a WebFormElement. This intermediate |
48 // aggregating structure is provided so GetPasswordForm() only has one | 48 // aggregating structure is provided so GetPasswordForm() only has one |
49 // view of the underlying data, regardless of its origin. | 49 // view of the underlying data, regardless of its origin. |
50 struct SyntheticForm { | 50 struct SyntheticForm { |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 return std::unique_ptr<PasswordForm>(); | 704 return std::unique_ptr<PasswordForm>(); |
705 | 705 |
706 if (!GetPasswordForm(synthetic_form, password_form.get(), | 706 if (!GetPasswordForm(synthetic_form, password_form.get(), |
707 field_value_and_properties_map, form_predictions)) | 707 field_value_and_properties_map, form_predictions)) |
708 return std::unique_ptr<PasswordForm>(); | 708 return std::unique_ptr<PasswordForm>(); |
709 | 709 |
710 return password_form; | 710 return password_form; |
711 } | 711 } |
712 | 712 |
713 std::unique_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements( | 713 std::unique_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements( |
714 const WebFrame& frame, | 714 const WebLocalFrame& frame, |
715 const FieldValueAndPropertiesMaskMap* field_value_and_properties_map, | 715 const FieldValueAndPropertiesMaskMap* field_value_and_properties_map, |
716 const FormsPredictionsMap* form_predictions) { | 716 const FormsPredictionsMap* form_predictions) { |
717 SyntheticForm synthetic_form; | 717 SyntheticForm synthetic_form; |
718 synthetic_form.control_elements = form_util::GetUnownedFormFieldElements( | 718 synthetic_form.control_elements = form_util::GetUnownedFormFieldElements( |
719 frame.GetDocument().All(), &synthetic_form.fieldsets); | 719 frame.GetDocument().All(), &synthetic_form.fieldsets); |
720 synthetic_form.document = frame.GetDocument(); | 720 synthetic_form.document = frame.GetDocument(); |
721 | 721 |
722 if (synthetic_form.control_elements.empty()) | 722 if (synthetic_form.control_elements.empty()) |
723 return std::unique_ptr<PasswordForm>(); | 723 return std::unique_ptr<PasswordForm>(); |
724 | 724 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 MatchesPattern(field.GetAttribute("name").Utf16(), kCardCvcReCached); | 784 MatchesPattern(field.GetAttribute("name").Utf16(), kCardCvcReCached); |
785 } | 785 } |
786 | 786 |
787 std::string GetSignOnRealm(const GURL& origin) { | 787 std::string GetSignOnRealm(const GURL& origin) { |
788 GURL::Replacements rep; | 788 GURL::Replacements rep; |
789 rep.SetPathStr(""); | 789 rep.SetPathStr(""); |
790 return origin.ReplaceComponents(rep).spec(); | 790 return origin.ReplaceComponents(rep).spec(); |
791 } | 791 } |
792 | 792 |
793 } // namespace autofill | 793 } // namespace autofill |
OLD | NEW |