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 ASH_MUS_USER_WINDOW_CONTROLLER_IMPL_H_ | |
6 #define ASH_MUS_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 "services/ui/common/types.h" | |
15 #include "services/ui/public/cpp/window_observer.h" | |
16 #include "services/ui/public/cpp/window_tree_client_observer.h" | |
17 | |
18 namespace ash { | |
19 namespace mus { | |
20 | |
21 class RootWindowController; | |
22 class WindowPropertyObserver; | |
23 | |
24 class UserWindowControllerImpl : public mojom::UserWindowController, | |
25 public ui::WindowObserver, | |
26 public ui::WindowTreeClientObserver { | |
27 public: | |
28 UserWindowControllerImpl(); | |
29 ~UserWindowControllerImpl() override; | |
30 | |
31 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(ui::Window* window); | |
39 | |
40 // Removes observers from the window and client. | |
41 void RemoveObservers(ui::Window* user_container); | |
42 | |
43 // Returns the window with the specified user id. | |
44 ui::Window* GetUserWindowById(uint32_t id); | |
45 | |
46 // A helper to get the container for user windows. | |
47 ui::Window* GetUserWindowContainer() const; | |
48 | |
49 // ui::WindowObserver: | |
50 void OnTreeChanging(const TreeChangeParams& params) override; | |
51 void OnWindowDestroying(ui::Window* window) override; | |
52 | |
53 // ui::WindowTreeClientObserver: | |
54 void OnWindowTreeFocusChanged(ui::Window* gained_focus, | |
55 ui::Window* lost_focus) override; | |
56 | |
57 // mojom::UserWindowController: | |
58 void AddUserWindowObserver(mojom::UserWindowObserverPtr observer) override; | |
59 void ActivateUserWindow(uint32_t window_id) override; | |
60 | |
61 RootWindowController* root_controller_; | |
62 mojom::UserWindowObserverPtr user_window_observer_; | |
63 std::unique_ptr<WindowPropertyObserver> window_property_observer_; | |
64 uint32_t next_id_ = 1u; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(UserWindowControllerImpl); | |
67 }; | |
68 | |
69 } // namespace mus | |
70 } // namespace ash | |
71 | |
72 #endif // ASH_MUS_USER_WINDOW_CONTROLLER_IMPL_H_ | |
OLD | NEW |