| 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 "ui/wm/core/window_util.h" | 5 #include "ui/wm/core/window_util.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "ui/aura/client/aura_constants.h" |
| 8 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 9 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
| 10 #include "ui/compositor/layer_tree_owner.h" | 11 #include "ui/compositor/layer_tree_owner.h" |
| 11 #include "ui/wm/core/transient_window_manager.h" | 12 #include "ui/wm/core/transient_window_manager.h" |
| 12 #include "ui/wm/public/activation_client.h" | 13 #include "ui/wm/public/activation_client.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // Invokes RecreateLayer() on all the children of |to_clone|, adding the newly | 17 // Invokes RecreateLayer() on all the children of |to_clone|, adding the newly |
| 17 // cloned children to |parent|. | 18 // cloned children to |parent|. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 78 |
| 78 bool CanActivateWindow(aura::Window* window) { | 79 bool CanActivateWindow(aura::Window* window) { |
| 79 DCHECK(window); | 80 DCHECK(window); |
| 80 if (!window->GetRootWindow()) | 81 if (!window->GetRootWindow()) |
| 81 return false; | 82 return false; |
| 82 aura::client::ActivationClient* client = | 83 aura::client::ActivationClient* client = |
| 83 aura::client::GetActivationClient(window->GetRootWindow()); | 84 aura::client::GetActivationClient(window->GetRootWindow()); |
| 84 return client && client->CanActivateWindow(window); | 85 return client && client->CanActivateWindow(window); |
| 85 } | 86 } |
| 86 | 87 |
| 88 void SetWindowFullscreen(aura::Window* window, bool fullscreen) { |
| 89 DCHECK(window); |
| 90 bool is_fullscreen = window->GetProperty(aura::client::kShowStateKey) == |
| 91 ui::SHOW_STATE_FULLSCREEN; |
| 92 if (fullscreen == is_fullscreen) |
| 93 return; |
| 94 if (fullscreen) { |
| 95 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 96 } else { |
| 97 auto state = window->GetProperty(aura::client::kPreFullscreenShowStateKey); |
| 98 DCHECK_NE(state, ui::SHOW_STATE_MINIMIZED); |
| 99 window->SetProperty(aura::client::kShowStateKey, state); |
| 100 window->ClearProperty(aura::client::kPreFullscreenShowStateKey); |
| 101 } |
| 102 } |
| 103 |
| 87 aura::Window* GetActivatableWindow(aura::Window* window) { | 104 aura::Window* GetActivatableWindow(aura::Window* window) { |
| 88 aura::client::ActivationClient* client = | 105 aura::client::ActivationClient* client = |
| 89 aura::client::GetActivationClient(window->GetRootWindow()); | 106 aura::client::GetActivationClient(window->GetRootWindow()); |
| 90 return client ? client->GetActivatableWindow(window) : NULL; | 107 return client ? client->GetActivatableWindow(window) : NULL; |
| 91 } | 108 } |
| 92 | 109 |
| 93 aura::Window* GetToplevelWindow(aura::Window* window) { | 110 aura::Window* GetToplevelWindow(aura::Window* window) { |
| 94 aura::client::ActivationClient* client = | 111 aura::client::ActivationClient* client = |
| 95 aura::client::GetActivationClient(window->GetRootWindow()); | 112 aura::client::GetActivationClient(window->GetRootWindow()); |
| 96 return client ? client->GetToplevelWindow(window) : NULL; | 113 return client ? client->GetToplevelWindow(window) : NULL; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 bool HasTransientAncestor(const aura::Window* window, | 158 bool HasTransientAncestor(const aura::Window* window, |
| 142 const aura::Window* ancestor) { | 159 const aura::Window* ancestor) { |
| 143 const aura::Window* transient_parent = GetTransientParent(window); | 160 const aura::Window* transient_parent = GetTransientParent(window); |
| 144 if (transient_parent == ancestor) | 161 if (transient_parent == ancestor) |
| 145 return true; | 162 return true; |
| 146 return transient_parent ? | 163 return transient_parent ? |
| 147 HasTransientAncestor(transient_parent, ancestor) : false; | 164 HasTransientAncestor(transient_parent, ancestor) : false; |
| 148 } | 165 } |
| 149 | 166 |
| 150 } // namespace wm | 167 } // namespace wm |
| OLD | NEW |