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 ASH_MUS_WINDOW_MANAGER_H_ | 5 #ifndef ASH_MUS_WINDOW_MANAGER_H_ |
6 #define ASH_MUS_WINDOW_MANAGER_H_ | 6 #define ASH_MUS_WINDOW_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 namespace shell { | 26 namespace shell { |
27 class Connector; | 27 class Connector; |
28 } | 28 } |
29 | 29 |
30 namespace ash { | 30 namespace ash { |
31 namespace mus { | 31 namespace mus { |
32 | 32 |
33 class RootWindowController; | 33 class RootWindowController; |
34 class RootWindowsObserver; | |
35 class ShadowController; | 34 class ShadowController; |
36 class WindowManagerApplication; | 35 class WindowManagerObserver; |
37 class WmShellMus; | 36 class WmShellMus; |
38 class WmLookupMus; | 37 class WmLookupMus; |
39 class WmTestHelper; | 38 class WmTestHelper; |
40 | 39 |
41 // WindowManager serves as the WindowManagerDelegate and | 40 // WindowManager serves as the WindowManagerDelegate and |
42 // WindowTreeClientDelegate for mash. WindowManager creates (and owns) | 41 // WindowTreeClientDelegate for mash. WindowManager creates (and owns) |
43 // a RootWindowController per Display. WindowManager takes ownership of | 42 // a RootWindowController per Display. WindowManager takes ownership of |
44 // the WindowTreeClient. | 43 // the WindowTreeClient. |
45 class WindowManager : public ::mus::WindowManagerDelegate, | 44 class WindowManager : public ::mus::WindowManagerDelegate, |
46 public ::mus::WindowObserver, | 45 public ::mus::WindowObserver, |
47 public ::mus::WindowTreeClientDelegate { | 46 public ::mus::WindowTreeClientDelegate { |
48 public: | 47 public: |
49 WindowManager(WindowManagerApplication* window_manager_app, | 48 explicit WindowManager(shell::Connector* connector); |
50 shell::Connector* connector); | |
51 ~WindowManager() override; | 49 ~WindowManager() override; |
52 | 50 |
53 void Init(::mus::WindowTreeClient* window_tree_client); | 51 void Init(::mus::WindowTreeClient* window_tree_client); |
54 | 52 |
55 WmShellMus* shell() { return shell_.get(); } | 53 WmShellMus* shell() { return shell_.get(); } |
56 | 54 |
57 ::mus::WindowManagerClient* window_manager_client() { | 55 ::mus::WindowManagerClient* window_manager_client() { |
58 return window_manager_client_; | 56 return window_manager_client_; |
59 } | 57 } |
60 | 58 |
61 shell::Connector* connector() { return connector_; } | 59 shell::Connector* connector() { return connector_; } |
62 | 60 |
63 void SetScreenLocked(bool is_locked); | 61 void SetScreenLocked(bool is_locked); |
64 | 62 |
65 // Creates a new top level window. | 63 // Creates a new top level window. |
66 ::mus::Window* NewTopLevelWindow( | 64 ::mus::Window* NewTopLevelWindow( |
67 std::map<std::string, std::vector<uint8_t>>* properties); | 65 std::map<std::string, std::vector<uint8_t>>* properties); |
68 | 66 |
69 std::set<RootWindowController*> GetRootWindowControllers(); | 67 std::set<RootWindowController*> GetRootWindowControllers(); |
70 | 68 |
71 void AddRootWindowsObserver(RootWindowsObserver* observer); | 69 void AddObserver(WindowManagerObserver* observer); |
72 void RemoveRootWindowsObserver(RootWindowsObserver* observer); | 70 void RemoveObserver(WindowManagerObserver* observer); |
73 | 71 |
74 private: | 72 private: |
75 friend class WmTestHelper; | 73 friend class WmTestHelper; |
76 | 74 |
77 void AddAccelerators(); | 75 void AddAccelerators(); |
78 | 76 |
79 RootWindowController* CreateRootWindowController( | 77 RootWindowController* CreateRootWindowController( |
80 ::mus::Window* window, | 78 ::mus::Window* window, |
81 const display::Display& display); | 79 const display::Display& display); |
82 | 80 |
(...skipping 15 matching lines...) Expand all Loading... |
98 std::unique_ptr<std::vector<uint8_t>>* new_data) override; | 96 std::unique_ptr<std::vector<uint8_t>>* new_data) override; |
99 ::mus::Window* OnWmCreateTopLevelWindow( | 97 ::mus::Window* OnWmCreateTopLevelWindow( |
100 std::map<std::string, std::vector<uint8_t>>* properties) override; | 98 std::map<std::string, std::vector<uint8_t>>* properties) override; |
101 void OnWmClientJankinessChanged( | 99 void OnWmClientJankinessChanged( |
102 const std::set<::mus::Window*>& client_windows, | 100 const std::set<::mus::Window*>& client_windows, |
103 bool not_responding) override; | 101 bool not_responding) override; |
104 void OnWmNewDisplay(::mus::Window* window, | 102 void OnWmNewDisplay(::mus::Window* window, |
105 const display::Display& display) override; | 103 const display::Display& display) override; |
106 void OnAccelerator(uint32_t id, const ui::Event& event) override; | 104 void OnAccelerator(uint32_t id, const ui::Event& event) override; |
107 | 105 |
108 // TODO(sky): this is unfortunate, remove. | |
109 WindowManagerApplication* window_manager_app_; | |
110 | |
111 shell::Connector* connector_; | 106 shell::Connector* connector_; |
112 | 107 |
113 ::mus::WindowTreeClient* window_tree_client_ = nullptr; | 108 ::mus::WindowTreeClient* window_tree_client_ = nullptr; |
114 | 109 |
115 ::mus::WindowManagerClient* window_manager_client_ = nullptr; | 110 ::mus::WindowManagerClient* window_manager_client_ = nullptr; |
116 | 111 |
117 std::unique_ptr<ShadowController> shadow_controller_; | 112 std::unique_ptr<ShadowController> shadow_controller_; |
118 | 113 |
119 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_; | 114 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_; |
120 | 115 |
121 base::ObserverList<RootWindowsObserver> root_windows_observers_; | 116 base::ObserverList<WindowManagerObserver> observers_; |
122 | 117 |
123 std::unique_ptr<display::Screen> screen_; | 118 std::unique_ptr<display::Screen> screen_; |
124 | 119 |
125 std::unique_ptr<WmShellMus> shell_; | 120 std::unique_ptr<WmShellMus> shell_; |
126 | 121 |
127 std::unique_ptr<WmLookupMus> lookup_; | 122 std::unique_ptr<WmLookupMus> lookup_; |
128 | 123 |
129 DISALLOW_COPY_AND_ASSIGN(WindowManager); | 124 DISALLOW_COPY_AND_ASSIGN(WindowManager); |
130 }; | 125 }; |
131 | 126 |
132 } // namespace mus | 127 } // namespace mus |
133 } // namespace ash | 128 } // namespace ash |
134 | 129 |
135 #endif // ASH_MUS_WINDOW_MANAGER_H_ | 130 #endif // ASH_MUS_WINDOW_MANAGER_H_ |
OLD | NEW |