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

Side by Side Diff: components/autofill/browser/wallet/wallet_address.h

Issue 13973004: Convert string16 -> base::string16 in components/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_WALLET_WALLET_ADDRESS_H_ 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ADDRESS_H_
6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ADDRESS_H_ 6 #define COMPONENTS_AUTOFILL_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"
(...skipping 24 matching lines...) Expand all
35 // TODO(ahutter): Use additional fields (descriptive_name, is_post_box, 35 // TODO(ahutter): Use additional fields (descriptive_name, is_post_box,
36 // is_minimal_address, is_valid, is_default) when SaveToWallet is implemented. 36 // is_minimal_address, is_valid, is_default) when SaveToWallet is implemented.
37 // See http://crbug.com/164284. 37 // See http://crbug.com/164284.
38 38
39 Address(); 39 Address();
40 40
41 // Using the raw info in |profile|, create a wallet::Address. 41 // Using the raw info in |profile|, create a wallet::Address.
42 explicit Address(const AutofillProfile& profile); 42 explicit Address(const AutofillProfile& profile);
43 43
44 Address(const std::string& country_name_code, 44 Address(const std::string& country_name_code,
45 const string16& recipient_name, 45 const base::string16& recipient_name,
46 const string16& address_line_1, 46 const base::string16& address_line_1,
47 const string16& address_line_2, 47 const base::string16& address_line_2,
48 const string16& locality_name, 48 const base::string16& locality_name,
49 const string16& administrative_area_name, 49 const base::string16& administrative_area_name,
50 const string16& postal_code_number, 50 const base::string16& postal_code_number,
51 const string16& phone_number, 51 const base::string16& phone_number,
52 const std::string& object_id); 52 const std::string& object_id);
53 53
54 ~Address(); 54 ~Address();
55 55
56 // Returns an empty scoped_ptr if input is invalid or a valid address that is 56 // Returns an empty scoped_ptr if input is invalid or a valid address that is
57 // selectable for Google Wallet use. Does not require "id" in |dictionary|. 57 // selectable for Google Wallet use. Does not require "id" in |dictionary|.
58 // IDs are not required for billing addresses. 58 // IDs are not required for billing addresses.
59 static scoped_ptr<Address> CreateAddress( 59 static scoped_ptr<Address> CreateAddress(
60 const base::DictionaryValue& dictionary); 60 const base::DictionaryValue& dictionary);
61 61
(...skipping 12 matching lines...) Expand all
74 // different format and with a few additional fields set, most importantly 74 // different format and with a few additional fields set, most importantly
75 // |object_id_|. 75 // |object_id_|.
76 scoped_ptr<base::DictionaryValue> ToDictionaryWithID() const; 76 scoped_ptr<base::DictionaryValue> ToDictionaryWithID() const;
77 77
78 // Newly created addresses will not have an associated |object_id_| and are 78 // Newly created addresses will not have an associated |object_id_| and are
79 // sent to the server in a slightly different format. 79 // sent to the server in a slightly different format.
80 scoped_ptr<base::DictionaryValue> ToDictionaryWithoutID() const; 80 scoped_ptr<base::DictionaryValue> ToDictionaryWithoutID() const;
81 81
82 // Returns a string that summarizes this address, suitable for display to 82 // Returns a string that summarizes this address, suitable for display to
83 // the user. 83 // the user.
84 string16 DisplayName() const; 84 base::string16 DisplayName() const;
85 85
86 // Returns a string that could be used as a sub-label, suitable for display 86 // Returns a string that could be used as a sub-label, suitable for display
87 // to the user together with DisplayName(). 87 // to the user together with DisplayName().
88 string16 DisplayNameDetail() const; 88 base::string16 DisplayNameDetail() const;
89 89
90 // Returns data appropriate for |type|. 90 // Returns data appropriate for |type|.
91 string16 GetInfo(AutofillFieldType type, 91 base::string16 GetInfo(AutofillFieldType type,
92 const std::string& app_locale) const; 92 const std::string& app_locale) const;
93 93
94 const std::string& country_name_code() const { return country_name_code_; } 94 const std::string& country_name_code() const { return country_name_code_; }
95 const string16& recipient_name() const { return recipient_name_; } 95 const base::string16& recipient_name() const { return recipient_name_; }
96 const string16& address_line_1() const { return address_line_1_; } 96 const base::string16& address_line_1() const { return address_line_1_; }
97 const string16& address_line_2() const { return address_line_2_; } 97 const base::string16& address_line_2() const { return address_line_2_; }
98 const string16& locality_name() const { return locality_name_; } 98 const base::string16& locality_name() const { return locality_name_; }
99 const string16& administrative_area_name() const { 99 const base::string16& administrative_area_name() const {
100 return administrative_area_name_; 100 return administrative_area_name_;
101 } 101 }
102 const string16& postal_code_number() const { return postal_code_number_; } 102 const base::string16& postal_code_number() const {
103 const string16& phone_number() const { return phone_number_; } 103 return postal_code_number_;
104 }
105 const base::string16& phone_number() const { return phone_number_; }
104 const std::string& object_id() const { return object_id_; } 106 const std::string& object_id() const { return object_id_; }
105 107
106 void set_country_name_code(const std::string& country_name_code) { 108 void set_country_name_code(const std::string& country_name_code) {
107 country_name_code_ = country_name_code; 109 country_name_code_ = country_name_code;
108 } 110 }
109 void set_recipient_name(const string16& recipient_name) { 111 void set_recipient_name(const base::string16& recipient_name) {
110 recipient_name_ = recipient_name; 112 recipient_name_ = recipient_name;
111 } 113 }
112 void set_address_line_1(const string16& address_line_1) { 114 void set_address_line_1(const base::string16& address_line_1) {
113 address_line_1_ = address_line_1; 115 address_line_1_ = address_line_1;
114 } 116 }
115 void set_address_line_2(const string16& address_line_2) { 117 void set_address_line_2(const base::string16& address_line_2) {
116 address_line_2_ = address_line_2; 118 address_line_2_ = address_line_2;
117 } 119 }
118 void set_locality_name(const string16& locality_name) { 120 void set_locality_name(const base::string16& locality_name) {
119 locality_name_ = locality_name; 121 locality_name_ = locality_name;
120 } 122 }
121 void set_administrative_area_name(const string16& administrative_area_name) { 123 void set_administrative_area_name(
124 const base::string16& administrative_area_name) {
122 administrative_area_name_ = administrative_area_name; 125 administrative_area_name_ = administrative_area_name;
123 } 126 }
124 void set_postal_code_number(const string16& postal_code_number) { 127 void set_postal_code_number(const base::string16& postal_code_number) {
125 postal_code_number_ = postal_code_number; 128 postal_code_number_ = postal_code_number;
126 } 129 }
127 void set_phone_number(const string16& phone_number) { 130 void set_phone_number(const base::string16& phone_number) {
128 phone_number_ = phone_number; 131 phone_number_ = phone_number;
129 } 132 }
130 void set_object_id(const std::string& object_id) { 133 void set_object_id(const std::string& object_id) {
131 object_id_ = object_id; 134 object_id_ = object_id;
132 } 135 }
133 136
134 bool operator==(const Address& other) const; 137 bool operator==(const Address& other) const;
135 bool operator!=(const Address& other) const; 138 bool operator!=(const Address& other) const;
136 139
137 private: 140 private:
138 // |country_name_code_| should be an ISO 3166-1-alpha-2 (two letter codes, as 141 // |country_name_code_| should be an ISO 3166-1-alpha-2 (two letter codes, as
139 // used in DNS). For example, "GB". 142 // used in DNS). For example, "GB".
140 std::string country_name_code_; 143 std::string country_name_code_;
141 144
142 // The recipient's name. For example "John Doe". 145 // The recipient's name. For example "John Doe".
143 string16 recipient_name_; 146 base::string16 recipient_name_;
144 147
145 // |address_line_1| and |address_line_2| correspond to the "AddressLine" 148 // |address_line_1| and |address_line_2| correspond to the "AddressLine"
146 // elements in xAL, which are used to hold unstructured text. 149 // elements in xAL, which are used to hold unstructured text.
147 string16 address_line_1_; 150 base::string16 address_line_1_;
148 string16 address_line_2_; 151 base::string16 address_line_2_;
149 152
150 // Locality. This is something of a fuzzy term, but it generally refers to 153 // Locality. This is something of a fuzzy term, but it generally refers to
151 // the city/town portion of an address. In regions of the world where 154 // the city/town portion of an address. In regions of the world where
152 // localities are not well defined or do not fit into this structure well 155 // localities are not well defined or do not fit into this structure well
153 // (for example, Japan and China), leave locality_name empty and use 156 // (for example, Japan and China), leave locality_name empty and use
154 // |address_line_2|. 157 // |address_line_2|.
155 // Examples: US city, IT comune, UK post town. 158 // Examples: US city, IT comune, UK post town.
156 string16 locality_name_; 159 base::string16 locality_name_;
157 160
158 // Top-level administrative subdivision of this country. 161 // Top-level administrative subdivision of this country.
159 // Examples: US state, IT region, UK constituent nation, JP prefecture. 162 // Examples: US state, IT region, UK constituent nation, JP prefecture.
160 string16 administrative_area_name_; 163 base::string16 administrative_area_name_;
161 164
162 // Despite the name, |postal_code_number_| values are frequently alphanumeric. 165 // Despite the name, |postal_code_number_| values are frequently alphanumeric.
163 // Examples: "94043", "SW1W", "SW1W 9TQ". 166 // Examples: "94043", "SW1W", "SW1W 9TQ".
164 string16 postal_code_number_; 167 base::string16 postal_code_number_;
165 168
166 // A valid international phone number. If |phone_number_| is a user provided 169 // A valid international phone number. If |phone_number_| is a user provided
167 // value, it should have been validated using libphonenumber by clients of 170 // value, it should have been validated using libphonenumber by clients of
168 // this class before being set; see http://code.google.com/p/libphonenumber/. 171 // this class before being set; see http://code.google.com/p/libphonenumber/.
169 string16 phone_number_; 172 base::string16 phone_number_;
170 173
171 // Externalized Online Wallet id for this address. 174 // Externalized Online Wallet id for this address.
172 std::string object_id_; 175 std::string object_id_;
173 176
174 // This class is intentionally copyable. 177 // This class is intentionally copyable.
175 DISALLOW_ASSIGN(Address); 178 DISALLOW_ASSIGN(Address);
176 }; 179 };
177 180
178 } // namespace wallet 181 } // namespace wallet
179 } // namespace autofill 182 } // namespace autofill
180 183
181 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ADDRESS_H_ 184 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ADDRESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698