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 ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ | 5 #ifndef ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ |
6 #define ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ | 6 #define ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "services/ui/public/cpp/window_tree_client_observer.h" | 16 #include "services/ui/public/cpp/window_tree_client_observer.h" |
17 | 17 |
18 namespace shell { | 18 namespace shell { |
19 class Connector; | 19 class Connector; |
20 } | 20 } |
21 | 21 |
22 namespace ui { | 22 namespace ui { |
23 class WindowTreeClient; | 23 class WindowTreeClient; |
24 } | 24 } |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 namespace mus { | 27 namespace mus { |
28 | 28 |
29 class AcceleratorControllerDelegateMus; | 29 class AcceleratorControllerDelegateMus; |
| 30 class AcceleratorControllerRegistrar; |
| 31 class WindowManager; |
30 class WmRootWindowControllerMus; | 32 class WmRootWindowControllerMus; |
31 class WmWindowMus; | 33 class WmWindowMus; |
32 | 34 |
33 // WmShell implementation for mus. | 35 // WmShell implementation for mus. |
34 class WmShellMus : public WmShell, public ::ui::WindowTreeClientObserver { | 36 class WmShellMus : public WmShell, public ::ui::WindowTreeClientObserver { |
35 public: | 37 public: |
36 WmShellMus(std::unique_ptr<ShellDelegate> shell_delegate, | 38 WmShellMus(std::unique_ptr<ShellDelegate> shell_delegate, |
37 ::ui::WindowTreeClient* client); | 39 WindowManager* window_manager); |
38 ~WmShellMus() override; | 40 ~WmShellMus() override; |
39 | 41 |
40 static WmShellMus* Get(); | 42 static WmShellMus* Get(); |
41 | 43 |
42 void AddRootWindowController(WmRootWindowControllerMus* controller); | 44 void AddRootWindowController(WmRootWindowControllerMus* controller); |
43 void RemoveRootWindowController(WmRootWindowControllerMus* controller); | 45 void RemoveRootWindowController(WmRootWindowControllerMus* controller); |
44 | 46 |
45 // Returns the ancestor of |window| (including |window|) that is considered | 47 // Returns the ancestor of |window| (including |window|) that is considered |
46 // toplevel. |window| may be null. | 48 // toplevel. |window| may be null. |
47 static WmWindowMus* GetToplevelAncestor(::ui::Window* window); | 49 static WmWindowMus* GetToplevelAncestor(::ui::Window* window); |
48 | 50 |
49 WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id); | 51 WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id); |
50 | 52 |
| 53 AcceleratorControllerDelegateMus* accelerator_controller_delegate() { |
| 54 return accelerator_controller_delegate_.get(); |
| 55 } |
| 56 |
51 // WmShell: | 57 // WmShell: |
52 WmWindow* NewContainerWindow() override; | 58 WmWindow* NewContainerWindow() override; |
53 WmWindow* GetFocusedWindow() override; | 59 WmWindow* GetFocusedWindow() override; |
54 WmWindow* GetActiveWindow() override; | 60 WmWindow* GetActiveWindow() override; |
55 WmWindow* GetPrimaryRootWindow() override; | 61 WmWindow* GetPrimaryRootWindow() override; |
56 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; | 62 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; |
57 WmWindow* GetRootWindowForNewWindows() override; | 63 WmWindow* GetRootWindowForNewWindows() override; |
58 const DisplayInfo& GetDisplayInfo(int64_t display_id) const override; | 64 const DisplayInfo& GetDisplayInfo(int64_t display_id) const override; |
59 bool IsActiveDisplayId(int64_t display_id) const override; | 65 bool IsActiveDisplayId(int64_t display_id) const override; |
60 bool IsForceMaximizeOnFirstRun() override; | 66 bool IsForceMaximizeOnFirstRun() override; |
(...skipping 21 matching lines...) Expand all Loading... |
82 void RemoveActivationObserver(WmActivationObserver* observer) override; | 88 void RemoveActivationObserver(WmActivationObserver* observer) override; |
83 void AddDisplayObserver(WmDisplayObserver* observer) override; | 89 void AddDisplayObserver(WmDisplayObserver* observer) override; |
84 void RemoveDisplayObserver(WmDisplayObserver* observer) override; | 90 void RemoveDisplayObserver(WmDisplayObserver* observer) override; |
85 void AddPointerWatcher(views::PointerWatcher* watcher) override; | 91 void AddPointerWatcher(views::PointerWatcher* watcher) override; |
86 void RemovePointerWatcher(views::PointerWatcher* watcher) override; | 92 void RemovePointerWatcher(views::PointerWatcher* watcher) override; |
87 #if defined(OS_CHROMEOS) | 93 #if defined(OS_CHROMEOS) |
88 void ToggleIgnoreExternalKeyboard() override; | 94 void ToggleIgnoreExternalKeyboard() override; |
89 #endif | 95 #endif |
90 | 96 |
91 private: | 97 private: |
| 98 ::ui::WindowTreeClient* window_tree_client(); |
| 99 |
92 // Returns true if |window| is a window that can have active children. | 100 // Returns true if |window| is a window that can have active children. |
93 static bool IsActivationParent(::ui::Window* window); | 101 static bool IsActivationParent(::ui::Window* window); |
94 | 102 |
95 void RemoveClientObserver(); | |
96 | |
97 // ::ui::WindowTreeClientObserver: | 103 // ::ui::WindowTreeClientObserver: |
98 void OnWindowTreeFocusChanged(::ui::Window* gained_focus, | 104 void OnWindowTreeFocusChanged(::ui::Window* gained_focus, |
99 ::ui::Window* lost_focus) override; | 105 ::ui::Window* lost_focus) override; |
100 void OnDidDestroyClient(::ui::WindowTreeClient* client) override; | 106 void OnDidDestroyClient(::ui::WindowTreeClient* client) override; |
101 | 107 |
102 ::ui::WindowTreeClient* client_; | 108 WindowManager* window_manager_; |
103 | 109 |
104 std::vector<WmRootWindowControllerMus*> root_window_controllers_; | 110 std::vector<WmRootWindowControllerMus*> root_window_controllers_; |
105 | 111 |
106 std::unique_ptr<AcceleratorControllerDelegateMus> | 112 std::unique_ptr<AcceleratorControllerDelegateMus> |
107 accelerator_controller_delegate_; | 113 accelerator_controller_delegate_; |
| 114 std::unique_ptr<AcceleratorControllerRegistrar> |
| 115 accelerator_controller_registrar_; |
108 std::unique_ptr<SessionStateDelegate> session_state_delegate_; | 116 std::unique_ptr<SessionStateDelegate> session_state_delegate_; |
109 | 117 |
110 base::ObserverList<WmActivationObserver> activation_observers_; | 118 base::ObserverList<WmActivationObserver> activation_observers_; |
111 | 119 |
112 DISALLOW_COPY_AND_ASSIGN(WmShellMus); | 120 DISALLOW_COPY_AND_ASSIGN(WmShellMus); |
113 }; | 121 }; |
114 | 122 |
115 } // namespace mus | 123 } // namespace mus |
116 } // namespace ash | 124 } // namespace ash |
117 | 125 |
118 #endif // ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ | 126 #endif // ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ |
OLD | NEW |