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/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/window_cycle_controller.h" | 9 #include "ash/wm/mru_window_tracker.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 17 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
18 #include "chrome/browser/ui/host_desktop.h" | 18 #include "chrome/browser/ui/host_desktop.h" |
19 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 aura::Window* GetTopWindow(const gfx::Rect& bounds_in_screen) { | 65 aura::Window* GetTopWindow(const gfx::Rect& bounds_in_screen) { |
66 // Get the active window. | 66 // Get the active window. |
67 aura::Window* window = ash::wm::GetActiveWindow(); | 67 aura::Window* window = ash::wm::GetActiveWindow(); |
68 if (window && window->type() == aura::client::WINDOW_TYPE_NORMAL && | 68 if (window && window->type() == aura::client::WINDOW_TYPE_NORMAL && |
69 window->IsVisible() && IsValidToplevelWindow(window, bounds_in_screen)) { | 69 window->IsVisible() && IsValidToplevelWindow(window, bounds_in_screen)) { |
70 return window; | 70 return window; |
71 } | 71 } |
72 | 72 |
73 // Get a list of all windows. | 73 // Get a list of all windows. |
74 const std::vector<aura::Window*> windows = | 74 const std::vector<aura::Window*> windows = |
75 ash::WindowCycleController::BuildWindowList(NULL, false); | 75 ash::MruWindowTracker::BuildWindowList(false); |
76 | 76 |
77 if (windows.empty()) | 77 if (windows.empty()) |
78 return NULL; | 78 return NULL; |
79 | 79 |
80 aura::Window::Windows::const_iterator iter = windows.begin(); | 80 aura::Window::Windows::const_iterator iter = windows.begin(); |
81 // Find the index of the current window. | 81 // Find the index of the current window. |
82 if (window) | 82 if (window) |
83 iter = std::find(windows.begin(), windows.end(), window); | 83 iter = std::find(windows.begin(), windows.end(), window); |
84 | 84 |
85 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); | 85 int index = (iter == windows.end()) ? 0 : (iter - windows.begin()); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 if (default_width > kMaximumWindowWidth) { | 266 if (default_width > kMaximumWindowWidth) { |
267 // The window should get centered on the screen and not follow the grid. | 267 // The window should get centered on the screen and not follow the grid. |
268 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; | 268 offset_x = (work_area.width() - kMaximumWindowWidth) / 2; |
269 default_width = kMaximumWindowWidth; | 269 default_width = kMaximumWindowWidth; |
270 } | 270 } |
271 default_bounds->SetRect(work_area.x() + offset_x, | 271 default_bounds->SetRect(work_area.x() + offset_x, |
272 work_area.y() + kDesktopBorderSize, | 272 work_area.y() + kDesktopBorderSize, |
273 default_width, | 273 default_width, |
274 default_height); | 274 default_height); |
275 } | 275 } |
OLD | NEW |