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 #include "components/autofill/core/browser/address.h" | 5 #include "components/autofill/core/browser/address.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 case ADDRESS_HOME_STATE: | 58 case ADDRESS_HOME_STATE: |
59 return state_; | 59 return state_; |
60 | 60 |
61 case ADDRESS_HOME_ZIP: | 61 case ADDRESS_HOME_ZIP: |
62 return zip_code_; | 62 return zip_code_; |
63 | 63 |
64 case ADDRESS_HOME_SORTING_CODE: | 64 case ADDRESS_HOME_SORTING_CODE: |
65 return sorting_code_; | 65 return sorting_code_; |
66 | 66 |
67 case ADDRESS_HOME_COUNTRY: | 67 case ADDRESS_HOME_COUNTRY: |
68 return ASCIIToUTF16(country_code_); | 68 return base::ASCIIToUTF16(country_code_); |
69 | 69 |
70 case ADDRESS_HOME_STREET_ADDRESS: | 70 case ADDRESS_HOME_STREET_ADDRESS: |
71 return JoinString(street_address_, '\n'); | 71 return JoinString(street_address_, '\n'); |
72 | 72 |
73 default: | 73 default: |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 return base::string16(); | 75 return base::string16(); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 break; | 124 break; |
125 | 125 |
126 default: | 126 default: |
127 NOTREACHED(); | 127 NOTREACHED(); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 base::string16 Address::GetInfo(const AutofillType& type, | 131 base::string16 Address::GetInfo(const AutofillType& type, |
132 const std::string& app_locale) const { | 132 const std::string& app_locale) const { |
133 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) | 133 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) |
134 return ASCIIToUTF16(country_code_); | 134 return base::ASCIIToUTF16(country_code_); |
135 | 135 |
136 ServerFieldType storable_type = type.GetStorableType(); | 136 ServerFieldType storable_type = type.GetStorableType(); |
137 if (storable_type == ADDRESS_HOME_COUNTRY && !country_code_.empty()) | 137 if (storable_type == ADDRESS_HOME_COUNTRY && !country_code_.empty()) |
138 return AutofillCountry(country_code_, app_locale).name(); | 138 return AutofillCountry(country_code_, app_locale).name(); |
139 | 139 |
140 return GetRawInfo(storable_type); | 140 return GetRawInfo(storable_type); |
141 } | 141 } |
142 | 142 |
143 bool Address::SetInfo(const AutofillType& type, | 143 bool Address::SetInfo(const AutofillType& type, |
144 const base::string16& value, | 144 const base::string16& value, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 supported_types->insert(ADDRESS_HOME_COUNTRY); | 207 supported_types->insert(ADDRESS_HOME_COUNTRY); |
208 } | 208 } |
209 | 209 |
210 void Address::TrimStreetAddress() { | 210 void Address::TrimStreetAddress() { |
211 while (!street_address_.empty() && street_address_.back().empty()) { | 211 while (!street_address_.empty() && street_address_.back().empty()) { |
212 street_address_.pop_back(); | 212 street_address_.pop_back(); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 } // namespace autofill | 216 } // namespace autofill |
OLD | NEW |