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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // It exists to circumvent shortcomings of GridLayout and BoxLayout (namely that | 145 // It exists to circumvent shortcomings of GridLayout and BoxLayout (namely that |
146 // the former doesn't fully respect child visibility, and that the latter won't | 146 // the former doesn't fully respect child visibility, and that the latter won't |
147 // expand a single child). | 147 // expand a single child). |
148 class SectionRowView : public views::View { | 148 class SectionRowView : public views::View { |
149 public: | 149 public: |
150 SectionRowView() {} | 150 SectionRowView() {} |
151 virtual ~SectionRowView() {} | 151 virtual ~SectionRowView() {} |
152 | 152 |
153 // views::View implementation: | 153 // views::View implementation: |
154 virtual gfx::Size GetPreferredSize() OVERRIDE { | 154 virtual gfx::Size GetPreferredSize() OVERRIDE { |
155 // Only the height matters anyway. | 155 int height = 0; |
156 return child_at(2)->GetPreferredSize(); | 156 int width = 0; |
| 157 for (int i = 0; i < child_count(); ++i) { |
| 158 if (child_at(i)->visible()) { |
| 159 if (width > 0) |
| 160 width += kAroundTextPadding; |
| 161 |
| 162 gfx::Size size = child_at(i)->GetPreferredSize(); |
| 163 height = std::max(height, size.height()); |
| 164 width += size.width(); |
| 165 } |
| 166 } |
| 167 |
| 168 return gfx::Size(width, height); |
157 } | 169 } |
158 | 170 |
159 virtual void Layout() OVERRIDE { | 171 virtual void Layout() OVERRIDE { |
160 const gfx::Rect bounds = GetContentsBounds(); | 172 const gfx::Rect bounds = GetContentsBounds(); |
161 | 173 |
162 // Icon is left aligned. | 174 // Icon is left aligned. |
163 int start_x = bounds.x(); | 175 int start_x = bounds.x(); |
164 views::View* icon = child_at(0); | 176 views::View* icon = child_at(0); |
165 if (icon->visible()) { | 177 if (icon->visible()) { |
166 icon->SizeToPreferredSize(); | 178 icon->SizeToPreferredSize(); |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 kOverlayTextInterlineSpacing)); | 593 kOverlayTextInterlineSpacing)); |
582 message_stack_->set_border(views::Border::CreateEmptyBorder( | 594 message_stack_->set_border(views::Border::CreateEmptyBorder( |
583 kDialogEdgePadding, kDialogEdgePadding, 0, kDialogEdgePadding)); | 595 kDialogEdgePadding, kDialogEdgePadding, 0, kDialogEdgePadding)); |
584 | 596 |
585 AddChildView(button_); | 597 AddChildView(button_); |
586 button_->set_focusable(true); | 598 button_->set_focusable(true); |
587 } | 599 } |
588 | 600 |
589 AutofillDialogViews::OverlayView::~OverlayView() {} | 601 AutofillDialogViews::OverlayView::~OverlayView() {} |
590 | 602 |
591 int AutofillDialogViews::OverlayView::GetHeightForContentsForWidth(int w) { | 603 int AutofillDialogViews::OverlayView::GetHeightForContentsForWidth(int width) { |
592 // In this case, 0 means "no preference". | 604 // In this case, 0 means "no preference". |
593 if (!message_stack_->visible()) | 605 if (!message_stack_->visible()) |
594 return 0; | 606 return 0; |
595 | 607 |
596 return kOverlayImageBottomMargin + | 608 return kOverlayImageBottomMargin + |
597 views::kButtonVEdgeMarginNew + | 609 views::kButtonVEdgeMarginNew + |
598 message_stack_->GetHeightForWidth(w) + | 610 message_stack_->GetHeightForWidth(width) + |
599 image_view_->GetHeightForWidth(w) + | 611 image_view_->GetHeightForWidth(width) + |
600 (button_->visible() ? button_->GetHeightForWidth(w) + | 612 (button_->visible() ? button_->GetHeightForWidth(width) + |
601 views::kButtonVEdgeMarginNew : 0); | 613 views::kButtonVEdgeMarginNew : 0); |
602 } | 614 } |
603 | 615 |
604 void AutofillDialogViews::OverlayView::SetState( | 616 void AutofillDialogViews::OverlayView::SetState( |
605 const DialogOverlayState& state, | 617 const DialogOverlayState& state, |
606 views::ButtonListener* listener) { | 618 views::ButtonListener* listener) { |
607 // Don't update anything if we're still fading out the old state. | 619 // Don't update anything if we're still fading out the old state. |
608 if (fade_out_) | 620 if (fade_out_) |
609 return; | 621 return; |
610 | 622 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 ui::MouseEvent AutofillDialogViews::SectionContainer::ProxyEvent( | 991 ui::MouseEvent AutofillDialogViews::SectionContainer::ProxyEvent( |
980 const ui::MouseEvent& event) { | 992 const ui::MouseEvent& event) { |
981 ui::MouseEvent event_copy = event; | 993 ui::MouseEvent event_copy = event; |
982 event_copy.set_location(gfx::Point()); | 994 event_copy.set_location(gfx::Point()); |
983 return event_copy; | 995 return event_copy; |
984 } | 996 } |
985 | 997 |
986 // AutofilDialogViews::SuggestionView ------------------------------------------ | 998 // AutofilDialogViews::SuggestionView ------------------------------------------ |
987 | 999 |
988 AutofillDialogViews::SuggestionView::SuggestionView( | 1000 AutofillDialogViews::SuggestionView::SuggestionView( |
989 const base::string16& edit_label, | |
990 AutofillDialogViews* autofill_dialog) | 1001 AutofillDialogViews* autofill_dialog) |
991 : label_(new views::Label()), | 1002 : label_(new views::Label()), |
992 label_line_2_(new views::Label()), | 1003 label_line_2_(new views::Label()), |
993 icon_(new views::ImageView()), | 1004 icon_(new views::ImageView()), |
994 label_container_(new SectionRowView()), | |
995 decorated_( | 1005 decorated_( |
996 new DecoratedTextfield(base::string16(), | 1006 new DecoratedTextfield(base::string16(), |
997 base::string16(), | 1007 base::string16(), |
998 autofill_dialog)) { | 1008 autofill_dialog)) { |
999 // TODO(estade): Make this the correct color. | 1009 // TODO(estade): Make this the correct color. |
1000 set_border( | 1010 set_border( |
1001 views::Border::CreateSolidSidedBorder(1, 0, 0, 0, SK_ColorLTGRAY)); | 1011 views::Border::CreateSolidSidedBorder(1, 0, 0, 0, SK_ColorLTGRAY)); |
1002 | 1012 |
| 1013 SectionRowView* label_container = new SectionRowView(); |
| 1014 AddChildView(label_container); |
| 1015 |
1003 // Label and icon. | 1016 // Label and icon. |
| 1017 label_container->AddChildView(icon_); |
1004 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1018 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
1005 label_container_->AddChildView(icon_); | 1019 label_container->AddChildView(label_); |
1006 label_container_->AddChildView(label_); | 1020 |
1007 label_container_->AddChildView(decorated_); | 1021 // TODO(estade): get the sizing and spacing right on this textfield. |
1008 decorated_->SetVisible(false); | 1022 decorated_->SetVisible(false); |
1009 // TODO(estade): get the sizing and spacing right on this textfield. | |
1010 decorated_->set_default_width_in_chars(10); | 1023 decorated_->set_default_width_in_chars(10); |
1011 AddChildView(label_container_); | 1024 label_container->AddChildView(decorated_); |
1012 | 1025 |
| 1026 // TODO(estade): need to get the line height right. |
1013 label_line_2_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1027 label_line_2_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
1014 label_line_2_->SetVisible(false); | 1028 label_line_2_->SetVisible(false); |
1015 label_line_2_->SetMultiLine(true); | 1029 label_line_2_->SetMultiLine(true); |
1016 AddChildView(label_line_2_); | 1030 AddChildView(label_line_2_); |
1017 | 1031 |
1018 // TODO(estade): do something about this '2'. | 1032 // TODO(estade): do something about this '2'. |
1019 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 2, 0)); | 1033 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 2, 0)); |
1020 } | 1034 } |
1021 | 1035 |
1022 AutofillDialogViews::SuggestionView::~SuggestionView() {} | 1036 AutofillDialogViews::SuggestionView::~SuggestionView() {} |
1023 | 1037 |
1024 void AutofillDialogViews::SuggestionView::SetSuggestionText( | 1038 gfx::Size AutofillDialogViews::SuggestionView::GetPreferredSize() { |
1025 const base::string16& text, | 1039 // There's no preferred width. The parent's layout should get the preferred |
1026 gfx::Font::FontStyle text_style) { | 1040 // height from GetHeightForWidth(). |
1027 label_->SetFont(ui::ResourceBundle::GetSharedInstance().GetFont( | 1041 return gfx::Size(); |
1028 ui::ResourceBundle::BaseFont).DeriveFont(0, text_style)); | 1042 } |
1029 | 1043 |
| 1044 int AutofillDialogViews::SuggestionView::GetHeightForWidth(int width) { |
| 1045 int height = 0; |
| 1046 CanUseVerticallyCompactText(width, &height); |
| 1047 return height; |
| 1048 } |
| 1049 |
| 1050 bool AutofillDialogViews::SuggestionView::CanUseVerticallyCompactText( |
| 1051 int available_width, |
| 1052 int* resulting_height) { |
| 1053 // This calculation may be costly, avoid doing it more than once per width. |
| 1054 if (!calculated_heights_.count(available_width)) { |
| 1055 // Changing the state of |this| now will lead to extra layouts and |
| 1056 // paints we don't want, so create another SuggestionView to calculate |
| 1057 // which label we have room to show. |
| 1058 SuggestionView sizing_view(NULL); |
| 1059 sizing_view.SetLabelText(state_.vertically_compact_text); |
| 1060 sizing_view.SetIcon(state_.icon); |
| 1061 sizing_view.SetTextfield(state_.extra_text, state_.extra_icon); |
| 1062 |
| 1063 // Shortcut |sizing_view|'s GetHeightForWidth() to avoid an infinite loop. |
| 1064 // Its BoxLayout must do these calculations for us. |
| 1065 views::LayoutManager* layout = sizing_view.GetLayoutManager(); |
| 1066 if (layout->GetPreferredSize(&sizing_view).width() <= available_width) { |
| 1067 calculated_heights_[available_width] = std::make_pair( |
| 1068 true, |
| 1069 layout->GetPreferredHeightForWidth(&sizing_view, available_width)); |
| 1070 } else { |
| 1071 sizing_view.SetLabelText(state_.horizontally_compact_text); |
| 1072 calculated_heights_[available_width] = std::make_pair( |
| 1073 false, |
| 1074 layout->GetPreferredHeightForWidth(&sizing_view, available_width)); |
| 1075 } |
| 1076 } |
| 1077 |
| 1078 const std::pair<bool, int>& values = calculated_heights_[available_width]; |
| 1079 *resulting_height = values.second; |
| 1080 return values.first; |
| 1081 } |
| 1082 |
| 1083 void AutofillDialogViews::SuggestionView::OnBoundsChanged( |
| 1084 const gfx::Rect& previous_bounds) { |
| 1085 int unused; |
| 1086 SetLabelText(CanUseVerticallyCompactText(width(), &unused) ? |
| 1087 state_.vertically_compact_text : |
| 1088 state_.horizontally_compact_text); |
| 1089 } |
| 1090 |
| 1091 void AutofillDialogViews::SuggestionView::SetState( |
| 1092 const SuggestionState& state) { |
| 1093 calculated_heights_.clear(); |
| 1094 state_ = state; |
| 1095 SetVisible(state_.visible); |
| 1096 // Set to the more compact text for now. |this| will optionally switch to |
| 1097 // the more vertically expanded view when the bounds are set. |
| 1098 SetLabelText(state_.vertically_compact_text); |
| 1099 SetIcon(state_.icon); |
| 1100 SetTextfield(state_.extra_text, state_.extra_icon); |
| 1101 PreferredSizeChanged(); |
| 1102 } |
| 1103 |
| 1104 void AutofillDialogViews::SuggestionView::SetLabelText( |
| 1105 const base::string16& text) { |
1030 // TODO(estade): does this localize well? | 1106 // TODO(estade): does this localize well? |
1031 base::string16 line_return(ASCIIToUTF16("\n")); | 1107 base::string16 line_return(ASCIIToUTF16("\n")); |
1032 size_t position = text.find(line_return); | 1108 size_t position = text.find(line_return); |
1033 if (position == base::string16::npos) { | 1109 if (position == base::string16::npos) { |
1034 label_->SetText(text); | 1110 label_->SetText(text); |
1035 label_line_2_->SetVisible(false); | 1111 label_line_2_->SetVisible(false); |
1036 } else { | 1112 } else { |
1037 label_->SetText(text.substr(0, position)); | 1113 label_->SetText(text.substr(0, position)); |
1038 label_line_2_->SetText(text.substr(position + line_return.length())); | 1114 label_line_2_->SetText(text.substr(position + line_return.length())); |
1039 label_line_2_->SetVisible(true); | 1115 label_line_2_->SetVisible(true); |
1040 } | 1116 } |
1041 } | 1117 } |
1042 | 1118 |
1043 void AutofillDialogViews::SuggestionView::SetSuggestionIcon( | 1119 void AutofillDialogViews::SuggestionView::SetIcon( |
1044 const gfx::Image& image) { | 1120 const gfx::Image& image) { |
1045 icon_->SetVisible(!image.IsEmpty()); | 1121 icon_->SetVisible(!image.IsEmpty()); |
1046 icon_->SetImage(image.AsImageSkia()); | 1122 icon_->SetImage(image.AsImageSkia()); |
1047 } | 1123 } |
1048 | 1124 |
1049 void AutofillDialogViews::SuggestionView::ShowTextfield( | 1125 void AutofillDialogViews::SuggestionView::SetTextfield( |
1050 const base::string16& placeholder_text, | 1126 const base::string16& placeholder_text, |
1051 const gfx::Image& icon) { | 1127 const gfx::Image& icon) { |
1052 decorated_->set_placeholder_text(placeholder_text); | 1128 decorated_->set_placeholder_text(placeholder_text); |
1053 decorated_->SetIcon(icon); | 1129 decorated_->SetIcon(icon); |
1054 decorated_->SetVisible(true); | 1130 decorated_->SetVisible(!placeholder_text.empty()); |
1055 // The textfield will increase the height of the first row and cause the | |
1056 // label to be aligned properly, so the border is not necessary. | |
1057 label_->set_border(NULL); | |
1058 } | 1131 } |
1059 | 1132 |
1060 // AutofillDialogViews::AutocheckoutStepsArea --------------------------------- | 1133 // AutofillDialogViews::AutocheckoutStepsArea --------------------------------- |
1061 | 1134 |
1062 AutofillDialogViews::AutocheckoutStepsArea::AutocheckoutStepsArea() { | 1135 AutofillDialogViews::AutocheckoutStepsArea::AutocheckoutStepsArea() { |
1063 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, | 1136 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, |
1064 kAutocheckoutStepsAreaPadding, | 1137 kAutocheckoutStepsAreaPadding, |
1065 0, | 1138 0, |
1066 kAutocheckoutStepInset)); | 1139 kAutocheckoutStepInset)); |
1067 } | 1140 } |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 | 1531 |
1459 void AutofillDialogViews::Layout() { | 1532 void AutofillDialogViews::Layout() { |
1460 gfx::Rect content_bounds = GetContentsBounds(); | 1533 gfx::Rect content_bounds = GetContentsBounds(); |
1461 if (sign_in_webview_->visible()) { | 1534 if (sign_in_webview_->visible()) { |
1462 sign_in_webview_->SetBoundsRect(content_bounds); | 1535 sign_in_webview_->SetBoundsRect(content_bounds); |
1463 return; | 1536 return; |
1464 } | 1537 } |
1465 | 1538 |
1466 const int x = content_bounds.x(); | 1539 const int x = content_bounds.x(); |
1467 const int y = content_bounds.y(); | 1540 const int y = content_bounds.y(); |
1468 const int w = content_bounds.width(); | 1541 const int width = content_bounds.width(); |
1469 // Layout notification area at top of dialog. | 1542 // Layout notification area at top of dialog. |
1470 int notification_height = notification_area_->GetHeightForWidth(w); | 1543 int notification_height = notification_area_->GetHeightForWidth(width); |
1471 notification_area_->SetBounds(x, y, w, notification_height); | 1544 notification_area_->SetBounds(x, y, width, notification_height); |
1472 | 1545 |
1473 // Layout Autocheckout steps at bottom of dialog. | 1546 // Layout Autocheckout steps at bottom of dialog. |
1474 int steps_height = autocheckout_steps_area_->GetHeightForWidth(w); | 1547 int steps_height = autocheckout_steps_area_->GetHeightForWidth(width); |
1475 autocheckout_steps_area_->SetBounds(x, content_bounds.bottom() - steps_height, | 1548 autocheckout_steps_area_->SetBounds(x, content_bounds.bottom() - steps_height, |
1476 w, steps_height); | 1549 width, steps_height); |
1477 | 1550 |
1478 // The rest (the |scrollable_area_|) takes up whatever's left. | 1551 // The rest (the |scrollable_area_|) takes up whatever's left. |
1479 if (scrollable_area_->visible()) { | 1552 if (scrollable_area_->visible()) { |
1480 int scroll_y = y; | 1553 int scroll_y = y; |
1481 if (notification_height > 0) | 1554 if (notification_height > 0) |
1482 scroll_y += notification_height + views::kRelatedControlVerticalSpacing; | 1555 scroll_y += notification_height + views::kRelatedControlVerticalSpacing; |
1483 | 1556 |
1484 int scroll_bottom = content_bounds.bottom(); | 1557 int scroll_bottom = content_bounds.bottom(); |
1485 if (steps_height > 0) | 1558 if (steps_height > 0) |
1486 scroll_bottom -= steps_height + views::kRelatedControlVerticalSpacing; | 1559 scroll_bottom -= steps_height + views::kRelatedControlVerticalSpacing; |
1487 | 1560 |
1488 scrollable_area_->contents()->SizeToPreferredSize(); | 1561 scrollable_area_->contents()->SizeToPreferredSize(); |
1489 scrollable_area_->SetBounds(x, scroll_y, w, scroll_bottom - scroll_y); | 1562 scrollable_area_->SetBounds(x, scroll_y, width, scroll_bottom - scroll_y); |
1490 } | 1563 } |
1491 | 1564 |
1492 if (loading_shield_->visible()) | 1565 if (loading_shield_->visible()) |
1493 loading_shield_->SetBoundsRect(bounds()); | 1566 loading_shield_->SetBoundsRect(bounds()); |
1494 | 1567 |
1495 if (error_bubble_) | 1568 if (error_bubble_) |
1496 error_bubble_->UpdatePosition(); | 1569 error_bubble_->UpdatePosition(); |
1497 } | 1570 } |
1498 | 1571 |
1499 void AutofillDialogViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { | 1572 void AutofillDialogViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 | 1872 |
1800 views::View* AutofillDialogViews::CreateInputsContainer(DialogSection section) { | 1873 views::View* AutofillDialogViews::CreateInputsContainer(DialogSection section) { |
1801 // The |info_view| holds |manual_inputs| and |suggested_info|, allowing the | 1874 // The |info_view| holds |manual_inputs| and |suggested_info|, allowing the |
1802 // dialog to toggle which is shown. | 1875 // dialog to toggle which is shown. |
1803 views::View* info_view = new views::View(); | 1876 views::View* info_view = new views::View(); |
1804 info_view->SetLayoutManager( | 1877 info_view->SetLayoutManager( |
1805 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); | 1878 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
1806 | 1879 |
1807 views::View* manual_inputs = InitInputsView(section); | 1880 views::View* manual_inputs = InitInputsView(section); |
1808 info_view->AddChildView(manual_inputs); | 1881 info_view->AddChildView(manual_inputs); |
1809 SuggestionView* suggested_info = | 1882 SuggestionView* suggested_info = new SuggestionView(this); |
1810 new SuggestionView(delegate_->EditSuggestionText(), this); | |
1811 info_view->AddChildView(suggested_info); | 1883 info_view->AddChildView(suggested_info); |
1812 | 1884 |
1813 // TODO(estade): It might be slightly more OO if this button were created | 1885 // TODO(estade): It might be slightly more OO if this button were created |
1814 // and listened to by the section container. | 1886 // and listened to by the section container. |
1815 views::ImageButton* menu_button = new views::ImageButton(this); | 1887 views::ImageButton* menu_button = new views::ImageButton(this); |
1816 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 1888 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
1817 menu_button->SetImage(views::Button::STATE_NORMAL, | 1889 menu_button->SetImage(views::Button::STATE_NORMAL, |
1818 rb.GetImageSkiaNamed(IDR_AUTOFILL_DIALOG_MENU_BUTTON)); | 1890 rb.GetImageSkiaNamed(IDR_AUTOFILL_DIALOG_MENU_BUTTON)); |
1819 menu_button->SetImage(views::Button::STATE_PRESSED, | 1891 menu_button->SetImage(views::Button::STATE_PRESSED, |
1820 rb.GetImageSkiaNamed(IDR_AUTOFILL_DIALOG_MENU_BUTTON_P)); | 1892 rb.GetImageSkiaNamed(IDR_AUTOFILL_DIALOG_MENU_BUTTON_P)); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 } | 2028 } |
1957 } | 2029 } |
1958 } | 2030 } |
1959 | 2031 |
1960 UpdateDetailsGroupState(*group); | 2032 UpdateDetailsGroupState(*group); |
1961 } | 2033 } |
1962 | 2034 |
1963 void AutofillDialogViews::UpdateDetailsGroupState(const DetailsGroup& group) { | 2035 void AutofillDialogViews::UpdateDetailsGroupState(const DetailsGroup& group) { |
1964 const SuggestionState& suggestion_state = | 2036 const SuggestionState& suggestion_state = |
1965 delegate_->SuggestionStateForSection(group.section); | 2037 delegate_->SuggestionStateForSection(group.section); |
1966 bool show_suggestions = !suggestion_state.text.empty(); | 2038 group.suggested_info->SetState(suggestion_state); |
1967 group.suggested_info->SetVisible(show_suggestions); | 2039 group.manual_input->SetVisible(!suggestion_state.visible); |
1968 group.suggested_info->SetSuggestionText(suggestion_state.text, | |
1969 suggestion_state.text_style); | |
1970 group.suggested_info->SetSuggestionIcon(suggestion_state.icon); | |
1971 | |
1972 if (!suggestion_state.extra_text.empty()) { | |
1973 group.suggested_info->ShowTextfield( | |
1974 suggestion_state.extra_text, | |
1975 suggestion_state.extra_icon); | |
1976 } | |
1977 | |
1978 group.manual_input->SetVisible(!show_suggestions); | |
1979 | 2040 |
1980 UpdateButtonStripExtraView(); | 2041 UpdateButtonStripExtraView(); |
1981 | 2042 |
1982 const bool has_menu = !!delegate_->MenuModelForSection(group.section); | 2043 const bool has_menu = !!delegate_->MenuModelForSection(group.section); |
1983 | 2044 |
1984 if (group.suggested_button) | 2045 if (group.suggested_button) |
1985 group.suggested_button->SetVisible(has_menu); | 2046 group.suggested_button->SetVisible(has_menu); |
1986 | 2047 |
1987 if (group.container) { | 2048 if (group.container) { |
1988 group.container->SetForwardMouseEvents(has_menu && show_suggestions); | 2049 group.container->SetForwardMouseEvents( |
| 2050 has_menu && suggestion_state.visible); |
1989 group.container->SetVisible(delegate_->SectionIsActive(group.section)); | 2051 group.container->SetVisible(delegate_->SectionIsActive(group.section)); |
1990 if (group.container->visible()) | 2052 if (group.container->visible()) |
1991 ValidateGroup(group, VALIDATE_EDIT); | 2053 ValidateGroup(group, VALIDATE_EDIT); |
1992 } | 2054 } |
1993 | 2055 |
1994 ContentsPreferredSizeChanged(); | 2056 ContentsPreferredSizeChanged(); |
1995 } | 2057 } |
1996 | 2058 |
1997 template<class T> | 2059 template<class T> |
1998 void AutofillDialogViews::SetValidityForInput( | 2060 void AutofillDialogViews::SetValidityForInput( |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2281 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) | 2343 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) |
2282 : section(section), | 2344 : section(section), |
2283 container(NULL), | 2345 container(NULL), |
2284 manual_input(NULL), | 2346 manual_input(NULL), |
2285 suggested_info(NULL), | 2347 suggested_info(NULL), |
2286 suggested_button(NULL) {} | 2348 suggested_button(NULL) {} |
2287 | 2349 |
2288 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} | 2350 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} |
2289 | 2351 |
2290 } // namespace autofill | 2352 } // namespace autofill |
OLD | NEW |