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 #ifndef ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ | 5 #ifndef ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ |
6 #define ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ | 6 #define ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/wm/workspace/snap_types.h" | 9 #include "ash/wm/workspace/snap_types.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 | 11 |
| 12 namespace base { |
| 13 class Timer; |
| 14 } |
| 15 |
12 namespace aura { | 16 namespace aura { |
13 class Window; | 17 class Window; |
14 } | 18 } |
15 | 19 |
16 namespace base { | |
17 class Timer; | |
18 } | |
19 | |
20 namespace views { | |
21 class CustomButton; | |
22 } | |
23 | |
24 namespace ash { | 20 namespace ash { |
25 | 21 |
26 class FrameMaximizeButton; | 22 class FrameMaximizeButton; |
27 | 23 |
28 // A class which shows a helper UI for the maximize button after a delay. | 24 // A class which shows a helper UI for the maximize button after a delay. |
29 class ASH_EXPORT MaximizeBubbleController { | 25 class ASH_EXPORT MaximizeBubbleController { |
30 public: | 26 public: |
31 class Bubble; | 27 class Bubble; |
32 | 28 |
33 MaximizeBubbleController(FrameMaximizeButton* frame_maximize_button, | 29 MaximizeBubbleController(FrameMaximizeButton* frame_maximize_button, |
34 bool is_maximized, | 30 bool is_maximized); |
35 int appearance_delay_ms); | |
36 // Called from the outside to destroy the interface to the UI visuals. | 31 // Called from the outside to destroy the interface to the UI visuals. |
37 // The visuals will then delete when possible (maybe asynchronously). | 32 // The visuals will then delete when possible (maybe asynchronously). |
38 virtual ~MaximizeBubbleController(); | 33 virtual ~MaximizeBubbleController(); |
39 | 34 |
40 // Update the UI visuals to reflect the previewed |snap_type| snapping state. | 35 // Update the UI visuals to reflect the previewed |snap_type| snapping state. |
41 void SetSnapType(SnapType snap_type); | 36 void SetSnapType(SnapType snap_type); |
42 | 37 |
43 // To achieve proper Z-sorting with the snap animation, this window will be | 38 // To achieve proper Z-sorting with the snap animation, this window will be |
44 // presented above the phantom window. | 39 // presented above the phantom window. |
45 aura::Window* GetBubbleWindow(); | 40 aura::Window* GetBubbleWindow(); |
(...skipping 10 matching lines...) Expand all Loading... |
56 void OnButtonHover(SnapType snap_type); | 51 void OnButtonHover(SnapType snap_type); |
57 | 52 |
58 // Get the owning FrameMaximizeButton. | 53 // Get the owning FrameMaximizeButton. |
59 FrameMaximizeButton* frame_maximize_button() { | 54 FrameMaximizeButton* frame_maximize_button() { |
60 return frame_maximize_button_; | 55 return frame_maximize_button_; |
61 } | 56 } |
62 | 57 |
63 // The status of the associated window: Maximized or normal. | 58 // The status of the associated window: Maximized or normal. |
64 bool is_maximized() const { return is_maximized_; } | 59 bool is_maximized() const { return is_maximized_; } |
65 | 60 |
66 // A unit test function to return buttons of the sub menu. |state| can be | |
67 // either SNAP_LEFT, SNAP_RIGHT or SNAP_MINIMIZE. | |
68 views::CustomButton* GetButtonForUnitTest(SnapType state); | |
69 | |
70 protected: | 61 protected: |
71 // Called from the the Bubble class to destroy itself: It tells the owning | 62 // Called from the the Bubble class to destroy itself: It tells the owning |
72 // object that it will destroy itself asynchronously. The owner will then | 63 // object that it will destroy itself asynchronously. The owner will then |
73 // destroy |this|. | 64 // destroy |this|. |
74 void RequestDestructionThroughOwner(); | 65 void RequestDestructionThroughOwner(); |
75 | 66 |
76 private: | 67 private: |
77 // The function which creates the bubble once the delay is elapsed. | 68 // The function which creates the bubble once the delay is elapsed. |
78 void CreateBubble(); | 69 void CreateBubble(); |
79 | 70 |
80 // The owning button which is also the anchor for the menu. | 71 // The owning button which is also the anchor for the menu. |
81 FrameMaximizeButton* frame_maximize_button_; | 72 FrameMaximizeButton* frame_maximize_button_; |
82 | 73 |
83 // The bubble menu. | 74 // The bubble menu. |
84 Bubble* bubble_; | 75 Bubble* bubble_; |
85 | 76 |
86 // If true the owning window is maximized. | 77 // If true the owning window is maximized. |
87 const bool is_maximized_; | 78 const bool is_maximized_; |
88 | 79 |
89 // The timer for the delayed creation of the menu. | 80 // The timer for the delayed creation of the menu. |
90 scoped_ptr<base::Timer> timer_; | 81 scoped_ptr<base::Timer> timer_; |
91 | 82 |
92 // The appearance delay in ms (delay and fade in & fade out delay). | |
93 const int appearance_delay_ms_; | |
94 | |
95 DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleController); | 83 DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleController); |
96 }; | 84 }; |
97 | 85 |
98 } // namespace ash | 86 } // namespace ash |
99 | 87 |
100 #endif // ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ | 88 #endif // ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ |
OLD | NEW |