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: chrome/browser/autofill/autofill_field.h

Issue 12434004: Move remaining Autofill code to //components/autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix long lines 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/string16.h"
12 #include "chrome/browser/autofill/field_types.h"
13 #include "components/autofill/common/form_field_data.h"
14
15 class AutofillField : public FormFieldData {
16 public:
17 enum PhonePart {
18 IGNORED = 0,
19 PHONE_PREFIX = 1,
20 PHONE_SUFFIX = 2,
21 };
22
23 AutofillField();
24 AutofillField(const FormFieldData& field, const string16& unique_name);
25 virtual ~AutofillField();
26
27 const string16& unique_name() const { return unique_name_; }
28
29 const std::string& section() const { return section_; }
30 AutofillFieldType heuristic_type() const { return heuristic_type_; }
31 AutofillFieldType server_type() const { return server_type_; }
32 const FieldTypeSet& possible_types() const { return possible_types_; }
33 PhonePart phone_part() const { return phone_part_; }
34
35 // Sets the heuristic type of this field, validating the input.
36 void set_section(const std::string& section) { section_ = section; }
37 void set_heuristic_type(AutofillFieldType type);
38 void set_server_type(AutofillFieldType type);
39 void set_possible_types(const FieldTypeSet& possible_types) {
40 possible_types_ = possible_types;
41 }
42 void set_phone_part(PhonePart part) { phone_part_ = part; }
43
44 // This function automatically chooses between server and heuristic autofill
45 // type, depending on the data available.
46 AutofillFieldType type() const;
47
48 // Returns true if the value of this field is empty.
49 bool IsEmpty() const;
50
51 // The unique signature of this field, composed of the field name and the html
52 // input type in a 32-bit hash.
53 std::string FieldSignature() const;
54
55 // Returns true if the field type has been determined (without the text in the
56 // field).
57 bool IsFieldFillable() const;
58
59 void set_default_value(const std::string& value) { default_value_ = value; }
60 const std::string& default_value() const { return default_value_; }
61
62 private:
63 // The unique name of this field, generated by Autofill.
64 string16 unique_name_;
65
66 // The unique identifier for the section (e.g. billing vs. shipping address)
67 // that this field belongs to.
68 std::string section_;
69
70 // The type of the field, as determined by the Autofill server.
71 AutofillFieldType server_type_;
72
73 // The type of the field, as determined by the local heuristics.
74 AutofillFieldType heuristic_type_;
75
76 // The set of possible types for this field.
77 FieldTypeSet possible_types_;
78
79 // Used to track whether this field is a phone prefix or suffix.
80 PhonePart phone_part_;
81
82 // The default value returned by the Autofill server.
83 std::string default_value_;
84
85 DISALLOW_COPY_AND_ASSIGN(AutofillField);
86 };
87
88 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_external_delegate_unittest.cc ('k') | chrome/browser/autofill/autofill_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698