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