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

Side by Side Diff: chrome/browser/autofill/autofill_field.h

Issue 7613015: Add preliminary Autofill support for 'autocompletetype' sections. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup Created 9 years, 4 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/autofill/field_types.h" 13 #include "chrome/browser/autofill/field_types.h"
14 #include "webkit/glue/form_field.h" 14 #include "webkit/glue/form_field.h"
15 15
16 class AutofillField : public webkit_glue::FormField { 16 class AutofillField : public webkit_glue::FormField {
17 public: 17 public:
18 AutofillField(); 18 AutofillField();
19 AutofillField(const webkit_glue::FormField& field, 19 AutofillField(const webkit_glue::FormField& field,
20 const string16& unique_name); 20 const string16& unique_name);
21 virtual ~AutofillField(); 21 virtual ~AutofillField();
22 22
23 const string16& unique_name() const { return unique_name_; } 23 const string16& unique_name() const { return unique_name_; }
24 24
25 const string16& section() const { return section_; }
25 AutofillFieldType heuristic_type() const { return heuristic_type_; } 26 AutofillFieldType heuristic_type() const { return heuristic_type_; }
26 AutofillFieldType server_type() const { return server_type_; } 27 AutofillFieldType server_type() const { return server_type_; }
27 const FieldTypeSet& possible_types() const { return possible_types_; } 28 const FieldTypeSet& possible_types() const { return possible_types_; }
28 29
29 // Sets the heuristic type of this field, validating the input. 30 // Sets the heuristic type of this field, validating the input.
31 void set_section(const string16& section) { section_ = section; }
30 void set_heuristic_type(AutofillFieldType type); 32 void set_heuristic_type(AutofillFieldType type);
31 void set_server_type(AutofillFieldType type) { server_type_ = type; } 33 void set_server_type(AutofillFieldType type) { server_type_ = type; }
32 void set_possible_types(const FieldTypeSet& possible_types) { 34 void set_possible_types(const FieldTypeSet& possible_types) {
33 possible_types_ = possible_types; 35 possible_types_ = possible_types;
34 } 36 }
35 37
36 // This function automatically chooses between server and heuristic autofill 38 // This function automatically chooses between server and heuristic autofill
37 // type, depending on the data available. 39 // type, depending on the data available.
38 AutofillFieldType type() const; 40 AutofillFieldType type() const;
39 41
40 // Returns true if the value of this field is empty. 42 // Returns true if the value of this field is empty.
41 bool IsEmpty() const; 43 bool IsEmpty() const;
42 44
43 // The unique signature of this field, composed of the field name and the html 45 // The unique signature of this field, composed of the field name and the html
44 // input type in a 32-bit hash. 46 // input type in a 32-bit hash.
45 std::string FieldSignature() const; 47 std::string FieldSignature() const;
46 48
47 // Returns true if the field type has been determined (without the text in the 49 // Returns true if the field type has been determined (without the text in the
48 // field). 50 // field).
49 bool IsFieldFillable() const; 51 bool IsFieldFillable() const;
50 52
51 private: 53 private:
52 // The unique name of this field, generated by Autofill. 54 // The unique name of this field, generated by Autofill.
53 string16 unique_name_; 55 string16 unique_name_;
54 56
57 // The unique identifier for the section (e.g. billing vs. shipping address)
58 // that this field belongs to.
59 string16 section_;
60
55 // The type of the field, as determined by the Autofill server. 61 // The type of the field, as determined by the Autofill server.
56 AutofillFieldType server_type_; 62 AutofillFieldType server_type_;
57 63
58 // The type of the field, as determined by the local heuristics. 64 // The type of the field, as determined by the local heuristics.
59 AutofillFieldType heuristic_type_; 65 AutofillFieldType heuristic_type_;
60 66
61 // The set of possible types for this field. 67 // The set of possible types for this field.
62 FieldTypeSet possible_types_; 68 FieldTypeSet possible_types_;
63 69
64 DISALLOW_COPY_AND_ASSIGN(AutofillField); 70 DISALLOW_COPY_AND_ASSIGN(AutofillField);
65 }; 71 };
66 72
67 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_ 73 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_manager.h » ('j') | chrome/browser/autofill/autofill_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698