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_CACHE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_CACHE_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_CACHE_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_CACHE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 16 matching lines...) Expand all Loading... |
27 struct FormDataPredictions; | 27 struct FormDataPredictions; |
28 | 28 |
29 // Manages the forms in a single RenderFrame. | 29 // Manages the forms in a single RenderFrame. |
30 class FormCache { | 30 class FormCache { |
31 public: | 31 public: |
32 explicit FormCache(const blink::WebFrame& frame); | 32 explicit FormCache(const blink::WebFrame& frame); |
33 ~FormCache(); | 33 ~FormCache(); |
34 | 34 |
35 // Scans the DOM in |frame_| extracting and storing forms that have not been | 35 // Scans the DOM in |frame_| extracting and storing forms that have not been |
36 // seen before. Returns the extracted forms. | 36 // seen before. Returns the extracted forms. |
37 std::vector<FormData> ExtractNewForms(); | 37 // Writes the index of the unowned form to |unowned_form_index|, or the size |
| 38 // of the returned vector if no unowned form exists. |
| 39 std::vector<FormData> ExtractNewForms(size_t* unowned_form_index); |
38 | 40 |
39 // Resets the forms. | 41 // Resets the forms. |
40 void Reset(); | 42 void Reset(); |
41 | 43 |
42 // Clears the values of all input elements in the form that contains | 44 // Clears the values of all input elements in the form that contains |
43 // |element|. Returns false if the form is not found. | 45 // |element|. Returns false if the form is not found. |
44 bool ClearFormWithElement(const blink::WebFormControlElement& element); | 46 bool ClearFormWithElement(const blink::WebFormControlElement& element); |
45 | 47 |
46 // For each field in the |form|, sets the field's placeholder text to the | 48 // For each field in the |form|, sets the field's placeholder text to the |
47 // field's overall predicted type. Also sets the title to include the field's | 49 // field's overall predicted type. Also sets the title to include the field's |
(...skipping 26 matching lines...) Expand all Loading... |
74 | 76 |
75 // The cached initial values for checkable <input> elements. | 77 // The cached initial values for checkable <input> elements. |
76 std::map<const blink::WebInputElement, bool> initial_checked_state_; | 78 std::map<const blink::WebInputElement, bool> initial_checked_state_; |
77 | 79 |
78 DISALLOW_COPY_AND_ASSIGN(FormCache); | 80 DISALLOW_COPY_AND_ASSIGN(FormCache); |
79 }; | 81 }; |
80 | 82 |
81 } // namespace autofill | 83 } // namespace autofill |
82 | 84 |
83 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_CACHE_H_ | 85 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_CACHE_H_ |
OLD | NEW |