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/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 Loading... | |
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; | |
Evan Stade
2013/02/11 00:25:14
No longer needed
groby-ooo-7-16
2013/02/11 22:47:53
Done.
| |
437 | |
436 // TODO(groby): Add the missing checks. | 438 // TODO(groby): Add the missing checks. |
437 switch (type) { | 439 switch (type) { |
440 case EMAIL_ADDRESS: break; | |
Evan Stade
2013/02/11 00:25:14
I would prefer you put break on its own line (or a
groby-ooo-7-16
2013/02/11 22:47:53
Done.
| |
441 | |
438 case CREDIT_CARD_NUMBER: | 442 case CREDIT_CARD_NUMBER: |
439 return autofill::IsValidCreditCardNumber(value); | 443 return autofill::IsValidCreditCardNumber(value); |
444 case CREDIT_CARD_NAME: break; | |
445 case CREDIT_CARD_EXP_MONTH: | |
446 case CREDIT_CARD_EXP_4_DIGIT_YEAR: | |
447 NOTREACHED() << "Validation is not called for <select>"; | |
Evan Stade
2013/02/11 00:25:14
Can we remove this block and let the default case
groby-ooo-7-16
2013/02/11 22:47:53
I'd prefer to leave this NOTREACHED. If program fl
| |
448 break; | |
449 case CREDIT_CARD_VERIFICATION_CODE: | |
450 return autofill::IsValidCreditCardCSC(value); | |
451 | |
452 case ADDRESS_HOME_LINE1: | |
453 break; | |
454 case ADDRESS_HOME_LINE2: | |
455 return true; // Line 2 is optional - always valid. | |
456 case ADDRESS_HOME_CITY: | |
457 case ADDRESS_HOME_STATE: | |
458 case ADDRESS_HOME_ZIP: | |
459 break; | |
460 | |
440 default: | 461 default: |
462 NOTREACHED() << "Trying to validate unknown field"; | |
Ilya Sherman
2013/02/11 05:39:51
nit: Please remove the logging text. You can incl
groby-ooo-7-16
2013/02/11 22:47:53
Done.
| |
441 break; | 463 break; |
442 } | 464 } |
443 | 465 |
444 return !value.empty(); | 466 return !value.empty(); |
445 } | 467 } |
446 | 468 |
447 void AutofillDialogControllerImpl::UserEditedOrActivatedInput( | 469 void AutofillDialogControllerImpl::UserEditedOrActivatedInput( |
448 const DetailInput* input, | 470 const DetailInput* input, |
449 DialogSection section, | 471 DialogSection section, |
450 gfx::NativeView parent_view, | 472 gfx::NativeView parent_view, |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 DialogSection section) { | 975 DialogSection section) { |
954 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); | 976 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); |
955 } | 977 } |
956 | 978 |
957 void AutofillDialogControllerImpl::HidePopup() { | 979 void AutofillDialogControllerImpl::HidePopup() { |
958 if (popup_controller_) | 980 if (popup_controller_) |
959 popup_controller_->Hide(); | 981 popup_controller_->Hide(); |
960 } | 982 } |
961 | 983 |
962 } // namespace autofill | 984 } // namespace autofill |
OLD | NEW |