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

Unified Diff: ash/wm/window_maximize.h

Issue 10823025: Adding new maximize menu according to spec (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Found some edge cases for menu destruction Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/window_maximize.h
diff --git a/ash/wm/window_maximize.h b/ash/wm/window_maximize.h
new file mode 100644
index 0000000000000000000000000000000000000000..0efa25a9823472d965d0282d90b7b595b1e8d405
--- /dev/null
+++ b/ash/wm/window_maximize.h
@@ -0,0 +1,123 @@
+// 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_WINDOW_MAXIMIZE_H_
sky 2012/07/31 16:11:06 File name should match class name. So, this file s
Mr4D (OOO till 08-26) 2012/08/01 20:48:22 Done & renamed.
+#define ASH_WM_WINDOW_MAXIMIZE_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"
+
+namespace base {
+ class Timer;
+}
+
+namespace views {
+ class RadialMenu;
+}
+
+namespace ash {
+
+// A class which shows a helper UI for the maximize button. This menu is either
+// - showing a bubble showing three buttons and a help.
+// - a helo menu (experimental behind a flag).
sky 2012/07/31 16:11:06 halo?
Mr4D (OOO till 08-26) 2012/08/01 20:48:22 Done.
+// The menu gets created every time after an initial delay. The delay can be
+// reset through a function.
+// Note: The EventFilter dependency is only part of the radial menu and will
sky 2012/07/31 16:11:06 Why is the EventFilter part of this class? Shouldn
Mr4D (OOO till 08-26) 2012/08/01 20:48:22 No. The radial menu is a "renderer" with a hit tes
+// only be used to track mouse movement when the radial menu is shown. This is
+// needed to update the menu in case of a non pressed mouse move.
+class ASH_EXPORT MaximizeBubble : public aura::EventFilter {
+ public:
+ explicit MaximizeBubble(FrameMaximizeButton* frame_maximize_button,
+ bool is_maximized);
sky 2012/07/31 16:11:06 indent to match previous line.
Mr4D (OOO till 08-26) 2012/08/01 20:48:22 Done.
+ // Called from the outside to destroy the interface to the menu and
+ // the menu itself will delete itself then.
+ virtual ~MaximizeBubble();
+
+ // Update the visible menu to reflect the previewed |snap_type| snapping
+ // state.
+ void SetMenuState(FrameMaximizeButton::SnapType snap_type);
+
+ // Return a window handle underneath the snap animation window should
+ // operate.
+ aura::Window* GetMenuWindow();
+
+ // Reset the delay of the menu creation to the beg.
+ void DelayCreation();
+
+ // These functions below to the protected section were added for the
+ // experimental radial menu.
+
+ // Returns true when the radial menu is turned on
+ bool IsRadialMenu();
+
+ // Update the menu status and returns true if menu got hit and a |code|
+ // will be set accordingly.
+ bool SnapTypeForLocation(const gfx::Point& pt,
+ FrameMaximizeButton::SnapType& type);
+
+ // EventFilter overrides:
+ virtual bool PreHandleKeyEvent(aura::Window* target,
sky 2012/07/31 16:11:06 indent to match previous line. If indenting makes
Mr4D (OOO till 08-26) 2012/08/01 20:48:22 Done.
+ aura::KeyEvent* event) OVERRIDE;
+ virtual bool PreHandleMouseEvent(aura::Window* target,
+ aura::MouseEvent* event) OVERRIDE;
+ virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target,
+ aura::TouchEvent* event) OVERRIDE;
+ virtual ui::GestureStatus PreHandleGestureEvent(aura::Window* target,
+ aura::GestureEvent* event) OVERRIDE;
+
+ protected:
+ FrameMaximizeButton* frame_maximize_button() {
+ return frame_maximize_button_;
+ }
+
+ // Called from the menu itself: Hides the bubble and destroys it.
+ void CloseInternal();
+
+ // 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;
+ class BubbleContentsView;
+ class BubbleContentsButtonRow;
+ class BubbleMenuButton;
+
+ // The function which creates the bubble once the delay is elapsed.
+ void DelayedBubbleCreation();
+
+ // The status of the associated window: Maximized or normal.
+ bool is_maximized() { return is_maximized_; }
sky 2012/07/31 16:11:06 const
Mr4D (OOO till 08-26) 2012/08/01 20:48:22 Done.
+
+ // The owning button which is also the anchor for the menu.
+ FrameMaximizeButton* frame_maximize_button_;
+
+ // The bubble menu.
+ Bubble* bubble_;
+
+ // The alternative radial menu.
+ views::RadialMenu* radial_menu_;
+
+ // The snap type which was set by the user's mouse movement (when in
+ // hover mode and no button was clicked).
+ FrameMaximizeButton::SnapType current_radial_snap_hover_type_;
+
+ // 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(MaximizeBubble);
+};
+
+} // namespace ash
+
+#endif // ASH_WM_WINDOW_MAXIMIZE_H_
« no previous file with comments | « ash/ash_strings.grd ('k') | ash/wm/window_maximize.cc » ('j') | ash/wm/window_maximize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698