Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: components/autofill/common/form_field_data.cc

Issue 16879006: In components/autofill, move common/ to core/common/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to fix conflict Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #include "components/autofill/common/form_field_data.h"
6
7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h"
9
10 namespace autofill {
11
12 FormFieldData::FormFieldData()
13 : max_length(0),
14 is_autofilled(false),
15 is_checked(false),
16 is_checkable(false),
17 is_focusable(false),
18 should_autocomplete(true),
19 text_direction(base::i18n::UNKNOWN_DIRECTION) {
20 }
21
22 FormFieldData::~FormFieldData() {
23 }
24
25 bool FormFieldData::operator==(const FormFieldData& field) const {
26 // A FormFieldData stores a value, but the value is not part of the identity
27 // of the field, so we don't want to compare the values.
28 return (label == field.label &&
29 name == field.name &&
30 form_control_type == field.form_control_type &&
31 autocomplete_attribute == field.autocomplete_attribute &&
32 max_length == field.max_length);
33 }
34
35 bool FormFieldData::operator!=(const FormFieldData& field) const {
36 return !operator==(field);
37 }
38
39 bool FormFieldData::operator<(const FormFieldData& field) const {
40 if (label == field.label)
41 return name < field.name;
42
43 return label < field.label;
44 }
45
46 std::ostream& operator<<(std::ostream& os, const FormFieldData& field) {
47 return os
48 << UTF16ToUTF8(field.label)
49 << " "
50 << UTF16ToUTF8(field.name)
51 << " "
52 << UTF16ToUTF8(field.value)
53 << " "
54 << field.form_control_type
55 << " "
56 << field.autocomplete_attribute
57 << " "
58 << field.max_length
59 << " "
60 << (field.is_autofilled ? "true" : "false")
61 << " "
62 << (field.is_checked ? "true" : "false")
63 << " "
64 << (field.is_checkable ? "true" : "false")
65 << " "
66 << (field.is_focusable ? "true" : "false")
67 << " "
68 << (field.should_autocomplete ? "true" : "false")
69 << " "
70 << field.text_direction;
71 }
72
73 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/common/form_field_data.h ('k') | components/autofill/common/form_field_data_predictions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698