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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 424 |
425 FillInputFromFormGroup(form_group, inputs); | 425 FillInputFromFormGroup(form_group, inputs); |
426 } | 426 } |
427 | 427 |
428 section_editing_state_[section] = true; | 428 section_editing_state_[section] = true; |
429 view_->UpdateSection(section); | 429 view_->UpdateSection(section); |
430 } | 430 } |
431 | 431 |
432 bool AutofillDialogControllerImpl::InputIsValid(AutofillFieldType type, | 432 bool AutofillDialogControllerImpl::InputIsValid(AutofillFieldType type, |
433 const string16& value) { | 433 const string16& value) { |
434 // TODO(groby): Add the missing checks. | |
435 switch (type) { | 434 switch (type) { |
| 435 case EMAIL_ADDRESS: |
| 436 // TODO(groby): Add the missing check. |
| 437 break; |
| 438 |
436 case CREDIT_CARD_NUMBER: | 439 case CREDIT_CARD_NUMBER: |
437 return autofill::IsValidCreditCardNumber(value); | 440 return autofill::IsValidCreditCardNumber(value); |
| 441 case CREDIT_CARD_NAME: |
| 442 break; |
| 443 case CREDIT_CARD_EXP_MONTH: |
| 444 case CREDIT_CARD_EXP_4_DIGIT_YEAR: |
| 445 NOTREACHED(); // Validation is not called for <select> |
| 446 break; |
| 447 case CREDIT_CARD_VERIFICATION_CODE: |
| 448 return autofill::IsValidCreditCardSecurityCode(value); |
| 449 |
| 450 case ADDRESS_HOME_LINE1: |
| 451 break; |
| 452 case ADDRESS_HOME_LINE2: |
| 453 return true; // Line 2 is optional - always valid. |
| 454 case ADDRESS_HOME_CITY: |
| 455 case ADDRESS_HOME_STATE: |
| 456 case ADDRESS_HOME_ZIP: |
| 457 break; |
| 458 |
438 default: | 459 default: |
| 460 NOTREACHED(); // Trying to validate unknown field. |
439 break; | 461 break; |
440 } | 462 } |
441 | 463 |
442 return !value.empty(); | 464 return !value.empty(); |
443 } | 465 } |
444 | 466 |
445 void AutofillDialogControllerImpl::UserEditedOrActivatedInput( | 467 void AutofillDialogControllerImpl::UserEditedOrActivatedInput( |
446 const DetailInput* input, | 468 const DetailInput* input, |
447 DialogSection section, | 469 DialogSection section, |
448 gfx::NativeView parent_view, | 470 gfx::NativeView parent_view, |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 DialogSection section) { | 973 DialogSection section) { |
952 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); | 974 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); |
953 } | 975 } |
954 | 976 |
955 void AutofillDialogControllerImpl::HidePopup() { | 977 void AutofillDialogControllerImpl::HidePopup() { |
956 if (popup_controller_) | 978 if (popup_controller_) |
957 popup_controller_->Hide(); | 979 popup_controller_->Hide(); |
958 } | 980 } |
959 | 981 |
960 } // namespace autofill | 982 } // namespace autofill |
OLD | NEW |