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/ash_constants.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (lockscreen->Contains(window)) | 68 if (lockscreen->Contains(window)) |
69 return false; | 69 return false; |
70 | 70 |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 bool CanResizeWindow(const aura::Window* window) { | 74 bool CanResizeWindow(const aura::Window* window) { |
75 return window->GetProperty(aura::client::kCanResizeKey); | 75 return window->GetProperty(aura::client::kCanResizeKey); |
76 } | 76 } |
77 | 77 |
78 bool CanSnapWindow(aura::Window* window) { | |
79 if (!CanResizeWindow(window)) | |
80 return false; | |
81 // If a window has a maximum size defined, snapping may make it too big. | |
82 return window->delegate() ? window->delegate()->GetMaximumSize().IsEmpty() : | |
83 true; | |
84 } | |
85 | |
86 bool IsWindowNormal(const aura::Window* window) { | 78 bool IsWindowNormal(const aura::Window* window) { |
87 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); | 79 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); |
88 } | 80 } |
89 | 81 |
90 bool IsWindowStateNormal(ui::WindowShowState state) { | 82 bool IsWindowStateNormal(ui::WindowShowState state) { |
91 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; | 83 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; |
92 } | 84 } |
93 | 85 |
94 bool IsWindowMaximized(const aura::Window* window) { | 86 bool IsWindowMaximized(const aura::Window* window) { |
95 return window->GetProperty(aura::client::kShowStateKey) == | 87 return window->GetProperty(aura::client::kShowStateKey) == |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return false; | 195 return false; |
204 aura::Window* window_container = | 196 aura::Window* window_container = |
205 ash::Shell::GetContainer(target_root, window->parent()->id()); | 197 ash::Shell::GetContainer(target_root, window->parent()->id()); |
206 // Move the window to the target launcher. | 198 // Move the window to the target launcher. |
207 window_container->AddChild(window); | 199 window_container->AddChild(window); |
208 return true; | 200 return true; |
209 } | 201 } |
210 | 202 |
211 } // namespace wm | 203 } // namespace wm |
212 } // namespace ash | 204 } // namespace ash |
OLD | NEW |