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 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
| 10 #include <string> |
| 11 #include <utility> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
13 #include "components/autofill/core/common/password_form.h" | 15 #include "components/autofill/core/common/password_form.h" |
14 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 16 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
15 #include "third_party/WebKit/public/platform/WebString.h" | 17 #include "third_party/WebKit/public/platform/WebString.h" |
16 #include "url/gurl.h" | 18 #include "url/gurl.h" |
17 | 19 |
18 namespace blink { | 20 namespace blink { |
19 class WebFormElement; | 21 class WebFormElement; |
20 class WebFormControlElement; | 22 class WebFormControlElement; |
21 class WebFrame; | |
22 class WebInputElement; | 23 class WebInputElement; |
| 24 class WebLocalFrame; |
23 } | 25 } |
24 | 26 |
25 namespace autofill { | 27 namespace autofill { |
26 | 28 |
27 struct PasswordForm; | 29 struct PasswordForm; |
28 | 30 |
29 // Tests whether the given form is a GAIA reauthentication form. The form is | 31 // Tests whether the given form is a GAIA reauthentication form. The form is |
30 // not passed directly as WebFormElement, but by specifying its |origin| and | 32 // not passed directly as WebFormElement, but by specifying its |origin| and |
31 // |control_elements|. This is for better performance and easier testing. | 33 // |control_elements|. This is for better performance and easier testing. |
32 // TODO(msramek): Move this logic to the browser. | 34 // TODO(msramek): Move this logic to the browser. |
(...skipping 16 matching lines...) Expand all Loading... |
49 // |form_predictions| is Autofill server response, if present it's used for | 51 // |form_predictions| is Autofill server response, if present it's used for |
50 // overwriting default username element selection. | 52 // overwriting default username element selection. |
51 std::unique_ptr<PasswordForm> CreatePasswordFormFromWebForm( | 53 std::unique_ptr<PasswordForm> CreatePasswordFormFromWebForm( |
52 const blink::WebFormElement& form, | 54 const blink::WebFormElement& form, |
53 const FieldValueAndPropertiesMaskMap* nonscript_modified_values, | 55 const FieldValueAndPropertiesMaskMap* nonscript_modified_values, |
54 const FormsPredictionsMap* form_predictions); | 56 const FormsPredictionsMap* form_predictions); |
55 | 57 |
56 // Same as CreatePasswordFormFromWebForm() but for input elements that are not | 58 // Same as CreatePasswordFormFromWebForm() but for input elements that are not |
57 // enclosed in <form> element. | 59 // enclosed in <form> element. |
58 std::unique_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements( | 60 std::unique_ptr<PasswordForm> CreatePasswordFormFromUnownedInputElements( |
59 const blink::WebFrame& frame, | 61 const blink::WebLocalFrame& frame, |
60 const FieldValueAndPropertiesMaskMap* nonscript_modified_values, | 62 const FieldValueAndPropertiesMaskMap* nonscript_modified_values, |
61 const FormsPredictionsMap* form_predictions); | 63 const FormsPredictionsMap* form_predictions); |
62 | 64 |
63 // Checks in a case-insensitive way if the autocomplete attribute for the given | 65 // Checks in a case-insensitive way if the autocomplete attribute for the given |
64 // |element| is present and has the specified |value_in_lowercase|. | 66 // |element| is present and has the specified |value_in_lowercase|. |
65 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, | 67 bool HasAutocompleteAttributeValue(const blink::WebInputElement& element, |
66 base::StringPiece value_in_lowercase); | 68 base::StringPiece value_in_lowercase); |
67 | 69 |
68 // Checks in a case-insensitive way if credit card autocomplete attributes for | 70 // Checks in a case-insensitive way if credit card autocomplete attributes for |
69 // the given |element| are present. | 71 // the given |element| are present. |
70 bool HasCreditCardAutocompleteAttributes(const blink::WebInputElement& element); | 72 bool HasCreditCardAutocompleteAttributes(const blink::WebInputElement& element); |
71 | 73 |
72 // Returns whether the form |field| has a "password" type, but looks like a | 74 // Returns whether the form |field| has a "password" type, but looks like a |
73 // credit card verification field. | 75 // credit card verification field. |
74 bool IsCreditCardVerificationPasswordField(const blink::WebInputElement& field); | 76 bool IsCreditCardVerificationPasswordField(const blink::WebInputElement& field); |
75 | 77 |
76 // The "Realm" for the sign-on. This is scheme, host, port. | 78 // The "Realm" for the sign-on. This is scheme, host, port. |
77 std::string GetSignOnRealm(const GURL& origin); | 79 std::string GetSignOnRealm(const GURL& origin); |
78 | 80 |
79 } // namespace autofill | 81 } // namespace autofill |
80 | 82 |
81 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H
__ | 83 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_FORM_CONVERSION_UTILS_H
__ |
OLD | NEW |