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

Side by Side Diff: chrome/common/form_field_data.cc

Issue 12543010: Establish components/autofill and move some files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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
« no previous file with comments | « chrome/common/form_field_data.h ('k') | chrome/common/form_field_data_predictions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/common/form_field_data.h"
6
7 #include "base/string_util.h"
8 #include "base/utf_string_conversions.h"
9
10 FormFieldData::FormFieldData()
11 : max_length(0),
12 is_autofilled(false),
13 is_checked(false),
14 is_checkable(false),
15 is_focusable(false),
16 should_autocomplete(true) {
17 }
18
19 FormFieldData::~FormFieldData() {
20 }
21
22 bool FormFieldData::operator==(const FormFieldData& field) const {
23 // A FormFieldData stores a value, but the value is not part of the identity
24 // of the field, so we don't want to compare the values.
25 return (label == field.label &&
26 name == field.name &&
27 form_control_type == field.form_control_type &&
28 autocomplete_attribute == field.autocomplete_attribute &&
29 max_length == field.max_length);
30 }
31
32 bool FormFieldData::operator!=(const FormFieldData& field) const {
33 return !operator==(field);
34 }
35
36 bool FormFieldData::operator<(const FormFieldData& field) const {
37 if (label == field.label)
38 return name < field.name;
39
40 return label < field.label;
41 }
42
43 std::ostream& operator<<(std::ostream& os, const FormFieldData& field) {
44 return os
45 << UTF16ToUTF8(field.label)
46 << " "
47 << UTF16ToUTF8(field.name)
48 << " "
49 << UTF16ToUTF8(field.value)
50 << " "
51 << field.form_control_type
52 << " "
53 << field.autocomplete_attribute
54 << " "
55 << field.max_length
56 << " "
57 << (field.is_autofilled ? "true" : "false")
58 << " "
59 << (field.is_checked ? "true" : "false")
60 << " "
61 << (field.is_checkable ? "true" : "false")
62 << " "
63 << (field.is_focusable ? "true" : "false")
64 << " "
65 << (field.should_autocomplete ? "true" : "false");
66 }
OLDNEW
« no previous file with comments | « chrome/common/form_field_data.h ('k') | chrome/common/form_field_data_predictions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698