Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ | 5 #ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ |
| 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ | 6 #define COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "components/mus/public/interfaces/display.mojom.h" | 14 #include "components/mus/public/interfaces/display.mojom.h" |
| 15 #include "components/mus/ws/event_dispatcher.h" | 15 #include "components/mus/ws/event_dispatcher.h" |
| 16 #include "components/mus/ws/event_dispatcher_delegate.h" | 16 #include "components/mus/ws/event_dispatcher_delegate.h" |
| 17 #include "components/mus/ws/user_id.h" | 17 #include "components/mus/ws/user_id.h" |
| 18 #include "components/mus/ws/window_server.h" | 18 #include "components/mus/ws/window_server.h" |
| 19 | 19 |
| 20 namespace mus { | 20 namespace mus { |
| 21 namespace ws { | 21 namespace ws { |
| 22 | 22 |
| 23 class DisplayManager; | 23 class DisplayManager; |
| 24 class UserActivityMonitor; | |
| 24 class WindowTree; | 25 class WindowTree; |
| 25 | 26 |
| 26 namespace test { | 27 namespace test { |
| 27 class WindowManagerStateTestApi; | 28 class WindowManagerStateTestApi; |
| 28 } | 29 } |
| 29 | 30 |
| 30 // Manages state specific to a WindowManager that is shared across displays. | 31 // Manages state specific to a WindowManager that is shared across displays. |
| 31 // WindowManagerState is owned by the WindowTree the window manager is | 32 // WindowManagerState is owned by the WindowTree the window manager is |
| 32 // associated with. | 33 // associated with. |
| 33 class WindowManagerState : public EventDispatcherDelegate { | 34 class WindowManagerState : public EventDispatcherDelegate { |
|
sky
2016/06/27 15:54:26
This class is intended to own state from the windo
sadrul
2016/06/27 15:57:01
I had considered having MusApp::UserState own the
sadrul
2016/06/27 20:46:13
I ended up moving the ownership into WindowServer
| |
| 34 public: | 35 public: |
| 35 explicit WindowManagerState(WindowTree* window_tree); | 36 explicit WindowManagerState(WindowTree* window_tree); |
| 36 ~WindowManagerState() override; | 37 ~WindowManagerState() override; |
| 37 | 38 |
| 38 const UserId& user_id() const; | 39 const UserId& user_id() const; |
| 39 | 40 |
| 40 WindowTree* window_tree() { return window_tree_; } | 41 WindowTree* window_tree() { return window_tree_; } |
| 41 const WindowTree* window_tree() const { return window_tree_; } | 42 const WindowTree* window_tree() const { return window_tree_; } |
| 42 | 43 |
| 44 UserActivityMonitor* user_activity_monitor() { | |
| 45 return user_activity_monitor_.get(); | |
| 46 } | |
| 47 | |
| 43 void OnWillDestroyTree(WindowTree* tree); | 48 void OnWillDestroyTree(WindowTree* tree); |
| 44 | 49 |
| 45 void SetFrameDecorationValues(mojom::FrameDecorationValuesPtr values); | 50 void SetFrameDecorationValues(mojom::FrameDecorationValuesPtr values); |
| 46 const mojom::FrameDecorationValues& frame_decoration_values() const { | 51 const mojom::FrameDecorationValues& frame_decoration_values() const { |
| 47 return *frame_decoration_values_; | 52 return *frame_decoration_values_; |
| 48 } | 53 } |
| 49 bool got_frame_decoration_values() const { | 54 bool got_frame_decoration_values() const { |
| 50 return got_frame_decoration_values_; | 55 return got_frame_decoration_values_; |
| 51 } | 56 } |
| 52 | 57 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 | 164 |
| 160 // Set to true the first time SetFrameDecorationValues() is called. | 165 // Set to true the first time SetFrameDecorationValues() is called. |
| 161 bool got_frame_decoration_values_ = false; | 166 bool got_frame_decoration_values_ = false; |
| 162 mojom::FrameDecorationValuesPtr frame_decoration_values_; | 167 mojom::FrameDecorationValuesPtr frame_decoration_values_; |
| 163 | 168 |
| 164 mojom::WindowTree* tree_awaiting_input_ack_ = nullptr; | 169 mojom::WindowTree* tree_awaiting_input_ack_ = nullptr; |
| 165 std::unique_ptr<ui::Event> event_awaiting_input_ack_; | 170 std::unique_ptr<ui::Event> event_awaiting_input_ack_; |
| 166 base::WeakPtr<Accelerator> post_target_accelerator_; | 171 base::WeakPtr<Accelerator> post_target_accelerator_; |
| 167 std::queue<std::unique_ptr<QueuedEvent>> event_queue_; | 172 std::queue<std::unique_ptr<QueuedEvent>> event_queue_; |
| 168 base::OneShotTimer event_ack_timer_; | 173 base::OneShotTimer event_ack_timer_; |
| 174 std::unique_ptr<UserActivityMonitor> user_activity_monitor_; | |
| 169 | 175 |
| 170 EventDispatcher event_dispatcher_; | 176 EventDispatcher event_dispatcher_; |
| 171 | 177 |
| 172 // PlatformDisplay that currently has capture. | 178 // PlatformDisplay that currently has capture. |
| 173 PlatformDisplay* platform_display_with_capture_ = nullptr; | 179 PlatformDisplay* platform_display_with_capture_ = nullptr; |
| 174 | 180 |
| 175 base::WeakPtrFactory<WindowManagerState> weak_factory_; | 181 base::WeakPtrFactory<WindowManagerState> weak_factory_; |
| 176 | 182 |
| 177 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); | 183 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); |
| 178 }; | 184 }; |
| 179 | 185 |
| 180 } // namespace ws | 186 } // namespace ws |
| 181 } // namespace mus | 187 } // namespace mus |
| 182 | 188 |
| 183 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ | 189 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ |
| OLD | NEW |