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