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

Unified Diff: chrome/browser/autofill/contact_info.h

Issue 6650014: Autofill extend profiles to include multi-valued fields, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 9 years, 9 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
« no previous file with comments | « chrome/browser/autofill/autofill_type_unittest.cc ('k') | chrome/browser/autofill/contact_info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..22c618a6e5491e13b881d3a345280a8a294f1797 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;
+ // FormGroup:
virtual void GetPossibleFieldTypes(const string16& text,
FieldTypeSet* possible_types) const;
virtual void GetAvailableFieldTypes(FieldTypeSet* available_types) const;
@@ -31,12 +32,10 @@ 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);
+ FRIEND_TEST_ALL_PREFIXES(NameInfoTest, TestSetFullName);
- // Returns the full name, which can include up to the first, middle, middle
- // initial, last name, and suffix.
+ // Returns the full name, which can include up to the first, middle, and last
+ // name.
string16 FullName() const;
// Returns the middle initial if |middle_| is non-empty. Returns an empty
@@ -46,9 +45,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 +61,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;
@@ -76,10 +69,12 @@ class ContactInfo : public FormGroup {
// Returns true if all of the tokens in |text| match the tokens in
// |name_tokens|.
- bool IsNameMatch(const string16& text, const NameTokens& name_tokens) const;
+ bool IsNameMatch(const string16& text,
+ const std::vector<string16>& name_tokens) const;
// Returns true if |word| is one of the tokens in |name_tokens|.
- bool IsWordInName(const string16& word, const NameTokens& name_tokens) const;
+ bool IsWordInName(const string16& word,
+ const std::vector<string16>& name_tokens) const;
// Sets |first_| to |first| and |first_tokens_| to the set of tokens in
// |first|, made lowercase.
@@ -97,19 +92,57 @@ 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_;
+ std::vector<string16> first_tokens_;
+ std::vector<string16> middle_tokens_;
+ std::vector<string16> 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:
+ 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:
string16 email_;
+};
+
+class CompanyInfo : public FormGroup {
+ public:
+ CompanyInfo();
+ explicit CompanyInfo(const CompanyInfo& info);
+ virtual ~CompanyInfo();
+
+ CompanyInfo& operator=(const CompanyInfo& info);
+
+ // FormGroup:
+ 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:
string16 company_name_;
};
« no previous file with comments | « chrome/browser/autofill/autofill_type_unittest.cc ('k') | chrome/browser/autofill/contact_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698