| 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 "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/activation_controller.h" | 8 #include "ash/wm/activation_controller.h" |
| 9 #include "ui/aura/client/activation_client.h" | 9 #include "ui/aura/client/activation_client.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| 11 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_property.h" | 13 #include "ui/aura/window_property.h" |
| 14 #include "ui/base/ui_base_types.h" | 14 #include "ui/base/ui_base_types.h" |
| 15 #include "ui/gfx/screen.h" | 15 #include "ui/gfx/screen.h" |
| 16 | 16 |
| 17 DECLARE_WINDOW_PROPERTY_TYPE(bool); | 17 DECLARE_WINDOW_PROPERTY_TYPE(bool); |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 DEFINE_WINDOW_PROPERTY_KEY(bool, kOpenWindowSplitKey, false); | 20 DEFINE_WINDOW_PROPERTY_KEY(bool, kOpenWindowSplitKey, false); |
| 21 | 21 |
| 22 namespace wm { | 22 namespace wm { |
| 23 | 23 |
| 24 void ActivateWindow(aura::Window* window) { | 24 void ActivateWindow(aura::Window* window) { |
| 25 aura::client::GetActivationClient(Shell::GetRootWindow())->ActivateWindow( | 25 DCHECK(window->GetRootWindow()); |
| 26 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow( |
| 26 window); | 27 window); |
| 27 } | 28 } |
| 28 | 29 |
| 29 void DeactivateWindow(aura::Window* window) { | 30 void DeactivateWindow(aura::Window* window) { |
| 30 aura::client::GetActivationClient(Shell::GetRootWindow())->DeactivateWindow( | 31 DCHECK(window->GetRootWindow()); |
| 32 aura::client::GetActivationClient(window->GetRootWindow())->DeactivateWindow( |
| 31 window); | 33 window); |
| 32 } | 34 } |
| 33 | 35 |
| 34 bool IsActiveWindow(aura::Window* window) { | 36 bool IsActiveWindow(aura::Window* window) { |
| 35 return GetActiveWindow() == window; | 37 if (!window->GetRootWindow()) |
| 38 return false; |
| 39 |
| 40 return aura::client::GetActivationClient(window->GetRootWindow())-> |
| 41 GetActiveWindow() == window; |
| 36 } | 42 } |
| 37 | 43 |
| 38 aura::Window* GetActiveWindow() { | 44 aura::Window* GetActiveWindow() { |
| 39 return aura::client::GetActivationClient(Shell::GetRootWindow())-> | 45 return aura::client::GetActivationClient(Shell::GetRootWindow())-> |
| 40 GetActiveWindow(); | 46 GetActiveWindow(); |
| 41 } | 47 } |
| 42 | 48 |
| 43 aura::Window* GetActivatableWindow(aura::Window* window) { | 49 aura::Window* GetActivatableWindow(aura::Window* window) { |
| 44 return internal::ActivationController::GetActivatableWindow(window); | 50 return internal::ActivationController::GetActivatableWindow(window); |
| 45 } | 51 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void SetOpenWindowSplit(aura::Window* window, bool value) { | 88 void SetOpenWindowSplit(aura::Window* window, bool value) { |
| 83 window->SetProperty(kOpenWindowSplitKey, value); | 89 window->SetProperty(kOpenWindowSplitKey, value); |
| 84 } | 90 } |
| 85 | 91 |
| 86 bool GetOpenWindowSplit(aura::Window* window) { | 92 bool GetOpenWindowSplit(aura::Window* window) { |
| 87 return window->GetProperty(kOpenWindowSplitKey); | 93 return window->GetProperty(kOpenWindowSplitKey); |
| 88 } | 94 } |
| 89 | 95 |
| 90 } // namespace wm | 96 } // namespace wm |
| 91 } // namespace ash | 97 } // namespace ash |
| OLD | NEW |