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