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 #include "ash/wm/workspace/snap_sizer.h" | 5 #include "ash/wm/workspace/snap_sizer.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 num_moves_since_adjust_ = 0; | 104 num_moves_since_adjust_ = 0; |
105 last_adjust_x_ = x; | 105 last_adjust_x_ = x; |
106 } | 106 } |
107 | 107 |
108 gfx::Rect SnapSizer::GetTargetBounds() const { | 108 gfx::Rect SnapSizer::GetTargetBounds() const { |
109 return GetTargetBoundsForPercent(percent_index_); | 109 return GetTargetBoundsForPercent(percent_index_); |
110 } | 110 } |
111 | 111 |
112 gfx::Rect SnapSizer::GetTargetBoundsForPercent(int percent_index) const { | 112 gfx::Rect SnapSizer::GetTargetBoundsForPercent(int percent_index) const { |
113 gfx::Rect work_area(ScreenAsh::GetUnmaximizedWorkAreaParentBounds(window_)); | 113 gfx::Rect work_area(ScreenAsh::GetUnmaximizedWorkAreaBoundsInParent(window_)); |
114 int y = WindowResizer::AlignToGridRoundUp(work_area.y(), grid_size_); | 114 int y = WindowResizer::AlignToGridRoundUp(work_area.y(), grid_size_); |
115 // We don't align to the bottom of the grid as the launcher may not | 115 // We don't align to the bottom of the grid as the launcher may not |
116 // necessarily align to the grid (happens when auto-hidden). | 116 // necessarily align to the grid (happens when auto-hidden). |
117 int max_y = work_area.bottom(); | 117 int max_y = work_area.bottom(); |
118 int width = static_cast<float>(work_area.width()) * kPercents[percent_index]; | 118 int width = static_cast<float>(work_area.width()) * kPercents[percent_index]; |
119 if (edge_ == LEFT_EDGE) { | 119 if (edge_ == LEFT_EDGE) { |
120 int x = WindowResizer::AlignToGridRoundUp(work_area.x(), grid_size_); | 120 int x = WindowResizer::AlignToGridRoundUp(work_area.x(), grid_size_); |
121 int mid_x = WindowResizer::AlignToGridRoundUp( | 121 int mid_x = WindowResizer::AlignToGridRoundUp( |
122 work_area.x() + width, grid_size_); | 122 work_area.x() + width, grid_size_); |
123 return gfx::Rect(x, y, mid_x - x, max_y - y); | 123 return gfx::Rect(x, y, mid_x - x, max_y - y); |
124 } | 124 } |
125 int max_x = | 125 int max_x = |
126 WindowResizer::AlignToGridRoundDown(work_area.right(), grid_size_); | 126 WindowResizer::AlignToGridRoundDown(work_area.right(), grid_size_); |
127 int x = WindowResizer::AlignToGridRoundUp(max_x - width, grid_size_); | 127 int x = WindowResizer::AlignToGridRoundUp(max_x - width, grid_size_); |
128 return gfx::Rect(x , y, max_x - x, max_y - y); | 128 return gfx::Rect(x , y, max_x - x, max_y - y); |
129 } | 129 } |
130 | 130 |
131 bool SnapSizer::AlongEdge(int x) const { | 131 bool SnapSizer::AlongEdge(int x) const { |
132 gfx::Rect area(ScreenAsh::GetDisplayParentBounds(window_)); | 132 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window_)); |
133 return (x <= area.x()) || (x >= area.right() - 1); | 133 return (x <= area.x()) || (x >= area.right() - 1); |
134 } | 134 } |
135 | 135 |
136 } // namespace internal | 136 } // namespace internal |
137 } // namespace ash | 137 } // namespace ash |
OLD | NEW |