Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 12213077: [Autofill] Credit Card validation for rAc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/autofill_dialog_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 426
427 FillInputFromFormGroup(form_group, inputs); 427 FillInputFromFormGroup(form_group, inputs);
428 } 428 }
429 429
430 section_editing_state_[section] = true; 430 section_editing_state_[section] = true;
431 view_->UpdateSection(section); 431 view_->UpdateSection(section);
432 } 432 }
433 433
434 bool AutofillDialogControllerImpl::InputIsValid(AutofillFieldType type, 434 bool AutofillDialogControllerImpl::InputIsValid(AutofillFieldType type,
435 const string16& value) { 435 const string16& value) {
436 using base::Time;
436 // TODO(groby): Add the missing checks. 437 // TODO(groby): Add the missing checks.
437 switch (type) { 438 switch (type) {
439 case CREDIT_CARD_NAME: break;
438 case CREDIT_CARD_NUMBER: 440 case CREDIT_CARD_NUMBER:
439 return autofill::IsValidCreditCardNumber(value); 441 return autofill::IsValidCreditCardNumber(value);
442 case CREDIT_CARD_EXP_MONTH:
443 // TODO(groby): Cross-field dependency, needs year. Cannot validate.
444 break;
445 case CREDIT_CARD_EXP_2_DIGIT_YEAR:
Evan Stade 2013/02/08 15:48:14 You only need to handle the types in Show()
groby-ooo-7-16 2013/02/09 00:01:49 Done. Added NOTREACHED default to make clear thi
446 return autofill::IsValidCreditCardExpirationYear(value, 2, Time::Now());
447 case CREDIT_CARD_EXP_4_DIGIT_YEAR:
448 return autofill::IsValidCreditCardExpirationYear(value, 4, Time::Now());
449 case CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR:
450 return autofill::IsValidCreditCardExpirationDate(value, 4, Time::Now());
451 case CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR:
452 return autofill::IsValidCreditCardExpirationDate(value, 4, Time::Now());
453 case CREDIT_CARD_VERIFICATION_CODE:
454 // TODO(groby):: Cross-field dependency - would work better w/ CC type.
455 return autofill::IsValidCreditCardCSC(value);
440 default: 456 default:
441 break; 457 break;
442 } 458 }
443 459
444 return !value.empty(); 460 return !value.empty();
445 } 461 }
446 462
447 void AutofillDialogControllerImpl::UserEditedOrActivatedInput( 463 void AutofillDialogControllerImpl::UserEditedOrActivatedInput(
448 const DetailInput* input, 464 const DetailInput* input,
449 DialogSection section, 465 DialogSection section,
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 DialogSection section) { 964 DialogSection section) {
949 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); 965 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section));
950 } 966 }
951 967
952 void AutofillDialogControllerImpl::HidePopup() { 968 void AutofillDialogControllerImpl::HidePopup() {
953 if (popup_controller_) 969 if (popup_controller_)
954 popup_controller_->Hide(); 970 popup_controller_->Hide();
955 } 971 }
956 972
957 } // namespace autofill 973 } // namespace autofill
OLDNEW
« chrome/browser/autofill/validation.cc ('K') | « chrome/browser/autofill/validation_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698