Chromium Code Reviews| Index: ash/frame/caption_buttons/frame_caption_button_container_view.cc |
| diff --git a/ash/frame/caption_buttons/frame_caption_button_container_view.cc b/ash/frame/caption_buttons/frame_caption_button_container_view.cc |
| index 78c5a38ba40fad3fde1f51241a0d95e4ccb558bb..f67110f11ac9a7753cc2d5598499768dbf9d5fc1 100644 |
| --- a/ash/frame/caption_buttons/frame_caption_button_container_view.cc |
| +++ b/ash/frame/caption_buttons/frame_caption_button_container_view.cc |
| @@ -149,24 +149,16 @@ void FrameCaptionButtonContainerView::TestApi::EndAnimations() { |
| container_view_->maximize_mode_animation_->End(); |
| } |
| -void FrameCaptionButtonContainerView::SetButtonImages( |
| - CaptionButtonIcon icon, |
| - int icon_image_id, |
| - int hovered_background_image_id, |
| - int pressed_background_image_id) { |
| - button_icon_id_map_[icon] = ButtonIconIds(icon_image_id, |
| - hovered_background_image_id, |
| - pressed_background_image_id); |
| +void FrameCaptionButtonContainerView::SetButtonImage(CaptionButtonIcon icon, |
| + int icon_image_id) { |
| + button_icon_id_map_[icon] = icon_image_id; |
| + |
| FrameCaptionButton* buttons[] = { |
| minimize_button_, size_button_, close_button_ |
| }; |
| for (size_t i = 0; i < arraysize(buttons); ++i) { |
| if (buttons[i]->icon() == icon) { |
|
Peter Kasting
2015/12/18 18:59:15
Nit: {} not necessary
tdanderson
2016/01/04 23:11:14
Done.
|
| - buttons[i]->SetImages(icon, |
| - FrameCaptionButton::ANIMATE_NO, |
| - icon_image_id, |
| - hovered_background_image_id, |
| - pressed_background_image_id); |
| + buttons[i]->SetImage(icon, FrameCaptionButton::ANIMATE_NO, icon_image_id); |
| } |
| } |
| } |
| @@ -208,6 +200,12 @@ void FrameCaptionButtonContainerView::UpdateSizeButtonVisibility() { |
| } |
| } |
| +void FrameCaptionButtonContainerView::SetButtonSize(const gfx::Size& size) { |
| + minimize_button_->set_size(size); |
| + size_button_->set_size(size); |
| + close_button_->set_size(size); |
| +} |
| + |
| gfx::Size FrameCaptionButtonContainerView::GetPreferredSize() const { |
| int width = 0; |
| for (int i = 0; i < child_count(); ++i) { |
| @@ -215,6 +213,7 @@ gfx::Size FrameCaptionButtonContainerView::GetPreferredSize() const { |
| if (child->visible()) |
| width += child_at(i)->GetPreferredSize().width(); |
| } |
| + |
|
Peter Kasting
2015/12/18 18:59:15
Nit: I wouldn't add this blank line
tdanderson
2016/01/04 23:11:14
Done.
|
| return gfx::Size(width, close_button_->GetPreferredSize().height()); |
| } |
| @@ -299,15 +298,10 @@ void FrameCaptionButtonContainerView::SetButtonIcon(FrameCaptionButton* button, |
| FrameCaptionButton::Animate fcb_animate = (animate == ANIMATE_YES) ? |
| FrameCaptionButton::ANIMATE_YES : FrameCaptionButton::ANIMATE_NO; |
| - std::map<CaptionButtonIcon, ButtonIconIds>::const_iterator it = |
| + std::map<CaptionButtonIcon, int>::const_iterator it = |
|
Peter Kasting
2015/12/18 18:59:15
Nit: Use auto.
tdanderson
2016/01/04 23:11:14
Done.
|
| button_icon_id_map_.find(icon); |
| - if (it != button_icon_id_map_.end()) { |
| - button->SetImages(icon, |
| - fcb_animate, |
| - it->second.icon_image_id, |
| - it->second.hovered_background_image_id, |
| - it->second.pressed_background_image_id); |
| - } |
| + if (it != button_icon_id_map_.end()) |
| + button->SetImage(icon, fcb_animate, it->second); |
| } |
| bool FrameCaptionButtonContainerView::ShouldSizeButtonBeVisible() const { |
| @@ -418,22 +412,4 @@ void FrameCaptionButtonContainerView::SetHoveredAndPressedButtons( |
| } |
| } |
| -FrameCaptionButtonContainerView::ButtonIconIds::ButtonIconIds() |
| - : icon_image_id(-1), |
| - hovered_background_image_id(-1), |
| - pressed_background_image_id(-1) { |
| -} |
| - |
| -FrameCaptionButtonContainerView::ButtonIconIds::ButtonIconIds( |
| - int icon_id, |
| - int hovered_background_id, |
| - int pressed_background_id) |
| - : icon_image_id(icon_id), |
| - hovered_background_image_id(hovered_background_id), |
| - pressed_background_image_id(pressed_background_id) { |
| -} |
| - |
| -FrameCaptionButtonContainerView::ButtonIconIds::~ButtonIconIds() { |
| -} |
| - |
| } // namespace ash |