OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/touch_emulator.h" | 5 #include "content/browser/renderer_host/input/touch_emulator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 WebTouchEvent event = touch_events_to_ack_[0]; | 232 WebTouchEvent event = touch_events_to_ack_[0]; |
233 touch_events_to_ack_.erase(touch_events_to_ack_.begin()); | 233 touch_events_to_ack_.erase(touch_events_to_ack_.begin()); |
234 // Emulator should not handle ack from native stream. | 234 // Emulator should not handle ack from native stream. |
235 EXPECT_FALSE(emulator()->HandleTouchEventAck( | 235 EXPECT_FALSE(emulator()->HandleTouchEventAck( |
236 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS)); | 236 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS)); |
237 } | 237 } |
238 | 238 |
239 void DisableSynchronousTouchAck() { ack_touches_synchronously_ = false; } | 239 void DisableSynchronousTouchAck() { ack_touches_synchronously_ = false; } |
240 | 240 |
241 float GetCursorScaleFactor() { | 241 float GetCursorScaleFactor() { |
242 WebCursor::CursorInfo info; | 242 CursorInfo info; |
243 cursor_.GetCursorInfo(&info); | 243 cursor_.GetCursorInfo(&info); |
244 return info.image_scale_factor; | 244 return info.image_scale_factor; |
245 } | 245 } |
246 | 246 |
247 private: | 247 private: |
248 std::unique_ptr<TouchEmulator> emulator_; | 248 std::unique_ptr<TouchEmulator> emulator_; |
249 std::vector<WebInputEvent::Type> forwarded_events_; | 249 std::vector<WebInputEvent::Type> forwarded_events_; |
250 double last_event_time_seconds_; | 250 double last_event_time_seconds_; |
251 double event_time_delta_seconds_; | 251 double event_time_delta_seconds_; |
252 bool shift_pressed_; | 252 bool shift_pressed_; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 emulator()->SetDeviceScaleFactor(1.0f); | 588 emulator()->SetDeviceScaleFactor(1.0f); |
589 EXPECT_EQ(1.0f, GetCursorScaleFactor()); | 589 EXPECT_EQ(1.0f, GetCursorScaleFactor()); |
590 | 590 |
591 TouchEmulator another(this, 4.0f); | 591 TouchEmulator another(this, 4.0f); |
592 EXPECT_EQ(1.0f, GetCursorScaleFactor()); | 592 EXPECT_EQ(1.0f, GetCursorScaleFactor()); |
593 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); | 593 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); |
594 EXPECT_EQ(2.0f, GetCursorScaleFactor()); | 594 EXPECT_EQ(2.0f, GetCursorScaleFactor()); |
595 } | 595 } |
596 | 596 |
597 } // namespace content | 597 } // namespace content |
OLD | NEW |