| 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 COMPONENTS_MUS_WS_DISPLAY_H_ | 5 #ifndef COMPONENTS_MUS_WS_DISPLAY_H_ |
| 6 #define COMPONENTS_MUS_WS_DISPLAY_H_ | 6 #define COMPONENTS_MUS_WS_DISPLAY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 mojo::Connector* connector, | 67 mojo::Connector* connector, |
| 68 const scoped_refptr<GpuState>& gpu_state, | 68 const scoped_refptr<GpuState>& gpu_state, |
| 69 const scoped_refptr<SurfacesState>& surfaces_state); | 69 const scoped_refptr<SurfacesState>& surfaces_state); |
| 70 ~Display() override; | 70 ~Display() override; |
| 71 | 71 |
| 72 // Initializes state that depends on the existence of a Display. | 72 // Initializes state that depends on the existence of a Display. |
| 73 void Init(scoped_ptr<DisplayBinding> binding); | 73 void Init(scoped_ptr<DisplayBinding> binding); |
| 74 | 74 |
| 75 uint32_t id() const { return id_; } | 75 uint32_t id() const { return id_; } |
| 76 | 76 |
| 77 // TODO(sky): move to WMM. | 77 DisplayManager* display_manager(); |
| 78 void SetFrameDecorationValues(mojom::FrameDecorationValuesPtr values); | 78 const DisplayManager* display_manager() const; |
| 79 const mojom::FrameDecorationValues& frame_decoration_values() const { | 79 |
| 80 return *frame_decoration_values_; | 80 // Returns a mojom::Display for the specified display. WindowManager specific |
| 81 } | 81 // values are not set. In general you should use |
| 82 // WindowManagerState::ToMojomDisplay(). |
| 83 mojom::DisplayPtr ToMojomDisplay() const; |
| 82 | 84 |
| 83 // Schedules a paint for the specified region in the coordinates of |window|. | 85 // Schedules a paint for the specified region in the coordinates of |window|. |
| 84 void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds); | 86 void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds); |
| 85 | 87 |
| 86 // Schedules destruction of surfaces in |window|. If a frame has been | 88 // Schedules destruction of surfaces in |window|. If a frame has been |
| 87 // scheduled but not drawn surface destruction is delayed until the frame is | 89 // scheduled but not drawn surface destruction is delayed until the frame is |
| 88 // drawn, otherwise destruction is immediate. | 90 // drawn, otherwise destruction is immediate. |
| 89 void ScheduleSurfaceDestruction(ServerWindow* window); | 91 void ScheduleSurfaceDestruction(ServerWindow* window); |
| 90 | 92 |
| 91 // Returns the metrics for this viewport. | 93 // Returns the metrics for this viewport. |
| 92 const mojom::ViewportMetrics& GetViewportMetrics() const; | 94 const mojom::ViewportMetrics& GetViewportMetrics() const; |
| 93 | 95 |
| 94 mojom::Rotation GetRotation() const; | 96 mojom::Rotation GetRotation() const; |
| 95 | 97 |
| 96 ConnectionManager* connection_manager() { return connection_manager_; } | 98 ConnectionManager* connection_manager() { return connection_manager_; } |
| 97 | 99 |
| 98 EventDispatcher* event_dispatcher() { return &event_dispatcher_; } | 100 EventDispatcher* event_dispatcher() { return &event_dispatcher_; } |
| 99 | 101 |
| 100 // Returns the root of the Display. The root's children are the roots | 102 // Returns the root of the Display. The root's children are the roots |
| 101 // of the corresponding WindowManagers. | 103 // of the corresponding WindowManagers. |
| 102 ServerWindow* root_window() { return root_.get(); } | 104 ServerWindow* root_window() { return root_.get(); } |
| 103 const ServerWindow* root_window() const { return root_.get(); } | 105 const ServerWindow* root_window() const { return root_.get(); } |
| 104 | 106 |
| 105 ServerWindow* GetRootWithId(const WindowId& id); | 107 ServerWindow* GetRootWithId(const WindowId& id); |
| 106 | 108 |
| 107 WindowManagerState* GetWindowManagerStateWithRoot(const ServerWindow* window); | 109 WindowManagerState* GetWindowManagerStateWithRoot(const ServerWindow* window); |
| 108 // TODO(sky): this is wrong, plumb through user_id. | 110 // TODO(sky): this is wrong, plumb through user_id. |
| 109 WindowManagerState* GetFirstWindowManagerState(); | 111 WindowManagerState* GetFirstWindowManagerState(); |
| 110 WindowManagerState* GetWindowManagerStateForUser(const UserId& user_id); | 112 WindowManagerState* GetWindowManagerStateForUser(const UserId& user_id) { |
| 113 return const_cast<WindowManagerState*>( |
| 114 const_cast<const Display*>(this)->GetWindowManagerStateForUser( |
| 115 user_id)); |
| 116 } |
| 117 const WindowManagerState* GetWindowManagerStateForUser( |
| 118 const UserId& user_id) const; |
| 111 size_t num_window_manger_states() const { | 119 size_t num_window_manger_states() const { |
| 112 return window_manager_state_map_.size(); | 120 return window_manager_state_map_.size(); |
| 113 } | 121 } |
| 114 | 122 |
| 115 void SetCapture(ServerWindow* window, bool in_nonclient_area); | 123 void SetCapture(ServerWindow* window, bool in_nonclient_area); |
| 116 | 124 |
| 117 void SetFocusedWindow(ServerWindow* window); | 125 void SetFocusedWindow(ServerWindow* window); |
| 118 ServerWindow* GetFocusedWindow(); | 126 ServerWindow* GetFocusedWindow(); |
| 119 void DestroyFocusController(); | 127 void DestroyFocusController(); |
| 120 FocusController* focus_controller() { return focus_controller_.get(); } | 128 FocusController* focus_controller() { return focus_controller_.get(); } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 QueuedEvent(); | 179 QueuedEvent(); |
| 172 ~QueuedEvent(); | 180 ~QueuedEvent(); |
| 173 | 181 |
| 174 scoped_ptr<ui::Event> event; | 182 scoped_ptr<ui::Event> event; |
| 175 scoped_ptr<ProcessedEventTarget> processed_target; | 183 scoped_ptr<ProcessedEventTarget> processed_target; |
| 176 }; | 184 }; |
| 177 | 185 |
| 178 // Inits the necessary state once the display is ready. | 186 // Inits the necessary state once the display is ready. |
| 179 void InitWindowManagersIfNecessary(); | 187 void InitWindowManagersIfNecessary(); |
| 180 | 188 |
| 181 DisplayManager* display_manager(); | |
| 182 const DisplayManager* display_manager() const; | |
| 183 | |
| 184 void OnEventAckTimeout(); | 189 void OnEventAckTimeout(); |
| 185 | 190 |
| 186 // Schedules an event to be processed later. | 191 // Schedules an event to be processed later. |
| 187 void QueueEvent(const ui::Event& event, | 192 void QueueEvent(const ui::Event& event, |
| 188 scoped_ptr<ProcessedEventTarget> processed_event_target); | 193 scoped_ptr<ProcessedEventTarget> processed_event_target); |
| 189 | 194 |
| 190 // Processes the next valid event in |event_queue_|. If the event has already | 195 // Processes the next valid event in |event_queue_|. If the event has already |
| 191 // been processed it is dispatched, otherwise the event is passed to the | 196 // been processed it is dispatched, otherwise the event is passed to the |
| 192 // EventDispatcher for processing. | 197 // EventDispatcher for processing. |
| 193 void ProcessNextEventFromQueue(); | 198 void ProcessNextEventFromQueue(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 272 |
| 268 // Set of windows with surfaces that need to be destroyed once the frame | 273 // Set of windows with surfaces that need to be destroyed once the frame |
| 269 // draws. | 274 // draws. |
| 270 std::set<ServerWindow*> windows_needing_frame_destruction_; | 275 std::set<ServerWindow*> windows_needing_frame_destruction_; |
| 271 | 276 |
| 272 std::queue<scoped_ptr<QueuedEvent>> event_queue_; | 277 std::queue<scoped_ptr<QueuedEvent>> event_queue_; |
| 273 base::OneShotTimer event_ack_timer_; | 278 base::OneShotTimer event_ack_timer_; |
| 274 | 279 |
| 275 WindowManagerStateMap window_manager_state_map_; | 280 WindowManagerStateMap window_manager_state_map_; |
| 276 | 281 |
| 277 mojom::FrameDecorationValuesPtr frame_decoration_values_; | |
| 278 | |
| 279 DISALLOW_COPY_AND_ASSIGN(Display); | 282 DISALLOW_COPY_AND_ASSIGN(Display); |
| 280 }; | 283 }; |
| 281 | 284 |
| 282 } // namespace ws | 285 } // namespace ws |
| 283 } // namespace mus | 286 } // namespace mus |
| 284 | 287 |
| 285 #endif // COMPONENTS_MUS_WS_DISPLAY_H_ | 288 #endif // COMPONENTS_MUS_WS_DISPLAY_H_ |
| OLD | NEW |