| 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); |
| 26 DCHECK(window->GetRootWindow()); |
| 27 aura::client::GetActivationClient(window->GetRootWindow())->ActivateWindow( |
| 26 window); | 28 window); |
| 27 } | 29 } |
| 28 | 30 |
| 29 void DeactivateWindow(aura::Window* window) { | 31 void DeactivateWindow(aura::Window* window) { |
| 30 aura::client::GetActivationClient(Shell::GetRootWindow())->DeactivateWindow( | 32 DCHECK(window); |
| 33 DCHECK(window->GetRootWindow()); |
| 34 aura::client::GetActivationClient(window->GetRootWindow())->DeactivateWindow( |
| 31 window); | 35 window); |
| 32 } | 36 } |
| 33 | 37 |
| 34 bool IsActiveWindow(aura::Window* window) { | 38 bool IsActiveWindow(aura::Window* window) { |
| 35 return GetActiveWindow() == window; | 39 DCHECK(window); |
| 40 if (!window->GetRootWindow()) |
| 41 return false; |
| 42 |
| 43 return aura::client::GetActivationClient(window->GetRootWindow())-> |
| 44 GetActiveWindow() == window; |
| 36 } | 45 } |
| 37 | 46 |
| 38 aura::Window* GetActiveWindow() { | 47 aura::Window* GetActiveWindow() { |
| 39 return aura::client::GetActivationClient(Shell::GetRootWindow())-> | 48 return aura::client::GetActivationClient(Shell::GetRootWindow())-> |
| 40 GetActiveWindow(); | 49 GetActiveWindow(); |
| 41 } | 50 } |
| 42 | 51 |
| 43 aura::Window* GetActivatableWindow(aura::Window* window) { | 52 aura::Window* GetActivatableWindow(aura::Window* window) { |
| 44 return internal::ActivationController::GetActivatableWindow(window); | 53 return internal::ActivationController::GetActivatableWindow(window); |
| 45 } | 54 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void SetOpenWindowSplit(aura::Window* window, bool value) { | 96 void SetOpenWindowSplit(aura::Window* window, bool value) { |
| 88 window->SetProperty(kOpenWindowSplitKey, value); | 97 window->SetProperty(kOpenWindowSplitKey, value); |
| 89 } | 98 } |
| 90 | 99 |
| 91 bool GetOpenWindowSplit(aura::Window* window) { | 100 bool GetOpenWindowSplit(aura::Window* window) { |
| 92 return window->GetProperty(kOpenWindowSplitKey); | 101 return window->GetProperty(kOpenWindowSplitKey); |
| 93 } | 102 } |
| 94 | 103 |
| 95 } // namespace wm | 104 } // namespace wm |
| 96 } // namespace ash | 105 } // namespace ash |
| OLD | NEW |