| OLD | NEW |
| 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 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 5 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" |
| 11 #include "components/autofill/content/browser/wallet/full_wallet.h" | 11 #include "components/autofill/content/browser/wallet/full_wallet.h" |
| 12 #include "components/autofill/content/browser/wallet/wallet_address.h" | 12 #include "components/autofill/content/browser/wallet/wallet_address.h" |
| 13 #include "components/autofill/content/browser/wallet/wallet_items.h" | 13 #include "components/autofill/content/browser/wallet/wallet_items.h" |
| 14 #include "components/autofill/core/browser/autofill_data_model.h" | 14 #include "components/autofill/core/browser/autofill_data_model.h" |
| 15 #include "components/autofill/core/browser/autofill_profile.h" | 15 #include "components/autofill/core/browser/autofill_profile.h" |
| 16 #include "components/autofill/core/browser/autofill_type.h" | 16 #include "components/autofill/core/browser/autofill_type.h" |
| 17 #include "components/autofill/core/browser/credit_card.h" | 17 #include "components/autofill/core/browser/credit_card.h" |
| 18 #include "components/autofill/core/browser/form_structure.h" | 18 #include "components/autofill/core/browser/form_structure.h" |
| 19 #include "components/autofill/core/browser/validation.h" | 19 #include "components/autofill/core/browser/validation.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 22 | 22 |
| 23 namespace autofill { | 23 namespace autofill { |
| 24 | 24 |
| 25 DataModelWrapper::~DataModelWrapper() {} | 25 DataModelWrapper::~DataModelWrapper() {} |
| 26 | 26 |
| 27 string16 DataModelWrapper::GetDisplayText() { | 27 gfx::Image DataModelWrapper::GetIcon() { |
| 28 string16 comma = ASCIIToUTF16(", "); | 28 return gfx::Image(); |
| 29 string16 label = GetInfo(NAME_FULL) + comma + GetInfo(ADDRESS_HOME_LINE1); | 29 } |
| 30 string16 address2 = GetInfo(ADDRESS_HOME_LINE2); | 30 |
| 31 if (!address2.empty()) | 31 void DataModelWrapper::FillInputs(DetailInputs* inputs) { |
| 32 label += comma + address2; | 32 for (size_t i = 0; i < inputs->size(); ++i) { |
| 33 label += ASCIIToUTF16("\n") + | 33 (*inputs)[i].initial_value = GetInfo((*inputs)[i].type); |
| 34 GetInfo(ADDRESS_HOME_CITY) + comma + | 34 } |
| 35 GetInfo(ADDRESS_HOME_STATE) + ASCIIToUTF16(" ") + | 35 } |
| 36 GetInfo(ADDRESS_HOME_ZIP); | 36 |
| 37 return label; | 37 bool DataModelWrapper::GetDisplayText( |
| 38 base::string16* vertically_compact, |
| 39 base::string16* horizontally_compact) { |
| 40 base::string16 comma = ASCIIToUTF16(", "); |
| 41 base::string16 newline = ASCIIToUTF16("\n"); |
| 42 |
| 43 *vertically_compact = GetAddressDisplayText(comma); |
| 44 *horizontally_compact = GetAddressDisplayText(newline); |
| 45 return true; |
| 38 } | 46 } |
| 39 | 47 |
| 40 bool DataModelWrapper::FillFormStructure( | 48 bool DataModelWrapper::FillFormStructure( |
| 41 const DetailInputs& inputs, | 49 const DetailInputs& inputs, |
| 42 const InputFieldComparator& compare, | 50 const InputFieldComparator& compare, |
| 43 FormStructure* form_structure) const { | 51 FormStructure* form_structure) const { |
| 44 bool filled_something = false; | 52 bool filled_something = false; |
| 45 for (size_t i = 0; i < form_structure->field_count(); ++i) { | 53 for (size_t i = 0; i < form_structure->field_count(); ++i) { |
| 46 AutofillField* field = form_structure->field(i); | 54 AutofillField* field = form_structure->field(i); |
| 47 for (size_t j = 0; j < inputs.size(); ++j) { | 55 for (size_t j = 0; j < inputs.size(); ++j) { |
| 48 if (compare.Run(inputs[j], *field)) { | 56 if (compare.Run(inputs[j], *field)) { |
| 49 FillFormField(field); | 57 FillFormField(field); |
| 50 filled_something = true; | 58 filled_something = true; |
| 51 break; | 59 break; |
| 52 } | 60 } |
| 53 } | 61 } |
| 54 } | 62 } |
| 55 return filled_something; | 63 return filled_something; |
| 56 } | 64 } |
| 57 | 65 |
| 58 void DataModelWrapper::FillInputs(DetailInputs* inputs) { | 66 DataModelWrapper::DataModelWrapper() {} |
| 59 for (size_t i = 0; i < inputs->size(); ++i) { | |
| 60 (*inputs)[i].initial_value = GetInfo((*inputs)[i].type); | |
| 61 } | |
| 62 } | |
| 63 | 67 |
| 64 void DataModelWrapper::FillFormField(AutofillField* field) const { | 68 void DataModelWrapper::FillFormField(AutofillField* field) const { |
| 65 field->value = GetInfo(field->type()); | 69 field->value = GetInfo(field->type()); |
| 66 } | 70 } |
| 67 | 71 |
| 68 DataModelWrapper::DataModelWrapper() {} | 72 base::string16 DataModelWrapper::GetAddressDisplayText( |
| 73 const base::string16& separator) { |
| 74 base::string16 address = GetInfo(NAME_FULL) + separator + |
| 75 GetInfo(ADDRESS_HOME_LINE1); |
| 76 base::string16 address2 = GetInfo(ADDRESS_HOME_LINE2); |
| 77 if (!address2.empty()) |
| 78 address += separator + address2; |
| 69 | 79 |
| 70 gfx::Image DataModelWrapper::GetIcon() { | 80 base::string16 comma = ASCIIToUTF16(", "); |
| 71 return gfx::Image(); | 81 base::string16 newline = ASCIIToUTF16("\n"); |
| 82 address += separator + |
| 83 GetInfo(ADDRESS_HOME_CITY) + comma + |
| 84 GetInfo(ADDRESS_HOME_STATE) + ASCIIToUTF16(" ") + |
| 85 GetInfo(ADDRESS_HOME_ZIP); |
| 86 |
| 87 // TODO(estade): email? |
| 88 address += newline + GetInfo(PHONE_HOME_WHOLE_NUMBER); |
| 89 |
| 90 return address; |
| 72 } | 91 } |
| 73 | 92 |
| 74 // EmptyDataModelWrapper | 93 // EmptyDataModelWrapper |
| 75 | 94 |
| 76 EmptyDataModelWrapper::EmptyDataModelWrapper() {} | 95 EmptyDataModelWrapper::EmptyDataModelWrapper() {} |
| 77 EmptyDataModelWrapper::~EmptyDataModelWrapper() {} | 96 EmptyDataModelWrapper::~EmptyDataModelWrapper() {} |
| 78 | 97 |
| 79 string16 EmptyDataModelWrapper::GetInfo(AutofillFieldType type) const { | 98 base::string16 EmptyDataModelWrapper::GetInfo(AutofillFieldType type) const { |
| 80 return string16(); | 99 return base::string16(); |
| 81 } | 100 } |
| 82 | 101 |
| 83 void EmptyDataModelWrapper::FillFormField(AutofillField* field) const {} | 102 void EmptyDataModelWrapper::FillFormField(AutofillField* field) const {} |
| 84 | 103 |
| 85 // AutofillDataModelWrapper | 104 // AutofillDataModelWrapper |
| 86 | 105 |
| 87 AutofillDataModelWrapper::AutofillDataModelWrapper( | 106 AutofillDataModelWrapper::AutofillDataModelWrapper( |
| 88 const AutofillDataModel* data_model, | 107 const AutofillDataModel* data_model, |
| 89 size_t variant) | 108 size_t variant) |
| 90 : data_model_(data_model), | 109 : data_model_(data_model), |
| 91 variant_(variant) {} | 110 variant_(variant) {} |
| 92 | 111 |
| 93 AutofillDataModelWrapper::~AutofillDataModelWrapper() {} | 112 AutofillDataModelWrapper::~AutofillDataModelWrapper() {} |
| 94 | 113 |
| 95 string16 AutofillDataModelWrapper::GetInfo(AutofillFieldType type) const { | 114 base::string16 AutofillDataModelWrapper::GetInfo(AutofillFieldType type) const { |
| 96 return data_model_->GetInfo(type, g_browser_process->GetApplicationLocale()); | 115 return data_model_->GetInfo(type, g_browser_process->GetApplicationLocale()); |
| 97 } | 116 } |
| 98 | 117 |
| 99 void AutofillDataModelWrapper::FillFormField(AutofillField* field) const { | 118 void AutofillDataModelWrapper::FillFormField(AutofillField* field) const { |
| 100 data_model_->FillFormField( | 119 data_model_->FillFormField( |
| 101 *field, variant_, g_browser_process->GetApplicationLocale(), field); | 120 *field, variant_, g_browser_process->GetApplicationLocale(), field); |
| 102 } | 121 } |
| 103 | 122 |
| 104 // AutofillProfileWrapper | 123 // AutofillProfileWrapper |
| 105 | 124 |
| 106 AutofillProfileWrapper::AutofillProfileWrapper( | 125 AutofillProfileWrapper::AutofillProfileWrapper( |
| 107 const AutofillProfile* profile, size_t variant) | 126 const AutofillProfile* profile, size_t variant) |
| 108 : AutofillDataModelWrapper(profile, variant), | 127 : AutofillDataModelWrapper(profile, variant), |
| 109 profile_(profile) {} | 128 profile_(profile) {} |
| 110 | 129 |
| 111 AutofillProfileWrapper::~AutofillProfileWrapper() {} | 130 AutofillProfileWrapper::~AutofillProfileWrapper() {} |
| 112 | 131 |
| 113 void AutofillProfileWrapper::FillInputs(DetailInputs* inputs) { | 132 void AutofillProfileWrapper::FillInputs(DetailInputs* inputs) { |
| 114 const std::string app_locale = g_browser_process->GetApplicationLocale(); | 133 const std::string app_locale = g_browser_process->GetApplicationLocale(); |
| 115 for (size_t j = 0; j < inputs->size(); ++j) { | 134 for (size_t j = 0; j < inputs->size(); ++j) { |
| 116 std::vector<string16> values; | 135 std::vector<base::string16> values; |
| 117 profile_->GetMultiInfo((*inputs)[j].type, app_locale, &values); | 136 profile_->GetMultiInfo((*inputs)[j].type, app_locale, &values); |
| 118 (*inputs)[j].initial_value = values[variant()]; | 137 (*inputs)[j].initial_value = values[variant()]; |
| 119 } | 138 } |
| 120 } | 139 } |
| 121 | 140 |
| 122 void AutofillProfileWrapper::FillFormField(AutofillField* field) const { | 141 void AutofillProfileWrapper::FillFormField(AutofillField* field) const { |
| 123 AutofillFieldType field_type = field->type(); | 142 AutofillFieldType field_type = field->type(); |
| 124 | 143 |
| 125 if (field_type == CREDIT_CARD_NAME) { | 144 if (field_type == CREDIT_CARD_NAME) { |
| 126 // Requests for the user's credit card are filled from the billing address, | 145 // Requests for the user's credit card are filled from the billing address, |
| 127 // but the AutofillProfile class doesn't know how to fill credit card | 146 // but the AutofillProfile class doesn't know how to fill credit card |
| 128 // fields. So, temporarily set the type to the corresponding profile type. | 147 // fields. So, temporarily set the type to the corresponding profile type. |
| 129 field->set_heuristic_type(NAME_FULL); | 148 field->set_heuristic_type(NAME_FULL); |
| 130 } | 149 } |
| 131 | 150 |
| 132 AutofillDataModelWrapper::FillFormField(field); | 151 AutofillDataModelWrapper::FillFormField(field); |
| 133 | 152 |
| 134 field->set_heuristic_type(field_type); | 153 field->set_heuristic_type(field_type); |
| 135 } | 154 } |
| 136 | 155 |
| 137 // AutofillCreditCardWrapper | 156 // AutofillCreditCardWrapper |
| 138 | 157 |
| 139 AutofillCreditCardWrapper::AutofillCreditCardWrapper(const CreditCard* card) | 158 AutofillCreditCardWrapper::AutofillCreditCardWrapper(const CreditCard* card) |
| 140 : AutofillDataModelWrapper(card, 0), | 159 : AutofillDataModelWrapper(card, 0), |
| 141 card_(card) {} | 160 card_(card) {} |
| 142 | 161 |
| 143 AutofillCreditCardWrapper::~AutofillCreditCardWrapper() {} | 162 AutofillCreditCardWrapper::~AutofillCreditCardWrapper() {} |
| 144 | 163 |
| 145 string16 AutofillCreditCardWrapper::GetInfo(AutofillFieldType type) const { | 164 base::string16 AutofillCreditCardWrapper::GetInfo( |
| 165 AutofillFieldType type) const { |
| 146 if (type == CREDIT_CARD_EXP_MONTH) | 166 if (type == CREDIT_CARD_EXP_MONTH) |
| 147 return MonthComboboxModel::FormatMonth(card_->expiration_month()); | 167 return MonthComboboxModel::FormatMonth(card_->expiration_month()); |
| 148 | 168 |
| 149 return AutofillDataModelWrapper::GetInfo(type); | 169 return AutofillDataModelWrapper::GetInfo(type); |
| 150 } | 170 } |
| 151 | 171 |
| 152 gfx::Image AutofillCreditCardWrapper::GetIcon() { | 172 gfx::Image AutofillCreditCardWrapper::GetIcon() { |
| 153 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 173 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 154 return rb.GetImageNamed(CreditCard::IconResourceId(card_->type())); | 174 return rb.GetImageNamed(CreditCard::IconResourceId(card_->type())); |
| 155 } | 175 } |
| 156 | 176 |
| 157 string16 AutofillCreditCardWrapper::GetDisplayText() { | 177 bool AutofillCreditCardWrapper::GetDisplayText( |
| 178 base::string16* vertically_compact, |
| 179 base::string16* horizontally_compact) { |
| 158 if (!card_->IsValid()) | 180 if (!card_->IsValid()) |
| 159 return string16(); | 181 return false; |
| 160 | 182 |
| 161 return card_->TypeAndLastFourDigits(); | 183 *vertically_compact = *horizontally_compact = card_->TypeAndLastFourDigits(); |
| 184 return true; |
| 162 } | 185 } |
| 163 | 186 |
| 164 // WalletAddressWrapper | 187 // WalletAddressWrapper |
| 165 | 188 |
| 166 WalletAddressWrapper::WalletAddressWrapper( | 189 WalletAddressWrapper::WalletAddressWrapper( |
| 167 const wallet::Address* address) : address_(address) {} | 190 const wallet::Address* address) : address_(address) {} |
| 168 | 191 |
| 169 WalletAddressWrapper::~WalletAddressWrapper() {} | 192 WalletAddressWrapper::~WalletAddressWrapper() {} |
| 170 | 193 |
| 171 string16 WalletAddressWrapper::GetInfo(AutofillFieldType type) const { | 194 base::string16 WalletAddressWrapper::GetInfo(AutofillFieldType type) const { |
| 172 return address_->GetInfo(type, g_browser_process->GetApplicationLocale()); | 195 return address_->GetInfo(type, g_browser_process->GetApplicationLocale()); |
| 173 } | 196 } |
| 174 | 197 |
| 175 string16 WalletAddressWrapper::GetDisplayText() { | 198 bool WalletAddressWrapper::GetDisplayText( |
| 199 base::string16* vertically_compact, |
| 200 base::string16* horizontally_compact) { |
| 176 if (!address_->is_complete_address() || | 201 if (!address_->is_complete_address() || |
| 177 GetInfo(PHONE_HOME_WHOLE_NUMBER).empty()) { | 202 GetInfo(PHONE_HOME_WHOLE_NUMBER).empty()) { |
| 178 return string16(); | 203 return false; |
| 179 } | 204 } |
| 180 | 205 |
| 181 return DataModelWrapper::GetDisplayText(); | 206 return DataModelWrapper::GetDisplayText(vertically_compact, |
| 207 horizontally_compact); |
| 182 } | 208 } |
| 183 | 209 |
| 184 // WalletInstrumentWrapper | 210 // WalletInstrumentWrapper |
| 185 | 211 |
| 186 WalletInstrumentWrapper::WalletInstrumentWrapper( | 212 WalletInstrumentWrapper::WalletInstrumentWrapper( |
| 187 const wallet::WalletItems::MaskedInstrument* instrument) | 213 const wallet::WalletItems::MaskedInstrument* instrument) |
| 188 : instrument_(instrument) {} | 214 : instrument_(instrument) {} |
| 189 | 215 |
| 190 WalletInstrumentWrapper::~WalletInstrumentWrapper() {} | 216 WalletInstrumentWrapper::~WalletInstrumentWrapper() {} |
| 191 | 217 |
| 192 string16 WalletInstrumentWrapper::GetInfo(AutofillFieldType type) const { | 218 base::string16 WalletInstrumentWrapper::GetInfo(AutofillFieldType type) const { |
| 193 if (type == CREDIT_CARD_EXP_MONTH) | 219 if (type == CREDIT_CARD_EXP_MONTH) |
| 194 return MonthComboboxModel::FormatMonth(instrument_->expiration_month()); | 220 return MonthComboboxModel::FormatMonth(instrument_->expiration_month()); |
| 195 | 221 |
| 196 return instrument_->GetInfo(type, g_browser_process->GetApplicationLocale()); | 222 return instrument_->GetInfo(type, g_browser_process->GetApplicationLocale()); |
| 197 } | 223 } |
| 198 | 224 |
| 199 gfx::Image WalletInstrumentWrapper::GetIcon() { | 225 gfx::Image WalletInstrumentWrapper::GetIcon() { |
| 200 return instrument_->CardIcon(); | 226 return instrument_->CardIcon(); |
| 201 } | 227 } |
| 202 | 228 |
| 203 string16 WalletInstrumentWrapper::GetDisplayText() { | 229 bool WalletInstrumentWrapper::GetDisplayText( |
| 230 base::string16* vertically_compact, |
| 231 base::string16* horizontally_compact) { |
| 204 // TODO(dbeam): handle other instrument statuses? http://crbug.com/233048 | 232 // TODO(dbeam): handle other instrument statuses? http://crbug.com/233048 |
| 205 if (instrument_->status() == wallet::WalletItems::MaskedInstrument::EXPIRED || | 233 if (instrument_->status() == wallet::WalletItems::MaskedInstrument::EXPIRED || |
| 206 !instrument_->address().is_complete_address() || | 234 !instrument_->address().is_complete_address() || |
| 207 GetInfo(PHONE_HOME_WHOLE_NUMBER).empty()) { | 235 GetInfo(PHONE_HOME_WHOLE_NUMBER).empty()) { |
| 208 return string16(); | 236 return false; |
| 209 } | 237 } |
| 210 | 238 |
| 239 DataModelWrapper::GetDisplayText(vertically_compact, horizontally_compact); |
| 211 // TODO(estade): descriptive_name() is user-provided. Should we use it or | 240 // TODO(estade): descriptive_name() is user-provided. Should we use it or |
| 212 // just type + last 4 digits? | 241 // just type + last 4 digits? |
| 213 string16 line1 = instrument_->descriptive_name(); | 242 base::string16 line1 = instrument_->descriptive_name() + ASCIIToUTF16("\n"); |
| 214 return line1 + ASCIIToUTF16("\n") + DataModelWrapper::GetDisplayText(); | 243 *vertically_compact = line1 + *vertically_compact; |
| 244 *horizontally_compact = line1 + *horizontally_compact; |
| 245 return true; |
| 215 } | 246 } |
| 216 | 247 |
| 217 // FullWalletBillingWrapper | 248 // FullWalletBillingWrapper |
| 218 | 249 |
| 219 FullWalletBillingWrapper::FullWalletBillingWrapper( | 250 FullWalletBillingWrapper::FullWalletBillingWrapper( |
| 220 wallet::FullWallet* full_wallet) | 251 wallet::FullWallet* full_wallet) |
| 221 : full_wallet_(full_wallet) { | 252 : full_wallet_(full_wallet) { |
| 222 DCHECK(full_wallet_); | 253 DCHECK(full_wallet_); |
| 223 } | 254 } |
| 224 | 255 |
| 225 FullWalletBillingWrapper::~FullWalletBillingWrapper() {} | 256 FullWalletBillingWrapper::~FullWalletBillingWrapper() {} |
| 226 | 257 |
| 227 string16 FullWalletBillingWrapper::GetInfo(AutofillFieldType type) const { | 258 base::string16 FullWalletBillingWrapper::GetInfo(AutofillFieldType type) const { |
| 228 if (type == CREDIT_CARD_EXP_MONTH) | 259 if (type == CREDIT_CARD_EXP_MONTH) |
| 229 return MonthComboboxModel::FormatMonth(full_wallet_->expiration_month()); | 260 return MonthComboboxModel::FormatMonth(full_wallet_->expiration_month()); |
| 230 | 261 |
| 231 if (AutofillType(type).group() == CREDIT_CARD) | 262 if (AutofillType(type).group() == CREDIT_CARD) |
| 232 return full_wallet_->GetInfo(type); | 263 return full_wallet_->GetInfo(type); |
| 233 | 264 |
| 234 return full_wallet_->billing_address()->GetInfo( | 265 return full_wallet_->billing_address()->GetInfo( |
| 235 type, g_browser_process->GetApplicationLocale()); | 266 type, g_browser_process->GetApplicationLocale()); |
| 236 } | 267 } |
| 237 | 268 |
| 238 string16 FullWalletBillingWrapper::GetDisplayText() { | 269 bool FullWalletBillingWrapper::GetDisplayText( |
| 270 base::string16* vertically_compact, |
| 271 base::string16* horizontally_compact) { |
| 239 // TODO(dbeam): handle other required actions? http://crbug.com/163508 | 272 // TODO(dbeam): handle other required actions? http://crbug.com/163508 |
| 240 if (full_wallet_->HasRequiredAction(wallet::UPDATE_EXPIRATION_DATE)) | 273 if (full_wallet_->HasRequiredAction(wallet::UPDATE_EXPIRATION_DATE)) |
| 241 return string16(); | 274 return false; |
| 242 | 275 |
| 243 return DataModelWrapper::GetDisplayText(); | 276 return DataModelWrapper::GetDisplayText(vertically_compact, |
| 277 horizontally_compact); |
| 244 } | 278 } |
| 245 | 279 |
| 246 // FullWalletShippingWrapper | 280 // FullWalletShippingWrapper |
| 247 | 281 |
| 248 FullWalletShippingWrapper::FullWalletShippingWrapper( | 282 FullWalletShippingWrapper::FullWalletShippingWrapper( |
| 249 wallet::FullWallet* full_wallet) | 283 wallet::FullWallet* full_wallet) |
| 250 : full_wallet_(full_wallet) { | 284 : full_wallet_(full_wallet) { |
| 251 DCHECK(full_wallet_); | 285 DCHECK(full_wallet_); |
| 252 } | 286 } |
| 253 | 287 |
| 254 FullWalletShippingWrapper::~FullWalletShippingWrapper() {} | 288 FullWalletShippingWrapper::~FullWalletShippingWrapper() {} |
| 255 | 289 |
| 256 string16 FullWalletShippingWrapper::GetInfo(AutofillFieldType type) const { | 290 base::string16 FullWalletShippingWrapper::GetInfo( |
| 291 AutofillFieldType type) const { |
| 257 return full_wallet_->shipping_address()->GetInfo( | 292 return full_wallet_->shipping_address()->GetInfo( |
| 258 type, g_browser_process->GetApplicationLocale()); | 293 type, g_browser_process->GetApplicationLocale()); |
| 259 } | 294 } |
| 260 | 295 |
| 261 DetailOutputWrapper::DetailOutputWrapper(const DetailOutputMap& outputs) | 296 DetailOutputWrapper::DetailOutputWrapper(const DetailOutputMap& outputs) |
| 262 : outputs_(outputs) {} | 297 : outputs_(outputs) {} |
| 263 | 298 |
| 264 DetailOutputWrapper::~DetailOutputWrapper() {} | 299 DetailOutputWrapper::~DetailOutputWrapper() {} |
| 265 | 300 |
| 266 base::string16 DetailOutputWrapper::GetInfo(AutofillFieldType type) const { | 301 base::string16 DetailOutputWrapper::GetInfo(AutofillFieldType type) const { |
| 267 for (DetailOutputMap::const_iterator it = outputs_.begin(); | 302 for (DetailOutputMap::const_iterator it = outputs_.begin(); |
| 268 it != outputs_.end(); ++it) { | 303 it != outputs_.end(); ++it) { |
| 269 if (type == it->first->type) | 304 if (type == it->first->type) |
| 270 return it->second; | 305 return it->second; |
| 271 } | 306 } |
| 272 return base::string16(); | 307 return base::string16(); |
| 273 } | 308 } |
| 274 | 309 |
| 275 } // namespace autofill | 310 } // namespace autofill |
| OLD | NEW |