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_FORM_AUTOFILL_UTIL_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 14 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
15 #include "components/autofill/core/common/autofill_constants.h" | 15 #include "components/autofill/core/common/autofill_constants.h" |
16 #include "components/autofill/core/common/password_form_field_prediction_map.h" | 16 #include "components/autofill/core/common/password_form_field_prediction_map.h" |
17 #include "third_party/WebKit/public/platform/WebVector.h" | 17 #include "third_party/WebKit/public/platform/WebVector.h" |
18 #include "third_party/WebKit/public/web/WebElementCollection.h" | 18 #include "third_party/WebKit/public/web/WebElementCollection.h" |
19 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
20 | 20 |
21 class GURL; | 21 class GURL; |
22 | 22 |
23 namespace blink { | 23 namespace blink { |
24 class WebDocument; | 24 class WebDocument; |
25 class WebElement; | 25 class WebElement; |
26 class WebFormControlElement; | 26 class WebFormControlElement; |
27 class WebFormElement; | 27 class WebFormElement; |
28 class WebFrame; | |
29 class WebInputElement; | 28 class WebInputElement; |
| 29 class WebLocalFrame; |
30 class WebNode; | 30 class WebNode; |
31 } | 31 } |
32 | 32 |
33 namespace autofill { | 33 namespace autofill { |
34 | 34 |
35 struct FormData; | 35 struct FormData; |
36 struct FormFieldData; | 36 struct FormFieldData; |
37 | 37 |
38 namespace form_util { | 38 namespace form_util { |
39 | 39 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 GURL StripAuthAndParams(const GURL& gurl); | 80 GURL StripAuthAndParams(const GURL& gurl); |
81 | 81 |
82 // Extract FormData from the form element and return whether the operation was | 82 // Extract FormData from the form element and return whether the operation was |
83 // successful. | 83 // successful. |
84 bool ExtractFormData(const blink::WebFormElement& form_element, FormData* data); | 84 bool ExtractFormData(const blink::WebFormElement& form_element, FormData* data); |
85 | 85 |
86 // Helper function to check if there exist any visible form on |frame| which | 86 // Helper function to check if there exist any visible form on |frame| which |
87 // equals |form_element|. If |form_element| is null, checks if forms action | 87 // equals |form_element|. If |form_element| is null, checks if forms action |
88 // equals |action|. Returns true if so. For forms with empty or unspecified | 88 // equals |action|. Returns true if so. For forms with empty or unspecified |
89 // actions, all form data are used for comparison. | 89 // actions, all form data are used for comparison. |
90 bool IsFormVisible(blink::WebFrame* frame, | 90 bool IsFormVisible(blink::WebLocalFrame* frame, |
91 const blink::WebFormElement& form_element, | 91 const blink::WebFormElement& form_element, |
92 const GURL& action, | 92 const GURL& action, |
93 const GURL& origin, | 93 const GURL& origin, |
94 const FormData& form_data); | 94 const FormData& form_data); |
95 | 95 |
96 // Returns true if at least one element from |control_elements| is visible. | 96 // Returns true if at least one element from |control_elements| is visible. |
97 bool IsSomeControlElementVisible( | 97 bool IsSomeControlElementVisible( |
98 const blink::WebVector<blink::WebFormControlElement>& control_elements); | 98 const blink::WebVector<blink::WebFormControlElement>& control_elements); |
99 | 99 |
100 // Returns true if some control elements of |form| are visible. | 100 // Returns true if some control elements of |form| are visible. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 // Checks if the webpage is empty. | 249 // Checks if the webpage is empty. |
250 // This kind of webpage is considered as empty: | 250 // This kind of webpage is considered as empty: |
251 // <html> | 251 // <html> |
252 // <head> | 252 // <head> |
253 // <head/> | 253 // <head/> |
254 // <body> | 254 // <body> |
255 // <body/> | 255 // <body/> |
256 // <html/> | 256 // <html/> |
257 // Meta, script and title tags don't influence the emptiness of a webpage. | 257 // Meta, script and title tags don't influence the emptiness of a webpage. |
258 bool IsWebpageEmpty(const blink::WebFrame* frame); | 258 bool IsWebpageEmpty(const blink::WebLocalFrame* frame); |
259 | 259 |
260 // This function checks whether the children of |element| | 260 // This function checks whether the children of |element| |
261 // are of the type <script>, <meta>, or <title>. | 261 // are of the type <script>, <meta>, or <title>. |
262 bool IsWebElementEmpty(const blink::WebElement& element); | 262 bool IsWebElementEmpty(const blink::WebElement& element); |
263 | 263 |
264 // Previews |suggestion| in |input_element| and highlights the suffix of | 264 // Previews |suggestion| in |input_element| and highlights the suffix of |
265 // |suggestion| not included in the |input_element| text. |input_element| must | 265 // |suggestion| not included in the |input_element| text. |input_element| must |
266 // not be null. |user_input| should be the text typed by the user into | 266 // not be null. |user_input| should be the text typed by the user into |
267 // |input_element|. Note that |user_input| cannot be easily derived from | 267 // |input_element|. Note that |user_input| cannot be easily derived from |
268 // |input_element| by calling value(), because of http://crbug.com/507714. | 268 // |input_element| by calling value(), because of http://crbug.com/507714. |
269 void PreviewSuggestion(const base::string16& suggestion, | 269 void PreviewSuggestion(const base::string16& suggestion, |
270 const base::string16& user_input, | 270 const base::string16& user_input, |
271 blink::WebFormControlElement* input_element); | 271 blink::WebFormControlElement* input_element); |
272 | 272 |
273 } // namespace form_util | 273 } // namespace form_util |
274 } // namespace autofill | 274 } // namespace autofill |
275 | 275 |
276 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ | 276 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_AUTOFILL_UTIL_H_ |
OLD | NEW |