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" | |
10 #include "ash/shell.h" | 9 #include "ash/shell.h" |
11 #include "ash/wm/activation_controller.h" | 10 #include "ash/wm/activation_controller.h" |
12 #include "ash/wm/window_properties.h" | 11 #include "ash/wm/window_properties.h" |
13 #include "ui/aura/client/activation_client.h" | 12 #include "ui/aura/client/activation_client.h" |
14 #include "ui/aura/client/aura_constants.h" | 13 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
16 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
17 #include "ui/compositor/layer.h" | 16 #include "ui/compositor/layer.h" |
18 #include "ui/gfx/display.h" | 17 #include "ui/gfx/display.h" |
19 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 66 |
68 bool CanActivateWindow(aura::Window* window) { | 67 bool CanActivateWindow(aura::Window* window) { |
69 DCHECK(window); | 68 DCHECK(window); |
70 if (!window->GetRootWindow()) | 69 if (!window->GetRootWindow()) |
71 return false; | 70 return false; |
72 aura::client::ActivationClient* client = | 71 aura::client::ActivationClient* client = |
73 aura::client::GetActivationClient(window->GetRootWindow()); | 72 aura::client::GetActivationClient(window->GetRootWindow()); |
74 return client && client->CanActivateWindow(window); | 73 return client && client->CanActivateWindow(window); |
75 } | 74 } |
76 | 75 |
77 bool CanMaximizeWindow(const aura::Window* window) { | 76 bool CanMaximizeWindow(aura::Window* window) { |
78 return window->GetProperty(aura::client::kCanMaximizeKey); | 77 return window->GetProperty(aura::client::kCanMaximizeKey); |
79 } | 78 } |
80 | 79 |
81 bool IsWindowNormal(const aura::Window* window) { | 80 bool IsWindowNormal(aura::Window* window) { |
82 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); | 81 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); |
83 } | 82 } |
84 | 83 |
85 bool IsWindowStateNormal(ui::WindowShowState state) { | 84 bool IsWindowStateNormal(ui::WindowShowState state) { |
86 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; | 85 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; |
87 } | 86 } |
88 | 87 |
89 bool IsWindowMaximized(const aura::Window* window) { | 88 bool IsWindowMaximized(aura::Window* window) { |
90 return window->GetProperty(aura::client::kShowStateKey) == | 89 return window->GetProperty(aura::client::kShowStateKey) == |
91 ui::SHOW_STATE_MAXIMIZED; | 90 ui::SHOW_STATE_MAXIMIZED; |
92 } | 91 } |
93 | 92 |
94 bool IsWindowMinimized(const aura::Window* window) { | 93 bool IsWindowMinimized(aura::Window* window) { |
95 return window->GetProperty(aura::client::kShowStateKey) == | 94 return window->GetProperty(aura::client::kShowStateKey) == |
96 ui::SHOW_STATE_MINIMIZED; | 95 ui::SHOW_STATE_MINIMIZED; |
97 } | 96 } |
98 | 97 |
99 bool IsWindowFullscreen(const aura::Window* window) { | 98 bool IsWindowFullscreen(aura::Window* window) { |
100 return window->GetProperty(aura::client::kShowStateKey) == | 99 return window->GetProperty(aura::client::kShowStateKey) == |
101 ui::SHOW_STATE_FULLSCREEN; | 100 ui::SHOW_STATE_FULLSCREEN; |
102 } | 101 } |
103 | 102 |
104 void MaximizeWindow(aura::Window* window) { | 103 void MaximizeWindow(aura::Window* window) { |
105 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 104 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
106 } | 105 } |
107 | 106 |
108 void MinimizeWindow(aura::Window* window) { | 107 void MinimizeWindow(aura::Window* window) { |
109 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 108 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 std::vector<ui::Layer*> children = layer->children(); | 146 std::vector<ui::Layer*> children = layer->children(); |
148 for (std::vector<ui::Layer*>::const_iterator it = children.begin(); | 147 for (std::vector<ui::Layer*>::const_iterator it = children.begin(); |
149 it != children.end(); | 148 it != children.end(); |
150 ++it) { | 149 ++it) { |
151 ui::Layer* child = *it; | 150 ui::Layer* child = *it; |
152 DeepDeleteLayers(child); | 151 DeepDeleteLayers(child); |
153 } | 152 } |
154 delete layer; | 153 delete layer; |
155 } | 154 } |
156 | 155 |
157 bool IsWindowPositionManaged(const aura::Window* window) { | |
158 return window->GetProperty(ash::internal::kWindowPositionManagedKey); | |
159 } | |
160 | |
161 void SetWindowPositionManaged(aura::Window* window, bool managed) { | |
162 window->SetProperty(ash::internal::kWindowPositionManagedKey, managed); | |
163 } | |
164 | |
165 bool HasUserChangedWindowPositionOrSize(const aura::Window* window) { | |
166 return window->GetProperty( | |
167 ash::internal::kUserChangedWindowPositionOrSizeKey); | |
168 } | |
169 | |
170 void SetUserHasChangedWindowPositionOrSize(aura::Window* window, bool changed) { | |
171 window->SetProperty(ash::internal::kUserChangedWindowPositionOrSizeKey, | |
172 changed); | |
173 } | |
174 | |
175 } // namespace wm | 156 } // namespace wm |
176 } // namespace ash | 157 } // namespace ash |
OLD | NEW |