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 "chrome/browser/ui/window_sizer/window_sizer.h" | 5 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/window_cycle_controller.h" | 8 #include "ash/wm/window_cycle_controller.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return true; | 157 return true; |
158 | 158 |
159 gfx::Rect other_bounds_in_screen = top_window->GetBoundsInScreen(); | 159 gfx::Rect other_bounds_in_screen = top_window->GetBoundsInScreen(); |
160 bool move_right = | 160 bool move_right = |
161 other_bounds_in_screen.CenterPoint().x() < work_area.CenterPoint().x(); | 161 other_bounds_in_screen.CenterPoint().x() < work_area.CenterPoint().x(); |
162 | 162 |
163 // In case we have only one window, we move the other window fully to the | 163 // In case we have only one window, we move the other window fully to the |
164 // "other side" - making room for this new window. | 164 // "other side" - making room for this new window. |
165 if (count == 1) { | 165 if (count == 1) { |
166 gfx::Display display = | 166 gfx::Display display = |
167 gfx::Screen::GetDisplayMatching( | 167 ash::Shell::GetAshScreen()->GetDisplayMatching( |
168 top_window->GetRootWindow()->GetBoundsInScreen()); | 168 top_window->GetRootWindow()->GetBoundsInScreen()); |
169 if (MoveRect(work_area, other_bounds_in_screen, !move_right)) | 169 if (MoveRect(work_area, other_bounds_in_screen, !move_right)) |
170 top_window->SetBoundsInScreen(other_bounds_in_screen, display); | 170 top_window->SetBoundsInScreen(other_bounds_in_screen, display); |
171 } | 171 } |
172 // Use the size of the other window, and mirror the location to the | 172 // Use the size of the other window, and mirror the location to the |
173 // opposite side. Then make sure that it is inside our work area | 173 // opposite side. Then make sure that it is inside our work area |
174 // (if possible). | 174 // (if possible). |
175 *bounds_in_screen = other_bounds_in_screen; | 175 *bounds_in_screen = other_bounds_in_screen; |
176 MoveRect(work_area, *bounds_in_screen, move_right); | 176 MoveRect(work_area, *bounds_in_screen, move_right); |
177 if (bounds_in_screen->bottom() > work_area.bottom()) | 177 if (bounds_in_screen->bottom() > work_area.bottom()) |
(...skipping 25 matching lines...) Expand all Loading... |
203 if (default_width > kMaximumWindowWidth) { | 203 if (default_width > kMaximumWindowWidth) { |
204 // The window should get centered on the screen and not follow the grid. | 204 // The window should get centered on the screen and not follow the grid. |
205 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; | 205 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; |
206 default_width = kMaximumWindowWidth; | 206 default_width = kMaximumWindowWidth; |
207 } | 207 } |
208 default_bounds->SetRect(work_area.x() + offset_x, | 208 default_bounds->SetRect(work_area.x() + offset_x, |
209 work_area.y() + kDesktopBorderSize, | 209 work_area.y() + kDesktopBorderSize, |
210 default_width, | 210 default_width, |
211 default_height); | 211 default_height); |
212 } | 212 } |
OLD | NEW |