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

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

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