From 3fdb73284d2b947f3a81ebe81501635b220b4dc1 Mon Sep 17 00:00:00 2001 From: jackhou Date: Wed, 24 Sep 2014 03:25:48 -0700 Subject: Add CanMinimize to classes that implement WidgetDelegate::CanMaximize. There were some cases where we use CanMaximize to determine if minimization should be disabled. They now use CanMinimize: - custom_frame_view_ash - hwnd_message_handler All classes that implement CanMaximize now implement CanMinimize in the same way, so there should no change in behavior. BUG=328241,341010 Review URL: https://codereview.chromium.org/583603004 Cr-Commit-Position: refs/heads/master@{#296381} --- .../caption_buttons/frame_caption_button_container_view_unittest.cc | 4 ++++ ash/frame/caption_buttons/frame_size_button_unittest.cc | 3 +++ ash/frame/custom_frame_view_ash.cc | 4 +--- ash/frame/custom_frame_view_ash_unittest.cc | 4 ++++ 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'ash/frame') diff --git a/ash/frame/caption_buttons/frame_caption_button_container_view_unittest.cc b/ash/frame/caption_buttons/frame_caption_button_container_view_unittest.cc index a487005..682883c 100644 --- a/ash/frame/caption_buttons/frame_caption_button_container_view_unittest.cc +++ b/ash/frame/caption_buttons/frame_caption_button_container_view_unittest.cc @@ -28,6 +28,10 @@ class TestWidgetDelegate : public views::WidgetDelegateView { return can_maximize_; } + virtual bool CanMinimize() const OVERRIDE { + return can_maximize_; + } + private: bool can_maximize_; diff --git a/ash/frame/caption_buttons/frame_size_button_unittest.cc b/ash/frame/caption_buttons/frame_size_button_unittest.cc index 02c6023..8736308 100644 --- a/ash/frame/caption_buttons/frame_size_button_unittest.cc +++ b/ash/frame/caption_buttons/frame_size_button_unittest.cc @@ -40,6 +40,9 @@ class TestWidgetDelegate : public views::WidgetDelegateView { virtual bool CanMaximize() const OVERRIDE { return true; } + virtual bool CanMinimize() const OVERRIDE { + return true; + } ash::FrameCaptionButtonContainerView* caption_button_container() { return caption_button_container_; diff --git a/ash/frame/custom_frame_view_ash.cc b/ash/frame/custom_frame_view_ash.cc index 450015a..f4422fc 100644 --- a/ash/frame/custom_frame_view_ash.cc +++ b/ash/frame/custom_frame_view_ash.cc @@ -202,10 +202,8 @@ CustomFrameViewAsh::HeaderView::HeaderView(views::Widget* frame) avatar_icon_(NULL), caption_button_container_(NULL), fullscreen_visible_fraction_(0) { - // Unfortunately, there is no views::WidgetDelegate::CanMinimize(). Assume - // that the window frame can be minimized if it can be maximized. FrameCaptionButtonContainerView::MinimizeAllowed minimize_allowed = - frame_->widget_delegate()->CanMaximize() ? + frame_->widget_delegate()->CanMinimize() ? FrameCaptionButtonContainerView::MINIMIZE_ALLOWED : FrameCaptionButtonContainerView::MINIMIZE_DISALLOWED; caption_button_container_ = new FrameCaptionButtonContainerView(frame_, diff --git a/ash/frame/custom_frame_view_ash_unittest.cc b/ash/frame/custom_frame_view_ash_unittest.cc index 3bcf912..f947692 100644 --- a/ash/frame/custom_frame_view_ash_unittest.cc +++ b/ash/frame/custom_frame_view_ash_unittest.cc @@ -68,6 +68,10 @@ class TestWidgetConstraintsDelegate : public TestWidgetDelegate { return true; } + virtual bool CanMinimize() const OVERRIDE { + return true; + } + void set_minimum_size(const gfx::Size& min_size) { minimum_size_ = min_size; } -- cgit v1.1