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

Unified Diff: ash/wm/workspace/frame_maximize_button.h

Issue 10823025: Adding new maximize menu according to spec (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: git try 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/maximize_bubble_controller.cc ('k') | ash/wm/workspace/frame_maximize_button.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/frame_maximize_button.h
diff --git a/ash/wm/workspace/frame_maximize_button.h b/ash/wm/workspace/frame_maximize_button.h
index 0124c2f4159d92d5c4799c1e4a4688c292e3a654..2b0eec7b4c6aee689acacbff67786bb52cba8411 100644
--- a/ash/wm/workspace/frame_maximize_button.h
+++ b/ash/wm/workspace/frame_maximize_button.h
@@ -6,8 +6,10 @@
#define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
#include "ash/ash_export.h"
+#include "ash/wm/workspace/snap_types.h"
#include "base/memory/scoped_ptr.h"
#include "base/timer.h"
+#include "ui/aura/window_observer.h"
#include "ui/views/controls/button/image_button.h"
namespace views {
@@ -21,13 +23,36 @@ class PhantomWindowController;
class SnapSizer;
}
+class MaximizeBubbleController;
+
// Button used for the maximize control on the frame. Handles snapping logic.
-class ASH_EXPORT FrameMaximizeButton : public views::ImageButton {
+class ASH_EXPORT FrameMaximizeButton : public views::ImageButton,
+ public aura::WindowObserver {
public:
FrameMaximizeButton(views::ButtonListener* listener,
views::NonClientFrameView* frame);
virtual ~FrameMaximizeButton();
+ // Updates |snap_type_| based on a a given snap type. This is used by
+ // external hover events from the button menu.
+ void SnapButtonHovered(SnapType type);
+
+ // The user clicked the |type| button and the action needs to be performed,
+ // which will at the same time close the window.
+ void ExecuteSnapAndCloseMenu(SnapType type);
+
+ // Remove the maximize menu from the screen (and destroy it).
+ void DestroyMaximizeMenu();
+
+ // Returns true when the user clicks and drags the button.
+ bool is_snap_enabled() const { return is_snap_enabled_; }
+
+ // WindowObserver overrides:
+ virtual void OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) OVERRIDE;
+ virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
+
// ImageButton overrides:
virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE;
@@ -38,23 +63,9 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton {
virtual ui::GestureStatus OnGestureEvent(
const views::GestureEvent& event) OVERRIDE;
- protected:
- // ImageButton overrides:
- virtual gfx::ImageSkia GetImageToPaint() OVERRIDE;
-
private:
class EscapeEventFilter;
- // Where to snap to.
- enum SnapType {
- SNAP_LEFT,
- SNAP_RIGHT,
- SNAP_MAXIMIZE,
- SNAP_MINIMIZE,
- SNAP_RESTORE,
- SNAP_NONE
- };
-
// Initializes the snap-gesture based on the event. This should only be called
// when the event is confirmed to have started a snap gesture.
void ProcessStartEvent(const views::LocatedEvent& event);
@@ -66,8 +77,9 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton {
// Returns true if the window was snapped. Returns false otherwise.
bool ProcessEndEvent(const views::LocatedEvent& event);
- // Cancels snap behavior.
- void Cancel();
+ // Cancels snap behavior. If |keep_menu_open| is set, a possibly opened
+ // bubble help will remain open.
+ void Cancel(bool keep_menu_open);
// Installs/uninstalls an EventFilter to track when escape is pressed.
void InstallEventFilter();
@@ -106,6 +118,9 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton {
// Did the user drag far enough to trigger snapping?
bool exceeded_drag_threshold_;
+ // This is the Window we are contained in.
+ aura::Window* window_;
+
// Location of the press.
gfx::Point press_location_;
@@ -118,6 +133,8 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton {
base::OneShotTimer<FrameMaximizeButton> update_timer_;
+ scoped_ptr<MaximizeBubbleController> maximizer_;
+
DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton);
};
« no previous file with comments | « ash/wm/maximize_bubble_controller.cc ('k') | ash/wm/workspace/frame_maximize_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698