OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/renderer_host/input/input_router_impl.h" | 5 #include "content/browser/renderer_host/input/input_router_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "content/browser/renderer_host/input/gesture_event_queue.h" | 14 #include "content/browser/renderer_host/input/gesture_event_queue.h" |
15 #include "content/browser/renderer_host/input/input_ack_handler.h" | 15 #include "content/browser/renderer_host/input/input_ack_handler.h" |
16 #include "content/browser/renderer_host/input/input_router_client.h" | 16 #include "content/browser/renderer_host/input/input_router_client.h" |
17 #include "content/browser/renderer_host/input/touch_event_queue.h" | 17 #include "content/browser/renderer_host/input/touch_event_queue.h" |
18 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" | 18 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" |
19 #include "content/browser/renderer_host/input/web_input_event_util.h" | |
20 #include "content/common/content_constants_internal.h" | 19 #include "content/common/content_constants_internal.h" |
21 #include "content/common/edit_command.h" | 20 #include "content/common/edit_command.h" |
22 #include "content/common/input/input_event_ack_state.h" | 21 #include "content/common/input/input_event_ack_state.h" |
23 #include "content/common/input/touch_action.h" | 22 #include "content/common/input/touch_action.h" |
24 #include "content/common/input/web_touch_event_traits.h" | 23 #include "content/common/input/web_touch_event_traits.h" |
25 #include "content/common/input_messages.h" | 24 #include "content/common/input_messages.h" |
26 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
27 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
28 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
29 #include "content/public/browser/user_metrics.h" | 28 #include "content/public/browser/user_metrics.h" |
30 #include "content/public/common/content_switches.h" | 29 #include "content/public/common/content_switches.h" |
31 #include "ipc/ipc_sender.h" | 30 #include "ipc/ipc_sender.h" |
31 #include "ui/events/blink/blink_event_util.h" | |
32 #include "ui/events/event.h" | 32 #include "ui/events/event.h" |
33 #include "ui/events/keycodes/keyboard_codes.h" | 33 #include "ui/events/keycodes/keyboard_codes.h" |
34 | 34 |
35 using base::Time; | 35 using base::Time; |
36 using base::TimeDelta; | 36 using base::TimeDelta; |
37 using base::TimeTicks; | 37 using base::TimeTicks; |
38 using blink::WebGestureEvent; | 38 using blink::WebGestureEvent; |
39 using blink::WebInputEvent; | 39 using blink::WebInputEvent; |
40 using blink::WebKeyboardEvent; | 40 using blink::WebKeyboardEvent; |
41 using blink::WebMouseEvent; | 41 using blink::WebMouseEvent; |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 break; | 412 break; |
413 default: | 413 default: |
414 break; | 414 break; |
415 } | 415 } |
416 | 416 |
417 return consumed; | 417 return consumed; |
418 } | 418 } |
419 | 419 |
420 bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event, | 420 bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event, |
421 const ui::LatencyInfo& latency_info) { | 421 const ui::LatencyInfo& latency_info) { |
422 // This coversion is temporary. WebInputEvent should be generated | |
tdresser
2016/01/21 21:14:51
coversion -> conversion
oshima
2016/01/22 01:22:23
Done.
| |
423 // directly fromui::Event with the viewport coordinates. See | |
tdresser
2016/01/21 21:14:51
fromui -> from ui
oshima
2016/01/22 01:22:23
Done.
| |
424 // crbug.com/563730. | |
422 scoped_ptr<blink::WebInputEvent> event_in_viewport = | 425 scoped_ptr<blink::WebInputEvent> event_in_viewport = |
423 ConvertWebInputEventToViewport(input_event, device_scale_factor_); | 426 ui::ScaleWebInputEvent(input_event, device_scale_factor_); |
424 const WebInputEvent* event_to_send = | 427 const WebInputEvent* event_to_send = |
425 event_in_viewport ? event_in_viewport.get() : &input_event; | 428 event_in_viewport ? event_in_viewport.get() : &input_event; |
426 | 429 |
427 if (Send(new InputMsg_HandleInputEvent(routing_id(), event_to_send, | 430 if (Send(new InputMsg_HandleInputEvent(routing_id(), event_to_send, |
428 latency_info))) { | 431 latency_info))) { |
429 // Ack messages for ignored ack event types should never be sent by the | 432 // Ack messages for ignored ack event types should never be sent by the |
430 // renderer. Consequently, such event types should not affect event time | 433 // renderer. Consequently, such event types should not affect event time |
431 // or in-flight event count metrics. | 434 // or in-flight event count metrics. |
432 if (WebInputEventTraits::WillReceiveAckFromRenderer(*event_to_send)) { | 435 if (WebInputEventTraits::WillReceiveAckFromRenderer(*event_to_send)) { |
433 input_event_start_time_ = TimeTicks::Now(); | 436 input_event_start_time_ = TimeTicks::Now(); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
651 return; | 654 return; |
652 | 655 |
653 if (HasPendingEvents()) | 656 if (HasPendingEvents()) |
654 return; | 657 return; |
655 | 658 |
656 flush_requested_ = false; | 659 flush_requested_ = false; |
657 client_->DidFlush(); | 660 client_->DidFlush(); |
658 } | 661 } |
659 | 662 |
660 } // namespace content | 663 } // namespace content |
OLD | NEW |