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_WORKSPACE_WINDOW_RESIZER_H_ |
6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 6 #define ASH_WM_WORKSPACE_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 "ash/wm/workspace/magnetism_matcher.h" | 11 #include "ash/wm/workspace/magnetism_matcher.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | |
14 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
16 #include "ui/aura/window_tracker.h" | 15 #include "ui/aura/window_tracker.h" |
17 | 16 |
18 namespace ash { | 17 namespace ash { |
19 class DockedWindowLayoutManager; | 18 class DockedWindowLayoutManager; |
20 class PhantomWindowController; | 19 class PhantomWindowController; |
21 class TwoStepEdgeCycler; | 20 class TwoStepEdgeCycler; |
22 class WindowSize; | 21 class WindowSize; |
23 | 22 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // indicating that that many pixels couldn't be removed from the attached | 83 // indicating that that many pixels couldn't be removed from the attached |
85 // windows. | 84 // windows. |
86 int CalculateAttachedSizes( | 85 int CalculateAttachedSizes( |
87 int delta, | 86 int delta, |
88 int available_size, | 87 int available_size, |
89 std::vector<int>* sizes) const; | 88 std::vector<int>* sizes) const; |
90 | 89 |
91 // Divides |amount| evenly between |sizes|. If |amount| is negative it | 90 // Divides |amount| evenly between |sizes|. If |amount| is negative it |
92 // indicates how many pixels |sizes| should be shrunk by. | 91 // indicates how many pixels |sizes| should be shrunk by. |
93 // Returns how many pixels failed to be allocated/removed from |sizes|. | 92 // Returns how many pixels failed to be allocated/removed from |sizes|. |
94 int GrowFairly(int amount, std::vector<WindowSize>& sizes) const; | 93 int GrowFairly(int amount, std::vector<WindowSize>* sizes) const; |
95 | 94 |
96 // Calculate the ratio of pixels that each WindowSize in |sizes| should | 95 // Calculate the ratio of pixels that each WindowSize in |sizes| should |
97 // receive when growing or shrinking. | 96 // receive when growing or shrinking. |
98 void CalculateGrowthRatios(const std::vector<WindowSize*>& sizes, | 97 void CalculateGrowthRatios(const std::vector<WindowSize*>& sizes, |
99 std::vector<float>* out_ratios) const; | 98 std::vector<float>* out_ratios) const; |
100 | 99 |
101 // Adds a WindowSize to |sizes| for each attached window. | 100 // Adds a WindowSize to |sizes| for each attached window. |
102 void CreateBucketsForAttached(std::vector<WindowSize>* sizes) const; | 101 void CreateBucketsForAttached(std::vector<WindowSize>* sizes) const; |
103 | 102 |
104 // If possible snaps the window to a neary window. Updates |bounds| if there | 103 // If possible snaps the window to a neary window. Updates |bounds| if there |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 215 |
217 // Used to determine if this has been deleted during a drag such as when a tab | 216 // Used to determine if this has been deleted during a drag such as when a tab |
218 // gets dragged into another browser window. | 217 // gets dragged into another browser window. |
219 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_; | 218 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_; |
220 | 219 |
221 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 220 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
222 }; | 221 }; |
223 | 222 |
224 } // namespace ash | 223 } // namespace ash |
225 | 224 |
226 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 225 #endif // ASH_WM_WORKSPACE_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |