diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-22 08:29:32 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-22 08:29:32 +0000 |
commit | fcfece45185268c1a55260a1d5c0abfbceaffe1f (patch) | |
tree | bab09f97a07ef8931e297f3801d792f0067ae407 /chrome/browser/autofill/contact_info.h | |
parent | b4291aefaf817107e62694d540c427a7d115bdea (diff) | |
download | chromium_src-fcfece45185268c1a55260a1d5c0abfbceaffe1f.zip chromium_src-fcfece45185268c1a55260a1d5c0abfbceaffe1f.tar.gz chromium_src-fcfece45185268c1a55260a1d5c0abfbceaffe1f.tar.bz2 |
Consolidate Autofill possible type detection code, and enforce greater match precision.
* Only consider submitted field values to match locally stored data if the strings match exactly
+ This means we will send fewer false positives to the server, at the cost of some false negatives. Most importantly, we should stop identifying ADDRESS_LINE_2 fields as ADDRESS_LINE_1.
+ There are a few excpetions for structured fields with canonicalized values, like countries (which are canonicalized to country codes)
* Eliminate FormGroup::GetMatchingTypes() -- all of this work is now done in a consistent way within AutofillManager
* Refactor FormGroup::GetNonEmptyTypes() to be shared code.
BUG=81867, 76992
TEST=unit_tests --gtest_filter=AutofillManagerTest.DeterminePossibleFieldTypesForUpload
Review URL: http://codereview.chromium.org/7398019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93582 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/contact_info.h')
-rw-r--r-- | chrome/browser/autofill/contact_info.h | 75 |
1 files changed, 17 insertions, 58 deletions
diff --git a/chrome/browser/autofill/contact_info.h b/chrome/browser/autofill/contact_info.h index 2d9d043..ac6ed2b 100644 --- a/chrome/browser/autofill/contact_info.h +++ b/chrome/browser/autofill/contact_info.h @@ -23,15 +23,15 @@ class NameInfo : public FormGroup { NameInfo& operator=(const NameInfo& info); // FormGroup: - virtual void GetMatchingTypes(const string16& text, - FieldTypeSet* matching_types) const; - virtual void GetNonEmptyTypes(FieldTypeSet* non_empty_types) const; - virtual string16 GetInfo(AutofillFieldType type) const; - virtual void SetInfo(AutofillFieldType type, const string16& value); + virtual string16 GetInfo(AutofillFieldType type) const OVERRIDE; + virtual void SetInfo(AutofillFieldType type, const string16& value) OVERRIDE; private: FRIEND_TEST_ALL_PREFIXES(NameInfoTest, TestSetFullName); + // FormGroup: + virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; + // Returns the full name, which can include up to the first, middle, and last // name. string16 FullName() const; @@ -44,51 +44,10 @@ class NameInfo : public FormGroup { const string16& middle() const { return middle_; } const string16& last() const { return last_; } - // Returns true if |text| is the first name. - bool IsFirstName(const string16& text) const; - - // Returns true if |text| is the middle name. - bool IsMiddleName(const string16& text) const; - - // Returns true if |text| is the last name. - bool IsLastName(const string16& text) const; - - // Returns true if |text| is the middle initial. - bool IsMiddleInitial(const string16& text) const; - - // Returns true if |text| is the last name. - bool IsFullName(const string16& text) const; - - // Returns true if all of the tokens in |text| match the tokens in - // |name_tokens|. - 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 std::vector<string16>& name_tokens) const; - - // Sets |first_| to |first| and |first_tokens_| to the set of tokens in - // |first|, made lowercase. - void SetFirst(const string16& first); - - // Sets |middle_| to |middle| and |middle_tokens_| to the set of tokens in - // |middle|, made lowercase. - void SetMiddle(const string16& middle); - - // Sets |last_| to |last| and |last_tokens_| to the set of tokens in |last|, - // made lowercase. - void SetLast(const string16& last); - - // Sets |first_|, |middle_|, |last_| and |*_tokens_| to the tokenized - // |full|. It is tokenized on a space only. + // Sets |first_|, |middle_|, and |last_| to the tokenized |full|. + // It is tokenized on a space only. void SetFullName(const string16& full); - // List of tokens in each part of the name. - std::vector<string16> first_tokens_; - std::vector<string16> middle_tokens_; - std::vector<string16> last_tokens_; - string16 first_; string16 middle_; string16 last_; @@ -103,13 +62,13 @@ class EmailInfo : public FormGroup { EmailInfo& operator=(const EmailInfo& info); // FormGroup: - virtual void GetMatchingTypes(const string16& text, - FieldTypeSet* matching_types) const; - virtual void GetNonEmptyTypes(FieldTypeSet* non_empty_types) const; - virtual string16 GetInfo(AutofillFieldType type) const; - virtual void SetInfo(AutofillFieldType type, const string16& value); + virtual string16 GetInfo(AutofillFieldType type) const OVERRIDE; + virtual void SetInfo(AutofillFieldType type, const string16& value) OVERRIDE; private: + // FormGroup: + virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; + string16 email_; }; @@ -122,13 +81,13 @@ class CompanyInfo : public FormGroup { CompanyInfo& operator=(const CompanyInfo& info); // FormGroup: - virtual void GetMatchingTypes(const string16& text, - FieldTypeSet* matching_types) const; - virtual void GetNonEmptyTypes(FieldTypeSet* non_empty_types) const; - virtual string16 GetInfo(AutofillFieldType type) const; - virtual void SetInfo(AutofillFieldType type, const string16& value); + virtual string16 GetInfo(AutofillFieldType type) const OVERRIDE; + virtual void SetInfo(AutofillFieldType type, const string16& value) OVERRIDE; private: + // FormGroup: + virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; + string16 company_name_; }; |