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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 67 |
67 bool CanActivateWindow(aura::Window* window) { | 68 bool CanActivateWindow(aura::Window* window) { |
68 DCHECK(window); | 69 DCHECK(window); |
69 if (!window->GetRootWindow()) | 70 if (!window->GetRootWindow()) |
70 return false; | 71 return false; |
71 aura::client::ActivationClient* client = | 72 aura::client::ActivationClient* client = |
72 aura::client::GetActivationClient(window->GetRootWindow()); | 73 aura::client::GetActivationClient(window->GetRootWindow()); |
73 return client && client->CanActivateWindow(window); | 74 return client && client->CanActivateWindow(window); |
74 } | 75 } |
75 | 76 |
76 bool CanMaximizeWindow(aura::Window* window) { | 77 bool CanMaximizeWindow(const aura::Window* window) { |
77 return window->GetProperty(aura::client::kCanMaximizeKey); | 78 return window->GetProperty(aura::client::kCanMaximizeKey); |
78 } | 79 } |
79 | 80 |
80 bool IsWindowNormal(aura::Window* window) { | 81 bool IsWindowNormal(const aura::Window* window) { |
81 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); | 82 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); |
82 } | 83 } |
83 | 84 |
84 bool IsWindowStateNormal(ui::WindowShowState state) { | 85 bool IsWindowStateNormal(ui::WindowShowState state) { |
85 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; | 86 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; |
86 } | 87 } |
87 | 88 |
88 bool IsWindowMaximized(aura::Window* window) { | 89 bool IsWindowMaximized(const aura::Window* window) { |
89 return window->GetProperty(aura::client::kShowStateKey) == | 90 return window->GetProperty(aura::client::kShowStateKey) == |
90 ui::SHOW_STATE_MAXIMIZED; | 91 ui::SHOW_STATE_MAXIMIZED; |
91 } | 92 } |
92 | 93 |
93 bool IsWindowMinimized(aura::Window* window) { | 94 bool IsWindowMinimized(const aura::Window* window) { |
94 return window->GetProperty(aura::client::kShowStateKey) == | 95 return window->GetProperty(aura::client::kShowStateKey) == |
95 ui::SHOW_STATE_MINIMIZED; | 96 ui::SHOW_STATE_MINIMIZED; |
96 } | 97 } |
97 | 98 |
98 bool IsWindowFullscreen(aura::Window* window) { | 99 bool IsWindowFullscreen(const aura::Window* window) { |
99 return window->GetProperty(aura::client::kShowStateKey) == | 100 return window->GetProperty(aura::client::kShowStateKey) == |
100 ui::SHOW_STATE_FULLSCREEN; | 101 ui::SHOW_STATE_FULLSCREEN; |
101 } | 102 } |
102 | 103 |
103 void MaximizeWindow(aura::Window* window) { | 104 void MaximizeWindow(aura::Window* window) { |
104 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 105 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
105 } | 106 } |
106 | 107 |
107 void MinimizeWindow(aura::Window* window) { | 108 void MinimizeWindow(aura::Window* window) { |
108 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 109 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 std::vector<ui::Layer*> children = layer->children(); | 147 std::vector<ui::Layer*> children = layer->children(); |
147 for (std::vector<ui::Layer*>::const_iterator it = children.begin(); | 148 for (std::vector<ui::Layer*>::const_iterator it = children.begin(); |
148 it != children.end(); | 149 it != children.end(); |
149 ++it) { | 150 ++it) { |
150 ui::Layer* child = *it; | 151 ui::Layer* child = *it; |
151 DeepDeleteLayers(child); | 152 DeepDeleteLayers(child); |
152 } | 153 } |
153 delete layer; | 154 delete layer; |
154 } | 155 } |
155 | 156 |
| 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 |
156 } // namespace wm | 175 } // namespace wm |
157 } // namespace ash | 176 } // namespace ash |
OLD | NEW |