OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/frame/custom_frame_view_ash.h" | 5 #include "ash/frame/custom_frame_view_ash.h" |
6 | 6 |
7 #include "ash/frame/caption_buttons/frame_caption_button.h" | 7 #include "ash/frame/caption_buttons/frame_caption_button.h" |
8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "ash/test/test_session_state_delegate.h" | 11 #include "ash/test/test_session_state_delegate.h" |
12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/gfx/image/image_skia.h" | 16 #include "ui/gfx/image/image_skia.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
19 #include "ui/views/widget/widget_delegate.h" | 19 #include "ui/views/widget/widget_delegate.h" |
20 | 20 |
21 namespace ash { | 21 namespace ash { |
22 | 22 |
23 // A views::WidgetDelegate which uses a CustomFrameViewAsh. | 23 // A views::WidgetDelegate which uses a CustomFrameViewAsh. |
24 class TestWidgetDelegate : public views::WidgetDelegateView { | 24 class TestWidgetDelegate : public views::WidgetDelegateView { |
25 public: | 25 public: |
26 TestWidgetDelegate() {} | 26 TestWidgetDelegate() {} |
27 virtual ~TestWidgetDelegate() {} | 27 virtual ~TestWidgetDelegate() {} |
28 | 28 |
29 virtual views::NonClientFrameView* CreateNonClientFrameView( | 29 virtual views::NonClientFrameView* CreateNonClientFrameView( |
30 views::Widget* widget) OVERRIDE { | 30 views::Widget* widget) override { |
31 custom_frame_view_ = new CustomFrameViewAsh(widget); | 31 custom_frame_view_ = new CustomFrameViewAsh(widget); |
32 return custom_frame_view_; | 32 return custom_frame_view_; |
33 } | 33 } |
34 | 34 |
35 CustomFrameViewAsh* custom_frame_view() const { | 35 CustomFrameViewAsh* custom_frame_view() const { |
36 return custom_frame_view_; | 36 return custom_frame_view_; |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 // Not owned. | 40 // Not owned. |
41 CustomFrameViewAsh* custom_frame_view_; | 41 CustomFrameViewAsh* custom_frame_view_; |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); | 43 DISALLOW_COPY_AND_ASSIGN(TestWidgetDelegate); |
44 }; | 44 }; |
45 | 45 |
46 class TestWidgetConstraintsDelegate : public TestWidgetDelegate { | 46 class TestWidgetConstraintsDelegate : public TestWidgetDelegate { |
47 public: | 47 public: |
48 TestWidgetConstraintsDelegate() {} | 48 TestWidgetConstraintsDelegate() {} |
49 virtual ~TestWidgetConstraintsDelegate() {} | 49 virtual ~TestWidgetConstraintsDelegate() {} |
50 | 50 |
51 // views::View: | 51 // views::View: |
52 virtual gfx::Size GetMinimumSize() const OVERRIDE { | 52 virtual gfx::Size GetMinimumSize() const override { |
53 return minimum_size_; | 53 return minimum_size_; |
54 } | 54 } |
55 | 55 |
56 virtual gfx::Size GetMaximumSize() const OVERRIDE { | 56 virtual gfx::Size GetMaximumSize() const override { |
57 return maximum_size_; | 57 return maximum_size_; |
58 } | 58 } |
59 | 59 |
60 virtual views::View* GetContentsView() OVERRIDE { | 60 virtual views::View* GetContentsView() override { |
61 // Set this instance as the contents view so that the maximum and minimum | 61 // Set this instance as the contents view so that the maximum and minimum |
62 // size constraints will be used. | 62 // size constraints will be used. |
63 return this; | 63 return this; |
64 } | 64 } |
65 | 65 |
66 // views::WidgetDelegate: | 66 // views::WidgetDelegate: |
67 virtual bool CanMaximize() const OVERRIDE { | 67 virtual bool CanMaximize() const override { |
68 return true; | 68 return true; |
69 } | 69 } |
70 | 70 |
71 virtual bool CanMinimize() const OVERRIDE { | 71 virtual bool CanMinimize() const override { |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 void set_minimum_size(const gfx::Size& min_size) { | 75 void set_minimum_size(const gfx::Size& min_size) { |
76 minimum_size_ = min_size; | 76 minimum_size_ = min_size; |
77 } | 77 } |
78 | 78 |
79 void set_maximum_size(const gfx::Size& max_size) { | 79 void set_maximum_size(const gfx::Size& max_size) { |
80 maximum_size_ = max_size; | 80 maximum_size_ = max_size; |
81 } | 81 } |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); | 228 EXPECT_GT(initial.width(), maximize_mode_bounds.width()); |
229 Shell::GetInstance()->maximize_mode_controller()-> | 229 Shell::GetInstance()->maximize_mode_controller()-> |
230 EnableMaximizeModeWindowManager(false); | 230 EnableMaximizeModeWindowManager(false); |
231 delegate->EndFrameCaptionButtonContainerViewAnimations(); | 231 delegate->EndFrameCaptionButtonContainerViewAnimations(); |
232 const gfx::Rect after_restore = delegate-> | 232 const gfx::Rect after_restore = delegate-> |
233 GetFrameCaptionButtonContainerViewBounds(); | 233 GetFrameCaptionButtonContainerViewBounds(); |
234 EXPECT_EQ(initial, after_restore); | 234 EXPECT_EQ(initial, after_restore); |
235 } | 235 } |
236 | 236 |
237 } // namespace ash | 237 } // namespace ash |
OLD | NEW |