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
3 // found in the LICENSE file.
5 #ifndef ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_
6 #define ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "ash/wm/workspace/maximize_bubble_frame_state.h"
10 #include "ash/wm/workspace/snap_types.h"
11 #include "base/memory/scoped_ptr.h"
27 class FrameMaximizeButton
;
29 // A class which shows a helper UI for the maximize button after a delay.
30 class ASH_EXPORT MaximizeBubbleController
{
34 MaximizeBubbleController(FrameMaximizeButton
* frame_maximize_button
,
35 MaximizeBubbleFrameState maximize_type
,
36 int appearance_delay_ms
);
37 // Called from the outside to destroy the interface to the UI visuals.
38 // The visuals will then delete when possible (maybe asynchronously).
39 virtual ~MaximizeBubbleController();
41 // Update the UI visuals to reflect the previewed |snap_type| snapping state.
42 void SetSnapType(SnapType snap_type
);
44 // To achieve proper Z-sorting with the snap animation, this window will be
45 // presented above the phantom window.
46 aura::Window
* GetBubbleWindow();
48 // Reset the delay of the menu creation (if it was not created yet).
51 // Called to tell the owning FrameMaximizeButton that a button was clicked.
52 void OnButtonClicked(SnapType snap_type
);
54 // Called to tell the the owning FrameMaximizeButton that the hover status
55 // for a button has changed. |snap_type| can be either SNAP_LEFT, SNAP_RIGHT,
56 // SNAP_MINIMIZE or SNAP_NONE.
57 void OnButtonHover(SnapType snap_type
);
59 // Get the owning FrameMaximizeButton.
60 FrameMaximizeButton
* frame_maximize_button() {
61 return frame_maximize_button_
;
64 // The status of the associated window: Maximized or normal.
65 MaximizeBubbleFrameState
maximize_type() const { return maximize_type_
; }
67 // A unit test function to return buttons of the sub menu. |state| can be
68 // either SNAP_LEFT, SNAP_RIGHT or SNAP_MINIMIZE.
69 views::CustomButton
* GetButtonForUnitTest(SnapType state
);
72 // Called from the the Bubble class to destroy itself: It tells the owning
73 // object that it will destroy itself asynchronously. The owner will then
75 void RequestDestructionThroughOwner();
78 // The function which creates the bubble once the delay is elapsed.
81 // The owning button which is also the anchor for the menu.
82 FrameMaximizeButton
* frame_maximize_button_
;
87 // The current maximize state of the owning window.
88 const MaximizeBubbleFrameState maximize_type_
;
90 // The timer for the delayed creation of the menu.
91 scoped_ptr
<base::Timer
> timer_
;
93 // The appearance delay in ms (delay and fade in & fade out delay).
94 const int appearance_delay_ms_
;
96 DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleController
);
101 #endif // ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_