Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 | 13 |
| 14 namespace aura { | |
| 15 class RootWindow; | |
| 16 } // namespace aura | |
| 17 | |
| 14 namespace ash { | 18 namespace ash { |
| 15 namespace internal { | 19 namespace internal { |
| 16 | 20 |
| 17 class PhantomWindowController; | 21 class PhantomWindowController; |
| 18 class SnapSizer; | 22 class SnapSizer; |
| 19 | 23 |
| 20 // WindowResizer implementation for workspaces. This enforces that windows are | 24 // WindowResizer implementation for workspaces. This enforces that windows are |
| 21 // not allowed to vertically move or resize outside of the work area. As windows | 25 // not allowed to vertically move or resize outside of the work area. As windows |
| 22 // are moved outside the work area they are shrunk. We remember the height of | 26 // are moved outside the work area they are shrunk. We remember the height of |
| 23 // the window before it was moved so that if the window is again moved up we | 27 // the window before it was moved so that if the window is again moved up we |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 int grid_size) const; | 102 int grid_size) const; |
| 99 | 103 |
| 100 // Returns true if the window touches the bottom edge of the work area. | 104 // Returns true if the window touches the bottom edge of the work area. |
| 101 bool TouchesBottomOfScreen() const; | 105 bool TouchesBottomOfScreen() const; |
| 102 | 106 |
| 103 // Returns a coordinate along the primary axis. Used to share code for | 107 // Returns a coordinate along the primary axis. Used to share code for |
| 104 // left/right multi window resize and top/bottom resize. | 108 // left/right multi window resize and top/bottom resize. |
| 105 int PrimaryAxisSize(const gfx::Size& size) const; | 109 int PrimaryAxisSize(const gfx::Size& size) const; |
| 106 int PrimaryAxisCoordinate(int x, int y) const; | 110 int PrimaryAxisCoordinate(int x, int y) const; |
| 107 | 111 |
| 108 // Updates the bounds of the phantom window. | 112 // Updates the bounds of the phantom window for window snapping. |
| 109 void UpdatePhantomWindow( | 113 void UpdatePhantomWindow( |
| 110 const gfx::Point& location, | 114 const gfx::Point& location, |
| 111 const gfx::Rect& bounds, | 115 const gfx::Rect& bounds, |
| 112 int grid_size); | 116 int grid_size); |
| 113 | 117 |
| 118 // Updates the bounds of the phantom window for window dragging. | |
| 119 void UpdateDragPhantomWindow(const gfx::Rect& bounds); | |
| 120 | |
| 114 // Restacks the windows z-order position so that one of the windows is at the | 121 // Restacks the windows z-order position so that one of the windows is at the |
| 115 // top of the z-order, and the rest directly underneath it. | 122 // top of the z-order, and the rest directly underneath it. |
| 116 void RestackWindows(); | 123 void RestackWindows(); |
| 117 | 124 |
| 118 // Returns the SnapType for the specified point. SNAP_NONE is used if no | 125 // Returns the SnapType for the specified point. SNAP_NONE is used if no |
| 119 // snapping should be used. | 126 // snapping should be used. |
| 120 SnapType GetSnapType(const gfx::Point& location) const; | 127 SnapType GetSnapType(const gfx::Point& location) const; |
| 121 | 128 |
| 122 // Returns true if we should allow the mouse pointer to warp. | 129 // Returns true if we should allow the mouse pointer to warp. |
| 123 bool ShouldAllowMouseWarp() const; | 130 bool ShouldAllowMouseWarp() const; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 150 std::vector<float> expand_fraction_; | 157 std::vector<float> expand_fraction_; |
| 151 | 158 |
| 152 // Sum of sizes in |min_size_|. | 159 // Sum of sizes in |min_size_|. |
| 153 int total_min_; | 160 int total_min_; |
| 154 | 161 |
| 155 // Sum of the sizes in |initial_size_|. | 162 // Sum of the sizes in |initial_size_|. |
| 156 int total_initial_size_; | 163 int total_initial_size_; |
| 157 | 164 |
| 158 // Gives a previews of where the the window will end up. Only used if there | 165 // Gives a previews of where the the window will end up. Only used if there |
| 159 // is a grid and the caption is being dragged. | 166 // is a grid and the caption is being dragged. |
| 160 scoped_ptr<PhantomWindowController> phantom_window_controller_; | 167 scoped_ptr<PhantomWindowController> phantom_window_controller_; |
|
sky
2012/08/07 03:28:05
Rename this so its clear what its for, maybe snap_
Yusuke Sato
2012/08/07 16:38:30
Done.
| |
| 161 | 168 |
| 169 // For now, we show a phantom window on the other root window during dragging. | |
| 170 // TODO(yusukes): Show a semi-transparent image (screen shot) of the window | |
| 171 // instead. | |
| 172 scoped_ptr<PhantomWindowController> drag_phantom_window_controller_; | |
| 173 | |
| 162 // Used to determine the target position of a snap. | 174 // Used to determine the target position of a snap. |
| 163 scoped_ptr<SnapSizer> snap_sizer_; | 175 scoped_ptr<SnapSizer> snap_sizer_; |
| 164 | 176 |
| 165 // Last SnapType. | 177 // Last SnapType. |
| 166 SnapType snap_type_; | 178 SnapType snap_type_; |
| 167 | 179 |
| 168 // Number of mouse moves since the last bounds change. Only used for phantom | 180 // Number of mouse moves since the last bounds change. Only used for phantom |
| 169 // placement to track when the mouse is moved while pushed against the edge of | 181 // placement to track when the mouse is moved while pushed against the edge of |
| 170 // the screen. | 182 // the screen. |
| 171 int num_mouse_moves_since_bounds_change_; | 183 int num_mouse_moves_since_bounds_change_; |
| 172 | 184 |
| 173 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 185 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
| 174 }; | 186 }; |
| 175 | 187 |
| 176 } // namespace internal | 188 } // namespace internal |
| 177 } // namespace ash | 189 } // namespace ash |
| 178 | 190 |
| 179 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 191 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
| OLD | NEW |