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