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