| 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/common/input/web_touch_event_traits.h" | 9 #include "content/common/input/web_touch_event_traits.h" |
| 10 #include "content/grit/content_resources.h" | 10 #include "content/grit/content_resources.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 cursor->InitFromCursorInfo(cursor_info); | 153 cursor->InitFromCursorInfo(cursor_info); |
| 154 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); | 154 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); |
| 155 } | 155 } |
| 156 | 156 |
| 157 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { | 157 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { |
| 158 if (!enabled()) | 158 if (!enabled()) |
| 159 return false; | 159 return false; |
| 160 | 160 |
| 161 if (mouse_event.button == WebMouseEvent::Button::kRight && | 161 if (mouse_event.button == WebMouseEvent::Button::kRight && |
| 162 mouse_event.GetType() == WebInputEvent::kMouseDown) { | 162 mouse_event.GetType() == WebInputEvent::kMouseDown) { |
| 163 client_->ShowContextMenuAtPoint(gfx::Point( | 163 client_->ShowContextMenuAtPoint( |
| 164 mouse_event.PositionInWidget().x, mouse_event.PositionInWidget().y)); | 164 gfx::Point(mouse_event.PositionInWidget().x, |
| 165 mouse_event.PositionInWidget().y), |
| 166 false); |
| 165 } | 167 } |
| 166 | 168 |
| 167 if (mouse_event.button != WebMouseEvent::Button::kLeft) | 169 if (mouse_event.button != WebMouseEvent::Button::kLeft) |
| 168 return true; | 170 return true; |
| 169 | 171 |
| 170 if (mouse_event.GetType() == WebInputEvent::kMouseMove) { | 172 if (mouse_event.GetType() == WebInputEvent::kMouseMove) { |
| 171 if (last_mouse_event_was_move_ && | 173 if (last_mouse_event_was_move_ && |
| 172 mouse_event.TimeStampSeconds() < | 174 mouse_event.TimeStampSeconds() < |
| 173 last_mouse_move_timestamp_ + kMouseMoveDropIntervalSeconds) | 175 last_mouse_move_timestamp_ + kMouseMoveDropIntervalSeconds) |
| 174 return true; | 176 return true; |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 point.tilt_x = 0; | 476 point.tilt_x = 0; |
| 475 point.tilt_y = 0; | 477 point.tilt_y = 0; |
| 476 point.pointer_type = blink::WebPointerProperties::PointerType::kTouch; | 478 point.pointer_type = blink::WebPointerProperties::PointerType::kTouch; |
| 477 } | 479 } |
| 478 | 480 |
| 479 bool TouchEmulator::InPinchGestureMode() const { | 481 bool TouchEmulator::InPinchGestureMode() const { |
| 480 return shift_pressed_; | 482 return shift_pressed_; |
| 481 } | 483 } |
| 482 | 484 |
| 483 } // namespace content | 485 } // namespace content |
| OLD | NEW |