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 #include "content/renderer/mus/render_widget_mus_connection.h" | 5 #include "content/renderer/mus/render_widget_mus_connection.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 void RenderWidgetMusConnection::OnDidOverscroll( | 121 void RenderWidgetMusConnection::OnDidOverscroll( |
122 const DidOverscrollParams& params) { | 122 const DidOverscrollParams& params) { |
123 NOTIMPLEMENTED(); | 123 NOTIMPLEMENTED(); |
124 } | 124 } |
125 | 125 |
126 void RenderWidgetMusConnection::OnInputEventAck( | 126 void RenderWidgetMusConnection::OnInputEventAck( |
127 std::unique_ptr<InputEventAck> input_event_ack) { | 127 std::unique_ptr<InputEventAck> input_event_ack) { |
128 DCHECK(!pending_ack_.is_null()); | 128 DCHECK(!pending_ack_.is_null()); |
129 pending_ack_.Run(input_event_ack->state == | 129 pending_ack_.Run(input_event_ack->state == |
130 InputEventAckState::INPUT_EVENT_ACK_STATE_CONSUMED); | 130 InputEventAckState::INPUT_EVENT_ACK_STATE_CONSUMED |
| 131 ? mus::mojom::EventResult::HANDLED |
| 132 : mus::mojom::EventResult::UNHANDLED); |
131 pending_ack_.Reset(); | 133 pending_ack_.Reset(); |
132 } | 134 } |
133 | 135 |
134 void RenderWidgetMusConnection::NotifyInputEventHandled( | 136 void RenderWidgetMusConnection::NotifyInputEventHandled( |
135 blink::WebInputEvent::Type handled_type) { | 137 blink::WebInputEvent::Type handled_type) { |
136 NOTIMPLEMENTED(); | 138 NOTIMPLEMENTED(); |
137 } | 139 } |
138 | 140 |
139 void RenderWidgetMusConnection::SetInputHandler( | 141 void RenderWidgetMusConnection::SetInputHandler( |
140 RenderWidgetInputHandler* input_handler) { | 142 RenderWidgetInputHandler* input_handler) { |
(...skipping 21 matching lines...) Expand all Loading... |
162 } | 164 } |
163 | 165 |
164 void RenderWidgetMusConnection::OnConnectionLost() { | 166 void RenderWidgetMusConnection::OnConnectionLost() { |
165 DCHECK(thread_checker_.CalledOnValidThread()); | 167 DCHECK(thread_checker_.CalledOnValidThread()); |
166 g_connections.Get().erase(routing_id_); | 168 g_connections.Get().erase(routing_id_); |
167 delete this; | 169 delete this; |
168 } | 170 } |
169 | 171 |
170 void RenderWidgetMusConnection::OnWindowInputEvent( | 172 void RenderWidgetMusConnection::OnWindowInputEvent( |
171 std::unique_ptr<blink::WebInputEvent> input_event, | 173 std::unique_ptr<blink::WebInputEvent> input_event, |
172 const base::Callback<void(bool)>& ack) { | 174 const base::Callback<void(mus::mojom::EventResult)>& ack) { |
173 DCHECK(thread_checker_.CalledOnValidThread()); | 175 DCHECK(thread_checker_.CalledOnValidThread()); |
174 // If we don't yet have a RenderWidgetInputHandler then we don't yet have | 176 // If we don't yet have a RenderWidgetInputHandler then we don't yet have |
175 // an initialized RenderWidget. | 177 // an initialized RenderWidget. |
176 if (!input_handler_) { | 178 if (!input_handler_) { |
177 ack.Run(false); | 179 ack.Run(mus::mojom::EventResult::UNHANDLED); |
178 return; | 180 return; |
179 } | 181 } |
180 // TODO(fsamuel): It would be nice to add this DCHECK but the reality is an | 182 // TODO(fsamuel): It would be nice to add this DCHECK but the reality is an |
181 // event could timeout and we could receive the next event before we ack the | 183 // event could timeout and we could receive the next event before we ack the |
182 // previous event. | 184 // previous event. |
183 // DCHECK(pending_ack_.is_null()); | 185 // DCHECK(pending_ack_.is_null()); |
184 pending_ack_ = ack; | 186 pending_ack_ = ack; |
185 // TODO(fsamuel, sadrul): Track real latency info. | 187 // TODO(fsamuel, sadrul): Track real latency info. |
186 ui::LatencyInfo latency_info; | 188 ui::LatencyInfo latency_info; |
187 input_handler_->HandleInputEvent(*input_event, latency_info, | 189 input_handler_->HandleInputEvent(*input_event, latency_info, |
188 DISPATCH_TYPE_BLOCKING); | 190 DISPATCH_TYPE_BLOCKING); |
189 } | 191 } |
190 | 192 |
191 } // namespace content | 193 } // namespace content |
OLD | NEW |