Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: content/browser/renderer_host/input/mock_input_ack_handler.cc

Issue 250923004: Synthesize ctrl-wheel events on touchpad pinch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows build and tweaks Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/mock_input_ack_handler.h" 5 #include "content/browser/renderer_host/input/mock_input_ack_handler.h"
6 6
7 #include "content/browser/renderer_host/input/input_router.h" 7 #include "content/browser/renderer_host/input/input_router.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 using base::TimeDelta; 10 using base::TimeDelta;
(...skipping 12 matching lines...) Expand all
23 unexpected_event_ack_called_(false), 23 unexpected_event_ack_called_(false),
24 ack_state_(INPUT_EVENT_ACK_STATE_UNKNOWN) {} 24 ack_state_(INPUT_EVENT_ACK_STATE_UNKNOWN) {}
25 25
26 MockInputAckHandler::~MockInputAckHandler() {} 26 MockInputAckHandler::~MockInputAckHandler() {}
27 27
28 void MockInputAckHandler::OnKeyboardEventAck( 28 void MockInputAckHandler::OnKeyboardEventAck(
29 const NativeWebKeyboardEvent& event, 29 const NativeWebKeyboardEvent& event,
30 InputEventAckState ack_result) { 30 InputEventAckState ack_result) {
31 VLOG(1) << __FUNCTION__ << " called!"; 31 VLOG(1) << __FUNCTION__ << " called!";
32 acked_key_event_ = event; 32 acked_key_event_ = event;
33 RecordAckCalled(ack_result); 33 RecordAckCalled(event.type, ack_result);
34 } 34 }
35 35
36 void MockInputAckHandler::OnWheelEventAck( 36 void MockInputAckHandler::OnWheelEventAck(
37 const MouseWheelEventWithLatencyInfo& event, 37 const MouseWheelEventWithLatencyInfo& event,
38 InputEventAckState ack_result) { 38 InputEventAckState ack_result) {
39 VLOG(1) << __FUNCTION__ << " called!"; 39 VLOG(1) << __FUNCTION__ << " called!";
40 acked_wheel_event_ = event.event; 40 acked_wheel_event_ = event.event;
41 RecordAckCalled(ack_result); 41 RecordAckCalled(event.event.type, ack_result);
42 } 42 }
43 43
44 void MockInputAckHandler::OnTouchEventAck( 44 void MockInputAckHandler::OnTouchEventAck(
45 const TouchEventWithLatencyInfo& event, 45 const TouchEventWithLatencyInfo& event,
46 InputEventAckState ack_result) { 46 InputEventAckState ack_result) {
47 VLOG(1) << __FUNCTION__ << " called!"; 47 VLOG(1) << __FUNCTION__ << " called!";
48 acked_touch_event_ = event; 48 acked_touch_event_ = event;
49 RecordAckCalled(ack_result); 49 RecordAckCalled(event.event.type, ack_result);
50 if (touch_followup_event_) 50 if (touch_followup_event_)
51 input_router_->SendTouchEvent(*touch_followup_event_); 51 input_router_->SendTouchEvent(*touch_followup_event_);
52 if (gesture_followup_event_) 52 if (gesture_followup_event_)
53 input_router_->SendGestureEvent(*gesture_followup_event_); 53 input_router_->SendGestureEvent(*gesture_followup_event_);
54 } 54 }
55 55
56 void MockInputAckHandler::OnGestureEventAck( 56 void MockInputAckHandler::OnGestureEventAck(
57 const GestureEventWithLatencyInfo& event, 57 const GestureEventWithLatencyInfo& event,
58 InputEventAckState ack_result) { 58 InputEventAckState ack_result) {
59 VLOG(1) << __FUNCTION__ << " called!"; 59 VLOG(1) << __FUNCTION__ << " called!";
60 acked_gesture_event_ = event.event; 60 acked_gesture_event_ = event.event;
61 RecordAckCalled(ack_result); 61 RecordAckCalled(event.event.type, ack_result);
62 } 62 }
63 63
64 void MockInputAckHandler::OnUnexpectedEventAck(UnexpectedEventAckType type) { 64 void MockInputAckHandler::OnUnexpectedEventAck(UnexpectedEventAckType type) {
65 VLOG(1) << __FUNCTION__ << " called!"; 65 VLOG(1) << __FUNCTION__ << " called!";
66 unexpected_event_ack_called_ = true; 66 unexpected_event_ack_called_ = true;
67 } 67 }
68 68
69 size_t MockInputAckHandler::GetAndResetAckCount() { 69 size_t MockInputAckHandler::GetAndResetAckCount() {
70 size_t ack_count = ack_count_; 70 size_t ack_count = ack_count_;
71 ack_count_ = 0; 71 ack_count_ = 0;
72 return ack_count; 72 return ack_count;
73 } 73 }
74 74
75 void MockInputAckHandler::RecordAckCalled(InputEventAckState ack_result) { 75 void MockInputAckHandler::RecordAckCalled(blink::WebInputEvent::Type type,
76 InputEventAckState ack_result) {
77 ack_event_type_ = type;
76 ++ack_count_; 78 ++ack_count_;
77 ack_state_ = ack_result; 79 ack_state_ = ack_result;
78 } 80 }
79 81
80 } // namespace content 82 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698