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/compositor_mus_connection.h" | 5 #include "content/renderer/mus/compositor_mus_connection.h" |
6 | 6 |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "content/common/input/web_input_event_traits.h" | 8 #include "content/common/input/web_input_event_traits.h" |
9 #include "content/renderer/input/input_handler_manager.h" | 9 #include "content/renderer/input/input_handler_manager.h" |
10 #include "content/renderer/mus/render_widget_mus_connection.h" | 10 #include "content/renderer/mus/render_widget_mus_connection.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 scoped_ptr<blink::WebInputEvent> web_event = | 114 scoped_ptr<blink::WebInputEvent> web_event = |
115 event.To<scoped_ptr<blink::WebInputEvent>>(); | 115 event.To<scoped_ptr<blink::WebInputEvent>>(); |
116 // TODO(sad): We probably need to plumb LatencyInfo through Mus. | 116 // TODO(sad): We probably need to plumb LatencyInfo through Mus. |
117 ui::LatencyInfo info; | 117 ui::LatencyInfo info; |
118 InputEventAckState ack_state = input_handler_manager_->HandleInputEvent( | 118 InputEventAckState ack_state = input_handler_manager_->HandleInputEvent( |
119 routing_id_, web_event.get(), &info); | 119 routing_id_, web_event.get(), &info); |
120 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED) | 120 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED) |
121 return; | 121 return; |
122 base::Closure ack = base::Bind(&base::DoNothing); | 122 base::Closure ack = base::Bind(&base::DoNothing); |
123 const bool send_ack = | 123 const bool send_ack = |
124 WebInputEventTraits::WillReceiveAckFromRenderer(*web_event); | 124 WebInputEventTraits::ShouldBlockEventOnRenderer(*web_event); |
125 if (send_ack) { | 125 if (send_ack) { |
126 // Ultimately, this ACK needs to go back to the Mus client lib which is not | 126 // Ultimately, this ACK needs to go back to the Mus client lib which is not |
127 // thread-safe and lives on the compositor thread. For ACKs that are passed | 127 // thread-safe and lives on the compositor thread. For ACKs that are passed |
128 // to the main thread we pass them back to the compositor thread via | 128 // to the main thread we pass them back to the compositor thread via |
129 // OnWindowInputEventAckOnMainThread. | 129 // OnWindowInputEventAckOnMainThread. |
130 ack = | 130 ack = |
131 base::Bind(&CompositorMusConnection::OnWindowInputEventAckOnMainThread, | 131 base::Bind(&CompositorMusConnection::OnWindowInputEventAckOnMainThread, |
132 this, *ack_callback->get()); | 132 this, *ack_callback->get()); |
133 ack_callback->reset(); | 133 ack_callback->reset(); |
134 } | 134 } |
135 main_task_runner_->PostTask( | 135 main_task_runner_->PostTask( |
136 FROM_HERE, | 136 FROM_HERE, |
137 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, | 137 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, |
138 base::Passed(std::move(web_event)), ack)); | 138 base::Passed(std::move(web_event)), ack)); |
139 } | 139 } |
140 | 140 |
141 } // namespace content | 141 } // namespace content |
OLD | NEW |