| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 aura::Window* GetTopWindow(const gfx::Rect& bounds_in_screen) { | 61 aura::Window* GetTopWindow(const gfx::Rect& bounds_in_screen) { |
| 62 // Get the active window. | 62 // Get the active window. |
| 63 aura::Window* window = ash::wm::GetActiveWindow(); | 63 aura::Window* window = ash::wm::GetActiveWindow(); |
| 64 if (window && window->type() == aura::client::WINDOW_TYPE_NORMAL && | 64 if (window && window->type() == aura::client::WINDOW_TYPE_NORMAL && |
| 65 window->IsVisible() && IsValidToplevelWindow(window, bounds_in_screen)) { | 65 window->IsVisible() && IsValidToplevelWindow(window, bounds_in_screen)) { |
| 66 return window; | 66 return window; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Get a list of all windows. | 69 // Get a list of all windows. |
| 70 const std::vector<aura::Window*> windows = | 70 const std::vector<aura::Window*> windows = |
| 71 ash::WindowCycleController::BuildWindowList(NULL); | 71 ash::WindowCycleController::BuildWindowList(NULL, false); |
| 72 | 72 |
| 73 if (windows.empty()) | 73 if (windows.empty()) |
| 74 return NULL; | 74 return NULL; |
| 75 | 75 |
| 76 aura::Window::Windows::const_iterator iter = windows.begin(); | 76 aura::Window::Windows::const_iterator iter = windows.begin(); |
| 77 // Find the index of the current window. | 77 // Find the index of the current window. |
| 78 if (window) | 78 if (window) |
| 79 iter = std::find(windows.begin(), windows.end(), window); | 79 iter = std::find(windows.begin(), windows.end(), window); |
| 80 | 80 |
| 81 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); | 81 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 if (default_width > kMaximumWindowWidth) { | 227 if (default_width > kMaximumWindowWidth) { |
| 228 // The window should get centered on the screen and not follow the grid. | 228 // The window should get centered on the screen and not follow the grid. |
| 229 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; | 229 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; |
| 230 default_width = kMaximumWindowWidth; | 230 default_width = kMaximumWindowWidth; |
| 231 } | 231 } |
| 232 default_bounds->SetRect(work_area.x() + offset_x, | 232 default_bounds->SetRect(work_area.x() + offset_x, |
| 233 work_area.y() + kDesktopBorderSize, | 233 work_area.y() + kDesktopBorderSize, |
| 234 default_width, | 234 default_width, |
| 235 default_height); | 235 default_height); |
| 236 } | 236 } |
| OLD | NEW |