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_AURA_CLIENT_ACTIVATION_CLIENT_H_ | 5 #ifndef UI_AURA_CLIENT_ACTIVATION_CLIENT_H_ |
6 #define UI_AURA_CLIENT_ACTIVATION_CLIENT_H_ | 6 #define UI_AURA_CLIENT_ACTIVATION_CLIENT_H_ |
7 | 7 |
8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 | 10 |
| 11 namespace ui { |
| 12 class Event; |
| 13 } |
| 14 |
11 namespace aura { | 15 namespace aura { |
12 class Event; | |
13 class RootWindow; | 16 class RootWindow; |
14 | 17 |
15 namespace client { | 18 namespace client { |
16 class ActivationChangeObserver; | 19 class ActivationChangeObserver; |
17 | 20 |
18 // An interface implemented by an object that manages window activation. | 21 // An interface implemented by an object that manages window activation. |
19 class AURA_EXPORT ActivationClient { | 22 class AURA_EXPORT ActivationClient { |
20 public: | 23 public: |
21 // Adds/Removes ActivationChangeObservers. | 24 // Adds/Removes ActivationChangeObservers. |
22 virtual void AddObserver(ActivationChangeObserver* observer) = 0; | 25 virtual void AddObserver(ActivationChangeObserver* observer) = 0; |
23 virtual void RemoveObserver(ActivationChangeObserver* observer) = 0; | 26 virtual void RemoveObserver(ActivationChangeObserver* observer) = 0; |
24 | 27 |
25 // Activates |window|. If |window| is NULL, nothing happens. | 28 // Activates |window|. If |window| is NULL, nothing happens. |
26 virtual void ActivateWindow(Window* window) = 0; | 29 virtual void ActivateWindow(Window* window) = 0; |
27 | 30 |
28 // Deactivates |window|. What (if anything) is activated next is up to the | 31 // Deactivates |window|. What (if anything) is activated next is up to the |
29 // client. If |window| is NULL, nothing happens. | 32 // client. If |window| is NULL, nothing happens. |
30 virtual void DeactivateWindow(Window* window) = 0; | 33 virtual void DeactivateWindow(Window* window) = 0; |
31 | 34 |
32 // Retrieves the active window, or NULL if there is none. | 35 // Retrieves the active window, or NULL if there is none. |
33 virtual aura::Window* GetActiveWindow() = 0; | 36 virtual Window* GetActiveWindow() = 0; |
34 | 37 |
35 // Invoked prior to |window| getting focus as a result of the |event|. |event| | 38 // Invoked prior to |window| getting focus as a result of the |event|. |event| |
36 // may be NULL. Returning false blocks |window| from getting focus. | 39 // may be NULL. Returning false blocks |window| from getting focus. |
37 virtual bool OnWillFocusWindow(Window* window, const Event* event) = 0; | 40 virtual bool OnWillFocusWindow(Window* window, const ui::Event* event) = 0; |
38 | 41 |
39 // Returns true if |window| can be activated, false otherwise. If |window| has | 42 // Returns true if |window| can be activated, false otherwise. If |window| has |
40 // a modal child it can not be activated. | 43 // a modal child it can not be activated. |
41 virtual bool CanActivateWindow(Window* window) const = 0; | 44 virtual bool CanActivateWindow(Window* window) const = 0; |
42 | 45 |
43 protected: | 46 protected: |
44 virtual ~ActivationClient() {} | 47 virtual ~ActivationClient() {} |
45 }; | 48 }; |
46 | 49 |
47 // Sets/Gets the activation client on the RootWindow. | 50 // Sets/Gets the activation client on the RootWindow. |
48 AURA_EXPORT void SetActivationClient(RootWindow* root_window, | 51 AURA_EXPORT void SetActivationClient(RootWindow* root_window, |
49 ActivationClient* client); | 52 ActivationClient* client); |
50 AURA_EXPORT ActivationClient* GetActivationClient(RootWindow* root_window); | 53 AURA_EXPORT ActivationClient* GetActivationClient(RootWindow* root_window); |
51 | 54 |
52 // Some types of transient window are only visible when active. | 55 // Some types of transient window are only visible when active. |
53 // The transient parents of these windows may have visual appearance properties | 56 // The transient parents of these windows may have visual appearance properties |
54 // that differ from transient parents that can be deactivated. | 57 // that differ from transient parents that can be deactivated. |
55 // The presence of this property implies these traits. | 58 // The presence of this property implies these traits. |
56 // TODO(beng): currently the UI framework (views) implements the actual | 59 // TODO(beng): currently the UI framework (views) implements the actual |
57 // close-on-deactivate component of this feature but it should be | 60 // close-on-deactivate component of this feature but it should be |
58 // possible to implement in the aura client. | 61 // possible to implement in the aura client. |
59 AURA_EXPORT void SetHideOnDeactivate(Window* window, bool hide_on_deactivate); | 62 AURA_EXPORT void SetHideOnDeactivate(Window* window, bool hide_on_deactivate); |
60 AURA_EXPORT bool GetHideOnDeactivate(Window* window); | 63 AURA_EXPORT bool GetHideOnDeactivate(Window* window); |
61 | 64 |
62 } // namespace clients | 65 } // namespace clients |
63 } // namespace aura | 66 } // namespace aura |
64 | 67 |
65 #endif // UI_AURA_CLIENT_ACTIVATION_CLIENT_H_ | 68 #endif // UI_AURA_CLIENT_ACTIVATION_CLIENT_H_ |
OLD | NEW |