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/property_util.h" | |
| 10 #include "ash/wm/window_resizer.h" | 11 #include "ash/wm/window_resizer.h" |
| 11 #include "ash/wm/workspace/magnetism_matcher.h" | 12 #include "ash/wm/workspace/magnetism_matcher.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "ui/aura/window_tracker.h" | 16 #include "ui/aura/window_tracker.h" |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 namespace internal { | 19 namespace internal { |
| 19 | 20 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 // returns the number of pixels that couldn't be allocated to the attached | 95 // returns the number of pixels that couldn't be allocated to the attached |
| 95 // windows (due to min/max size constraints). | 96 // windows (due to min/max size constraints). |
| 96 // Note the return value can be positive or negative, a negative value | 97 // Note the return value can be positive or negative, a negative value |
| 97 // indicating that that many pixels couldn't be removed from the attached | 98 // indicating that that many pixels couldn't be removed from the attached |
| 98 // windows. | 99 // windows. |
| 99 int CalculateAttachedSizes( | 100 int CalculateAttachedSizes( |
| 100 int delta, | 101 int delta, |
| 101 int available_size, | 102 int available_size, |
| 102 std::vector<int>* sizes) const; | 103 std::vector<int>* sizes) const; |
| 103 | 104 |
| 105 // Returns an edge touching the dock bounds when dock is not opened yet or | |
| 106 // the edge representing the side that the dock is opened on. | |
| 107 DockEdge FindDockEdge(const gfx::Rect& bounds) const; | |
| 108 | |
| 104 // Divides |amount| evenly between |sizes|. If |amount| is negative it | 109 // Divides |amount| evenly between |sizes|. If |amount| is negative it |
| 105 // indicates how many pixels |sizes| should be shrunk by. | 110 // indicates how many pixels |sizes| should be shrunk by. |
| 106 // Returns how many pixels failed to be allocated/removed from |sizes|. | 111 // Returns how many pixels failed to be allocated/removed from |sizes|. |
| 107 int GrowFairly(int amount, std::vector<WindowSize>& sizes) const; | 112 int GrowFairly(int amount, std::vector<WindowSize>& sizes) const; |
| 108 | 113 |
| 109 // Calculate the ratio of pixels that each WindowSize in |sizes| should | 114 // Calculate the ratio of pixels that each WindowSize in |sizes| should |
| 110 // receive when growing or shrinking. | 115 // receive when growing or shrinking. |
| 111 void CalculateGrowthRatios(const std::vector<WindowSize*>& sizes, | 116 void CalculateGrowthRatios(const std::vector<WindowSize*>& sizes, |
| 112 std::vector<float>* out_ratios) const; | 117 std::vector<float>* out_ratios) const; |
| 113 | 118 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 // Gives a previews of where the the window will end up. Only used if there | 188 // Gives a previews of where the the window will end up. Only used if there |
| 184 // is a grid and the caption is being dragged. | 189 // is a grid and the caption is being dragged. |
| 185 scoped_ptr<PhantomWindowController> snap_phantom_window_controller_; | 190 scoped_ptr<PhantomWindowController> snap_phantom_window_controller_; |
| 186 | 191 |
| 187 // Used to determine the target position of a snap. | 192 // Used to determine the target position of a snap. |
| 188 scoped_ptr<SnapSizer> snap_sizer_; | 193 scoped_ptr<SnapSizer> snap_sizer_; |
| 189 | 194 |
| 190 // Last SnapType. | 195 // Last SnapType. |
| 191 SnapType snap_type_; | 196 SnapType snap_type_; |
| 192 | 197 |
| 198 // Last updated touched edge. | |
|
stevenjb
2013/06/03 18:19:03
Can you expand this comment? It's not entirely cle
varkha
2013/06/03 21:03:17
This is how I track a window that is still part of
| |
| 199 ash::DockEdge dock_edge_; | |
| 200 | |
| 193 // Number of mouse moves since the last bounds change. Only used for phantom | 201 // Number of mouse moves since the last bounds change. Only used for phantom |
| 194 // placement to track when the mouse is moved while pushed against the edge of | 202 // placement to track when the mouse is moved while pushed against the edge of |
| 195 // the screen. | 203 // the screen. |
| 196 int num_mouse_moves_since_bounds_change_; | 204 int num_mouse_moves_since_bounds_change_; |
| 197 | 205 |
| 198 // The mouse location passed to Drag(). | 206 // The mouse location passed to Drag(). |
| 199 gfx::Point last_mouse_location_; | 207 gfx::Point last_mouse_location_; |
| 200 | 208 |
| 201 // Window the drag has magnetically attached to. | 209 // Window the drag has magnetically attached to. |
| 202 aura::Window* magnetism_window_; | 210 aura::Window* magnetism_window_; |
| 203 | 211 |
| 204 // Used to verify |magnetism_window_| is still valid. | 212 // Used to verify |magnetism_window_| is still valid. |
| 205 aura::WindowTracker window_tracker_; | 213 aura::WindowTracker window_tracker_; |
| 206 | 214 |
| 207 // If |magnetism_window_| is non-NULL this indicates how the two windows | 215 // If |magnetism_window_| is non-NULL this indicates how the two windows |
| 208 // should attach. | 216 // should attach. |
| 209 MatchedEdge magnetism_edge_; | 217 MatchedEdge magnetism_edge_; |
| 210 | 218 |
| 211 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 219 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
| 212 }; | 220 }; |
| 213 | 221 |
| 214 } // namespace internal | 222 } // namespace internal |
| 215 } // namespace ash | 223 } // namespace ash |
| 216 | 224 |
| 217 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 225 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
| OLD | NEW |