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 "ash/wm/window_util.h" | 5 #include "ash/wm/window_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/activation_controller.h" | 10 #include "ash/wm/activation_controller.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void ToggleMaximizedWindow(aura::Window* window) { | 103 void ToggleMaximizedWindow(aura::Window* window) { |
104 if (ash::wm::IsWindowMaximized(window)) | 104 if (ash::wm::IsWindowMaximized(window)) |
105 ash::wm::RestoreWindow(window); | 105 ash::wm::RestoreWindow(window); |
106 else if (ash::wm::CanMaximizeWindow(window)) | 106 else if (ash::wm::CanMaximizeWindow(window)) |
107 ash::wm::MaximizeWindow(window); | 107 ash::wm::MaximizeWindow(window); |
108 } | 108 } |
109 | 109 |
110 void CenterWindow(aura::Window* window) { | 110 void CenterWindow(aura::Window* window) { |
111 const gfx::Display display = | 111 const gfx::Display display = |
112 Shell::GetScreen()->GetDisplayNearestWindow(window); | 112 Shell::GetScreen()->GetDisplayNearestWindow(window); |
113 gfx::Rect center = display.work_area().Center(window->bounds().size()); | 113 gfx::Rect center = display.work_area(); |
| 114 center.ClampToCenteredSize(window->bounds().size()); |
114 window->SetBounds(center); | 115 window->SetBounds(center); |
115 } | 116 } |
116 | 117 |
117 ui::Layer* RecreateWindowLayers(aura::Window* window, bool set_bounds) { | 118 ui::Layer* RecreateWindowLayers(aura::Window* window, bool set_bounds) { |
118 const gfx::Rect bounds = window->bounds(); | 119 const gfx::Rect bounds = window->bounds(); |
119 ui::Layer* old_layer = window->RecreateLayer(); | 120 ui::Layer* old_layer = window->RecreateLayer(); |
120 DCHECK(old_layer); | 121 DCHECK(old_layer); |
121 for (aura::Window::Windows::const_iterator it = window->children().begin(); | 122 for (aura::Window::Windows::const_iterator it = window->children().begin(); |
122 it != window->children().end(); | 123 it != window->children().end(); |
123 ++it) { | 124 ++it) { |
(...skipping 11 matching lines...) Expand all Loading... |
135 it != children.end(); | 136 it != children.end(); |
136 ++it) { | 137 ++it) { |
137 ui::Layer* child = *it; | 138 ui::Layer* child = *it; |
138 DeepDeleteLayers(child); | 139 DeepDeleteLayers(child); |
139 } | 140 } |
140 delete layer; | 141 delete layer; |
141 } | 142 } |
142 | 143 |
143 } // namespace wm | 144 } // namespace wm |
144 } // namespace ash | 145 } // namespace ash |
OLD | NEW |