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/workspace/frame_maximize_button.h

Issue 9705039: Makes escape cancel a snap operation from the maximize button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | « no previous file | ash/wm/workspace/frame_maximize_button.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_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ 5 #ifndef ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
6 #define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ 6 #define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/views/controls/button/image_button.h" 10 #include "ui/views/controls/button/image_button.h"
(...skipping 16 matching lines...) Expand all
27 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; 27 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
28 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; 28 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
29 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; 29 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
30 virtual void OnMouseCaptureLost() OVERRIDE; 30 virtual void OnMouseCaptureLost() OVERRIDE;
31 31
32 protected: 32 protected:
33 // ImageButton overrides: 33 // ImageButton overrides:
34 virtual SkBitmap GetImageToPaint() OVERRIDE; 34 virtual SkBitmap GetImageToPaint() OVERRIDE;
35 35
36 private: 36 private:
37 class EscapeEventFilter;
38
37 // Where to snap to. 39 // Where to snap to.
38 enum SnapType { 40 enum SnapType {
39 SNAP_LEFT, 41 SNAP_LEFT,
40 SNAP_RIGHT, 42 SNAP_RIGHT,
41 SNAP_MAXIMIZE, 43 SNAP_MAXIMIZE,
42 SNAP_MINIMIZE, 44 SNAP_MINIMIZE,
43 SNAP_NONE 45 SNAP_NONE
44 }; 46 };
45 47
48 // Cancels snap behavior.
49 void Cancel();
50
51 // Installs/uninstalls an EventFilter to track when escape is pressed.
52 void InstallEventFilter();
53 void UninstallEventFilter();
54
46 // Updates |snap_type_| based on a mouse drag. The parameters are relative to 55 // Updates |snap_type_| based on a mouse drag. The parameters are relative to
47 // the mouse pressed location. 56 // the mouse pressed location.
48 void UpdateSnap(int delta_x, int delta_y); 57 void UpdateSnap(int delta_x, int delta_y);
49 58
50 // Returns the type of snap based on the specified coordaintes (relative to 59 // Returns the type of snap based on the specified coordaintes (relative to
51 // the press location). 60 // the press location).
52 SnapType SnapTypeForDelta(int delta_x, int delta_y) const; 61 SnapType SnapTypeForDelta(int delta_x, int delta_y) const;
53 62
54 // Returns the bounds of the resulting window for the specified type. 63 // Returns the bounds of the resulting window for the specified type.
55 gfx::Rect BoundsForType(SnapType type) const; 64 gfx::Rect BoundsForType(SnapType type) const;
(...skipping 10 matching lines...) Expand all
66 75
67 // Did the user drag far enough to trigger snapping? 76 // Did the user drag far enough to trigger snapping?
68 bool exceeded_drag_threshold_; 77 bool exceeded_drag_threshold_;
69 78
70 // Location of the press. 79 // Location of the press.
71 gfx::Point press_location_; 80 gfx::Point press_location_;
72 81
73 // Current snap type. 82 // Current snap type.
74 SnapType snap_type_; 83 SnapType snap_type_;
75 84
85 scoped_ptr<EscapeEventFilter> escape_event_filter_;
86
76 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton); 87 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton);
77 }; 88 };
78 89
79 } // namespace ash 90 } // namespace ash
80 91
81 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ 92 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
OLDNEW
« no previous file with comments | « no previous file | ash/wm/workspace/frame_maximize_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698