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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 float cursor_scale_factor = use_2x ? 2.f : 1.f; | 126 float cursor_scale_factor = use_2x ? 2.f : 1.f; |
127 cursor_size_ = InitCursorFromResource(&touch_cursor_, | 127 cursor_size_ = InitCursorFromResource(&touch_cursor_, |
128 cursor_scale_factor, | 128 cursor_scale_factor, |
129 use_2x ? IDR_DEVTOOLS_TOUCH_CURSOR_ICON_2X : | 129 use_2x ? IDR_DEVTOOLS_TOUCH_CURSOR_ICON_2X : |
130 IDR_DEVTOOLS_TOUCH_CURSOR_ICON); | 130 IDR_DEVTOOLS_TOUCH_CURSOR_ICON); |
131 InitCursorFromResource(&pinch_cursor_, | 131 InitCursorFromResource(&pinch_cursor_, |
132 cursor_scale_factor, | 132 cursor_scale_factor, |
133 use_2x ? IDR_DEVTOOLS_PINCH_CURSOR_ICON_2X : | 133 use_2x ? IDR_DEVTOOLS_PINCH_CURSOR_ICON_2X : |
134 IDR_DEVTOOLS_PINCH_CURSOR_ICON); | 134 IDR_DEVTOOLS_PINCH_CURSOR_ICON); |
135 | 135 |
136 WebCursor::CursorInfo cursor_info; | 136 CursorInfo cursor_info; |
137 cursor_info.type = blink::WebCursorInfo::kTypePointer; | 137 cursor_info.type = blink::WebCursorInfo::kTypePointer; |
138 pointer_cursor_.InitFromCursorInfo(cursor_info); | 138 pointer_cursor_.InitFromCursorInfo(cursor_info); |
139 return true; | 139 return true; |
140 } | 140 } |
141 | 141 |
142 gfx::SizeF TouchEmulator::InitCursorFromResource( | 142 gfx::SizeF TouchEmulator::InitCursorFromResource( |
143 WebCursor* cursor, float scale, int resource_id) { | 143 WebCursor* cursor, float scale, int resource_id) { |
144 gfx::Image& cursor_image = | 144 gfx::Image& cursor_image = |
145 content::GetContentClient()->GetNativeImageNamed(resource_id); | 145 content::GetContentClient()->GetNativeImageNamed(resource_id); |
146 WebCursor::CursorInfo cursor_info; | 146 CursorInfo cursor_info; |
147 cursor_info.type = blink::WebCursorInfo::kTypeCustom; | 147 cursor_info.type = blink::WebCursorInfo::kTypeCustom; |
148 cursor_info.image_scale_factor = scale; | 148 cursor_info.image_scale_factor = scale; |
149 cursor_info.custom_image = cursor_image.AsBitmap(); | 149 cursor_info.custom_image = cursor_image.AsBitmap(); |
150 cursor_info.hotspot = | 150 cursor_info.hotspot = |
151 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); | 151 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); |
152 | 152 |
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 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 point.tilt_x = 0; | 474 point.tilt_x = 0; |
475 point.tilt_y = 0; | 475 point.tilt_y = 0; |
476 point.pointer_type = blink::WebPointerProperties::PointerType::kTouch; | 476 point.pointer_type = blink::WebPointerProperties::PointerType::kTouch; |
477 } | 477 } |
478 | 478 |
479 bool TouchEmulator::InPinchGestureMode() const { | 479 bool TouchEmulator::InPinchGestureMode() const { |
480 return shift_pressed_; | 480 return shift_pressed_; |
481 } | 481 } |
482 | 482 |
483 } // namespace content | 483 } // namespace content |
OLD | NEW |