Index: ash/wm/maximize_bubble_controller.h |
diff --git a/ash/wm/maximize_bubble_controller.h b/ash/wm/maximize_bubble_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..82df5dc13e8fba69b87dbafb53c9dd3ec2b39247 |
--- /dev/null |
+++ b/ash/wm/maximize_bubble_controller.h |
@@ -0,0 +1,87 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ |
+#define ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ |
+ |
+#include "ash/ash_export.h" |
+#include "ash/wm/workspace/frame_maximize_button.h" |
+#include "base/memory/scoped_ptr.h" |
+#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.
|
+ |
+namespace base { |
+ class Timer; |
+} |
+ |
+namespace ash { |
+ |
+// A class which shows a helper UI for the maximize button. |
+// 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.
|
+// reset through a function. |
+class ASH_EXPORT MaximizeBubbleController { |
+ public: |
+ 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.
|
+ bool is_maximized); |
+ // Called from the outside to destroy the interface to the menu and |
+ // 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.
|
+ virtual ~MaximizeBubbleController(); |
+ |
+ // 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.
|
+ // state. |
+ 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.
|
+ |
+ // 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.
|
+ // operate. |
+ aura::Window* GetMenuWindow(); |
+ |
+ // 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.
|
+ void DelayCreation(); |
+ |
+ 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
|
+ FrameMaximizeButton* frame_maximize_button() { |
+ return frame_maximize_button_; |
+ } |
+ |
+ // Called from the menu itself: Closes the bubble menu at the earliest time |
+ // and destroys |this| object through the owner. |
+ void RequestDestructionThroughOwner(); |
+ |
+ // Called when a button was clicked. |
+ void OnButtonClicked(FrameMaximizeButton::SnapType snap_type); |
+ |
+ // Tell the owner that the hover status for a button has changed. |
+ // |snap_type| can be either SNAP_LEFT, SNAP_RIGHT, SNAP_MINIMIZE or |
+ // SNAP_NONE. |
+ void OnButtonHover(FrameMaximizeButton::SnapType snap_type); |
+ |
+ private: |
+ 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
|
+ 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.
|
+ class BubbleContentsButtonRow; |
+ class BubbleMenuButton; |
+ |
+ // The function which creates the bubble once the delay is elapsed. |
+ 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
|
+ |
+ // The status of the associated window: Maximized or normal. |
+ bool is_maximized() const { return is_maximized_; } |
+ |
+ // The owning button which is also the anchor for the menu. |
+ FrameMaximizeButton* frame_maximize_button_; |
+ |
+ // The bubble menu. |
+ Bubble* bubble_; |
+ |
+ // If true the owning window is maximized. |
+ const bool is_maximized_; |
+ |
+ // The timer for the delayed creation of the menu. |
+ scoped_ptr<base::Timer> timer_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MaximizeBubbleController); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // ASH_WM_MAXIMIZE_BUBBLE_CONTROLLER_H_ |