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

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

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

Powered by Google App Engine
This is Rietveld 408576698