Chromium Code Reviews| 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/frame_maximize_button.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/aura/event_filter.h" | |
|
msw
2012/08/02 18:56:59
Is this include necessary?
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
| |
| 12 | |
| 13 namespace base { | |
| 14 class Timer; | |
| 15 } | |
| 16 | |
| 17 namespace ash { | |
| 18 | |
| 19 // A class which shows a helper UI for the maximize button. | |
| 20 // The menu gets created every time after an initial delay. The delay can be | |
|
sky
2012/08/02 18:30:30
Using menu is confusing here since this class does
msw
2012/08/02 18:56:59
nit: "every time" what happens? Consider just appe
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
| |
| 21 // reset through a function. | |
| 22 class ASH_EXPORT MaximizeBubbleController { | |
| 23 public: | |
| 24 explicit MaximizeBubbleController(FrameMaximizeButton* frame_maximize_button, | |
|
sky
2012/08/02 18:30:30
no explicit
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
| |
| 25 bool is_maximized); | |
| 26 // Called from the outside to destroy the interface to the menu and | |
| 27 // the menu itself will delete itself then. | |
|
msw
2012/08/02 18:56:59
nit: redundant "itself will delete itself"
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
| |
| 28 virtual ~MaximizeBubbleController(); | |
| 29 | |
| 30 // Update the visible menu to reflect the previewed |snap_type| snapping | |
|
msw
2012/08/02 18:56:59
nit: nix "visible" for a single line comment :)
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
| |
| 31 // state. | |
| 32 void SetMenuState(FrameMaximizeButton::SnapType snap_type); | |
|
sky
2012/08/02 18:30:30
How about SetSnapType?
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
| |
| 33 | |
| 34 // Return a window handle underneath the snap animation window should | |
|
sky
2012/08/02 18:30:30
The name of this method is rather confusing. I thi
msw
2012/08/02 18:56:59
nit: grammar / clarity; did you mean "underneath w
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
| |
| 35 // operate. | |
| 36 aura::Window* GetMenuWindow(); | |
| 37 | |
| 38 // Reset the delay of the menu creation to the beg. | |
|
sky
2012/08/02 18:30:30
beg?
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Done.
| |
| 39 void DelayCreation(); | |
| 40 | |
| 41 protected: | |
|
sky
2012/08/02 18:30:30
Why is any of this protected?
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
See below. I don't want to have the destruction fu
| |
| 42 FrameMaximizeButton* frame_maximize_button() { | |
| 43 return frame_maximize_button_; | |
| 44 } | |
| 45 | |
| 46 // Called from the menu itself: Closes the bubble menu at the earliest time | |
| 47 // and destroys |this| object through the owner. | |
| 48 void RequestDestructionThroughOwner(); | |
| 49 | |
| 50 // Called when a button was clicked. | |
| 51 void OnButtonClicked(FrameMaximizeButton::SnapType snap_type); | |
| 52 | |
| 53 // Tell the owner that the hover status for a button has changed. | |
| 54 // |snap_type| can be either SNAP_LEFT, SNAP_RIGHT, SNAP_MINIMIZE or | |
| 55 // SNAP_NONE. | |
| 56 void OnButtonHover(FrameMaximizeButton::SnapType snap_type); | |
| 57 | |
| 58 private: | |
| 59 class Bubble; | |
|
sky
2012/08/02 18:30:30
Do all of these really need to be inner classes? F
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
I have removed all but one from this class. I want
| |
| 60 class BubbleContentsView; | |
|
msw
2012/08/02 18:56:59
Are these forward decls necessary?
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
Again, removed most of them.
| |
| 61 class BubbleContentsButtonRow; | |
| 62 class BubbleMenuButton; | |
| 63 | |
| 64 // The function which creates the bubble once the delay is elapsed. | |
| 65 void DelayedBubbleCreation(); | |
|
sky
2012/08/02 18:30:30
How about CreateBubble().
Mr4D (OOO till 08-26)
2012/08/02 23:10:38
I thought it is clearer to show the fact that this
| |
| 66 | |
| 67 // The status of the associated window: Maximized or normal. | |
| 68 bool is_maximized() const { return is_maximized_; } | |
| 69 | |
| 70 // The owning button which is also the anchor for the menu. | |
| 71 FrameMaximizeButton* frame_maximize_button_; | |
| 72 | |
| 73 // The bubble menu. | |
| 74 Bubble* bubble_; | |
| 75 | |
| 76 // If true the owning window is maximized. | |
| 77 const bool is_maximized_; | |
| 78 | |
| 79 // The timer for the delayed creation of the menu. | |
| 80 scoped_ptr<base::Timer> timer_; | |
| 81 | |
| 82 DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleController); | |
| 83 }; | |
| 84 | |
| 85 } // namespace ash | |
| 86 | |
| 87 #endif // ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ | |
| OLD | NEW |