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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 bool CanActivateWindow(aura::Window* window) { | 55 bool CanActivateWindow(aura::Window* window) { |
56 DCHECK(window); | 56 DCHECK(window); |
57 if (!window->GetRootWindow()) | 57 if (!window->GetRootWindow()) |
58 return false; | 58 return false; |
59 aura::client::ActivationClient* client = | 59 aura::client::ActivationClient* client = |
60 aura::client::GetActivationClient(window->GetRootWindow()); | 60 aura::client::GetActivationClient(window->GetRootWindow()); |
61 return client && client->CanActivateWindow(window); | 61 return client && client->CanActivateWindow(window); |
62 } | 62 } |
63 | 63 |
64 bool CanMaximizeWindow(aura::Window* window) { | 64 bool CanMaximizeWindow(const aura::Window* window) { |
65 return window->GetProperty(aura::client::kCanMaximizeKey); | 65 return window->GetProperty(aura::client::kCanMaximizeKey); |
66 } | 66 } |
67 | 67 |
68 bool IsWindowNormal(aura::Window* window) { | 68 bool IsWindowNormal(const aura::Window* window) { |
69 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); | 69 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); |
70 } | 70 } |
71 | 71 |
72 bool IsWindowStateNormal(ui::WindowShowState state) { | 72 bool IsWindowStateNormal(ui::WindowShowState state) { |
73 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; | 73 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; |
74 } | 74 } |
75 | 75 |
76 bool IsWindowMaximized(aura::Window* window) { | 76 bool IsWindowMaximized(const aura::Window* window) { |
77 return window->GetProperty(aura::client::kShowStateKey) == | 77 return window->GetProperty(aura::client::kShowStateKey) == |
78 ui::SHOW_STATE_MAXIMIZED; | 78 ui::SHOW_STATE_MAXIMIZED; |
79 } | 79 } |
80 | 80 |
81 bool IsWindowMinimized(aura::Window* window) { | 81 bool IsWindowMinimized(const aura::Window* window) { |
82 return window->GetProperty(aura::client::kShowStateKey) == | 82 return window->GetProperty(aura::client::kShowStateKey) == |
83 ui::SHOW_STATE_MINIMIZED; | 83 ui::SHOW_STATE_MINIMIZED; |
84 } | 84 } |
85 | 85 |
86 bool IsWindowFullscreen(aura::Window* window) { | 86 bool IsWindowFullscreen(const aura::Window* window) { |
87 return window->GetProperty(aura::client::kShowStateKey) == | 87 return window->GetProperty(aura::client::kShowStateKey) == |
88 ui::SHOW_STATE_FULLSCREEN; | 88 ui::SHOW_STATE_FULLSCREEN; |
89 } | 89 } |
90 | 90 |
91 void MaximizeWindow(aura::Window* window) { | 91 void MaximizeWindow(aura::Window* window) { |
92 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 92 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
93 } | 93 } |
94 | 94 |
95 void MinimizeWindow(aura::Window* window) { | 95 void MinimizeWindow(aura::Window* window) { |
96 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 96 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
(...skipping 28 matching lines...) Expand all Loading... |
125 std::vector<ui::Layer*> children = layer->children(); | 125 std::vector<ui::Layer*> children = layer->children(); |
126 for (std::vector<ui::Layer*>::const_iterator it = children.begin(); | 126 for (std::vector<ui::Layer*>::const_iterator it = children.begin(); |
127 it != children.end(); | 127 it != children.end(); |
128 ++it) { | 128 ++it) { |
129 ui::Layer* child = *it; | 129 ui::Layer* child = *it; |
130 DeepDeleteLayers(child); | 130 DeepDeleteLayers(child); |
131 } | 131 } |
132 delete layer; | 132 delete layer; |
133 } | 133 } |
134 | 134 |
| 135 bool IsWindowPositionManageable(const aura::Window* window) { |
| 136 return window->GetProperty(aura::client::kWindowPositionManageableKey); |
| 137 } |
| 138 |
| 139 void SetWindowPositionManageable(aura::Window* window, bool manageable) { |
| 140 window->SetProperty(aura::client::kWindowPositionManageableKey, manageable); |
| 141 } |
| 142 |
| 143 bool HasUserChangedWindowPositionOrSize(const aura::Window* window) { |
| 144 return window->GetProperty(aura::client::kUserChangedWindowPositionOrSizeKey); |
| 145 } |
| 146 |
| 147 void UserHasChangedWindowPositionOrSize(aura::Window* window, bool changed) { |
| 148 window->SetProperty(aura::client::kUserChangedWindowPositionOrSizeKey, |
| 149 changed); |
| 150 } |
| 151 |
135 } // namespace wm | 152 } // namespace wm |
136 } // namespace ash | 153 } // namespace ash |
OLD | NEW |