Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: ash/wm/maximize_bubble_controller.h

Issue 10883069: Added restore functionality for maximize full/left/right (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit test failure Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/custom_frame_view_ash_unittest.cc ('k') | ash/wm/maximize_bubble_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/maximize_bubble_frame_state.h"
9 #include "ash/wm/workspace/snap_types.h" 10 #include "ash/wm/workspace/snap_types.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 12
12 namespace aura { 13 namespace aura {
13 class Window; 14 class Window;
14 } 15 }
15 16
16 namespace base { 17 namespace base {
17 class Timer; 18 class Timer;
18 } 19 }
19 20
20 namespace views { 21 namespace views {
21 class CustomButton; 22 class CustomButton;
22 } 23 }
23 24
24 namespace ash { 25 namespace ash {
25 26
26 class FrameMaximizeButton; 27 class FrameMaximizeButton;
27 28
28 // A class which shows a helper UI for the maximize button after a delay. 29 // A class which shows a helper UI for the maximize button after a delay.
29 class ASH_EXPORT MaximizeBubbleController { 30 class ASH_EXPORT MaximizeBubbleController {
30 public: 31 public:
31 class Bubble; 32 class Bubble;
32 33
33 MaximizeBubbleController(FrameMaximizeButton* frame_maximize_button, 34 MaximizeBubbleController(FrameMaximizeButton* frame_maximize_button,
34 bool is_maximized, 35 MaximizeBubbleFrameState maximize_type,
35 int appearance_delay_ms); 36 int appearance_delay_ms);
36 // Called from the outside to destroy the interface to the UI visuals. 37 // Called from the outside to destroy the interface to the UI visuals.
37 // The visuals will then delete when possible (maybe asynchronously). 38 // The visuals will then delete when possible (maybe asynchronously).
38 virtual ~MaximizeBubbleController(); 39 virtual ~MaximizeBubbleController();
39 40
40 // Update the UI visuals to reflect the previewed |snap_type| snapping state. 41 // Update the UI visuals to reflect the previewed |snap_type| snapping state.
41 void SetSnapType(SnapType snap_type); 42 void SetSnapType(SnapType snap_type);
42 43
43 // To achieve proper Z-sorting with the snap animation, this window will be 44 // To achieve proper Z-sorting with the snap animation, this window will be
44 // presented above the phantom window. 45 // presented above the phantom window.
45 aura::Window* GetBubbleWindow(); 46 aura::Window* GetBubbleWindow();
46 47
47 // Reset the delay of the menu creation (if it was not created yet). 48 // Reset the delay of the menu creation (if it was not created yet).
48 void DelayCreation(); 49 void DelayCreation();
49 50
50 // Called to tell the owning FrameMaximizeButton that a button was clicked. 51 // Called to tell the owning FrameMaximizeButton that a button was clicked.
51 void OnButtonClicked(SnapType snap_type); 52 void OnButtonClicked(SnapType snap_type);
52 53
53 // Called to tell the the owning FrameMaximizeButton that the hover status 54 // Called to tell the the owning FrameMaximizeButton that the hover status
54 // for a button has changed. |snap_type| can be either SNAP_LEFT, SNAP_RIGHT, 55 // for a button has changed. |snap_type| can be either SNAP_LEFT, SNAP_RIGHT,
55 // SNAP_MINIMIZE or SNAP_NONE. 56 // SNAP_MINIMIZE or SNAP_NONE.
56 void OnButtonHover(SnapType snap_type); 57 void OnButtonHover(SnapType snap_type);
57 58
58 // Get the owning FrameMaximizeButton. 59 // Get the owning FrameMaximizeButton.
59 FrameMaximizeButton* frame_maximize_button() { 60 FrameMaximizeButton* frame_maximize_button() {
60 return frame_maximize_button_; 61 return frame_maximize_button_;
61 } 62 }
62 63
63 // The status of the associated window: Maximized or normal. 64 // The status of the associated window: Maximized or normal.
64 bool is_maximized() const { return is_maximized_; } 65 MaximizeBubbleFrameState maximize_type() const { return maximize_type_; }
65 66
66 // A unit test function to return buttons of the sub menu. |state| can be 67 // A unit test function to return buttons of the sub menu. |state| can be
67 // either SNAP_LEFT, SNAP_RIGHT or SNAP_MINIMIZE. 68 // either SNAP_LEFT, SNAP_RIGHT or SNAP_MINIMIZE.
68 views::CustomButton* GetButtonForUnitTest(SnapType state); 69 views::CustomButton* GetButtonForUnitTest(SnapType state);
69 70
70 protected: 71 protected:
71 // Called from the the Bubble class to destroy itself: It tells the owning 72 // 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 73 // object that it will destroy itself asynchronously. The owner will then
73 // destroy |this|. 74 // destroy |this|.
74 void RequestDestructionThroughOwner(); 75 void RequestDestructionThroughOwner();
75 76
76 private: 77 private:
77 // The function which creates the bubble once the delay is elapsed. 78 // The function which creates the bubble once the delay is elapsed.
78 void CreateBubble(); 79 void CreateBubble();
79 80
80 // The owning button which is also the anchor for the menu. 81 // The owning button which is also the anchor for the menu.
81 FrameMaximizeButton* frame_maximize_button_; 82 FrameMaximizeButton* frame_maximize_button_;
82 83
83 // The bubble menu. 84 // The bubble menu.
84 Bubble* bubble_; 85 Bubble* bubble_;
85 86
86 // If true the owning window is maximized. 87 // The current maximize state of the owning window.
87 const bool is_maximized_; 88 const MaximizeBubbleFrameState maximize_type_;
88 89
89 // The timer for the delayed creation of the menu. 90 // The timer for the delayed creation of the menu.
90 scoped_ptr<base::Timer> timer_; 91 scoped_ptr<base::Timer> timer_;
91 92
92 // The appearance delay in ms (delay and fade in & fade out delay). 93 // The appearance delay in ms (delay and fade in & fade out delay).
93 const int appearance_delay_ms_; 94 const int appearance_delay_ms_;
94 95
95 DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleController); 96 DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleController);
96 }; 97 };
97 98
98 } // namespace ash 99 } // namespace ash
99 100
100 #endif // ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ 101 #endif // ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/wm/custom_frame_view_ash_unittest.cc ('k') | ash/wm/maximize_bubble_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698