OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_EXO_WM_HELPER_MUS_H_ | 5 #ifndef COMPONENTS_EXO_WM_HELPER_MUS_H_ |
6 #define COMPONENTS_EXO_WM_HELPER_MUS_H_ | 6 #define COMPONENTS_EXO_WM_HELPER_MUS_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/exo/wm_helper.h" | 9 #include "components/exo/wm_helper.h" |
10 #include "services/ui/public/cpp/window_tree_client_observer.h" | |
11 #include "ui/aura/client/focus_change_observer.h" | 10 #include "ui/aura/client/focus_change_observer.h" |
| 11 #include "ui/aura/env_observer.h" |
12 #include "ui/events/devices/input_device_event_observer.h" | 12 #include "ui/events/devices/input_device_event_observer.h" |
13 | 13 |
| 14 namespace aura { |
| 15 namespace client { |
| 16 class ActivationClient; |
| 17 } |
| 18 } |
| 19 |
14 namespace exo { | 20 namespace exo { |
15 | 21 |
16 // A helper class for accessing WindowManager related features. | 22 // A helper class for accessing WindowManager related features. |
17 class WMHelperMus : public WMHelper, | 23 class WMHelperMus : public WMHelper, |
18 public ui::InputDeviceEventObserver, | 24 public ui::InputDeviceEventObserver, |
19 public ui::WindowTreeClientObserver, | 25 public aura::EnvObserver, |
20 public aura::client::FocusChangeObserver { | 26 public aura::client::FocusChangeObserver { |
21 public: | 27 public: |
22 WMHelperMus(); | 28 WMHelperMus(); |
23 ~WMHelperMus() override; | 29 ~WMHelperMus() override; |
24 | 30 |
25 // Overriden from WMHelper: | 31 // Overriden from WMHelper: |
26 const display::ManagedDisplayInfo GetDisplayInfo( | 32 const display::ManagedDisplayInfo GetDisplayInfo( |
27 int64_t display_id) const override; | 33 int64_t display_id) const override; |
28 aura::Window* GetContainer(int container_id) override; | 34 aura::Window* GetContainer(int container_id) override; |
29 aura::Window* GetActiveWindow() const override; | 35 aura::Window* GetActiveWindow() const override; |
30 aura::Window* GetFocusedWindow() const override; | 36 aura::Window* GetFocusedWindow() const override; |
31 ui::CursorSetType GetCursorSet() const override; | 37 ui::CursorSetType GetCursorSet() const override; |
32 void AddPreTargetHandler(ui::EventHandler* handler) override; | 38 void AddPreTargetHandler(ui::EventHandler* handler) override; |
33 void PrependPreTargetHandler(ui::EventHandler* handler) override; | 39 void PrependPreTargetHandler(ui::EventHandler* handler) override; |
34 void RemovePreTargetHandler(ui::EventHandler* handler) override; | 40 void RemovePreTargetHandler(ui::EventHandler* handler) override; |
35 void AddPostTargetHandler(ui::EventHandler* handler) override; | 41 void AddPostTargetHandler(ui::EventHandler* handler) override; |
36 void RemovePostTargetHandler(ui::EventHandler* handler) override; | 42 void RemovePostTargetHandler(ui::EventHandler* handler) override; |
37 bool IsMaximizeModeWindowManagerEnabled() const override; | 43 bool IsMaximizeModeWindowManagerEnabled() const override; |
38 bool IsSpokenFeedbackEnabled() const override; | 44 bool IsSpokenFeedbackEnabled() const override; |
39 void PlayEarcon(int sound_key) const override; | 45 void PlayEarcon(int sound_key) const override; |
40 | 46 |
41 // Overriden from ui::WindowTreeClientObserver: | 47 // Overriden from aura::EnvObserver: |
42 void OnWindowTreeFocusChanged(ui::Window* gained_focus, | 48 void OnWindowInitialized(aura::Window* window) override; |
43 ui::Window* lost_focus) override; | 49 void OnActiveFocusClientChanged(aura::client::FocusClient* focus_client, |
| 50 aura::Window* window) override; |
44 | 51 |
45 // Overriden from ui::client::FocusChangeObserver: | 52 // Overriden from ui::client::FocusChangeObserver: |
46 void OnWindowFocused(aura::Window* gained_focus, | 53 void OnWindowFocused(aura::Window* gained_focus, |
47 aura::Window* lost_focus) override; | 54 aura::Window* lost_focus) override; |
48 | 55 |
49 // Overriden from ui::InputDeviceEventObserver: | 56 // Overriden from ui::InputDeviceEventObserver: |
50 void OnKeyboardDeviceConfigurationChanged() override; | 57 void OnKeyboardDeviceConfigurationChanged() override; |
51 | 58 |
52 private: | 59 private: |
53 aura::Window* active_window_; | 60 void SetActiveFocusClient(aura::client::FocusClient* focus_client, |
54 aura::Window* focused_window_; | 61 aura::Window* window); |
| 62 void SetActiveWindow(aura::Window* window); |
| 63 void SetFocusedWindow(aura::Window* window); |
| 64 |
| 65 aura::client::ActivationClient* GetActivationClient(); |
| 66 |
| 67 // Current FocusClient. |
| 68 aura::client::FocusClient* active_focus_client_ = nullptr; |
| 69 // This is the window that |active_focus_client_| comes from (may be null). |
| 70 aura::Window* root_with_active_focus_client_ = nullptr; |
| 71 aura::Window* active_window_ = nullptr; |
| 72 aura::Window* focused_window_ = nullptr; |
55 | 73 |
56 DISALLOW_COPY_AND_ASSIGN(WMHelperMus); | 74 DISALLOW_COPY_AND_ASSIGN(WMHelperMus); |
57 }; | 75 }; |
58 | 76 |
59 } // namespace exo | 77 } // namespace exo |
60 | 78 |
61 #endif // COMPONENTS_EXO_WM_HELPER_H_ | 79 #endif // COMPONENTS_EXO_WM_HELPER_H_ |
OLD | NEW |