| 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_FOCUS_CLIENT_H_ | 5 #ifndef UI_AURA_CLIENT_FOCUS_CLIENT_H_ |
| 6 #define UI_AURA_CLIENT_FOCUS_CLIENT_H_ | 6 #define UI_AURA_CLIENT_FOCUS_CLIENT_H_ |
| 7 | 7 |
| 8 #include "ui/aura/aura_export.h" | 8 #include "ui/aura/aura_export.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 class Event; | 11 class Event; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace aura { | 14 namespace aura { |
| 15 class RootWindow; | 15 class RootWindow; |
| 16 class Window; | 16 class Window; |
| 17 | 17 |
| 18 namespace client { | 18 namespace client { |
| 19 class FocusChangeObserver; | 19 class FocusChangeObserver; |
| 20 | 20 |
| 21 // An interface implemented by an object that manages window focus. | 21 // An interface implemented by an object that manages window focus. |
| 22 class AURA_EXPORT FocusClient { | 22 class AURA_EXPORT FocusClient { |
| 23 public: | 23 public: |
| 24 virtual ~FocusClient() {} | 24 virtual ~FocusClient() {} |
| 25 | 25 |
| 26 // TODO(beng): these methods will be OBSOLETE by FocusChangeEvent. | |
| 27 virtual void AddObserver(FocusChangeObserver* observer) = 0; | 26 virtual void AddObserver(FocusChangeObserver* observer) = 0; |
| 28 virtual void RemoveObserver(FocusChangeObserver* observer) = 0; | 27 virtual void RemoveObserver(FocusChangeObserver* observer) = 0; |
| 29 | 28 |
| 30 // Focuses |window|. Passing NULL clears focus. | 29 // Focuses |window|. Passing NULL clears focus. |
| 31 virtual void FocusWindow(Window* window) = 0; | 30 virtual void FocusWindow(Window* window) = 0; |
| 32 | 31 |
| 33 // Sets focus to |window| if it's within the active window. Not intended as a | 32 // Sets focus to |window| if it's within the active window. Not intended as a |
| 34 // general purpose API, use FocusWindow() instead. | 33 // general purpose API, use FocusWindow() instead. |
| 35 virtual void ResetFocusWithinActiveWindow(Window* window) = 0; | 34 virtual void ResetFocusWithinActiveWindow(Window* window) = 0; |
| 36 | 35 |
| 37 // Retrieves the focused window, or NULL if there is none. | 36 // Retrieves the focused window, or NULL if there is none. |
| 38 virtual Window* GetFocusedWindow() = 0; | 37 virtual Window* GetFocusedWindow() = 0; |
| 39 | |
| 40 // TODO(beng): temporary compat until FocusController is on. | |
| 41 // Called when |window|'s disposition in |root_window| changes such that | |
| 42 // focus must be shifted away from it. |destroyed| is true if the disposition | |
| 43 // change is that |window| is being destroyed. | |
| 44 virtual void OnWindowHiddenInRootWindow(aura::Window* window, | |
| 45 aura::RootWindow* root_window, | |
| 46 bool destroyed) = 0; | |
| 47 }; | 38 }; |
| 48 | 39 |
| 49 // Sets/Gets the focus client on the RootWindow. | 40 // Sets/Gets the focus client on the RootWindow. |
| 50 AURA_EXPORT void SetFocusClient(RootWindow* root_window, FocusClient* client); | 41 AURA_EXPORT void SetFocusClient(RootWindow* root_window, FocusClient* client); |
| 51 AURA_EXPORT FocusClient* GetFocusClient(Window* window); | 42 AURA_EXPORT FocusClient* GetFocusClient(Window* window); |
| 52 AURA_EXPORT FocusClient* GetFocusClient(const Window* window); | 43 AURA_EXPORT FocusClient* GetFocusClient(const Window* window); |
| 53 | 44 |
| 54 } // namespace clients | 45 } // namespace clients |
| 55 } // namespace aura | 46 } // namespace aura |
| 56 | 47 |
| 57 #endif // UI_AURA_CLIENT_FOCUS_CLIENT_H_ | 48 #endif // UI_AURA_CLIENT_FOCUS_CLIENT_H_ |
| OLD | NEW |