| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 namespace content { | 45 namespace content { |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 const char* GetEventAckName(InputEventAckState ack_result) { | 48 const char* GetEventAckName(InputEventAckState ack_result) { |
| 49 switch(ack_result) { | 49 switch(ack_result) { |
| 50 case INPUT_EVENT_ACK_STATE_UNKNOWN: return "UNKNOWN"; | 50 case INPUT_EVENT_ACK_STATE_UNKNOWN: return "UNKNOWN"; |
| 51 case INPUT_EVENT_ACK_STATE_CONSUMED: return "CONSUMED"; | 51 case INPUT_EVENT_ACK_STATE_CONSUMED: return "CONSUMED"; |
| 52 case INPUT_EVENT_ACK_STATE_NOT_CONSUMED: return "NOT_CONSUMED"; | 52 case INPUT_EVENT_ACK_STATE_NOT_CONSUMED: return "NOT_CONSUMED"; |
| 53 case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS: return "NO_CONSUMER_EXISTS"; | 53 case INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS: return "NO_CONSUMER_EXISTS"; |
| 54 case INPUT_EVENT_ACK_STATE_IGNORED: return "IGNORED"; | 54 case INPUT_EVENT_ACK_STATE_IGNORED: return "IGNORED"; |
| 55 case INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING: |
| 56 return "SET_NON_BLOCKING"; |
| 55 } | 57 } |
| 56 DLOG(WARNING) << "Unhandled InputEventAckState in GetEventAckName."; | 58 DLOG(WARNING) << "Unhandled InputEventAckState in GetEventAckName."; |
| 57 return ""; | 59 return ""; |
| 58 } | 60 } |
| 59 | 61 |
| 60 bool UseGestureBasedWheelScrolling() { | 62 bool UseGestureBasedWheelScrolling() { |
| 61 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 63 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 62 switches::kEnableWheelGestures); | 64 switches::kEnableWheelGestures); |
| 63 } | 65 } |
| 64 | 66 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event, | 407 bool InputRouterImpl::OfferToRenderer(const WebInputEvent& input_event, |
| 406 const ui::LatencyInfo& latency_info) { | 408 const ui::LatencyInfo& latency_info) { |
| 407 // This conversion is temporary. WebInputEvent should be generated | 409 // This conversion is temporary. WebInputEvent should be generated |
| 408 // directly from ui::Event with the viewport coordinates. See | 410 // directly from ui::Event with the viewport coordinates. See |
| 409 // crbug.com/563730. | 411 // crbug.com/563730. |
| 410 scoped_ptr<blink::WebInputEvent> event_in_viewport = | 412 scoped_ptr<blink::WebInputEvent> event_in_viewport = |
| 411 ui::ScaleWebInputEvent(input_event, device_scale_factor_); | 413 ui::ScaleWebInputEvent(input_event, device_scale_factor_); |
| 412 const WebInputEvent* event_to_send = | 414 const WebInputEvent* event_to_send = |
| 413 event_in_viewport ? event_in_viewport.get() : &input_event; | 415 event_in_viewport ? event_in_viewport.get() : &input_event; |
| 414 | 416 |
| 415 if (Send(new InputMsg_HandleInputEvent(routing_id(), event_to_send, | 417 if (Send(new InputMsg_HandleInputEvent( |
| 416 latency_info))) { | 418 routing_id(), event_to_send, latency_info, |
| 419 InputEventDispatchType::DISPATCH_TYPE_NORMAL))) { |
| 417 // Ack messages for ignored ack event types should never be sent by the | 420 // Ack messages for ignored ack event types should never be sent by the |
| 418 // renderer. Consequently, such event types should not affect event time | 421 // renderer. Consequently, such event types should not affect event time |
| 419 // or in-flight event count metrics. | 422 // or in-flight event count metrics. |
| 420 if (WebInputEventTraits::WillReceiveAckFromRenderer(*event_to_send)) { | 423 if (WebInputEventTraits::WillReceiveAckFromRenderer(*event_to_send)) { |
| 421 input_event_start_time_ = TimeTicks::Now(); | 424 input_event_start_time_ = TimeTicks::Now(); |
| 422 client_->IncrementInFlightEventCount(); | 425 client_->IncrementInFlightEventCount(); |
| 423 } | 426 } |
| 424 return true; | 427 return true; |
| 425 } | 428 } |
| 426 return false; | 429 return false; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 return; | 622 return; |
| 620 | 623 |
| 621 if (HasPendingEvents()) | 624 if (HasPendingEvents()) |
| 622 return; | 625 return; |
| 623 | 626 |
| 624 flush_requested_ = false; | 627 flush_requested_ = false; |
| 625 client_->DidFlush(); | 628 client_->DidFlush(); |
| 626 } | 629 } |
| 627 | 630 |
| 628 } // namespace content | 631 } // namespace content |
| OLD | NEW |