OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "components/autofill/content/renderer/form_cache.h" | 5 #include "components/autofill/content/renderer/form_cache.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/autofill/content/renderer/form_autofill_util.h" | 9 #include "components/autofill/content/renderer/form_autofill_util.h" |
10 #include "components/autofill/core/common/autofill_constants.h" | 10 #include "components/autofill/core/common/autofill_constants.h" |
11 #include "components/autofill/core/common/form_data.h" | 11 #include "components/autofill/core/common/form_data.h" |
12 #include "components/autofill/core/common/form_data_predictions.h" | 12 #include "components/autofill/core/common/form_data_predictions.h" |
13 #include "components/autofill/core/common/form_field_data.h" | 13 #include "components/autofill/core/common/form_field_data.h" |
14 #include "components/autofill/core/common/form_field_data_predictions.h" | 14 #include "components/autofill/core/common/form_field_data_predictions.h" |
15 #include "grit/component_strings.h" | 15 #include "grit/component_strings.h" |
16 #include "third_party/WebKit/public/platform/WebString.h" | 16 #include "third_party/WebKit/public/platform/WebString.h" |
17 #include "third_party/WebKit/public/platform/WebVector.h" | 17 #include "third_party/WebKit/public/platform/WebVector.h" |
18 #include "third_party/WebKit/public/web/WebDocument.h" | 18 #include "third_party/WebKit/public/web/WebDocument.h" |
19 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 19 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
20 #include "third_party/WebKit/public/web/WebFormElement.h" | 20 #include "third_party/WebKit/public/web/WebFormElement.h" |
21 #include "third_party/WebKit/public/web/WebFrame.h" | 21 #include "third_party/WebKit/public/web/WebFrame.h" |
22 #include "third_party/WebKit/public/web/WebInputElement.h" | 22 #include "third_party/WebKit/public/web/WebInputElement.h" |
23 #include "third_party/WebKit/public/web/WebSelectElement.h" | 23 #include "third_party/WebKit/public/web/WebSelectElement.h" |
24 #include "third_party/WebKit/public/web/WebTextAreaElement.h" | 24 #include "third_party/WebKit/public/web/WebTextAreaElement.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 | 26 |
27 using WebKit::WebDocument; | 27 using blink::WebDocument; |
28 using WebKit::WebFormControlElement; | 28 using blink::WebFormControlElement; |
29 using WebKit::WebFormElement; | 29 using blink::WebFormElement; |
30 using WebKit::WebFrame; | 30 using blink::WebFrame; |
31 using WebKit::WebInputElement; | 31 using blink::WebInputElement; |
32 using WebKit::WebSelectElement; | 32 using blink::WebSelectElement; |
33 using WebKit::WebTextAreaElement; | 33 using blink::WebTextAreaElement; |
34 using WebKit::WebString; | 34 using blink::WebString; |
35 using WebKit::WebVector; | 35 using blink::WebVector; |
36 | 36 |
37 namespace autofill { | 37 namespace autofill { |
38 | 38 |
39 // Helper function to discard state of various WebFormElements when they go out | 39 // Helper function to discard state of various WebFormElements when they go out |
40 // of web frame's scope. This is done to release memory that we no longer need | 40 // of web frame's scope. This is done to release memory that we no longer need |
41 // to hold. | 41 // to hold. |
42 // K should inherit from WebFormControlElement as the function looks to extract | 42 // K should inherit from WebFormControlElement as the function looks to extract |
43 // WebFormElement for K.form(). | 43 // WebFormElement for K.form(). |
44 template <class K, class V> | 44 template <class K, class V> |
45 void RemoveOldElements(const WebFrame& frame, std::map<const K, V>* states) { | 45 void RemoveOldElements(const WebFrame& frame, std::map<const K, V>* states) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 UTF8ToUTF16(form.experiment_id)); | 297 UTF8ToUTF16(form.experiment_id)); |
298 if (!element->hasAttribute("placeholder")) | 298 if (!element->hasAttribute("placeholder")) |
299 element->setAttribute("placeholder", WebString(UTF8ToUTF16(placeholder))); | 299 element->setAttribute("placeholder", WebString(UTF8ToUTF16(placeholder))); |
300 element->setAttribute("title", WebString(title)); | 300 element->setAttribute("title", WebString(title)); |
301 } | 301 } |
302 | 302 |
303 return true; | 303 return true; |
304 } | 304 } |
305 | 305 |
306 } // namespace autofill | 306 } // namespace autofill |
OLD | NEW |