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 DCHECK(window->GetRootWindow()); |
sky
2012/03/13 17:14:42
Maybe this shouldn't be a DCHECK, but instead retu
DaveMoore
2012/03/13 23:33:56
Done.
| |
38 return aura::client::GetActivationClient(window->GetRootWindow())-> | |
39 GetActiveWindow() == window; | |
36 } | 40 } |
37 | 41 |
38 aura::Window* GetActiveWindow() { | 42 aura::Window* GetActiveWindow() { |
39 return aura::client::GetActivationClient(Shell::GetRootWindow())-> | 43 return aura::client::GetActivationClient(Shell::GetRootWindow())-> |
40 GetActiveWindow(); | 44 GetActiveWindow(); |
41 } | 45 } |
42 | 46 |
43 aura::Window* GetActivatableWindow(aura::Window* window) { | 47 aura::Window* GetActivatableWindow(aura::Window* window) { |
44 return internal::ActivationController::GetActivatableWindow(window); | 48 return internal::ActivationController::GetActivatableWindow(window); |
45 } | 49 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 void SetOpenWindowSplit(aura::Window* window, bool value) { | 86 void SetOpenWindowSplit(aura::Window* window, bool value) { |
83 window->SetProperty(kOpenWindowSplitKey, value); | 87 window->SetProperty(kOpenWindowSplitKey, value); |
84 } | 88 } |
85 | 89 |
86 bool GetOpenWindowSplit(aura::Window* window) { | 90 bool GetOpenWindowSplit(aura::Window* window) { |
87 return window->GetProperty(kOpenWindowSplitKey); | 91 return window->GetProperty(kOpenWindowSplitKey); |
88 } | 92 } |
89 | 93 |
90 } // namespace wm | 94 } // namespace wm |
91 } // namespace ash | 95 } // namespace ash |
OLD | NEW |