| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 return true; | 139 return true; |
| 140 | 140 |
| 141 gfx::Rect other_bounds_in_screen = top_window->GetBoundsInScreen(); | 141 gfx::Rect other_bounds_in_screen = top_window->GetBoundsInScreen(); |
| 142 bool move_right = | 142 bool move_right = |
| 143 other_bounds_in_screen.CenterPoint().x() < work_area.CenterPoint().x(); | 143 other_bounds_in_screen.CenterPoint().x() < work_area.CenterPoint().x(); |
| 144 | 144 |
| 145 // In case we have only one window, we move the other window fully to the | 145 // In case we have only one window, we move the other window fully to the |
| 146 // "other side" - making room for this new window. | 146 // "other side" - making room for this new window. |
| 147 if (count == 1) { | 147 if (count == 1) { |
| 148 gfx::Display display = | 148 gfx::Display display = |
| 149 gfx::Screen::GetDisplayMatching( | 149 ash::Shell::GetAshScreen()->GetDisplayMatching( |
| 150 top_window->GetRootWindow()->GetBoundsInScreen()); | 150 top_window->GetRootWindow()->GetBoundsInScreen()); |
| 151 if (MoveRect(work_area, other_bounds_in_screen, !move_right)) | 151 if (MoveRect(work_area, other_bounds_in_screen, !move_right)) |
| 152 top_window->SetBoundsInScreen(other_bounds_in_screen, display); | 152 top_window->SetBoundsInScreen(other_bounds_in_screen, display); |
| 153 } | 153 } |
| 154 // Use the size of the other window, and mirror the location to the | 154 // Use the size of the other window, and mirror the location to the |
| 155 // opposite side. Then make sure that it is inside our work area | 155 // opposite side. Then make sure that it is inside our work area |
| 156 // (if possible). | 156 // (if possible). |
| 157 *bounds_in_screen = other_bounds_in_screen; | 157 *bounds_in_screen = other_bounds_in_screen; |
| 158 MoveRect(work_area, *bounds_in_screen, move_right); | 158 MoveRect(work_area, *bounds_in_screen, move_right); |
| 159 if (bounds_in_screen->bottom() > work_area.bottom()) | 159 if (bounds_in_screen->bottom() > work_area.bottom()) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 185 if (default_width > kMaximumWindowWidth) { | 185 if (default_width > kMaximumWindowWidth) { |
| 186 // The window should get centered on the screen and not follow the grid. | 186 // The window should get centered on the screen and not follow the grid. |
| 187 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; | 187 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; |
| 188 default_width = kMaximumWindowWidth; | 188 default_width = kMaximumWindowWidth; |
| 189 } | 189 } |
| 190 default_bounds->SetRect(work_area.x() + offset_x, | 190 default_bounds->SetRect(work_area.x() + offset_x, |
| 191 work_area.y() + kDesktopBorderSize, | 191 work_area.y() + kDesktopBorderSize, |
| 192 default_width, | 192 default_width, |
| 193 default_height); | 193 default_height); |
| 194 } | 194 } |
| OLD | NEW |