| 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/ash_constants.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/wm/activation_controller.h" | 11 #include "ash/wm/activation_controller.h" |
| 11 #include "ash/wm/window_properties.h" | 12 #include "ash/wm/window_properties.h" |
| 12 #include "ui/aura/client/activation_client.h" | 13 #include "ui/aura/client/activation_client.h" |
| 13 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
| 14 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
| 15 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 16 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 17 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
| 18 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 55 |
| 55 bool CanActivateWindow(aura::Window* window) { | 56 bool CanActivateWindow(aura::Window* window) { |
| 56 DCHECK(window); | 57 DCHECK(window); |
| 57 if (!window->GetRootWindow()) | 58 if (!window->GetRootWindow()) |
| 58 return false; | 59 return false; |
| 59 aura::client::ActivationClient* client = | 60 aura::client::ActivationClient* client = |
| 60 aura::client::GetActivationClient(window->GetRootWindow()); | 61 aura::client::GetActivationClient(window->GetRootWindow()); |
| 61 return client && client->CanActivateWindow(window); | 62 return client && client->CanActivateWindow(window); |
| 62 } | 63 } |
| 63 | 64 |
| 64 bool CanMaximizeWindow(aura::Window* window) { | 65 bool CanMaximizeWindow(const aura::Window* window) { |
| 65 return window->GetProperty(aura::client::kCanMaximizeKey); | 66 return window->GetProperty(aura::client::kCanMaximizeKey); |
| 66 } | 67 } |
| 67 | 68 |
| 68 bool IsWindowNormal(aura::Window* window) { | 69 bool IsWindowNormal(const aura::Window* window) { |
| 69 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); | 70 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); |
| 70 } | 71 } |
| 71 | 72 |
| 72 bool IsWindowStateNormal(ui::WindowShowState state) { | 73 bool IsWindowStateNormal(ui::WindowShowState state) { |
| 73 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; | 74 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; |
| 74 } | 75 } |
| 75 | 76 |
| 76 bool IsWindowMaximized(aura::Window* window) { | 77 bool IsWindowMaximized(const aura::Window* window) { |
| 77 return window->GetProperty(aura::client::kShowStateKey) == | 78 return window->GetProperty(aura::client::kShowStateKey) == |
| 78 ui::SHOW_STATE_MAXIMIZED; | 79 ui::SHOW_STATE_MAXIMIZED; |
| 79 } | 80 } |
| 80 | 81 |
| 81 bool IsWindowMinimized(aura::Window* window) { | 82 bool IsWindowMinimized(const aura::Window* window) { |
| 82 return window->GetProperty(aura::client::kShowStateKey) == | 83 return window->GetProperty(aura::client::kShowStateKey) == |
| 83 ui::SHOW_STATE_MINIMIZED; | 84 ui::SHOW_STATE_MINIMIZED; |
| 84 } | 85 } |
| 85 | 86 |
| 86 bool IsWindowFullscreen(aura::Window* window) { | 87 bool IsWindowFullscreen(const aura::Window* window) { |
| 87 return window->GetProperty(aura::client::kShowStateKey) == | 88 return window->GetProperty(aura::client::kShowStateKey) == |
| 88 ui::SHOW_STATE_FULLSCREEN; | 89 ui::SHOW_STATE_FULLSCREEN; |
| 89 } | 90 } |
| 90 | 91 |
| 91 void MaximizeWindow(aura::Window* window) { | 92 void MaximizeWindow(aura::Window* window) { |
| 92 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 93 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void MinimizeWindow(aura::Window* window) { | 96 void MinimizeWindow(aura::Window* window) { |
| 96 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 97 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 std::vector<ui::Layer*> children = layer->children(); | 134 std::vector<ui::Layer*> children = layer->children(); |
| 134 for (std::vector<ui::Layer*>::const_iterator it = children.begin(); | 135 for (std::vector<ui::Layer*>::const_iterator it = children.begin(); |
| 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 |
| 144 bool IsWindowPositionManaged(const aura::Window* window) { |
| 145 return window->GetProperty(ash::internal::kWindowPositionManagedKey); |
| 146 } |
| 147 |
| 148 void SetWindowPositionManaged(aura::Window* window, bool managed) { |
| 149 window->SetProperty(ash::internal::kWindowPositionManagedKey, managed); |
| 150 } |
| 151 |
| 152 bool HasUserChangedWindowPositionOrSize(const aura::Window* window) { |
| 153 return window->GetProperty( |
| 154 ash::internal::kUserChangedWindowPositionOrSizeKey); |
| 155 } |
| 156 |
| 157 void SetUserHasChangedWindowPositionOrSize(aura::Window* window, bool changed) { |
| 158 window->SetProperty(ash::internal::kUserChangedWindowPositionOrSizeKey, |
| 159 changed); |
| 160 } |
| 161 |
| 143 } // namespace wm | 162 } // namespace wm |
| 144 } // namespace ash | 163 } // namespace ash |
| OLD | NEW |