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 "content/browser/renderer_host/input/motion_event_web.h" | 7 #include "content/browser/renderer_host/input/motion_event_web.h" |
8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 cursor_info.type = blink::WebCursorInfo::TypeCustom; | 123 cursor_info.type = blink::WebCursorInfo::TypeCustom; |
124 cursor_info.image_scale_factor = scale; | 124 cursor_info.image_scale_factor = scale; |
125 cursor_info.custom_image = cursor_image.AsBitmap(); | 125 cursor_info.custom_image = cursor_image.AsBitmap(); |
126 cursor_info.hotspot = | 126 cursor_info.hotspot = |
127 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); | 127 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); |
128 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
129 cursor_info.external_handle = 0; | 129 cursor_info.external_handle = 0; |
130 #endif | 130 #endif |
131 | 131 |
132 cursor->InitFromCursorInfo(cursor_info); | 132 cursor->InitFromCursorInfo(cursor_info); |
133 return gfx::ScaleSize(cursor_image.Size(), 1.f / scale); | 133 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); |
134 } | 134 } |
135 | 135 |
136 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { | 136 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { |
137 if (!enabled()) | 137 if (!enabled()) |
138 return false; | 138 return false; |
139 | 139 |
140 if (mouse_event.button == WebMouseEvent::ButtonRight && | 140 if (mouse_event.button == WebMouseEvent::ButtonRight && |
141 mouse_event.type == WebInputEvent::MouseDown) { | 141 mouse_event.type == WebInputEvent::MouseDown) { |
142 client_->ShowContextMenuAtPoint(gfx::Point(mouse_event.x, mouse_event.y)); | 142 client_->ShowContextMenuAtPoint(gfx::Point(mouse_event.x, mouse_event.y)); |
143 } | 143 } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 point.screenPosition.x = mouse_event.globalX; | 446 point.screenPosition.x = mouse_event.globalX; |
447 point.position.y = mouse_event.y; | 447 point.position.y = mouse_event.y; |
448 point.screenPosition.y = mouse_event.globalY; | 448 point.screenPosition.y = mouse_event.globalY; |
449 } | 449 } |
450 | 450 |
451 bool TouchEmulator::InPinchGestureMode() const { | 451 bool TouchEmulator::InPinchGestureMode() const { |
452 return shift_pressed_; | 452 return shift_pressed_; |
453 } | 453 } |
454 | 454 |
455 } // namespace content | 455 } // namespace content |
OLD | NEW |