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 #include "chrome/browser/autofill/autofill_field.h" | 5 #include "chrome/browser/autofill/autofill_field.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 : FormFieldData(field), | 36 : FormFieldData(field), |
37 unique_name_(unique_name), | 37 unique_name_(unique_name), |
38 server_type_(NO_SERVER_DATA), | 38 server_type_(NO_SERVER_DATA), |
39 heuristic_type_(UNKNOWN_TYPE), | 39 heuristic_type_(UNKNOWN_TYPE), |
40 phone_part_(IGNORED) { | 40 phone_part_(IGNORED) { |
41 } | 41 } |
42 | 42 |
43 AutofillField::~AutofillField() {} | 43 AutofillField::~AutofillField() {} |
44 | 44 |
45 void AutofillField::set_heuristic_type(AutofillFieldType type) { | 45 void AutofillField::set_heuristic_type(AutofillFieldType type) { |
46 if (type >= 0 && type < MAX_VALID_FIELD_TYPE) { | 46 if (type >= 0 && type < MAX_VALID_FIELD_TYPE && |
| 47 type != FIELD_WITH_DEFAULT_VALUE) { |
47 heuristic_type_ = type; | 48 heuristic_type_ = type; |
48 } else { | 49 } else { |
49 NOTREACHED(); | 50 NOTREACHED(); |
50 // This case should not be reachable; but since this has potential | 51 // This case should not be reachable; but since this has potential |
51 // implications on data uploaded to the server, better safe than sorry. | 52 // implications on data uploaded to the server, better safe than sorry. |
52 heuristic_type_ = UNKNOWN_TYPE; | 53 heuristic_type_ = UNKNOWN_TYPE; |
53 } | 54 } |
54 } | 55 } |
55 | 56 |
56 void AutofillField::set_server_type(AutofillFieldType type) { | 57 void AutofillField::set_server_type(AutofillFieldType type) { |
(...skipping 17 matching lines...) Expand all Loading... |
74 | 75 |
75 std::string AutofillField::FieldSignature() const { | 76 std::string AutofillField::FieldSignature() const { |
76 std::string field_name = UTF16ToUTF8(name); | 77 std::string field_name = UTF16ToUTF8(name); |
77 std::string field_string = field_name + "&" + form_control_type; | 78 std::string field_string = field_name + "&" + form_control_type; |
78 return Hash32Bit(field_string); | 79 return Hash32Bit(field_string); |
79 } | 80 } |
80 | 81 |
81 bool AutofillField::IsFieldFillable() const { | 82 bool AutofillField::IsFieldFillable() const { |
82 return type() != UNKNOWN_TYPE; | 83 return type() != UNKNOWN_TYPE; |
83 } | 84 } |
OLD | NEW |