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