OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 5 #ifndef ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
6 #define ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 6 #define ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/frame/caption_buttons/frame_size_button_delegate.h" | 11 #include "ash/frame/caption_buttons/frame_size_button_delegate.h" |
12 #include "ui/compositor/layer_animation_observer.h" | |
13 #include "ui/compositor/layer_owner_delegate.h" | |
14 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
15 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
16 | 14 |
17 namespace views { | 15 namespace views { |
18 class Widget; | 16 class Widget; |
19 } | 17 } |
20 | 18 |
21 namespace ash { | 19 namespace ash { |
22 | 20 |
23 // Container view for the frame caption buttons. It performs the appropriate | 21 // Container view for the frame caption buttons. It performs the appropriate |
24 // action when a caption button is clicked. | 22 // action when a caption button is clicked. |
25 class ASH_EXPORT FrameCaptionButtonContainerView | 23 class ASH_EXPORT FrameCaptionButtonContainerView |
26 : public views::View, | 24 : public views::View, |
27 public views::ButtonListener, | 25 public views::ButtonListener, |
28 public FrameSizeButtonDelegate, | 26 public FrameSizeButtonDelegate { |
29 public ui::ImplicitAnimationObserver, | |
30 public ui::LayerOwnerDelegate { | |
31 public: | 27 public: |
32 static const char kViewClassName[]; | 28 static const char kViewClassName[]; |
33 | 29 |
34 // Whether the frame can be minimized (either via the maximize/restore button | 30 // Whether the frame can be minimized (either via the maximize/restore button |
35 // or via a dedicated button). | 31 // or via a dedicated button). |
36 enum MinimizeAllowed { | 32 enum MinimizeAllowed { |
37 MINIMIZE_ALLOWED, | 33 MINIMIZE_ALLOWED, |
38 MINIMIZE_DISALLOWED | 34 MINIMIZE_DISALLOWED |
39 }; | 35 }; |
40 | 36 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 virtual void SetButtonsToNormal(Animate animate) OVERRIDE; | 131 virtual void SetButtonsToNormal(Animate animate) OVERRIDE; |
136 virtual void SetButtonIcons(CaptionButtonIcon minimize_button_icon, | 132 virtual void SetButtonIcons(CaptionButtonIcon minimize_button_icon, |
137 CaptionButtonIcon close_button_icon, | 133 CaptionButtonIcon close_button_icon, |
138 Animate animate) OVERRIDE; | 134 Animate animate) OVERRIDE; |
139 virtual const FrameCaptionButton* GetButtonClosestTo( | 135 virtual const FrameCaptionButton* GetButtonClosestTo( |
140 const gfx::Point& position_in_screen) const OVERRIDE; | 136 const gfx::Point& position_in_screen) const OVERRIDE; |
141 virtual void SetHoveredAndPressedButtons( | 137 virtual void SetHoveredAndPressedButtons( |
142 const FrameCaptionButton* to_hover, | 138 const FrameCaptionButton* to_hover, |
143 const FrameCaptionButton* to_press) OVERRIDE; | 139 const FrameCaptionButton* to_press) OVERRIDE; |
144 | 140 |
145 // ui::ImplicitAnimationObserver: | |
146 virtual void OnImplicitAnimationsCompleted() OVERRIDE; | |
147 | |
148 // ui::LayerOwnerDelegate: | |
149 virtual void OnLayerRecreated(ui::Layer* old_layer, | |
150 ui::Layer* new_layer) OVERRIDE; | |
151 | |
152 // The widget that the buttons act on. | 141 // The widget that the buttons act on. |
153 views::Widget* frame_; | 142 views::Widget* frame_; |
154 | 143 |
155 // The buttons. In the normal button style, at most one of |minimize_button_| | 144 // The buttons. In the normal button style, at most one of |minimize_button_| |
156 // and |size_button_| is visible. | 145 // and |size_button_| is visible. |
157 FrameCaptionButton* minimize_button_; | 146 FrameCaptionButton* minimize_button_; |
158 FrameCaptionButton* size_button_; | 147 FrameCaptionButton* size_button_; |
159 FrameCaptionButton* close_button_; | 148 FrameCaptionButton* close_button_; |
160 | 149 |
161 // Mapping of the images needed to paint a button for each of the values of | 150 // Mapping of the images needed to paint a button for each of the values of |
162 // CaptionButtonIcon. | 151 // CaptionButtonIcon. |
163 std::map<CaptionButtonIcon, ButtonIconIds> button_icon_id_map_; | 152 std::map<CaptionButtonIcon, ButtonIconIds> button_icon_id_map_; |
164 | 153 |
165 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); | 154 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView); |
166 }; | 155 }; |
167 | 156 |
168 } // namespace ash | 157 } // namespace ash |
169 | 158 |
170 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ | 159 #endif // ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_ |
OLD | NEW |