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" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 return AutofillDataModelWrapper::GetInfo(type); | 134 return AutofillDataModelWrapper::GetInfo(type); |
135 } | 135 } |
136 | 136 |
137 gfx::Image AutofillCreditCardWrapper::GetIcon() { | 137 gfx::Image AutofillCreditCardWrapper::GetIcon() { |
138 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 138 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
139 return rb.GetImageNamed(CreditCard::IconResourceId(card_->type())); | 139 return rb.GetImageNamed(CreditCard::IconResourceId(card_->type())); |
140 } | 140 } |
141 | 141 |
142 string16 AutofillCreditCardWrapper::GetDisplayText() { | 142 string16 AutofillCreditCardWrapper::GetDisplayText() { |
143 if (!autofill::IsValidCreditCardExpirationDate( | 143 if (!card_->IsValid()) |
144 card_->GetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR), | |
145 card_->GetRawInfo(CREDIT_CARD_EXP_MONTH), | |
146 base::Time::Now())) { | |
147 return string16(); | 144 return string16(); |
148 } | |
149 | 145 |
150 return card_->TypeAndLastFourDigits(); | 146 return card_->TypeAndLastFourDigits(); |
151 } | 147 } |
152 | 148 |
153 void AutofillCreditCardWrapper::FillFormField(AutofillField* field) const { | 149 void AutofillCreditCardWrapper::FillFormField(AutofillField* field) const { |
154 AutofillFieldType field_type = field->type(); | 150 AutofillFieldType field_type = field->type(); |
155 | 151 |
156 if (field_type == NAME_FULL) { | 152 if (field_type == NAME_FULL) { |
157 // Requests for the user's full name are filled from the credit card data, | 153 // Requests for the user's full name are filled from the credit card data, |
158 // but the CreditCard class only knows how to fill credit card fields. So, | 154 // but the CreditCard class only knows how to fill credit card fields. So, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 249 } |
254 | 250 |
255 FullWalletShippingWrapper::~FullWalletShippingWrapper() {} | 251 FullWalletShippingWrapper::~FullWalletShippingWrapper() {} |
256 | 252 |
257 string16 FullWalletShippingWrapper::GetInfo(AutofillFieldType type) const { | 253 string16 FullWalletShippingWrapper::GetInfo(AutofillFieldType type) const { |
258 return full_wallet_->shipping_address()->GetInfo( | 254 return full_wallet_->shipping_address()->GetInfo( |
259 type, g_browser_process->GetApplicationLocale()); | 255 type, g_browser_process->GetApplicationLocale()); |
260 } | 256 } |
261 | 257 |
262 } // namespace autofill | 258 } // namespace autofill |
OLD | NEW |