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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_CACHE_H_
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_CACHE_H_
12 #include "base/strings/string16.h"
16 class WebFormControlElement
;
18 class WebInputElement
;
19 class WebSelectElement
;
25 struct FormDataPredictions
;
27 // Manages the forms in a RenderView.
33 // Scans the DOM in |frame| extracting and storing forms that have not been
34 // seen before. Fills |forms| with extracted forms.
35 void ExtractNewForms(const blink::WebFrame
& frame
,
36 std::vector
<FormData
>* forms
);
38 // Resets the forms for the specified |frame|.
39 void ResetFrame(const blink::WebFrame
& frame
);
41 // Clears the values of all input elements in the form that contains
42 // |element|. Returns false if the form is not found.
43 bool ClearFormWithElement(const blink::WebFormControlElement
& element
);
45 // For each field in the |form|, sets the field's placeholder text to the
46 // field's overall predicted type. Also sets the title to include the field's
47 // heuristic type, server type, and signature; as well as the form's signature
48 // and the experiment id for the server predictions.
49 bool ShowPredictions(const FormDataPredictions
& form
);
52 // The cached web frames.
53 std::set
<blink::WebDocument
> web_documents_
;
55 // The cached forms per frame. Used to prevent re-extraction of forms.
56 std::map
<const blink::WebFrame
*, std::set
<FormData
> > parsed_forms_
;
58 // The cached initial values for <select> elements.
59 std::map
<const blink::WebSelectElement
, base::string16
>
60 initial_select_values_
;
62 // The cached initial values for checkable <input> elements.
63 std::map
<const blink::WebInputElement
, bool> initial_checked_state_
;
65 DISALLOW_COPY_AND_ASSIGN(FormCache
);
68 } // namespace autofill
70 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_CACHE_H_