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

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

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 #ifndef COMPONENTS_AUTOFILL_COMMON_FORM_FIELD_DATA_H_
6 #define COMPONENTS_AUTOFILL_COMMON_FORM_FIELD_DATA_H_
7
8 #include <vector>
9
10 #include "base/i18n/rtl.h"
11 #include "base/strings/string16.h"
12
13 namespace autofill {
14
15 // Stores information about a field in a form.
16 struct FormFieldData {
17 FormFieldData();
18 ~FormFieldData();
19
20 // Equality tests for identity which does not include |value| or
21 // |is_autofilled|.
22 // TODO(dhollowa): These operators need to be revised when we implement field
23 // ids.
24 bool operator==(const FormFieldData& field) const;
25 bool operator!=(const FormFieldData& field) const;
26 // Comparison operator exposed for STL map. Uses label, then name to sort.
27 bool operator<(const FormFieldData& field) const;
28
29 base::string16 label;
30 base::string16 name;
31 base::string16 value;
32 std::string form_control_type;
33 std::string autocomplete_attribute;
34 size_t max_length;
35 bool is_autofilled;
36 bool is_checked;
37 bool is_checkable;
38 bool is_focusable;
39 bool should_autocomplete;
40 base::i18n::TextDirection text_direction;
41
42 // For the HTML snippet |<option value="US">United States</option>|, the
43 // value is "US" and the contents are "United States".
44 std::vector<base::string16> option_values;
45 std::vector<base::string16> option_contents;
46 };
47
48 // So we can compare FormFieldDatas with EXPECT_EQ().
49 std::ostream& operator<<(std::ostream& os, const FormFieldData& field);
50
51 // Prefer to use this macro in place of |EXPECT_EQ()| for comparing
52 // |FormFieldData|s in test code.
53 #define EXPECT_FORM_FIELD_DATA_EQUALS(expected, actual) \
54 do { \
55 EXPECT_EQ(expected.label, actual.label); \
56 EXPECT_EQ(expected.name, actual.name); \
57 EXPECT_EQ(expected.value, actual.value); \
58 EXPECT_EQ(expected.form_control_type, actual.form_control_type); \
59 EXPECT_EQ(expected.autocomplete_attribute, actual.autocomplete_attribute); \
60 EXPECT_EQ(expected.max_length, actual.max_length); \
61 EXPECT_EQ(expected.is_autofilled, actual.is_autofilled); \
62 EXPECT_EQ(expected.is_checked, actual.is_checked); \
63 EXPECT_EQ(expected.is_checkable, actual.is_checkable); \
64 } while (0)
65
66 } // namespace autofill
67
68 #endif // COMPONENTS_AUTOFILL_COMMON_FORM_FIELD_DATA_H_
69
OLDNEW
« no previous file with comments | « components/autofill/common/form_data_predictions.cc ('k') | components/autofill/common/form_field_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698