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 26 matching lines...) Expand all Loading... |
37 // Get the first open window in the stack on the screen. | 37 // Get the first open window in the stack on the screen. |
38 aura::Window* GetTopWindow() { | 38 aura::Window* GetTopWindow() { |
39 // Get the active window. | 39 // Get the active window. |
40 aura::Window* window = ash::wm::GetActiveWindow(); | 40 aura::Window* window = ash::wm::GetActiveWindow(); |
41 if (window && window->type() == aura::client::WINDOW_TYPE_NORMAL && | 41 if (window && window->type() == aura::client::WINDOW_TYPE_NORMAL && |
42 window->IsVisible() && IsValidToplevelWindow(window)) | 42 window->IsVisible() && IsValidToplevelWindow(window)) |
43 return window; | 43 return window; |
44 | 44 |
45 // Get a list of all windows. | 45 // Get a list of all windows. |
46 const std::vector<aura::Window*> windows = | 46 const std::vector<aura::Window*> windows = |
47 ash::WindowCycleController::BuildWindowList(); | 47 ash::WindowCycleController::BuildWindowList(NULL); |
48 | 48 |
49 if (windows.empty()) | 49 if (windows.empty()) |
50 return NULL; | 50 return NULL; |
51 | 51 |
52 aura::Window::Windows::const_iterator iter = windows.begin(); | 52 aura::Window::Windows::const_iterator iter = windows.begin(); |
53 // Find the index of the current window. | 53 // Find the index of the current window. |
54 if (window) | 54 if (window) |
55 iter = std::find(windows.begin(), windows.end(), window); | 55 iter = std::find(windows.begin(), windows.end(), window); |
56 | 56 |
57 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); | 57 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // The window should get centered on the screen and not follow the grid. | 120 // The window should get centered on the screen and not follow the grid. |
121 offset_x = (work_area.width() - maximum_window_width) / 2; | 121 offset_x = (work_area.width() - maximum_window_width) / 2; |
122 // Never make a window wider then 1280. | 122 // Never make a window wider then 1280. |
123 default_width = maximum_window_width; | 123 default_width = maximum_window_width; |
124 } | 124 } |
125 default_bounds->SetRect(work_area.x() + offset_x, | 125 default_bounds->SetRect(work_area.x() + offset_x, |
126 work_area.y() + kDesktopBorderSize, | 126 work_area.y() + kDesktopBorderSize, |
127 default_width, | 127 default_width, |
128 default_height); | 128 default_height); |
129 } | 129 } |
OLD | NEW |