OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_ADDRESS_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_ADDRESS_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_ADDRESS_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_ADDRESS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "components/autofill/core/browser/phone_number_i18n.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class DictionaryValue; | 16 class DictionaryValue; |
16 } | 17 } |
17 | 18 |
18 namespace autofill { | 19 namespace autofill { |
19 | 20 |
20 class AutofillProfile; | 21 class AutofillProfile; |
21 class AutofillType; | 22 class AutofillType; |
22 | 23 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 scoped_ptr<base::DictionaryValue> ToDictionaryWithoutID() const; | 84 scoped_ptr<base::DictionaryValue> ToDictionaryWithoutID() const; |
84 | 85 |
85 // Returns a string that summarizes this address, suitable for display to | 86 // Returns a string that summarizes this address, suitable for display to |
86 // the user. | 87 // the user. |
87 base::string16 DisplayName() const; | 88 base::string16 DisplayName() const; |
88 | 89 |
89 // Returns a string that could be used as a sub-label, suitable for display | 90 // Returns a string that could be used as a sub-label, suitable for display |
90 // to the user together with DisplayName(). | 91 // to the user together with DisplayName(). |
91 base::string16 DisplayNameDetail() const; | 92 base::string16 DisplayNameDetail() const; |
92 | 93 |
| 94 // Returns the phone number as a string that is suitable for display to the |
| 95 // user. |
| 96 base::string16 DisplayPhoneNumber() const; |
| 97 |
93 // Returns data appropriate for |type|. | 98 // Returns data appropriate for |type|. |
94 base::string16 GetInfo(const AutofillType& type, | 99 base::string16 GetInfo(const AutofillType& type, |
95 const std::string& app_locale) const; | 100 const std::string& app_locale) const; |
96 | 101 |
97 const std::string& country_name_code() const { return country_name_code_; } | 102 const std::string& country_name_code() const { return country_name_code_; } |
98 const base::string16& recipient_name() const { return recipient_name_; } | 103 const base::string16& recipient_name() const { return recipient_name_; } |
99 const base::string16& address_line_1() const { return address_line_1_; } | 104 const base::string16& address_line_1() const { return address_line_1_; } |
100 const base::string16& address_line_2() const { return address_line_2_; } | 105 const base::string16& address_line_2() const { return address_line_2_; } |
101 const base::string16& locality_name() const { return locality_name_; } | 106 const base::string16& locality_name() const { return locality_name_; } |
102 const base::string16& administrative_area_name() const { | 107 const base::string16& administrative_area_name() const { |
(...skipping 23 matching lines...) Expand all Loading... |
126 void set_locality_name(const base::string16& locality_name) { | 131 void set_locality_name(const base::string16& locality_name) { |
127 locality_name_ = locality_name; | 132 locality_name_ = locality_name; |
128 } | 133 } |
129 void set_administrative_area_name( | 134 void set_administrative_area_name( |
130 const base::string16& administrative_area_name) { | 135 const base::string16& administrative_area_name) { |
131 administrative_area_name_ = administrative_area_name; | 136 administrative_area_name_ = administrative_area_name; |
132 } | 137 } |
133 void set_postal_code_number(const base::string16& postal_code_number) { | 138 void set_postal_code_number(const base::string16& postal_code_number) { |
134 postal_code_number_ = postal_code_number; | 139 postal_code_number_ = postal_code_number; |
135 } | 140 } |
136 void set_phone_number(const base::string16& phone_number) { | 141 void SetPhoneNumber(const base::string16& phone_number); |
137 phone_number_ = phone_number; | |
138 } | |
139 void set_object_id(const std::string& object_id) { | 142 void set_object_id(const std::string& object_id) { |
140 object_id_ = object_id; | 143 object_id_ = object_id; |
141 } | 144 } |
142 void set_is_complete_address(bool is_complete_address) { | 145 void set_is_complete_address(bool is_complete_address) { |
143 is_complete_address_ = is_complete_address; | 146 is_complete_address_ = is_complete_address; |
144 } | 147 } |
145 | 148 |
146 // Tests if this address exact matches |other|. |object_id| is ignored. | 149 // Tests if this address exact matches |other|. |object_id| is ignored. |
147 bool EqualsIgnoreID(const Address& other) const; | 150 bool EqualsIgnoreID(const Address& other) const; |
148 | 151 |
(...skipping 29 matching lines...) Expand all Loading... |
178 | 181 |
179 // Despite the name, |postal_code_number_| values are frequently alphanumeric. | 182 // Despite the name, |postal_code_number_| values are frequently alphanumeric. |
180 // Examples: "94043", "SW1W", "SW1W 9TQ". | 183 // Examples: "94043", "SW1W", "SW1W 9TQ". |
181 base::string16 postal_code_number_; | 184 base::string16 postal_code_number_; |
182 | 185 |
183 // A valid international phone number. If |phone_number_| is a user provided | 186 // A valid international phone number. If |phone_number_| is a user provided |
184 // value, it should have been validated using libphonenumber by clients of | 187 // value, it should have been validated using libphonenumber by clients of |
185 // this class before being set; see http://code.google.com/p/libphonenumber/. | 188 // this class before being set; see http://code.google.com/p/libphonenumber/. |
186 base::string16 phone_number_; | 189 base::string16 phone_number_; |
187 | 190 |
| 191 // The parsed phone number. |
| 192 i18n::PhoneObject phone_object_; |
| 193 |
188 // Externalized Online Wallet id for this address. | 194 // Externalized Online Wallet id for this address. |
189 std::string object_id_; | 195 std::string object_id_; |
190 | 196 |
191 // Server's understanding of this address as complete address or not. | 197 // Server's understanding of this address as complete address or not. |
192 bool is_complete_address_; | 198 bool is_complete_address_; |
193 | 199 |
194 // This class is intentionally copyable. | 200 // This class is intentionally copyable. |
195 DISALLOW_ASSIGN(Address); | 201 DISALLOW_ASSIGN(Address); |
196 }; | 202 }; |
197 | 203 |
198 } // namespace wallet | 204 } // namespace wallet |
199 } // namespace autofill | 205 } // namespace autofill |
200 | 206 |
201 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_ADDRESS_H_ | 207 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_WALLET_ADDRESS_H_ |
OLD | NEW |