OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_RENDERER_AUTOFILL_FORM_CACHE_H_ | 5 #ifndef CHROME_RENDERER_AUTOFILL_FORM_CACHE_H_ |
6 #define CHROME_RENDERER_AUTOFILL_FORM_CACHE_H_ | 6 #define CHROME_RENDERER_AUTOFILL_FORM_CACHE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 | 14 |
15 namespace webkit_glue { | 15 namespace webkit { |
| 16 namespace forms { |
16 struct FormData; | 17 struct FormData; |
17 struct FormDataPredictions; | 18 struct FormDataPredictions; |
18 } // namespace webkit_glue | 19 } |
| 20 } |
19 | 21 |
20 namespace WebKit { | 22 namespace WebKit { |
21 class WebDocument; | 23 class WebDocument; |
22 class WebFrame; | 24 class WebFrame; |
23 class WebInputElement; | 25 class WebInputElement; |
24 class WebSelectElement; | 26 class WebSelectElement; |
25 } // namespace WebKit | 27 } |
26 | 28 |
27 namespace autofill { | 29 namespace autofill { |
28 | 30 |
29 // Manages the forms in a RenderView. | 31 // Manages the forms in a RenderView. |
30 class FormCache { | 32 class FormCache { |
31 public: | 33 public: |
32 FormCache(); | 34 FormCache(); |
33 ~FormCache(); | 35 ~FormCache(); |
34 | 36 |
35 // Scans the DOM in |frame| extracting and storing forms. | 37 // Scans the DOM in |frame| extracting and storing forms. |
36 // Returns a vector of the extracted forms. | 38 // Returns a vector of the extracted forms. |
37 void ExtractForms(const WebKit::WebFrame& frame, | 39 void ExtractForms(const WebKit::WebFrame& frame, |
38 std::vector<webkit_glue::FormData>* forms); | 40 std::vector<webkit::forms::FormData>* forms); |
39 | 41 |
40 // Resets the forms for the specified |frame|. | 42 // Resets the forms for the specified |frame|. |
41 void ResetFrame(const WebKit::WebFrame& frame); | 43 void ResetFrame(const WebKit::WebFrame& frame); |
42 | 44 |
43 // Clears the values of all input elements in the form that contains | 45 // Clears the values of all input elements in the form that contains |
44 // |element|. Returns false if the form is not found. | 46 // |element|. Returns false if the form is not found. |
45 bool ClearFormWithElement(const WebKit::WebInputElement& element); | 47 bool ClearFormWithElement(const WebKit::WebInputElement& element); |
46 | 48 |
47 // For each field in the |form|, sets the field's placeholder text to the | 49 // For each field in the |form|, sets the field's placeholder text to the |
48 // field's overall predicted type. Also sets the title to include the field's | 50 // field's overall predicted type. Also sets the title to include the field's |
49 // heuristic type, server type, and signature; as well as the form's signature | 51 // heuristic type, server type, and signature; as well as the form's signature |
50 // and the experiment id for the server predictions. | 52 // and the experiment id for the server predictions. |
51 bool ShowPredictions(const webkit_glue::FormDataPredictions& form); | 53 bool ShowPredictions(const webkit::forms::FormDataPredictions& form); |
52 | 54 |
53 private: | 55 private: |
54 // The cached web frames. | 56 // The cached web frames. |
55 std::set<WebKit::WebDocument> web_documents_; | 57 std::set<WebKit::WebDocument> web_documents_; |
56 | 58 |
57 // The cached initial values for <select> elements. | 59 // The cached initial values for <select> elements. |
58 std::map<const WebKit::WebSelectElement, string16> initial_select_values_; | 60 std::map<const WebKit::WebSelectElement, string16> initial_select_values_; |
59 | 61 |
60 DISALLOW_COPY_AND_ASSIGN(FormCache); | 62 DISALLOW_COPY_AND_ASSIGN(FormCache); |
61 }; | 63 }; |
62 | 64 |
63 } // namespace autofill | 65 } // namespace autofill |
64 | 66 |
65 #endif // CHROME_RENDERER_AUTOFILL_FORM_CACHE_H_ | 67 #endif // CHROME_RENDERER_AUTOFILL_FORM_CACHE_H_ |
OLD | NEW |