| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 gfx::SizeF TouchEmulator::InitCursorFromResource( | 119 gfx::SizeF TouchEmulator::InitCursorFromResource( |
| 120 WebCursor* cursor, float scale, int resource_id) { | 120 WebCursor* cursor, float scale, int resource_id) { |
| 121 gfx::Image& cursor_image = | 121 gfx::Image& cursor_image = |
| 122 content::GetContentClient()->GetNativeImageNamed(resource_id); | 122 content::GetContentClient()->GetNativeImageNamed(resource_id); |
| 123 WebCursor::CursorInfo cursor_info; | 123 WebCursor::CursorInfo cursor_info; |
| 124 cursor_info.type = blink::WebCursorInfo::TypeCustom; | 124 cursor_info.type = blink::WebCursorInfo::TypeCustom; |
| 125 cursor_info.image_scale_factor = scale; | 125 cursor_info.image_scale_factor = scale; |
| 126 cursor_info.custom_image = cursor_image.AsBitmap(); | 126 cursor_info.custom_image = cursor_image.AsBitmap(); |
| 127 cursor_info.hotspot = | 127 cursor_info.hotspot = |
| 128 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); | 128 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); |
| 129 #if defined(OS_WIN) | |
| 130 cursor_info.external_handle = 0; | |
| 131 #endif | |
| 132 | 129 |
| 133 cursor->InitFromCursorInfo(cursor_info); | 130 cursor->InitFromCursorInfo(cursor_info); |
| 134 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); | 131 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); |
| 135 } | 132 } |
| 136 | 133 |
| 137 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { | 134 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { |
| 138 if (!enabled()) | 135 if (!enabled()) |
| 139 return false; | 136 return false; |
| 140 | 137 |
| 141 if (mouse_event.button == WebMouseEvent::ButtonRight && | 138 if (mouse_event.button == WebMouseEvent::ButtonRight && |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 point.tiltX = 0; | 447 point.tiltX = 0; |
| 451 point.tiltY = 0; | 448 point.tiltY = 0; |
| 452 point.pointerType = blink::WebPointerProperties::PointerType::Touch; | 449 point.pointerType = blink::WebPointerProperties::PointerType::Touch; |
| 453 } | 450 } |
| 454 | 451 |
| 455 bool TouchEmulator::InPinchGestureMode() const { | 452 bool TouchEmulator::InPinchGestureMode() const { |
| 456 return shift_pressed_; | 453 return shift_pressed_; |
| 457 } | 454 } |
| 458 | 455 |
| 459 } // namespace content | 456 } // namespace content |
| OLD | NEW |