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" | |
9 #include "content/renderer/input/input_handler_manager.h" | 8 #include "content/renderer/input/input_handler_manager.h" |
10 #include "content/renderer/mus/render_widget_mus_connection.h" | 9 #include "content/renderer/mus/render_widget_mus_connection.h" |
11 #include "mojo/converters/blink/blink_input_events_type_converters.h" | 10 #include "mojo/converters/blink/blink_input_events_type_converters.h" |
12 #include "ui/events/blink/did_overscroll_params.h" | 11 #include "ui/events/blink/did_overscroll_params.h" |
| 12 #include "ui/events/blink/web_input_event_traits.h" |
13 #include "ui/events/latency_info.h" | 13 #include "ui/events/latency_info.h" |
14 #include "ui/events/mojo/event.mojom.h" | 14 #include "ui/events/mojo/event.mojom.h" |
15 | 15 |
16 using ui::mojom::EventResult; | 16 using ui::mojom::EventResult; |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 void DoNothingWithEventResult(EventResult result) {} | 20 void DoNothingWithEventResult(EventResult result) {} |
21 | 21 |
22 } // namespace | 22 } // namespace |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // TODO(sad): We probably need to plumb LatencyInfo through Mus. | 131 // TODO(sad): We probably need to plumb LatencyInfo through Mus. |
132 ui::LatencyInfo info; | 132 ui::LatencyInfo info; |
133 InputEventAckState ack_state = input_handler_manager_->HandleInputEvent( | 133 InputEventAckState ack_state = input_handler_manager_->HandleInputEvent( |
134 routing_id_, web_event.get(), &info); | 134 routing_id_, web_event.get(), &info); |
135 // TODO(jonross): We probably need to ack the event based on the consumed | 135 // TODO(jonross): We probably need to ack the event based on the consumed |
136 // state. | 136 // state. |
137 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED) | 137 if (ack_state != INPUT_EVENT_ACK_STATE_NOT_CONSUMED) |
138 return; | 138 return; |
139 base::Callback<void(EventResult)> ack = | 139 base::Callback<void(EventResult)> ack = |
140 base::Bind(&::DoNothingWithEventResult); | 140 base::Bind(&::DoNothingWithEventResult); |
141 const bool send_ack = WebInputEventTraits::ShouldBlockEventStream(*web_event); | 141 const bool send_ack = |
| 142 ui::WebInputEventTraits::ShouldBlockEventStream(*web_event); |
142 if (send_ack) { | 143 if (send_ack) { |
143 // Ultimately, this ACK needs to go back to the Mus client lib which is not | 144 // Ultimately, this ACK needs to go back to the Mus client lib which is not |
144 // thread-safe and lives on the compositor thread. For ACKs that are passed | 145 // thread-safe and lives on the compositor thread. For ACKs that are passed |
145 // to the main thread we pass them back to the compositor thread via | 146 // to the main thread we pass them back to the compositor thread via |
146 // OnWindowInputEventAckOnMainThread. | 147 // OnWindowInputEventAckOnMainThread. |
147 ack = | 148 ack = |
148 base::Bind(&CompositorMusConnection::OnWindowInputEventAckOnMainThread, | 149 base::Bind(&CompositorMusConnection::OnWindowInputEventAckOnMainThread, |
149 this, *ack_callback->get()); | 150 this, *ack_callback->get()); |
150 ack_callback->reset(); | 151 ack_callback->reset(); |
151 } | 152 } |
152 main_task_runner_->PostTask( | 153 main_task_runner_->PostTask( |
153 FROM_HERE, | 154 FROM_HERE, |
154 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, | 155 base::Bind(&CompositorMusConnection::OnWindowInputEventOnMainThread, this, |
155 base::Passed(std::move(web_event)), ack)); | 156 base::Passed(std::move(web_event)), ack)); |
156 } | 157 } |
157 | 158 |
158 } // namespace content | 159 } // namespace content |
OLD | NEW |