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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "content/browser/renderer_host/input/motion_event_web.h" | 8 #include "content/browser/renderer_host/input/motion_event_web.h" |
9 #include "content/browser/renderer_host/input/web_input_event_util.h" | 9 #include "content/browser/renderer_host/input/web_input_event_util.h" |
10 #include "content/common/input/web_touch_event_traits.h" | 10 #include "content/common/input/web_touch_event_traits.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); | 134 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); |
135 | 135 |
136 cursor->InitFromCursorInfo(cursor_info); | 136 cursor->InitFromCursorInfo(cursor_info); |
137 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); | 137 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); |
138 } | 138 } |
139 | 139 |
140 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { | 140 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { |
141 if (!enabled()) | 141 if (!enabled()) |
142 return false; | 142 return false; |
143 | 143 |
144 if (mouse_event.button == WebMouseEvent::ButtonRight && | 144 if (mouse_event.button == WebMouseEvent::Button::Right && |
145 mouse_event.type == WebInputEvent::MouseDown) { | 145 mouse_event.type == WebInputEvent::MouseDown) { |
146 client_->ShowContextMenuAtPoint(gfx::Point(mouse_event.x, mouse_event.y)); | 146 client_->ShowContextMenuAtPoint(gfx::Point(mouse_event.x, mouse_event.y)); |
147 } | 147 } |
148 | 148 |
149 if (mouse_event.button != WebMouseEvent::ButtonLeft) | 149 if (mouse_event.button != WebMouseEvent::Button::Left) |
150 return true; | 150 return true; |
151 | 151 |
152 if (mouse_event.type == WebInputEvent::MouseMove) { | 152 if (mouse_event.type == WebInputEvent::MouseMove) { |
153 if (last_mouse_event_was_move_ && | 153 if (last_mouse_event_was_move_ && |
154 mouse_event.timeStampSeconds < last_mouse_move_timestamp_ + | 154 mouse_event.timeStampSeconds < last_mouse_move_timestamp_ + |
155 kMouseMoveDropIntervalSeconds) | 155 kMouseMoveDropIntervalSeconds) |
156 return true; | 156 return true; |
157 | 157 |
158 last_mouse_event_was_move_ = true; | 158 last_mouse_event_was_move_ = true; |
159 last_mouse_move_timestamp_ = mouse_event.timeStampSeconds; | 159 last_mouse_move_timestamp_ = mouse_event.timeStampSeconds; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 point.tiltX = 0; | 453 point.tiltX = 0; |
454 point.tiltY = 0; | 454 point.tiltY = 0; |
455 point.pointerType = blink::WebPointerProperties::PointerType::Touch; | 455 point.pointerType = blink::WebPointerProperties::PointerType::Touch; |
456 } | 456 } |
457 | 457 |
458 bool TouchEmulator::InPinchGestureMode() const { | 458 bool TouchEmulator::InPinchGestureMode() const { |
459 return shift_pressed_; | 459 return shift_pressed_; |
460 } | 460 } |
461 | 461 |
462 } // namespace content | 462 } // namespace content |
OLD | NEW |