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

Unified Diff: components/autofill/core/browser/autofill_field.cc

Issue 22040002: [Autofill] Add a separate enumeration for HTML field type hints. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add docs Created 7 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_field.cc
diff --git a/components/autofill/core/browser/autofill_field.cc b/components/autofill/core/browser/autofill_field.cc
index d5c7a017d6c32100c6b61afcaff9a0ecab4591a5..887d9d16a949daa064fba0c0c15454f9f66a095d 100644
--- a/components/autofill/core/browser/autofill_field.cc
+++ b/components/autofill/core/browser/autofill_field.cc
@@ -31,6 +31,8 @@ namespace autofill {
AutofillField::AutofillField()
: server_type_(NO_SERVER_DATA),
heuristic_type_(UNKNOWN_TYPE),
+ html_type_(HTML_TYPE_UNKNOWN),
+ html_mode_(HTML_MODE_NONE),
phone_part_(IGNORED) {
}
@@ -40,6 +42,8 @@ AutofillField::AutofillField(const FormFieldData& field,
unique_name_(unique_name),
server_type_(NO_SERVER_DATA),
heuristic_type_(UNKNOWN_TYPE),
+ html_type_(HTML_TYPE_UNKNOWN),
+ html_mode_(HTML_MODE_NONE),
phone_part_(IGNORED) {
}
@@ -65,7 +69,20 @@ void AutofillField::set_server_type(NativeFieldType type) {
server_type_ = type;
}
+void AutofillField::SetHtmlType(HtmlFieldType type, HtmlFieldMode mode) {
+ html_type_ = type;
+ html_mode_ = mode;
+
+ if (type == HTML_TYPE_TEL_LOCAL_PREFIX)
+ phone_part_ = AutofillField::PHONE_PREFIX;
+ else if (type == HTML_TYPE_TEL_LOCAL_SUFFIX)
+ phone_part_ = AutofillField::PHONE_SUFFIX;
+}
+
AutofillType AutofillField::Type() const {
+ if (html_type_ != HTML_TYPE_UNKNOWN)
+ return AutofillType(html_type_, html_mode_);
+
if (server_type_ != NO_SERVER_DATA)
return AutofillType(server_type_);
@@ -83,7 +100,7 @@ std::string AutofillField::FieldSignature() const {
}
bool AutofillField::IsFieldFillable() const {
- return Type().native_type() != UNKNOWN_TYPE;
+ return !Type().IsUnknown();
}
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698