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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.h

Issue 10910164: Removes the grid from ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ShelfBrowserTest Created 8 years, 3 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
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_WINDOW_RESIZER_H_ 5 #ifndef ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/wm/window_resizer.h" 10 #include "ash/wm/window_resizer.h"
(...skipping 24 matching lines...) Expand all
35 public: 35 public:
36 // When dragging an attached window this is the min size we'll make sure is 36 // When dragging an attached window this is the min size we'll make sure is
37 // visible. In the vertical direction we take the max of this and that from 37 // visible. In the vertical direction we take the max of this and that from
38 // the delegate. 38 // the delegate.
39 static const int kMinOnscreenSize; 39 static const int kMinOnscreenSize;
40 40
41 // Min height we'll force on screen when dragging the caption. 41 // Min height we'll force on screen when dragging the caption.
42 // TODO: this should come from a property on the window. 42 // TODO: this should come from a property on the window.
43 static const int kMinOnscreenHeight; 43 static const int kMinOnscreenHeight;
44 44
45 // Snap region when dragging close to the edges. That is, as the window gets
46 // this close to an edge of the screen it snaps to the edge.
47 static const int kScreenEdgeInset;
48
45 virtual ~WorkspaceWindowResizer(); 49 virtual ~WorkspaceWindowResizer();
46 50
47 static WorkspaceWindowResizer* Create( 51 static WorkspaceWindowResizer* Create(
48 aura::Window* window, 52 aura::Window* window,
49 const gfx::Point& location_in_parent, 53 const gfx::Point& location_in_parent,
50 int window_component, 54 int window_component,
51 const std::vector<aura::Window*>& attached_windows); 55 const std::vector<aura::Window*>& attached_windows);
52 56
53 // Returns true if the drag will result in changing the window in anyway. 57 // Returns true if the drag will result in changing the window in anyway.
54 bool is_resizable() const { return details_.is_resizable; } 58 bool is_resizable() const { return details_.is_resizable; }
(...skipping 19 matching lines...) Expand all
74 enum SnapType { 78 enum SnapType {
75 // Snap to the left/right edge of the screen. 79 // Snap to the left/right edge of the screen.
76 SNAP_LEFT_EDGE, 80 SNAP_LEFT_EDGE,
77 SNAP_RIGHT_EDGE, 81 SNAP_RIGHT_EDGE,
78 82
79 // No snap position. 83 // No snap position.
80 SNAP_NONE 84 SNAP_NONE
81 }; 85 };
82 86
83 // Returns the final bounds to place the window at. This differs from 87 // Returns the final bounds to place the window at. This differs from
84 // the current if there is a grid. 88 // the current when snapping.
85 gfx::Rect GetFinalBounds(const gfx::Rect& bounds, int grid_size) const; 89 gfx::Rect GetFinalBounds(const gfx::Rect& bounds) const;
86 90
87 // Lays out the attached windows. |bounds| is the bounds of the main window. 91 // Lays out the attached windows. |bounds| is the bounds of the main window.
88 void LayoutAttachedWindows(const gfx::Rect& bounds, int grid_size); 92 void LayoutAttachedWindows(const gfx::Rect& bounds);
89 93
90 // Calculates the size (along the primary axis) of the attached windows. 94 // Calculates the size (along the primary axis) of the attached windows.
91 // |initial_size| is the initial size of the main window, |current_size| the 95 // |initial_size| is the initial size of the main window, |current_size| the
92 // new size of the main window, |start| the position to layout the attached 96 // new size of the main window, |start| the position to layout the attached
93 // windows from and |end| the coordinate to position to. 97 // windows from and |end| the coordinate to position to.
94 void CalculateAttachedSizes( 98 void CalculateAttachedSizes(int initial_size,
95 int initial_size, 99 int current_size,
96 int current_size, 100 int start,
97 int start, 101 int end,
98 int end, 102 std::vector<int>* sizes) const;
99 int grid_size,
100 std::vector<int>* sizes) const;
101 103
102 // Adjusts the bounds to enforce that windows are vertically contained in the 104 // Adjusts the bounds to enforce that windows are vertically contained in the
103 // work area. 105 // work area.
104 void AdjustBoundsForMainWindow(gfx::Rect* bounds, int grid_size) const; 106 void AdjustBoundsForMainWindow(gfx::Rect* bounds, int grid_size) const;
105 107
106 // Snaps the window bounds to the work area edges if necessary. 108 // Snaps the window bounds to the work area edges if necessary.
107 void SnapToWorkAreaEdges( 109 void SnapToWorkAreaEdges(
108 const gfx::Rect& work_area, 110 const gfx::Rect& work_area,
109 gfx::Rect* bounds, 111 gfx::Rect* bounds,
110 int grid_size) const; 112 int grid_size) const;
111 113
112 // Returns true if the window touches the bottom edge of the work area. 114 // Returns true if the window touches the bottom edge of the work area.
113 bool TouchesBottomOfScreen() const; 115 bool TouchesBottomOfScreen() const;
114 116
115 // Returns a coordinate along the primary axis. Used to share code for 117 // Returns a coordinate along the primary axis. Used to share code for
116 // left/right multi window resize and top/bottom resize. 118 // left/right multi window resize and top/bottom resize.
117 int PrimaryAxisSize(const gfx::Size& size) const; 119 int PrimaryAxisSize(const gfx::Size& size) const;
118 int PrimaryAxisCoordinate(int x, int y) const; 120 int PrimaryAxisCoordinate(int x, int y) const;
119 121
120 // Updates the bounds of the phantom window for window snapping. 122 // Updates the bounds of the phantom window for window snapping.
121 void UpdateSnapPhantomWindow(const gfx::Point& location, 123 void UpdateSnapPhantomWindow(const gfx::Point& location,
122 const gfx::Rect& bounds, 124 const gfx::Rect& bounds);
123 int grid_size);
124 125
125 // Updates the bounds of the phantom window for window dragging. Set true on 126 // Updates the bounds of the phantom window for window dragging. Set true on
126 // |in_original_root| if the pointer is still in |window()->GetRootWindow()|. 127 // |in_original_root| if the pointer is still in |window()->GetRootWindow()|.
127 void UpdateDragPhantomWindow(const gfx::Rect& bounds, bool in_original_root); 128 void UpdateDragPhantomWindow(const gfx::Rect& bounds, bool in_original_root);
128 129
129 // Restacks the windows z-order position so that one of the windows is at the 130 // Restacks the windows z-order position so that one of the windows is at the
130 // top of the z-order, and the rest directly underneath it. 131 // top of the z-order, and the rest directly underneath it.
131 void RestackWindows(); 132 void RestackWindows();
132 133
133 // Returns the SnapType for the specified point. SNAP_NONE is used if no 134 // Returns the SnapType for the specified point. SNAP_NONE is used if no
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // been deleted. 203 // been deleted.
203 bool* destroyed_; 204 bool* destroyed_;
204 205
205 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); 206 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
206 }; 207 };
207 208
208 } // namespace internal 209 } // namespace internal
209 } // namespace ash 210 } // namespace ash
210 211
211 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 212 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_manager_unittest.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698