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_GLOBALS_MUS_H_ | 5 #ifndef ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ |
6 #define ASH_MUS_BRIDGE_WM_GLOBALS_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 <vector> | 10 #include <vector> |
11 | 11 |
12 #include "ash/common/wm/wm_globals.h" | 12 #include "ash/common/wm_shell.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "components/mus/public/cpp/window_tree_client_observer.h" | 15 #include "components/mus/public/cpp/window_tree_client_observer.h" |
16 | 16 |
17 namespace mus { | 17 namespace mus { |
18 class WindowTreeClient; | 18 class WindowTreeClient; |
19 } | 19 } |
20 | 20 |
21 namespace ash { | 21 namespace ash { |
22 namespace mus { | 22 namespace mus { |
23 | 23 |
24 class WmRootWindowControllerMus; | 24 class WmRootWindowControllerMus; |
25 class WmWindowMus; | 25 class WmWindowMus; |
26 | 26 |
27 // WmGlobals implementation for mus. | 27 // WmShell implementation for mus. |
28 class WmGlobalsMus : public wm::WmGlobals, | 28 class WmShellMus : public WmShell, public ::mus::WindowTreeClientObserver { |
29 public ::mus::WindowTreeClientObserver { | |
30 public: | 29 public: |
31 explicit WmGlobalsMus(::mus::WindowTreeClient* client); | 30 explicit WmShellMus(::mus::WindowTreeClient* client); |
32 ~WmGlobalsMus() override; | 31 ~WmShellMus() override; |
33 | 32 |
34 static WmGlobalsMus* Get(); | 33 static WmShellMus* Get(); |
35 | 34 |
36 void AddRootWindowController(WmRootWindowControllerMus* controller); | 35 void AddRootWindowController(WmRootWindowControllerMus* controller); |
37 void RemoveRootWindowController(WmRootWindowControllerMus* controller); | 36 void RemoveRootWindowController(WmRootWindowControllerMus* controller); |
38 | 37 |
39 // Returns the ancestor of |window| (including |window|) that is considered | 38 // Returns the ancestor of |window| (including |window|) that is considered |
40 // toplevel. |window| may be null. | 39 // toplevel. |window| may be null. |
41 static WmWindowMus* GetToplevelAncestor(::mus::Window* window); | 40 static WmWindowMus* GetToplevelAncestor(::mus::Window* window); |
42 | 41 |
43 WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id); | 42 WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id); |
44 | 43 |
45 // WmGlobals: | 44 // WmShell: |
46 wm::WmWindow* NewContainerWindow() override; | 45 WmWindow* NewContainerWindow() override; |
47 wm::WmWindow* GetFocusedWindow() override; | 46 WmWindow* GetFocusedWindow() override; |
48 wm::WmWindow* GetActiveWindow() override; | 47 WmWindow* GetActiveWindow() override; |
49 wm::WmWindow* GetPrimaryRootWindow() override; | 48 WmWindow* GetPrimaryRootWindow() override; |
50 wm::WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; | 49 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; |
51 wm::WmWindow* GetRootWindowForNewWindows() override; | 50 WmWindow* GetRootWindowForNewWindows() override; |
52 std::vector<wm::WmWindow*> GetMruWindowList() override; | 51 std::vector<WmWindow*> GetMruWindowList() override; |
53 std::vector<wm::WmWindow*> GetMruWindowListIgnoreModals() override; | 52 std::vector<WmWindow*> GetMruWindowListIgnoreModals() override; |
54 bool IsForceMaximizeOnFirstRun() override; | 53 bool IsForceMaximizeOnFirstRun() override; |
55 bool IsUserSessionBlocked() override; | 54 bool IsUserSessionBlocked() override; |
56 bool IsScreenLocked() override; | 55 bool IsScreenLocked() override; |
57 void LockCursor() override; | 56 void LockCursor() override; |
58 void UnlockCursor() override; | 57 void UnlockCursor() override; |
59 std::vector<wm::WmWindow*> GetAllRootWindows() override; | 58 std::vector<WmWindow*> GetAllRootWindows() override; |
60 void RecordUserMetricsAction(wm::WmUserMetricsAction action) override; | 59 void RecordUserMetricsAction(wm::WmUserMetricsAction action) override; |
61 std::unique_ptr<WindowResizer> CreateDragWindowResizer( | 60 std::unique_ptr<WindowResizer> CreateDragWindowResizer( |
62 std::unique_ptr<WindowResizer> next_window_resizer, | 61 std::unique_ptr<WindowResizer> next_window_resizer, |
63 wm::WindowState* window_state) override; | 62 wm::WindowState* window_state) override; |
64 bool IsOverviewModeSelecting() override; | 63 bool IsOverviewModeSelecting() override; |
65 bool IsOverviewModeRestoringMinimizedWindows() override; | 64 bool IsOverviewModeRestoringMinimizedWindows() override; |
66 void AddActivationObserver(wm::WmActivationObserver* observer) override; | 65 void AddActivationObserver(WmActivationObserver* observer) override; |
67 void RemoveActivationObserver(wm::WmActivationObserver* observer) override; | 66 void RemoveActivationObserver(WmActivationObserver* observer) override; |
68 void AddDisplayObserver(wm::WmDisplayObserver* observer) override; | 67 void AddDisplayObserver(WmDisplayObserver* observer) override; |
69 void RemoveDisplayObserver(wm::WmDisplayObserver* observer) override; | 68 void RemoveDisplayObserver(WmDisplayObserver* observer) override; |
70 void AddOverviewModeObserver(wm::WmOverviewModeObserver* observer) override; | 69 void AddOverviewModeObserver(WmOverviewModeObserver* observer) override; |
71 void RemoveOverviewModeObserver( | 70 void RemoveOverviewModeObserver(WmOverviewModeObserver* observer) override; |
72 wm::WmOverviewModeObserver* observer) override; | |
73 | 71 |
74 private: | 72 private: |
75 // Returns true if |window| is a window that can have active children. | 73 // Returns true if |window| is a window that can have active children. |
76 static bool IsActivationParent(::mus::Window* window); | 74 static bool IsActivationParent(::mus::Window* window); |
77 | 75 |
78 void RemoveClientObserver(); | 76 void RemoveClientObserver(); |
79 | 77 |
80 // ::mus::WindowTreeClientObserver: | 78 // ::mus::WindowTreeClientObserver: |
81 void OnWindowTreeFocusChanged(::mus::Window* gained_focus, | 79 void OnWindowTreeFocusChanged(::mus::Window* gained_focus, |
82 ::mus::Window* lost_focus) override; | 80 ::mus::Window* lost_focus) override; |
83 void OnWillDestroyClient(::mus::WindowTreeClient* client) override; | 81 void OnWillDestroyClient(::mus::WindowTreeClient* client) override; |
84 | 82 |
85 ::mus::WindowTreeClient* client_; | 83 ::mus::WindowTreeClient* client_; |
86 | 84 |
87 std::vector<WmRootWindowControllerMus*> root_window_controllers_; | 85 std::vector<WmRootWindowControllerMus*> root_window_controllers_; |
88 | 86 |
89 base::ObserverList<wm::WmActivationObserver> activation_observers_; | 87 base::ObserverList<WmActivationObserver> activation_observers_; |
90 | 88 |
91 DISALLOW_COPY_AND_ASSIGN(WmGlobalsMus); | 89 DISALLOW_COPY_AND_ASSIGN(WmShellMus); |
92 }; | 90 }; |
93 | 91 |
94 } // namespace mus | 92 } // namespace mus |
95 } // namespace ash | 93 } // namespace ash |
96 | 94 |
97 #endif // ASH_MUS_BRIDGE_WM_GLOBALS_MUS_H_ | 95 #endif // ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ |
OLD | NEW |