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> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 bool got_frame_decoration_values() const { | 49 bool got_frame_decoration_values() const { |
| 50 return got_frame_decoration_values_; | 50 return got_frame_decoration_values_; |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool SetCapture(ServerWindow* window, ClientSpecificId client_id); | 53 bool SetCapture(ServerWindow* window, ClientSpecificId client_id); |
| 54 ServerWindow* capture_window() { return event_dispatcher_.capture_window(); } | 54 ServerWindow* capture_window() { return event_dispatcher_.capture_window(); } |
| 55 const ServerWindow* capture_window() const { | 55 const ServerWindow* capture_window() const { |
| 56 return event_dispatcher_.capture_window(); | 56 return event_dispatcher_.capture_window(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // | |
| 60 void StartMoveLoop(uint32_t change_id, WindowId window_id, | |
|
sky
2016/06/24 19:59:01
In general only the functions from clients use a W
| |
| 61 const gfx::Rect& revert_bounds); | |
| 62 void EndMoveLoop(); | |
| 63 uint32_t GetCurrentMoveLoopChangeId(); | |
| 64 WindowId GetCurrentMoveLoopWindowId(); | |
| 65 gfx::Rect GetCurrentMoveLoopRevertBounds(); | |
| 66 bool in_move_loop() { return !!current_move_loop_.get(); } | |
| 67 | |
| 59 void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window); | 68 void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window); |
| 60 void ReleaseCaptureBlockedByAnyModalWindow(); | 69 void ReleaseCaptureBlockedByAnyModalWindow(); |
| 61 | 70 |
| 62 void AddSystemModalWindow(ServerWindow* window); | 71 void AddSystemModalWindow(ServerWindow* window); |
| 63 | 72 |
| 64 // TODO(sky): EventDispatcher is really an implementation detail and should | 73 // TODO(sky): EventDispatcher is really an implementation detail and should |
| 65 // not be exposed. | 74 // not be exposed. |
| 66 EventDispatcher* event_dispatcher() { return &event_dispatcher_; } | 75 EventDispatcher* event_dispatcher() { return &event_dispatcher_; } |
| 67 | 76 |
| 68 // Returns true if this is the WindowManager of the active user. | 77 // Returns true if this is the WindowManager of the active user. |
| 69 bool IsActive() const; | 78 bool IsActive() const; |
| 70 | 79 |
| 71 void Activate(const gfx::Point& mouse_location_on_screen); | 80 void Activate(const gfx::Point& mouse_location_on_screen); |
| 72 void Deactivate(); | 81 void Deactivate(); |
| 73 | 82 |
| 74 // Processes an event from PlatformDisplay. | 83 // Processes an event from PlatformDisplay. |
| 75 void ProcessEvent(const ui::Event& event); | 84 void ProcessEvent(const ui::Event& event); |
| 76 | 85 |
| 77 // Called when the ack from an event dispatched to WindowTree |tree| is | 86 // Called when the ack from an event dispatched to WindowTree |tree| is |
| 78 // received. | 87 // received. |
| 79 // TODO(sky): make this private and use a callback. | 88 // TODO(sky): make this private and use a callback. |
| 80 void OnEventAck(mojom::WindowTree* tree, mojom::EventResult result); | 89 void OnEventAck(mojom::WindowTree* tree, mojom::EventResult result); |
| 81 | 90 |
| 82 private: | 91 private: |
| 92 struct CurrentMoveLoopState; | |
| 83 class ProcessedEventTarget; | 93 class ProcessedEventTarget; |
| 84 friend class Display; | 94 friend class Display; |
| 85 friend class test::WindowManagerStateTestApi; | 95 friend class test::WindowManagerStateTestApi; |
| 86 | 96 |
| 87 // There are two types of events that may be queued, both occur only when | 97 // There are two types of events that may be queued, both occur only when |
| 88 // waiting for an ack from a client. | 98 // waiting for an ack from a client. |
| 89 // . We get an event from the PlatformDisplay. This results in |event| being | 99 // . We get an event from the PlatformDisplay. This results in |event| being |
| 90 // set, but |processed_target| is null. | 100 // set, but |processed_target| is null. |
| 91 // . We get an event from the EventDispatcher. In this case both |event| and | 101 // . We get an event from the EventDispatcher. In this case both |event| and |
| 92 // |processed_target| are valid. | 102 // |processed_target| are valid. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 | 169 |
| 160 // Set to true the first time SetFrameDecorationValues() is called. | 170 // Set to true the first time SetFrameDecorationValues() is called. |
| 161 bool got_frame_decoration_values_ = false; | 171 bool got_frame_decoration_values_ = false; |
| 162 mojom::FrameDecorationValuesPtr frame_decoration_values_; | 172 mojom::FrameDecorationValuesPtr frame_decoration_values_; |
| 163 | 173 |
| 164 mojom::WindowTree* tree_awaiting_input_ack_ = nullptr; | 174 mojom::WindowTree* tree_awaiting_input_ack_ = nullptr; |
| 165 std::unique_ptr<ui::Event> event_awaiting_input_ack_; | 175 std::unique_ptr<ui::Event> event_awaiting_input_ack_; |
| 166 base::WeakPtr<Accelerator> post_target_accelerator_; | 176 base::WeakPtr<Accelerator> post_target_accelerator_; |
| 167 std::queue<std::unique_ptr<QueuedEvent>> event_queue_; | 177 std::queue<std::unique_ptr<QueuedEvent>> event_queue_; |
| 168 base::OneShotTimer event_ack_timer_; | 178 base::OneShotTimer event_ack_timer_; |
| 179 std::unique_ptr<CurrentMoveLoopState> current_move_loop_; | |
| 169 | 180 |
| 170 EventDispatcher event_dispatcher_; | 181 EventDispatcher event_dispatcher_; |
| 171 | 182 |
| 172 // PlatformDisplay that currently has capture. | 183 // PlatformDisplay that currently has capture. |
| 173 PlatformDisplay* platform_display_with_capture_ = nullptr; | 184 PlatformDisplay* platform_display_with_capture_ = nullptr; |
| 174 | 185 |
| 175 base::WeakPtrFactory<WindowManagerState> weak_factory_; | 186 base::WeakPtrFactory<WindowManagerState> weak_factory_; |
| 176 | 187 |
| 177 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); | 188 DISALLOW_COPY_AND_ASSIGN(WindowManagerState); |
| 178 }; | 189 }; |
| 179 | 190 |
| 180 } // namespace ws | 191 } // namespace ws |
| 181 } // namespace mus | 192 } // namespace mus |
| 182 | 193 |
| 183 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ | 194 #endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_ |
| OLD | NEW |