OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/gtest_prod_util.h" | |
12 #include "chrome/browser/autofill/form_group.h" | 13 #include "chrome/browser/autofill/form_group.h" |
13 | 14 |
14 // A form group that stores phone number information. | 15 // A form group that stores phone number information. |
15 class PhoneNumber : public FormGroup { | 16 class PhoneNumber : public FormGroup { |
16 public: | 17 public: |
17 PhoneNumber(); | 18 PhoneNumber(); |
18 virtual ~PhoneNumber(); | 19 virtual ~PhoneNumber(); |
19 | 20 |
20 // FormGroup implementation: | 21 // FormGroup implementation: |
21 virtual FormGroup* Clone() const = 0; | 22 virtual FormGroup* Clone() const = 0; |
(...skipping 19 matching lines...) Expand all Loading... | |
41 // Size and offset of the prefix and suffix portions of phone numbers. | 42 // Size and offset of the prefix and suffix portions of phone numbers. |
42 static const int kPrefixOffset = 0; | 43 static const int kPrefixOffset = 0; |
43 static const int kPrefixLength = 3; | 44 static const int kPrefixLength = 3; |
44 static const int kSuffixOffset = 3; | 45 static const int kSuffixOffset = 3; |
45 static const int kSuffixLength = 4; | 46 static const int kSuffixLength = 4; |
46 | 47 |
47 protected: | 48 protected: |
48 explicit PhoneNumber(const PhoneNumber& phone_number); | 49 explicit PhoneNumber(const PhoneNumber& phone_number); |
49 | 50 |
50 private: | 51 private: |
51 // For test. | 52 FRIEND_TEST(PhoneNumberTest, Matcher); |
dhollowa
2010/12/12 06:55:32
FRIEND_TEST_ALL_PREFIXES
| |
52 friend class PhoneNumberTest; | |
53 | 53 |
54 void operator=(const PhoneNumber& phone_number); | 54 void operator=(const PhoneNumber& phone_number); |
55 | 55 |
56 const string16& country_code() const { return country_code_; } | 56 const string16& country_code() const { return country_code_; } |
57 const string16& city_code() const { return city_code_; } | 57 const string16& city_code() const { return city_code_; } |
58 const string16& number() const { return number_; } | 58 const string16& number() const { return number_; } |
59 const string16& extension() const { return extension_; } | 59 const string16& extension() const { return extension_; } |
60 string16 CityAndNumber() const { return city_code_ + number_; } | 60 string16 CityAndNumber() const { return city_code_ + number_; } |
61 | 61 |
62 // Returns the entire phone number as a string, without punctuation. | 62 // Returns the entire phone number as a string, without punctuation. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 static void StripPunctuation(string16* number); | 99 static void StripPunctuation(string16* number); |
100 | 100 |
101 // The pieces of the phone number. | 101 // The pieces of the phone number. |
102 string16 country_code_; | 102 string16 country_code_; |
103 string16 city_code_; // city or area code. | 103 string16 city_code_; // city or area code. |
104 string16 number_; | 104 string16 number_; |
105 string16 extension_; | 105 string16 extension_; |
106 }; | 106 }; |
107 | 107 |
108 #endif // CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ | 108 #endif // CHROME_BROWSER_AUTOFILL_PHONE_NUMBER_H_ |
OLD | NEW |