Make |track_| in MediaStreamTrack const. and a couple of other cosmetic changes.
[chromium-blink-merge.git] / components / autofill / content / renderer / form_cache.h
blob07f79153cd6d4a9602ff81a73d5dfe1f59620662
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_
8 #include <map>
9 #include <set>
10 #include <vector>
12 #include "base/strings/string16.h"
14 namespace blink {
15 class WebDocument;
16 class WebFormControlElement;
17 class WebFrame;
18 class WebInputElement;
19 class WebSelectElement;
22 namespace autofill {
24 struct FormData;
25 struct FormDataPredictions;
27 // Manages the forms in a RenderView.
28 class FormCache {
29 public:
30 FormCache();
31 ~FormCache();
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);
51 private:
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_