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 #ifndef UI_WM_PUBLIC_ACTIVATION_CLIENT_H_ | 5 #ifndef UI_WM_PUBLIC_ACTIVATION_CLIENT_H_ |
6 #define UI_WM_PUBLIC_ACTIVATION_CLIENT_H_ | 6 #define UI_WM_PUBLIC_ACTIVATION_CLIENT_H_ |
7 | 7 |
8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
9 | 9 |
10 namespace aura { | 10 namespace aura { |
(...skipping 10 matching lines...) Expand all Loading... | |
21 virtual void RemoveObserver(ActivationChangeObserver* observer) = 0; | 21 virtual void RemoveObserver(ActivationChangeObserver* observer) = 0; |
22 | 22 |
23 // Activates |window|. If |window| is NULL, nothing happens. | 23 // Activates |window|. If |window| is NULL, nothing happens. |
24 virtual void ActivateWindow(Window* window) = 0; | 24 virtual void ActivateWindow(Window* window) = 0; |
25 | 25 |
26 // Deactivates |window|. What (if anything) is activated next is up to the | 26 // Deactivates |window|. What (if anything) is activated next is up to the |
27 // client. If |window| is NULL, nothing happens. | 27 // client. If |window| is NULL, nothing happens. |
28 virtual void DeactivateWindow(Window* window) = 0; | 28 virtual void DeactivateWindow(Window* window) = 0; |
29 | 29 |
30 // Retrieves the active window, or NULL if there is none. | 30 // Retrieves the active window, or NULL if there is none. |
31 virtual Window* GetActiveWindow() = 0; | 31 Window* GetActiveWindow() { |
32 return const_cast<Window*>( | |
33 const_cast<const ActivationClient*>(this)->GetActiveWindow()); | |
34 } | |
35 virtual const Window* GetActiveWindow() const = 0; | |
alokp
2017/04/18 16:57:29
non-owner nit: I personally find *const* interface
sky
2017/04/18 17:16:05
This function is intended to be a trivial getter,
alokp
2017/04/18 18:48:33
Which is what I meant by making assumptions about
sky
2017/04/18 19:08:13
IsActiveWindow() requires the ActivationClient, wh
| |
32 | 36 |
33 // Retrieves the activatable window for |window|, or NULL if there is none. | 37 // Retrieves the activatable window for |window|, or NULL if there is none. |
34 // Note that this is often but not always the toplevel window (see | 38 // Note that this is often but not always the toplevel window (see |
35 // GetToplevelWindow() below), as the toplevel window may not be activatable | 39 // GetToplevelWindow() below), as the toplevel window may not be activatable |
36 // (for example it may be blocked by a modal transient, or some other | 40 // (for example it may be blocked by a modal transient, or some other |
37 // condition). | 41 // condition). |
38 virtual Window* GetActivatableWindow(Window* window) = 0; | 42 virtual Window* GetActivatableWindow(Window* window) = 0; |
39 | 43 |
40 // Retrieves the toplevel window for |window|, or NULL if there is none. | 44 // Retrieves the toplevel window for |window|, or NULL if there is none. |
41 virtual Window* GetToplevelWindow(Window* window) = 0; | 45 virtual Window* GetToplevelWindow(Window* window) = 0; |
42 | 46 |
43 // Returns true if |window| can be activated, false otherwise. If |window| has | 47 // Returns true if |window| can be activated, false otherwise. If |window| has |
44 // a modal child it can not be activated. | 48 // a modal child it can not be activated. |
45 virtual bool CanActivateWindow(Window* window) const = 0; | 49 virtual bool CanActivateWindow(Window* window) const = 0; |
46 | 50 |
47 protected: | 51 protected: |
48 virtual ~ActivationClient() {} | 52 virtual ~ActivationClient() {} |
49 }; | 53 }; |
50 | 54 |
51 // Sets/Gets the activation client on the root Window. | 55 // Sets/Gets the activation client on the root Window. |
52 AURA_EXPORT void SetActivationClient(Window* root_window, | 56 AURA_EXPORT void SetActivationClient(Window* root_window, |
53 ActivationClient* client); | 57 ActivationClient* client); |
54 AURA_EXPORT ActivationClient* GetActivationClient(Window* root_window); | 58 AURA_EXPORT ActivationClient* GetActivationClient(Window* root_window); |
59 AURA_EXPORT const ActivationClient* GetActivationClient( | |
60 const Window* root_window); | |
55 | 61 |
56 // Some types of transient window are only visible when active. | 62 // Some types of transient window are only visible when active. |
57 // The transient parents of these windows may have visual appearance properties | 63 // The transient parents of these windows may have visual appearance properties |
58 // that differ from transient parents that can be deactivated. | 64 // that differ from transient parents that can be deactivated. |
59 // The presence of this property implies these traits. | 65 // The presence of this property implies these traits. |
60 // TODO(beng): currently the UI framework (views) implements the actual | 66 // TODO(beng): currently the UI framework (views) implements the actual |
61 // close-on-deactivate component of this feature but it should be | 67 // close-on-deactivate component of this feature but it should be |
62 // possible to implement in the aura client. | 68 // possible to implement in the aura client. |
63 AURA_EXPORT void SetHideOnDeactivate(Window* window, bool hide_on_deactivate); | 69 AURA_EXPORT void SetHideOnDeactivate(Window* window, bool hide_on_deactivate); |
64 AURA_EXPORT bool GetHideOnDeactivate(Window* window); | 70 AURA_EXPORT bool GetHideOnDeactivate(Window* window); |
65 | 71 |
66 } // namespace clients | 72 } // namespace clients |
67 } // namespace aura | 73 } // namespace aura |
68 | 74 |
69 #endif // UI_WM_PUBLIC_ACTIVATION_CLIENT_H_ | 75 #endif // UI_WM_PUBLIC_ACTIVATION_CLIENT_H_ |
OLD | NEW |