Index: chrome/browser/autofill/contact_info.h |
diff --git a/chrome/browser/autofill/contact_info.h b/chrome/browser/autofill/contact_info.h |
index d743630674abaf604397f28a7d1076f1e4859361..f08583d3203823b6aa3155b283c92c413abb959b 100644 |
--- a/chrome/browser/autofill/contact_info.h |
+++ b/chrome/browser/autofill/contact_info.h |
@@ -8,19 +8,20 @@ |
#include <vector> |
+#include "base/gtest_prod_util.h" |
#include "base/string16.h" |
#include "chrome/browser/autofill/form_group.h" |
-typedef std::vector<string16> NameTokens; |
- |
-// A form group that stores contact information. |
-class ContactInfo : public FormGroup { |
+// A form group that stores name information. |
+class NameInfo : public FormGroup { |
public: |
- ContactInfo(); |
- virtual ~ContactInfo(); |
+ NameInfo(); |
+ explicit NameInfo(const NameInfo& info); |
+ virtual ~NameInfo(); |
+ |
+ NameInfo& operator=(const NameInfo& info); |
// FormGroup implementation: |
- virtual FormGroup* Clone() const; |
virtual void GetPossibleFieldTypes(const string16& text, |
FieldTypeSet* possible_types) const; |
virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; |
@@ -31,12 +32,12 @@ class ContactInfo : public FormGroup { |
virtual void SetInfo(const AutofillType& type, const string16& value); |
private: |
- friend class ContactInfoTest; |
- explicit ContactInfo(const ContactInfo& contact_info); |
- void operator=(const ContactInfo& info); |
+ typedef std::vector<string16> NameTokens; |
Ilya Sherman
2011/03/09 00:50:50
I don't think this typedef helps readability at al
dhollowa
2011/03/09 01:55:47
Done.
|
+ |
+ FRIEND_TEST_ALL_PREFIXES(NameInfoTest, TestSetFullName); |
// Returns the full name, which can include up to the first, middle, middle |
- // initial, last name, and suffix. |
+ // initial, and last name. |
Ilya Sherman
2011/03/09 00:50:50
What does "middle, middle initial" mean? Presumab
dhollowa
2011/03/09 01:55:47
Done.
|
string16 FullName() const; |
// Returns the middle initial if |middle_| is non-empty. Returns an empty |
@@ -46,9 +47,6 @@ class ContactInfo : public FormGroup { |
const string16& first() const { return first_; } |
const string16& middle() const { return middle_; } |
const string16& last() const { return last_; } |
- const string16& suffix() const { return suffix_; } |
- const string16& email() const { return email_; } |
- const string16& company_name() const { return company_name_; } |
// A helper function for FindInfoMatches that only handles matching the info |
// with the requested field type. |
@@ -65,9 +63,6 @@ class ContactInfo : public FormGroup { |
// Returns true if |text| is the last name. |
bool IsLastName(const string16& text) const; |
- // Returns true if |text| is the suffix. |
- bool IsSuffix(const string16& text) const; |
- |
// Returns true if |text| is the middle initial. |
bool IsMiddleInitial(const string16& text) const; |
@@ -97,19 +92,72 @@ class ContactInfo : public FormGroup { |
// |full|. It is tokenized on a space only. |
void SetFullName(const string16& full); |
- void set_suffix(const string16& suffix) { suffix_ = suffix; } |
- |
// List of tokens in each part of the name. |
NameTokens first_tokens_; |
NameTokens middle_tokens_; |
NameTokens last_tokens_; |
- // Contact information data. |
string16 first_; |
string16 middle_; |
string16 last_; |
- string16 suffix_; |
+}; |
+ |
+class EmailInfo : public FormGroup { |
+ public: |
+ EmailInfo(); |
+ explicit EmailInfo(const EmailInfo& info); |
+ virtual ~EmailInfo(); |
+ |
+ EmailInfo& operator=(const EmailInfo& info); |
+ |
+ // FormGroup implementation: |
+ virtual void GetPossibleFieldTypes(const string16& text, |
+ FieldTypeSet* possible_types) const; |
+ virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; |
+ virtual void FindInfoMatches(const AutofillType& type, |
+ const string16& info, |
+ std::vector<string16>* matched_text) const; |
+ virtual string16 GetFieldText(const AutofillType& type) const; |
+ virtual void SetInfo(const AutofillType& type, const string16& value); |
+ |
+ private: |
+ const string16& email() const { return email_; } |
+ |
+ // A helper function for FindInfoMatches that only handles matching the info |
+ // with the requested field type. |
+ bool FindInfoMatchesHelper(const AutofillFieldType& field_type, |
+ const string16& info, |
+ string16* matched_text) const; |
+ |
string16 email_; |
+}; |
+ |
+class CompanyInfo : public FormGroup { |
+ public: |
+ CompanyInfo(); |
+ explicit CompanyInfo(const CompanyInfo& info); |
+ virtual ~CompanyInfo(); |
+ |
+ CompanyInfo& operator=(const CompanyInfo& info); |
+ |
+ // FormGroup implementation: |
Ilya Sherman
2011/03/09 00:50:50
nit: I thought we were dropping the " implementati
dhollowa
2011/03/09 01:55:47
Done. Here and in AutoFillProfile.
|
+ virtual void GetPossibleFieldTypes(const string16& text, |
+ FieldTypeSet* possible_types) const; |
+ virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const; |
+ virtual void FindInfoMatches(const AutofillType& type, |
+ const string16& info, |
+ std::vector<string16>* matched_text) const; |
+ virtual string16 GetFieldText(const AutofillType& type) const; |
+ virtual void SetInfo(const AutofillType& type, const string16& value); |
+ |
+ private: |
+ const string16& company_name() const { return company_name_; } |
+ |
+ // A helper function for FindInfoMatches that only handles matching the info |
+ // with the requested field type. |
+ bool FindInfoMatchesHelper(const AutofillFieldType& field_type, |
+ const string16& info, |
+ string16* matched_text) const; |
string16 company_name_; |
}; |