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

Side by Side Diff: chrome/browser/autofill/phone_number.h

Issue 7892048: Autofill: Remove fax number completely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_
6 #define CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ 6 #define CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 virtual bool SetCanonicalizedInfo(AutofillFieldType type, 42 virtual bool SetCanonicalizedInfo(AutofillFieldType type,
43 const string16& value) OVERRIDE; 43 const string16& value) OVERRIDE;
44 44
45 // Size and offset of the prefix and suffix portions of phone numbers. 45 // Size and offset of the prefix and suffix portions of phone numbers.
46 static const size_t kPrefixOffset = 0; 46 static const size_t kPrefixOffset = 0;
47 static const size_t kPrefixLength = 3; 47 static const size_t kPrefixLength = 3;
48 static const size_t kSuffixOffset = 3; 48 static const size_t kSuffixOffset = 3;
49 static const size_t kSuffixLength = 4; 49 static const size_t kSuffixLength = 4;
50 50
51 // The following functions should return the field type for each part of the 51 // The following functions should return the field type for each part of the
52 // phone number. Currently, these are either fax or home phone number types. 52 // phone number.
53 AutofillFieldType GetNumberType() const; 53 AutofillFieldType GetNumberType() const;
54 AutofillFieldType GetCityCodeType() const; 54 AutofillFieldType GetCityCodeType() const;
55 AutofillFieldType GetCountryCodeType() const; 55 AutofillFieldType GetCountryCodeType() const;
56 AutofillFieldType GetCityAndNumberType() const; 56 AutofillFieldType GetCityAndNumberType() const;
57 AutofillFieldType GetWholeNumberType() const; 57 AutofillFieldType GetWholeNumberType() const;
Ilya Sherman 2011/09/15 03:47:08 Let's just get rid of these, as well as the whole
James Hawkins 2011/09/16 03:23:28 Done.
58 58
59 // The class used to combine home phone or fax parts into a whole number. 59 // The class used to combine home phone parts into a whole number.
60 class PhoneCombineHelper { 60 class PhoneCombineHelper {
61 public: 61 public:
62 explicit PhoneCombineHelper(AutofillType::FieldTypeGroup phone_group); 62 explicit PhoneCombineHelper(AutofillType::FieldTypeGroup phone_group);
63 ~PhoneCombineHelper(); 63 ~PhoneCombineHelper();
64 64
65 // If |type| is a phone field type, saves the |value| accordingly and 65 // If |type| is a phone field type, saves the |value| accordingly and
66 // returns true. For all other field types returs false. 66 // returns true. For all other field types returs false.
67 bool SetInfo(AutofillFieldType type, const string16& value); 67 bool SetInfo(AutofillFieldType type, const string16& value);
68 68
69 // Returns true if parsing was successful, false otherwise. 69 // Returns true if parsing was successful, false otherwise.
70 bool ParseNumber(const std::string& locale, string16* value); 70 bool ParseNumber(const std::string& locale, string16* value);
71 71
72 // Returns true if both |phone_| and |whole_number_| are empty. 72 // Returns true if both |phone_| and |whole_number_| are empty.
73 bool IsEmpty() const; 73 bool IsEmpty() const;
74 74
75 private: 75 private:
76 string16 country_; 76 string16 country_;
77 string16 city_; 77 string16 city_;
78 string16 phone_; 78 string16 phone_;
79 string16 whole_number_; 79 string16 whole_number_;
80 AutofillType::FieldTypeGroup phone_group_; 80 AutofillType::FieldTypeGroup phone_group_;
Ilya Sherman 2011/09/15 03:47:08 There's no reason to store the |phone_group_| here
James Hawkins 2011/09/16 03:23:28 Done.
81 }; 81 };
82 82
83 private: 83 private:
84 FRIEND_TEST_ALL_PREFIXES(PhoneNumberTest, Matcher); 84 FRIEND_TEST_ALL_PREFIXES(PhoneNumberTest, Matcher);
85 85
86 // FormGroup: 86 // FormGroup:
87 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; 87 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE;
88 88
89 // Validates |number_| and translates it into digits-only format. 89 // Validates |number_| and translates it into digits-only format.
90 bool NormalizePhone(); 90 bool NormalizePhone();
91 91
92 // Returns the locale for this phone number, based on the |profile_|. 92 // Returns the locale for this phone number, based on the |profile_|.
93 std::string locale() const; 93 std::string locale() const;
94 94
95 // Updates the cached parsed number if the profile's locale has changed 95 // Updates the cached parsed number if the profile's locale has changed
96 // since the last time the cache was updated. 96 // since the last time the cache was updated.
97 void UpdateCacheIfNeeded() const; 97 void UpdateCacheIfNeeded() const;
98 98
99 // Phone group - currently it is PHONE_HOME and PHONE_FAX. 99 // Phone group - currently it is PHONE_HOME.
100 AutofillType::FieldTypeGroup phone_group_; 100 AutofillType::FieldTypeGroup phone_group_;
Ilya Sherman 2011/09/15 03:47:08 There's no reason to store the |phone_group_| here
James Hawkins 2011/09/16 03:23:28 Done.
101 // The phone number. 101 // The phone number.
102 string16 number_; 102 string16 number_;
103 // Profile which stores the locale used as hint when normalizing the number. 103 // Profile which stores the locale used as hint when normalizing the number.
104 AutofillProfile* profile_; // WEAK 104 AutofillProfile* profile_; // WEAK
105 105
106 // Cached number. 106 // Cached number.
107 mutable autofill_i18n::PhoneObject cached_parsed_phone_; 107 mutable autofill_i18n::PhoneObject cached_parsed_phone_;
108 }; 108 };
109 109
110 #endif // CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ 110 #endif // CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698