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/views/autofill/autofill_dialog_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 icon_->SetImage(image.AsImageSkia()); | 325 icon_->SetImage(image.AsImageSkia()); |
326 } | 326 } |
327 | 327 |
328 void AutofillDialogViews::SuggestionView::ShowTextfield( | 328 void AutofillDialogViews::SuggestionView::ShowTextfield( |
329 const string16& placeholder_text) { | 329 const string16& placeholder_text) { |
330 decorated_->textfield()->set_placeholder_text(placeholder_text); | 330 decorated_->textfield()->set_placeholder_text(placeholder_text); |
331 decorated_->SetVisible(true); | 331 decorated_->SetVisible(true); |
332 } | 332 } |
333 | 333 |
334 // AutofilDialogViews::AutocheckoutProgressBar --------------------------------- | 334 // AutofilDialogViews::AutocheckoutProgressBar --------------------------------- |
| 335 |
335 AutofillDialogViews::AutocheckoutProgressBar::AutocheckoutProgressBar() {} | 336 AutofillDialogViews::AutocheckoutProgressBar::AutocheckoutProgressBar() {} |
336 | 337 |
337 gfx::Size AutofillDialogViews::AutocheckoutProgressBar::GetPreferredSize() { | 338 gfx::Size AutofillDialogViews::AutocheckoutProgressBar::GetPreferredSize() { |
338 return gfx::Size(kAutocheckoutProgressBarWidth, | 339 return gfx::Size(kAutocheckoutProgressBarWidth, |
339 kAutocheckoutProgressBarHeight); | 340 kAutocheckoutProgressBarHeight); |
340 } | 341 } |
341 | 342 |
342 // AutofillDialogView ---------------------------------------------------------- | 343 // AutofillDialogView ---------------------------------------------------------- |
343 | 344 |
344 // static | 345 // static |
(...skipping 13 matching lines...) Expand all Loading... |
358 use_billing_for_shipping_(NULL), | 359 use_billing_for_shipping_(NULL), |
359 sign_in_link_(NULL), | 360 sign_in_link_(NULL), |
360 sign_in_container_(NULL), | 361 sign_in_container_(NULL), |
361 cancel_sign_in_(NULL), | 362 cancel_sign_in_(NULL), |
362 sign_in_webview_(NULL), | 363 sign_in_webview_(NULL), |
363 main_container_(NULL), | 364 main_container_(NULL), |
364 button_strip_extra_view_(NULL), | 365 button_strip_extra_view_(NULL), |
365 save_in_chrome_checkbox_(NULL), | 366 save_in_chrome_checkbox_(NULL), |
366 autocheckout_progress_bar_view_(NULL), | 367 autocheckout_progress_bar_view_(NULL), |
367 autocheckout_progress_bar_(NULL), | 368 autocheckout_progress_bar_(NULL), |
| 369 footnote_view_(NULL), |
368 focus_manager_(NULL) { | 370 focus_manager_(NULL) { |
369 DCHECK(controller); | 371 DCHECK(controller); |
370 detail_groups_.insert(std::make_pair(SECTION_EMAIL, | 372 detail_groups_.insert(std::make_pair(SECTION_EMAIL, |
371 DetailsGroup(SECTION_EMAIL))); | 373 DetailsGroup(SECTION_EMAIL))); |
372 detail_groups_.insert(std::make_pair(SECTION_CC, | 374 detail_groups_.insert(std::make_pair(SECTION_CC, |
373 DetailsGroup(SECTION_CC))); | 375 DetailsGroup(SECTION_CC))); |
374 detail_groups_.insert(std::make_pair(SECTION_BILLING, | 376 detail_groups_.insert(std::make_pair(SECTION_BILLING, |
375 DetailsGroup(SECTION_BILLING))); | 377 DetailsGroup(SECTION_BILLING))); |
376 detail_groups_.insert(std::make_pair(SECTION_SHIPPING, | 378 detail_groups_.insert(std::make_pair(SECTION_SHIPPING, |
377 DetailsGroup(SECTION_SHIPPING))); | 379 DetailsGroup(SECTION_SHIPPING))); |
378 } | 380 } |
379 | 381 |
380 AutofillDialogViews::~AutofillDialogViews() { | 382 AutofillDialogViews::~AutofillDialogViews() { |
381 DCHECK(!window_); | 383 DCHECK(!window_); |
382 } | 384 } |
383 | 385 |
384 void AutofillDialogViews::Show() { | 386 void AutofillDialogViews::Show() { |
385 InitChildViews(); | 387 InitChildViews(); |
386 UpdateAccountChooser(); | 388 UpdateAccountChooser(); |
387 UpdateNotificationArea(); | 389 UpdateNotificationArea(); |
| 390 UpdateFootnote(); |
388 | 391 |
389 // Ownership of |contents_| is handed off by this call. The | 392 // Ownership of |contents_| is handed off by this call. The |
390 // WebContentsModalDialog will take care of deleting itself after calling | 393 // WebContentsModalDialog will take care of deleting itself after calling |
391 // DeleteDelegate(). | 394 // DeleteDelegate(). |
392 window_ = ConstrainedWindowViews::Create(controller_->web_contents(), this); | 395 window_ = ConstrainedWindowViews::Create(controller_->web_contents(), this); |
393 focus_manager_ = window_->GetFocusManager(); | 396 focus_manager_ = window_->GetFocusManager(); |
394 focus_manager_->AddFocusChangeListener(this); | 397 focus_manager_->AddFocusChangeListener(this); |
395 } | 398 } |
396 | 399 |
397 void AutofillDialogViews::Hide() { | 400 void AutofillDialogViews::Hide() { |
398 if (window_) | 401 if (window_) |
399 window_->CloseWebContentsModalDialog(); | 402 window_->CloseWebContentsModalDialog(); |
400 } | 403 } |
401 | 404 |
402 void AutofillDialogViews::UpdateAccountChooser() { | 405 void AutofillDialogViews::UpdateAccountChooser() { |
403 DialogSignedInState state = controller_->SignedInState(); | 406 DialogSignedInState state = controller_->SignedInState(); |
404 sign_in_link_->SetEnabled(state != REQUIRES_RESPONSE); | 407 sign_in_link_->SetEnabled(state != REQUIRES_RESPONSE); |
405 sign_in_link_->SetVisible(state != SIGNED_IN); | 408 sign_in_link_->SetVisible(state != SIGNED_IN); |
406 } | 409 } |
407 | 410 |
408 void AutofillDialogViews::UpdateNotificationArea() { | 411 void AutofillDialogViews::UpdateNotificationArea() { |
409 DCHECK(notification_area_); | 412 DCHECK(notification_area_); |
410 notification_area_->SetNotification(controller_->CurrentNotification()); | 413 notification_area_->SetNotification(controller_->CurrentNotification()); |
411 | 414 ContentsResized(); |
412 if (GetWidget()) | |
413 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); | |
414 | |
415 contents_->Layout(); | |
416 } | 415 } |
417 | 416 |
418 void AutofillDialogViews::UpdateSection(DialogSection section) { | 417 void AutofillDialogViews::UpdateSection(DialogSection section) { |
419 const DetailInputs& updated_inputs = | 418 const DetailInputs& updated_inputs = |
420 controller_->RequestedFieldsForSection(section); | 419 controller_->RequestedFieldsForSection(section); |
421 DetailsGroup* group = GroupForSection(section); | 420 DetailsGroup* group = GroupForSection(section); |
422 | 421 |
423 for (DetailInputs::const_iterator iter = updated_inputs.begin(); | 422 for (DetailInputs::const_iterator iter = updated_inputs.begin(); |
424 iter != updated_inputs.end(); ++iter) { | 423 iter != updated_inputs.end(); ++iter) { |
425 TextfieldMap::iterator input = group->textfields.find(&(*iter)); | 424 TextfieldMap::iterator input = group->textfields.find(&(*iter)); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 | 471 |
473 void AutofillDialogViews::HideSignIn() { | 472 void AutofillDialogViews::HideSignIn() { |
474 sign_in_container_->SetVisible(false); | 473 sign_in_container_->SetVisible(false); |
475 main_container_->SetVisible(true); | 474 main_container_->SetVisible(true); |
476 } | 475 } |
477 | 476 |
478 void AutofillDialogViews::UpdateProgressBar(double value) { | 477 void AutofillDialogViews::UpdateProgressBar(double value) { |
479 autocheckout_progress_bar_->SetValue(value); | 478 autocheckout_progress_bar_->SetValue(value); |
480 } | 479 } |
481 | 480 |
| 481 void AutofillDialogViews::UpdateFootnote() { |
| 482 PopulateFootnoteLinks(); |
| 483 ContentsResized(); |
| 484 } |
| 485 |
482 string16 AutofillDialogViews::GetWindowTitle() const { | 486 string16 AutofillDialogViews::GetWindowTitle() const { |
483 return controller_->DialogTitle(); | 487 return controller_->DialogTitle(); |
484 } | 488 } |
485 | 489 |
486 void AutofillDialogViews::WindowClosing() { | 490 void AutofillDialogViews::WindowClosing() { |
487 focus_manager_->RemoveFocusChangeListener(this); | 491 focus_manager_->RemoveFocusChangeListener(this); |
488 } | 492 } |
489 | 493 |
490 void AutofillDialogViews::DeleteDelegate() { | 494 void AutofillDialogViews::DeleteDelegate() { |
491 window_ = NULL; | 495 window_ = NULL; |
(...skipping 21 matching lines...) Expand all Loading... |
513 | 517 |
514 bool AutofillDialogViews::IsDialogButtonEnabled(ui::DialogButton button) const { | 518 bool AutofillDialogViews::IsDialogButtonEnabled(ui::DialogButton button) const { |
515 return true; | 519 return true; |
516 } | 520 } |
517 | 521 |
518 views::View* AutofillDialogViews::GetExtraView() { | 522 views::View* AutofillDialogViews::GetExtraView() { |
519 return button_strip_extra_view_; | 523 return button_strip_extra_view_; |
520 } | 524 } |
521 | 525 |
522 views::View* AutofillDialogViews::GetFootnoteView() { | 526 views::View* AutofillDialogViews::GetFootnoteView() { |
523 // TODO(estade): add a view to contain the terms of service. | 527 return footnote_view_; |
524 return NULL; | |
525 } | 528 } |
526 | 529 |
527 bool AutofillDialogViews::Cancel() { | 530 bool AutofillDialogViews::Cancel() { |
528 return true; | 531 return true; |
529 } | 532 } |
530 | 533 |
531 bool AutofillDialogViews::Accept() { | 534 bool AutofillDialogViews::Accept() { |
532 if (!ValidateForm()) | 535 if (!ValidateForm()) |
533 return false; | 536 return false; |
534 | 537 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 views::View* focused_before, | 598 views::View* focused_before, |
596 views::View* focused_now) { | 599 views::View* focused_now) { |
597 controller_->FocusMoved(); | 600 controller_->FocusMoved(); |
598 } | 601 } |
599 | 602 |
600 void AutofillDialogViews::OnDidChangeFocus( | 603 void AutofillDialogViews::OnDidChangeFocus( |
601 views::View* focused_before, | 604 views::View* focused_before, |
602 views::View* focused_now) {} | 605 views::View* focused_now) {} |
603 | 606 |
604 void AutofillDialogViews::LinkClicked(views::Link* source, int event_flags) { | 607 void AutofillDialogViews::LinkClicked(views::Link* source, int event_flags) { |
605 // Sign in link. | |
606 if (source == sign_in_link_) { | 608 if (source == sign_in_link_) { |
607 controller_->StartSignInFlow(); | 609 controller_->StartSignInFlow(); |
608 return; | 610 } else if (footnote_view_->Contains(source)) { |
609 } | 611 const size_t link_index = (source->parent()->GetIndexOf(source) - 1) / 2; |
610 | 612 controller_->LegalDocumentLinkClicked(link_index); |
611 // Edit links. | 613 } else { |
612 for (DetailGroupMap::iterator iter = detail_groups_.begin(); | 614 // Edit links. |
613 iter != detail_groups_.end(); ++iter) { | 615 for (DetailGroupMap::iterator iter = detail_groups_.begin(); |
614 if (iter->second.suggested_info->Contains(source)) { | 616 iter != detail_groups_.end(); ++iter) { |
615 controller_->EditClickedForSection(iter->first); | 617 if (iter->second.suggested_info->Contains(source)) { |
616 return; | 618 controller_->EditClickedForSection(iter->first); |
| 619 return; |
| 620 } |
617 } | 621 } |
618 } | 622 } |
619 } | 623 } |
620 | 624 |
621 void AutofillDialogViews::InitChildViews() { | 625 void AutofillDialogViews::InitChildViews() { |
622 button_strip_extra_view_ = new views::View(); | 626 button_strip_extra_view_ = new views::View(); |
623 button_strip_extra_view_->SetLayoutManager( | 627 button_strip_extra_view_->SetLayoutManager( |
624 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 628 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
625 | 629 |
626 save_in_chrome_checkbox_ = | 630 save_in_chrome_checkbox_ = |
(...skipping 13 matching lines...) Expand all Loading... |
640 autocheckout_progress_bar_ = new AutocheckoutProgressBar(); | 644 autocheckout_progress_bar_ = new AutocheckoutProgressBar(); |
641 autocheckout_progress_bar_view_->AddChildView(autocheckout_progress_bar_); | 645 autocheckout_progress_bar_view_->AddChildView(autocheckout_progress_bar_); |
642 | 646 |
643 button_strip_extra_view_->AddChildView(autocheckout_progress_bar_view_); | 647 button_strip_extra_view_->AddChildView(autocheckout_progress_bar_view_); |
644 | 648 |
645 contents_ = new views::View(); | 649 contents_ = new views::View(); |
646 contents_->SetLayoutManager( | 650 contents_->SetLayoutManager( |
647 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 651 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
648 contents_->AddChildView(CreateMainContainer()); | 652 contents_->AddChildView(CreateMainContainer()); |
649 contents_->AddChildView(CreateSignInContainer()); | 653 contents_->AddChildView(CreateSignInContainer()); |
650 } | |
651 | 654 |
652 views::View* AutofillDialogViews::CreateSignInContainer() { | 655 // |foonote_view_| is added to View hierarchy by |GetFootnoteView()|. |
653 sign_in_container_ = new views::View(); | 656 footnote_view_ = new views::View(); |
654 sign_in_container_->SetLayoutManager( | 657 footnote_view_->set_border(views::Border::CreateEmptyBorder( |
655 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 658 views::kUnrelatedControlVerticalSpacing, 0, 0, 0)); |
656 sign_in_container_->SetVisible(false); | 659 views::BoxLayout* box_layout = |
657 sign_in_webview_ = new views::WebView(controller_->profile()); | 660 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); |
658 cancel_sign_in_ = new views::TextButton(this, | 661 box_layout->set_spread_blank_space(true); |
659 controller_->CancelSignInText()); | 662 footnote_view_->SetLayoutManager(box_layout); |
660 sign_in_container_->AddChildView(cancel_sign_in_); | |
661 sign_in_container_->AddChildView(sign_in_webview_); | |
662 return sign_in_container_; | |
663 } | 663 } |
664 | 664 |
665 views::View* AutofillDialogViews::CreateMainContainer() { | 665 views::View* AutofillDialogViews::CreateMainContainer() { |
666 main_container_ = new views::View(); | 666 main_container_ = new views::View(); |
667 views::GridLayout* layout = new views::GridLayout(main_container_); | 667 views::GridLayout* layout = new views::GridLayout(main_container_); |
668 main_container_->SetLayoutManager(layout); | 668 main_container_->SetLayoutManager(layout); |
669 | 669 |
670 const int single_column_set = 0; | 670 const int single_column_set = 0; |
671 views::ColumnSet* column_set = layout->AddColumnSet(single_column_set); | 671 views::ColumnSet* column_set = layout->AddColumnSet(single_column_set); |
672 column_set->AddColumn(views::GridLayout::FILL, | 672 column_set->AddColumn(views::GridLayout::FILL, |
(...skipping 14 matching lines...) Expand all Loading... |
687 layout->StartRow(0, single_column_set); | 687 layout->StartRow(0, single_column_set); |
688 notification_area_ = new NotificationArea(); | 688 notification_area_ = new NotificationArea(); |
689 layout->AddView(notification_area_); | 689 layout->AddView(notification_area_); |
690 | 690 |
691 layout->StartRowWithPadding(0, single_column_set, | 691 layout->StartRowWithPadding(0, single_column_set, |
692 0, views::kUnrelatedControlVerticalSpacing); | 692 0, views::kUnrelatedControlVerticalSpacing); |
693 layout->AddView(CreateDetailsContainer()); | 693 layout->AddView(CreateDetailsContainer()); |
694 return main_container_; | 694 return main_container_; |
695 } | 695 } |
696 | 696 |
| 697 views::View* AutofillDialogViews::CreateSignInContainer() { |
| 698 sign_in_container_ = new views::View(); |
| 699 sign_in_container_->SetLayoutManager( |
| 700 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
| 701 sign_in_container_->SetVisible(false); |
| 702 sign_in_webview_ = new views::WebView(controller_->profile()); |
| 703 cancel_sign_in_ = new views::TextButton(this, |
| 704 controller_->CancelSignInText()); |
| 705 sign_in_container_->AddChildView(cancel_sign_in_); |
| 706 sign_in_container_->AddChildView(sign_in_webview_); |
| 707 return sign_in_container_; |
| 708 } |
| 709 |
| 710 void AutofillDialogViews::PopulateFootnoteLinks() { |
| 711 const std::vector<string16>& link_parts = controller_->FootnoteLinkParts(); |
| 712 |
| 713 const bool has_links = !link_parts.empty(); |
| 714 footnote_view_->SetVisible(has_links); |
| 715 if (!has_links) |
| 716 return; |
| 717 |
| 718 footnote_view_->RemoveAllChildViews(true); |
| 719 |
| 720 // TODO(dbeam): pull out hardcoded colors / theme? |
| 721 views::View* footnote_padding = new views::View(); |
| 722 footnote_padding->set_background(views::Background::CreateSolidBackground( |
| 723 SkColorSetRGB(0xf3, 0xf3, 0xf4))); |
| 724 footnote_padding->set_border(views::Border::CreateSolidSidedBorder( |
| 725 1, 0, 0, 0, SkColorSetRGB(0xea, 0xea, 0xeb))); |
| 726 |
| 727 footnote_view_->AddChildView(footnote_padding); |
| 728 |
| 729 views::GridLayout* padding_layout = new views::GridLayout(footnote_padding); |
| 730 footnote_padding->SetLayoutManager(padding_layout); |
| 731 |
| 732 const int links_column_set = 1; |
| 733 views::ColumnSet* column_set = padding_layout->AddColumnSet(links_column_set); |
| 734 |
| 735 for (size_t i = 0; i < link_parts.size(); ++i) { |
| 736 column_set->AddColumn(views::GridLayout::LEADING, |
| 737 views::GridLayout::FILL, |
| 738 0, |
| 739 views::GridLayout::USE_PREF, |
| 740 0, |
| 741 0); |
| 742 } |
| 743 |
| 744 // Padding between border and slew of labels/links. |
| 745 padding_layout->StartRowWithPadding( |
| 746 0, links_column_set, 0, views::kUnrelatedControlVerticalSpacing); |
| 747 |
| 748 for (size_t i = 0; i < link_parts.size(); ++i) { |
| 749 if (i % 2 == 0) { |
| 750 // Text between links. |
| 751 padding_layout->AddView(new views::Label(link_parts[i])); |
| 752 } else { |
| 753 // Link to a legal document (i.e. Terms Of Service, Privacy Policy). |
| 754 views::Link* link = new views::Link(link_parts[i]); |
| 755 link->SetEnabledColor(SkColorSetRGB(0x64, 0x64, 0x64)); |
| 756 link->set_listener(this); |
| 757 padding_layout->AddView(link); |
| 758 } |
| 759 } |
| 760 |
| 761 const int full_width_column_set = 2; |
| 762 padding_layout->AddColumnSet(full_width_column_set)->AddColumn( |
| 763 views::GridLayout::LEADING, |
| 764 views::GridLayout::FILL, |
| 765 1, |
| 766 views::GridLayout::USE_PREF, |
| 767 0, |
| 768 0); |
| 769 |
| 770 // Text after links explaining that by clicking you agree (i.e. "By clicking |
| 771 // submit you verify that you accept these changes."). |
| 772 padding_layout->StartRowWithPadding( |
| 773 0, full_width_column_set, 0, views::kRelatedControlVerticalSpacing); |
| 774 padding_layout->AddView( |
| 775 new views::Label(controller_->AcceptFootnoteLinksText())); |
| 776 |
| 777 padding_layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
| 778 } |
| 779 |
697 views::View* AutofillDialogViews::CreateDetailsContainer() { | 780 views::View* AutofillDialogViews::CreateDetailsContainer() { |
698 views::View* view = new views::View(); | 781 views::View* view = new views::View(); |
699 // A box layout is used because it respects widget visibility. | 782 // A box layout is used because it respects widget visibility. |
700 view->SetLayoutManager( | 783 view->SetLayoutManager( |
701 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, | 784 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, |
702 views::kRelatedControlVerticalSpacing)); | 785 views::kRelatedControlVerticalSpacing)); |
703 for (DetailGroupMap::iterator iter = detail_groups_.begin(); | 786 for (DetailGroupMap::iterator iter = detail_groups_.begin(); |
704 iter != detail_groups_.end(); ++iter) { | 787 iter != detail_groups_.end(); ++iter) { |
705 CreateDetailsSection(iter->second.section); | 788 CreateDetailsSection(iter->second.section); |
706 view->AddChildView(iter->second.container); | 789 view->AddChildView(iter->second.container); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 group.manual_input->SetVisible(!show_suggestions); | 957 group.manual_input->SetVisible(!show_suggestions); |
875 } | 958 } |
876 | 959 |
877 // Show or hide the "Save in chrome" checkbox. If nothing is in editing mode, | 960 // Show or hide the "Save in chrome" checkbox. If nothing is in editing mode, |
878 // hide. | 961 // hide. |
879 save_in_chrome_checkbox_->SetVisible(AtLeastOneSectionIsEditing()); | 962 save_in_chrome_checkbox_->SetVisible(AtLeastOneSectionIsEditing()); |
880 | 963 |
881 if (group.container) | 964 if (group.container) |
882 group.container->SetForwardMouseEvents(show_suggestions); | 965 group.container->SetForwardMouseEvents(show_suggestions); |
883 | 966 |
884 if (GetWidget()) | 967 ContentsResized(); |
885 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); | |
886 } | 968 } |
887 | 969 |
888 bool AutofillDialogViews::AtLeastOneSectionIsEditing() { | 970 bool AutofillDialogViews::AtLeastOneSectionIsEditing() { |
889 for (DetailGroupMap::iterator iter = detail_groups_.begin(); | 971 for (DetailGroupMap::iterator iter = detail_groups_.begin(); |
890 iter != detail_groups_.end(); ++iter) { | 972 iter != detail_groups_.end(); ++iter) { |
891 if (iter->second.manual_input && iter->second.manual_input->visible()) | 973 if (iter->second.manual_input && iter->second.manual_input->visible()) |
892 return true; | 974 return true; |
893 } | 975 } |
894 | 976 |
895 return false; | 977 return false; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 decorated = group->suggested_info->decorated_textfield(); | 1045 decorated = group->suggested_info->decorated_textfield(); |
964 type = CREDIT_CARD_VERIFICATION_CODE; | 1046 type = CREDIT_CARD_VERIFICATION_CODE; |
965 } | 1047 } |
966 DCHECK_NE(UNKNOWN_TYPE, type); | 1048 DCHECK_NE(UNKNOWN_TYPE, type); |
967 | 1049 |
968 // If the field is marked as invalid, check if the text is now valid. | 1050 // If the field is marked as invalid, check if the text is now valid. |
969 if (decorated->invalid() && was_edit) | 1051 if (decorated->invalid() && was_edit) |
970 decorated->SetInvalid(!controller_->InputIsValid(type, textfield->text())); | 1052 decorated->SetInvalid(!controller_->InputIsValid(type, textfield->text())); |
971 } | 1053 } |
972 | 1054 |
| 1055 void AutofillDialogViews::ContentsResized() { |
| 1056 if (GetWidget()) |
| 1057 GetWidget()->SetSize(GetWidget()->non_client_view()->GetPreferredSize()); |
| 1058 } |
| 1059 |
973 AutofillDialogViews::DetailsGroup* AutofillDialogViews::GroupForSection( | 1060 AutofillDialogViews::DetailsGroup* AutofillDialogViews::GroupForSection( |
974 DialogSection section) { | 1061 DialogSection section) { |
975 return &detail_groups_.find(section)->second; | 1062 return &detail_groups_.find(section)->second; |
976 } | 1063 } |
977 | 1064 |
978 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 1065 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
979 : section(section), | 1066 : section(section), |
980 container(NULL), | 1067 container(NULL), |
981 manual_input(NULL), | 1068 manual_input(NULL), |
982 suggested_info(NULL), | 1069 suggested_info(NULL), |
983 suggested_button(NULL) {} | 1070 suggested_button(NULL) {} |
984 | 1071 |
985 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 1072 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
986 | 1073 |
987 } // namespace autofill | 1074 } // namespace autofill |
OLD | NEW |