| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 111 } |
| 112 | 112 |
| 113 void RenderWidgetMusConnection::OnDidOverscroll( | 113 void RenderWidgetMusConnection::OnDidOverscroll( |
| 114 const DidOverscrollParams& params) { | 114 const DidOverscrollParams& params) { |
| 115 NOTIMPLEMENTED(); | 115 NOTIMPLEMENTED(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void RenderWidgetMusConnection::OnInputEventAck( | 118 void RenderWidgetMusConnection::OnInputEventAck( |
| 119 scoped_ptr<InputEventAck> input_event_ack) { | 119 scoped_ptr<InputEventAck> input_event_ack) { |
| 120 DCHECK(!pending_ack_.is_null()); | 120 DCHECK(!pending_ack_.is_null()); |
| 121 // TODO(fsamuel): Use the state in |input_event_ack|. | 121 pending_ack_.Run(input_event_ack->state == |
| 122 pending_ack_.Run(); | 122 InputEventAckState::INPUT_EVENT_ACK_STATE_CONSUMED); |
| 123 pending_ack_.Reset(); | 123 pending_ack_.Reset(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void RenderWidgetMusConnection::NonBlockingInputEventHandled( | 126 void RenderWidgetMusConnection::NonBlockingInputEventHandled( |
| 127 blink::WebInputEvent::Type handled_type) { | 127 blink::WebInputEvent::Type handled_type) { |
| 128 NOTIMPLEMENTED(); | 128 NOTIMPLEMENTED(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void RenderWidgetMusConnection::SetInputHandler( | 131 void RenderWidgetMusConnection::SetInputHandler( |
| 132 RenderWidgetInputHandler* input_handler) { | 132 RenderWidgetInputHandler* input_handler) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 154 } | 154 } |
| 155 | 155 |
| 156 void RenderWidgetMusConnection::OnConnectionLost() { | 156 void RenderWidgetMusConnection::OnConnectionLost() { |
| 157 DCHECK(thread_checker_.CalledOnValidThread()); | 157 DCHECK(thread_checker_.CalledOnValidThread()); |
| 158 g_connections.Get().erase(routing_id_); | 158 g_connections.Get().erase(routing_id_); |
| 159 delete this; | 159 delete this; |
| 160 } | 160 } |
| 161 | 161 |
| 162 void RenderWidgetMusConnection::OnWindowInputEvent( | 162 void RenderWidgetMusConnection::OnWindowInputEvent( |
| 163 scoped_ptr<blink::WebInputEvent> input_event, | 163 scoped_ptr<blink::WebInputEvent> input_event, |
| 164 const base::Closure& ack) { | 164 const base::Callback<void(bool)>& ack) { |
| 165 DCHECK(thread_checker_.CalledOnValidThread()); | 165 DCHECK(thread_checker_.CalledOnValidThread()); |
| 166 // If we don't yet have a RenderWidgetInputHandler then we don't yet have | 166 // If we don't yet have a RenderWidgetInputHandler then we don't yet have |
| 167 // an initialized RenderWidget. | 167 // an initialized RenderWidget. |
| 168 if (!input_handler_) { | 168 if (!input_handler_) { |
| 169 ack.Run(); | 169 ack.Run(false); |
| 170 return; | 170 return; |
| 171 } | 171 } |
| 172 // TODO(fsamuel): It would be nice to add this DCHECK but the reality is an | 172 // TODO(fsamuel): It would be nice to add this DCHECK but the reality is an |
| 173 // event could timeout and we could receive the next event before we ack the | 173 // event could timeout and we could receive the next event before we ack the |
| 174 // previous event. | 174 // previous event. |
| 175 // DCHECK(pending_ack_.is_null()); | 175 // DCHECK(pending_ack_.is_null()); |
| 176 pending_ack_ = ack; | 176 pending_ack_ = ack; |
| 177 // TODO(fsamuel, sadrul): Track real latency info. | 177 // TODO(fsamuel, sadrul): Track real latency info. |
| 178 ui::LatencyInfo latency_info; | 178 ui::LatencyInfo latency_info; |
| 179 input_handler_->HandleInputEvent(*input_event, latency_info, | 179 input_handler_->HandleInputEvent(*input_event, latency_info, |
| 180 DISPATCH_TYPE_NORMAL); | 180 DISPATCH_TYPE_NORMAL); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace content | 183 } // namespace content |
| OLD | NEW |