| OLD | NEW |
| 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/string16.h" | 11 #include "base/string16.h" |
| 12 #include "chrome/browser/autofill/field_types.h" | 12 #include "chrome/browser/autofill/field_types.h" |
| 13 #include "webkit/glue/form_field.h" | 13 #include "webkit/glue/form_field.h" |
| 14 | 14 |
| 15 class AutofillField : public webkit_glue::FormField { | 15 class AutofillField : public webkit_glue::FormField { |
| 16 public: | 16 public: |
| 17 AutofillField(); | 17 AutofillField(); |
| 18 AutofillField(const webkit_glue::FormField& field, | 18 AutofillField(const webkit_glue::FormField& field, |
| 19 const string16& unique_name); | 19 const string16& unique_name); |
| 20 virtual ~AutofillField(); | 20 virtual ~AutofillField(); |
| 21 | 21 |
| 22 const string16& unique_name() const { return unique_name_; } | 22 const string16& unique_name() const { return unique_name_; } |
| 23 | 23 |
| 24 AutofillFieldType heuristic_type() const { return heuristic_type_; } | 24 AutofillFieldType heuristic_type() const { return heuristic_type_; } |
| 25 AutofillFieldType server_type() const { return server_type_; } | 25 AutofillFieldType server_type() const { return server_type_; } |
| 26 const FieldTypeSet& possible_types() const { return possible_types_; } | 26 const FieldTypeSet& possible_types() const { return possible_types_; } |
| 27 | 27 |
| 28 // Sets the heuristic type of this field, validating the input. | 28 // Sets the heuristic type of this field, validating the input. |
| 29 void set_heuristic_type(const AutofillFieldType& type); | 29 void set_heuristic_type(AutofillFieldType type); |
| 30 void set_server_type(const AutofillFieldType& type) { server_type_ = type; } | 30 void set_server_type(AutofillFieldType type) { server_type_ = type; } |
| 31 void set_possible_types(const FieldTypeSet& possible_types) { | 31 void set_possible_types(const FieldTypeSet& possible_types) { |
| 32 possible_types_ = possible_types; | 32 possible_types_ = possible_types; |
| 33 } | 33 } |
| 34 | 34 |
| 35 // This function automatically chooses between server and heuristic autofill | 35 // This function automatically chooses between server and heuristic autofill |
| 36 // type, depending on the data available. | 36 // type, depending on the data available. |
| 37 AutofillFieldType type() const; | 37 AutofillFieldType type() const; |
| 38 | 38 |
| 39 // Returns true if the value of this field is empty. | 39 // Returns true if the value of this field is empty. |
| 40 bool IsEmpty() const; | 40 bool IsEmpty() const; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 57 // The type of the field, as determined by the local heuristics. | 57 // The type of the field, as determined by the local heuristics. |
| 58 AutofillFieldType heuristic_type_; | 58 AutofillFieldType heuristic_type_; |
| 59 | 59 |
| 60 // The set of possible types for this field. | 60 // The set of possible types for this field. |
| 61 FieldTypeSet possible_types_; | 61 FieldTypeSet possible_types_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(AutofillField); | 63 DISALLOW_COPY_AND_ASSIGN(AutofillField); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_ | 66 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_FIELD_H_ |
| OLD | NEW |