| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 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 = gfx::Screen::GetDisplayNearestWindow(window); | 111 const gfx::Display display = |
| 112 Shell::GetAshScreen()->GetDisplayNearestWindow(window); |
| 112 gfx::Rect center = display.work_area().Center(window->bounds().size()); | 113 gfx::Rect center = display.work_area().Center(window->bounds().size()); |
| 113 window->SetBounds(center); | 114 window->SetBounds(center); |
| 114 } | 115 } |
| 115 | 116 |
| 116 ui::Layer* RecreateWindowLayers(aura::Window* window, bool set_bounds) { | 117 ui::Layer* RecreateWindowLayers(aura::Window* window, bool set_bounds) { |
| 117 const gfx::Rect bounds = window->bounds(); | 118 const gfx::Rect bounds = window->bounds(); |
| 118 ui::Layer* old_layer = window->RecreateLayer(); | 119 ui::Layer* old_layer = window->RecreateLayer(); |
| 119 DCHECK(old_layer); | 120 DCHECK(old_layer); |
| 120 for (aura::Window::Windows::const_iterator it = window->children().begin(); | 121 for (aura::Window::Windows::const_iterator it = window->children().begin(); |
| 121 it != window->children().end(); | 122 it != window->children().end(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 134 it != children.end(); | 135 it != children.end(); |
| 135 ++it) { | 136 ++it) { |
| 136 ui::Layer* child = *it; | 137 ui::Layer* child = *it; |
| 137 DeepDeleteLayers(child); | 138 DeepDeleteLayers(child); |
| 138 } | 139 } |
| 139 delete layer; | 140 delete layer; |
| 140 } | 141 } |
| 141 | 142 |
| 142 } // namespace wm | 143 } // namespace wm |
| 143 } // namespace ash | 144 } // namespace ash |
| OLD | NEW |