OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autofill/credit_card.h" | 5 #include "chrome/browser/autofill/credit_card.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 string16 CreditCard::LastFourDigits() const { | 368 string16 CreditCard::LastFourDigits() const { |
369 static const size_t kNumLastDigits = 4; | 369 static const size_t kNumLastDigits = 4; |
370 | 370 |
371 if (number().size() < kNumLastDigits) | 371 if (number().size() < kNumLastDigits) |
372 return string16(); | 372 return string16(); |
373 | 373 |
374 return number().substr(number().size() - kNumLastDigits, kNumLastDigits); | 374 return number().substr(number().size() - kNumLastDigits, kNumLastDigits); |
375 } | 375 } |
376 | 376 |
377 void CreditCard::operator=(const CreditCard& credit_card) { | 377 void CreditCard::operator=(const CreditCard& credit_card) { |
| 378 if (this == &credit_card) |
| 379 return; |
| 380 |
378 number_ = credit_card.number_; | 381 number_ = credit_card.number_; |
379 name_on_card_ = credit_card.name_on_card_; | 382 name_on_card_ = credit_card.name_on_card_; |
380 type_ = credit_card.type_; | 383 type_ = credit_card.type_; |
381 last_four_digits_ = credit_card.last_four_digits_; | 384 last_four_digits_ = credit_card.last_four_digits_; |
382 expiration_month_ = credit_card.expiration_month_; | 385 expiration_month_ = credit_card.expiration_month_; |
383 expiration_year_ = credit_card.expiration_year_; | 386 expiration_year_ = credit_card.expiration_year_; |
384 label_ = credit_card.label_; | 387 label_ = credit_card.label_; |
385 guid_ = credit_card.guid_; | 388 guid_ = credit_card.guid_; |
386 } | 389 } |
387 | 390 |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 << UTF16ToUTF8(credit_card.GetFieldText(AutoFillType(CREDIT_CARD_TYPE))) | 632 << UTF16ToUTF8(credit_card.GetFieldText(AutoFillType(CREDIT_CARD_TYPE))) |
630 << " " | 633 << " " |
631 << UTF16ToUTF8(credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER))) | 634 << UTF16ToUTF8(credit_card.GetFieldText(AutoFillType(CREDIT_CARD_NUMBER))) |
632 << " " | 635 << " " |
633 << UTF16ToUTF8(credit_card.GetFieldText( | 636 << UTF16ToUTF8(credit_card.GetFieldText( |
634 AutoFillType(CREDIT_CARD_EXP_MONTH))) | 637 AutoFillType(CREDIT_CARD_EXP_MONTH))) |
635 << " " | 638 << " " |
636 << UTF16ToUTF8(credit_card.GetFieldText( | 639 << UTF16ToUTF8(credit_card.GetFieldText( |
637 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); | 640 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR))); |
638 } | 641 } |
OLD | NEW |