| 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 <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/common/wm_shell.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 | |
| 23 class WmShellCommon; | |
| 24 | |
| 25 namespace mus { | 22 namespace mus { |
| 26 | 23 |
| 27 class WmRootWindowControllerMus; | 24 class WmRootWindowControllerMus; |
| 28 class WmWindowMus; | 25 class WmWindowMus; |
| 29 | 26 |
| 30 // WmShell implementation for mus. | 27 // WmShell implementation for mus. |
| 31 class WmShellMus : public WmShell, public ::mus::WindowTreeClientObserver { | 28 class WmShellMus : public WmShell, public ::mus::WindowTreeClientObserver { |
| 32 public: | 29 public: |
| 33 explicit WmShellMus(::mus::WindowTreeClient* client); | 30 explicit WmShellMus(::mus::WindowTreeClient* client); |
| 34 ~WmShellMus() override; | 31 ~WmShellMus() override; |
| 35 | 32 |
| 36 static WmShellMus* Get(); | 33 static WmShellMus* Get(); |
| 37 | 34 |
| 38 void AddRootWindowController(WmRootWindowControllerMus* controller); | 35 void AddRootWindowController(WmRootWindowControllerMus* controller); |
| 39 void RemoveRootWindowController(WmRootWindowControllerMus* controller); | 36 void RemoveRootWindowController(WmRootWindowControllerMus* controller); |
| 40 | 37 |
| 41 // Returns the ancestor of |window| (including |window|) that is considered | 38 // Returns the ancestor of |window| (including |window|) that is considered |
| 42 // toplevel. |window| may be null. | 39 // toplevel. |window| may be null. |
| 43 static WmWindowMus* GetToplevelAncestor(::mus::Window* window); | 40 static WmWindowMus* GetToplevelAncestor(::mus::Window* window); |
| 44 | 41 |
| 45 WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id); | 42 WmRootWindowControllerMus* GetRootWindowControllerWithDisplayId(int64_t id); |
| 46 | 43 |
| 47 // WmShell: | 44 // WmShell: |
| 48 MruWindowTracker* GetMruWindowTracker() override; | |
| 49 WmWindow* NewContainerWindow() override; | 45 WmWindow* NewContainerWindow() override; |
| 50 WmWindow* GetFocusedWindow() override; | 46 WmWindow* GetFocusedWindow() override; |
| 51 WmWindow* GetActiveWindow() override; | 47 WmWindow* GetActiveWindow() override; |
| 52 WmWindow* GetPrimaryRootWindow() override; | 48 WmWindow* GetPrimaryRootWindow() override; |
| 53 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; | 49 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; |
| 54 WmWindow* GetRootWindowForNewWindows() override; | 50 WmWindow* GetRootWindowForNewWindows() override; |
| 55 const DisplayInfo& GetDisplayInfo(int64_t display_id) const override; | 51 const DisplayInfo& GetDisplayInfo(int64_t display_id) const override; |
| 56 bool IsForceMaximizeOnFirstRun() override; | 52 bool IsForceMaximizeOnFirstRun() override; |
| 57 bool IsPinned() override; | 53 bool IsPinned() override; |
| 58 void SetPinnedWindow(WmWindow* window) override; | 54 void SetPinnedWindow(WmWindow* window) override; |
| 59 bool CanShowWindowForUser(WmWindow* window) override; | 55 bool CanShowWindowForUser(WmWindow* window) override; |
| 60 void LockCursor() override; | 56 void LockCursor() override; |
| 61 void UnlockCursor() override; | 57 void UnlockCursor() override; |
| 62 std::vector<WmWindow*> GetAllRootWindows() override; | 58 std::vector<WmWindow*> GetAllRootWindows() override; |
| 63 void RecordUserMetricsAction(UserMetricsAction action) override; | 59 void RecordUserMetricsAction(UserMetricsAction action) override; |
| 64 std::unique_ptr<WindowResizer> CreateDragWindowResizer( | 60 std::unique_ptr<WindowResizer> CreateDragWindowResizer( |
| 65 std::unique_ptr<WindowResizer> next_window_resizer, | 61 std::unique_ptr<WindowResizer> next_window_resizer, |
| 66 wm::WindowState* window_state) override; | 62 wm::WindowState* window_state) override; |
| 67 std::unique_ptr<wm::MaximizeModeEventHandler> CreateMaximizeModeEventHandler() | 63 std::unique_ptr<wm::MaximizeModeEventHandler> CreateMaximizeModeEventHandler() |
| 68 override; | 64 override; |
| 69 void OnOverviewModeStarting() override; | 65 void OnOverviewModeStarting() override; |
| 70 void OnOverviewModeEnded() override; | 66 void OnOverviewModeEnded() override; |
| 71 AccessibilityDelegate* GetAccessibilityDelegate() override; | 67 AccessibilityDelegate* GetAccessibilityDelegate() override; |
| 72 SessionStateDelegate* GetSessionStateDelegate() override; | 68 SessionStateDelegate* GetSessionStateDelegate() override; |
| 73 void AddActivationObserver(WmActivationObserver* observer) override; | 69 void AddActivationObserver(WmActivationObserver* observer) override; |
| 74 void RemoveActivationObserver(WmActivationObserver* observer) override; | 70 void RemoveActivationObserver(WmActivationObserver* observer) override; |
| 75 void AddDisplayObserver(WmDisplayObserver* observer) override; | 71 void AddDisplayObserver(WmDisplayObserver* observer) override; |
| 76 void RemoveDisplayObserver(WmDisplayObserver* observer) override; | 72 void RemoveDisplayObserver(WmDisplayObserver* observer) override; |
| 77 void AddShellObserver(ShellObserver* observer) override; | |
| 78 void RemoveShellObserver(ShellObserver* observer) override; | |
| 79 void AddPointerWatcher(views::PointerWatcher* watcher) override; | 73 void AddPointerWatcher(views::PointerWatcher* watcher) override; |
| 80 void RemovePointerWatcher(views::PointerWatcher* watcher) override; | 74 void RemovePointerWatcher(views::PointerWatcher* watcher) override; |
| 81 #if defined(OS_CHROMEOS) | 75 #if defined(OS_CHROMEOS) |
| 82 void ToggleIgnoreExternalKeyboard() override; | 76 void ToggleIgnoreExternalKeyboard() override; |
| 83 #endif | 77 #endif |
| 84 | 78 |
| 85 private: | 79 private: |
| 86 // Returns true if |window| is a window that can have active children. | 80 // Returns true if |window| is a window that can have active children. |
| 87 static bool IsActivationParent(::mus::Window* window); | 81 static bool IsActivationParent(::mus::Window* window); |
| 88 | 82 |
| 89 void RemoveClientObserver(); | 83 void RemoveClientObserver(); |
| 90 | 84 |
| 91 // ::mus::WindowTreeClientObserver: | 85 // ::mus::WindowTreeClientObserver: |
| 92 void OnWindowTreeFocusChanged(::mus::Window* gained_focus, | 86 void OnWindowTreeFocusChanged(::mus::Window* gained_focus, |
| 93 ::mus::Window* lost_focus) override; | 87 ::mus::Window* lost_focus) override; |
| 94 void OnWillDestroyClient(::mus::WindowTreeClient* client) override; | 88 void OnWillDestroyClient(::mus::WindowTreeClient* client) override; |
| 95 | 89 |
| 96 ::mus::WindowTreeClient* client_; | 90 ::mus::WindowTreeClient* client_; |
| 97 | 91 |
| 98 std::unique_ptr<WmShellCommon> wm_shell_common_; | |
| 99 | |
| 100 std::vector<WmRootWindowControllerMus*> root_window_controllers_; | 92 std::vector<WmRootWindowControllerMus*> root_window_controllers_; |
| 101 | 93 |
| 102 std::unique_ptr<SessionStateDelegate> session_state_delegate_; | 94 std::unique_ptr<SessionStateDelegate> session_state_delegate_; |
| 103 | 95 |
| 104 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_; | 96 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_; |
| 105 | 97 |
| 106 base::ObserverList<WmActivationObserver> activation_observers_; | 98 base::ObserverList<WmActivationObserver> activation_observers_; |
| 107 | 99 |
| 108 DISALLOW_COPY_AND_ASSIGN(WmShellMus); | 100 DISALLOW_COPY_AND_ASSIGN(WmShellMus); |
| 109 }; | 101 }; |
| 110 | 102 |
| 111 } // namespace mus | 103 } // namespace mus |
| 112 } // namespace ash | 104 } // namespace ash |
| 113 | 105 |
| 114 #endif // ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ | 106 #endif // ASH_MUS_BRIDGE_WM_SHELL_MUS_H_ |
| OLD | NEW |