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 "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3315 } | 3315 } |
3316 | 3316 |
3317 bool AutofillDialogControllerImpl::IsCreditCardExpirationValid( | 3317 bool AutofillDialogControllerImpl::IsCreditCardExpirationValid( |
3318 const base::string16& year, | 3318 const base::string16& year, |
3319 const base::string16& month) const { | 3319 const base::string16& month) const { |
3320 // If the expiration is in the past as per the local clock, it's invalid. | 3320 // If the expiration is in the past as per the local clock, it's invalid. |
3321 base::Time now = base::Time::Now(); | 3321 base::Time now = base::Time::Now(); |
3322 if (!autofill::IsValidCreditCardExpirationDate(year, month, now)) | 3322 if (!autofill::IsValidCreditCardExpirationDate(year, month, now)) |
3323 return false; | 3323 return false; |
3324 | 3324 |
3325 if (IsPayingWithWallet() && IsEditingExistingData(SECTION_CC_BILLING)) { | 3325 const wallet::WalletItems::MaskedInstrument* instrument = |
3326 const wallet::WalletItems::MaskedInstrument* instrument = | 3326 ActiveInstrument(); |
3327 ActiveInstrument(); | 3327 if (instrument) { |
3328 const std::string& locale = g_browser_process->GetApplicationLocale(); | 3328 const std::string& locale = g_browser_process->GetApplicationLocale(); |
3329 int month_int; | 3329 int month_int; |
3330 if (base::StringToInt(month, &month_int) && | 3330 if (base::StringToInt(month, &month_int) && |
3331 instrument->status() == | 3331 instrument->status() == |
3332 wallet::WalletItems::MaskedInstrument::EXPIRED && | 3332 wallet::WalletItems::MaskedInstrument::EXPIRED && |
3333 year == | 3333 year == |
3334 instrument->GetInfo( | 3334 instrument->GetInfo( |
3335 AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), locale) && | 3335 AutofillType(CREDIT_CARD_EXP_4_DIGIT_YEAR), locale) && |
3336 month_int == instrument->expiration_month()) { | 3336 month_int == instrument->expiration_month()) { |
3337 // Otherwise, if the user is editing an instrument that's deemed expired | 3337 // Otherwise, if the user is editing an instrument that's deemed expired |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3810 view_->UpdateButtonStrip(); | 3810 view_->UpdateButtonStrip(); |
3811 } | 3811 } |
3812 | 3812 |
3813 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3813 void AutofillDialogControllerImpl::FetchWalletCookie() { |
3814 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3814 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
3815 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3815 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
3816 signin_helper_->StartWalletCookieValueFetch(); | 3816 signin_helper_->StartWalletCookieValueFetch(); |
3817 } | 3817 } |
3818 | 3818 |
3819 } // namespace autofill | 3819 } // namespace autofill |
OLD | NEW |