| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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_USER_WINDOW_CONTROLLER_IMPL_H_ | |
| 6 #define MASH_WM_USER_WINDOW_CONTROLLER_IMPL_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "ash/public/interfaces/user_window_controller.mojom.h" | |
| 13 #include "base/macros.h" | |
| 14 #include "components/mus/common/types.h" | |
| 15 #include "components/mus/public/cpp/window_observer.h" | |
| 16 #include "components/mus/public/cpp/window_tree_client_observer.h" | |
| 17 | |
| 18 namespace mash { | |
| 19 namespace wm { | |
| 20 | |
| 21 class RootWindowController; | |
| 22 class WindowPropertyObserver; | |
| 23 | |
| 24 class UserWindowControllerImpl : public ash::mojom::UserWindowController, | |
| 25 public mus::WindowObserver, | |
| 26 public mus::WindowTreeClientObserver { | |
| 27 public: | |
| 28 UserWindowControllerImpl(); | |
| 29 ~UserWindowControllerImpl() override; | |
| 30 | |
| 31 ash::mojom::UserWindowObserver* user_window_observer() const { | |
| 32 return user_window_observer_.get(); | |
| 33 } | |
| 34 | |
| 35 void Initialize(RootWindowController* root_controller); | |
| 36 | |
| 37 private: | |
| 38 void AssignIdIfNecessary(mus::Window* window); | |
| 39 | |
| 40 // Removes observers from the window and client. | |
| 41 void RemoveObservers(mus::Window* user_container); | |
| 42 | |
| 43 // Returns the window with the specified user id. | |
| 44 mus::Window* GetUserWindowById(uint32_t id); | |
| 45 | |
| 46 // A helper to get the container for user windows. | |
| 47 mus::Window* GetUserWindowContainer() const; | |
| 48 | |
| 49 // mus::WindowObserver: | |
| 50 void OnTreeChanging(const TreeChangeParams& params) override; | |
| 51 void OnWindowDestroying(mus::Window* window) override; | |
| 52 | |
| 53 // mus::WindowTreeClientObserver: | |
| 54 void OnWindowTreeFocusChanged(mus::Window* gained_focus, | |
| 55 mus::Window* lost_focus) override; | |
| 56 | |
| 57 // mojom::UserWindowController: | |
| 58 void AddUserWindowObserver( | |
| 59 ash::mojom::UserWindowObserverPtr observer) override; | |
| 60 void FocusUserWindow(uint32_t window_id) override; | |
| 61 | |
| 62 RootWindowController* root_controller_; | |
| 63 ash::mojom::UserWindowObserverPtr user_window_observer_; | |
| 64 std::unique_ptr<WindowPropertyObserver> window_property_observer_; | |
| 65 uint32_t next_id_ = 1u; | |
| 66 | |
| 67 DISALLOW_COPY_AND_ASSIGN(UserWindowControllerImpl); | |
| 68 }; | |
| 69 | |
| 70 } // namespace wm | |
| 71 } // namespace mash | |
| 72 | |
| 73 #endif // MASH_WM_USER_WINDOW_CONTROLLER_IMPL_H_ | |
| OLD | NEW |