Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1012)

Side by Side Diff: content/browser/renderer_host/input/touch_emulator.cc

Issue 2864833002: Tapping handle shouldn't select misspelled word (Closed)
Patch Set: Fixed naming Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_emulator_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "content/public/common/content_client.h" 11 #include "content/public/common/content_client.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 13 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
14 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h" 14 #include "third_party/WebKit/public/platform/WebKeyboardEvent.h"
15 #include "third_party/WebKit/public/platform/WebMouseEvent.h" 15 #include "third_party/WebKit/public/platform/WebMouseEvent.h"
16 #include "ui/base/ui_base_types.h"
16 #include "ui/events/base_event_utils.h" 17 #include "ui/events/base_event_utils.h"
17 #include "ui/events/blink/blink_event_util.h" 18 #include "ui/events/blink/blink_event_util.h"
18 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 19 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
19 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
20 21
21 using blink::WebGestureEvent; 22 using blink::WebGestureEvent;
22 using blink::WebInputEvent; 23 using blink::WebInputEvent;
23 using blink::WebKeyboardEvent; 24 using blink::WebKeyboardEvent;
24 using blink::WebMouseEvent; 25 using blink::WebMouseEvent;
25 using blink::WebMouseWheelEvent; 26 using blink::WebMouseWheelEvent;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 cursor->InitFromCursorInfo(cursor_info); 154 cursor->InitFromCursorInfo(cursor_info);
154 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); 155 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale);
155 } 156 }
156 157
157 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { 158 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) {
158 if (!enabled()) 159 if (!enabled())
159 return false; 160 return false;
160 161
161 if (mouse_event.button == WebMouseEvent::Button::kRight && 162 if (mouse_event.button == WebMouseEvent::Button::kRight &&
162 mouse_event.GetType() == WebInputEvent::kMouseDown) { 163 mouse_event.GetType() == WebInputEvent::kMouseDown) {
163 client_->ShowContextMenuAtPoint(gfx::Point( 164 client_->ShowContextMenuAtPoint(
164 mouse_event.PositionInWidget().x, mouse_event.PositionInWidget().y)); 165 gfx::Point(mouse_event.PositionInWidget().x,
166 mouse_event.PositionInWidget().y),
167 ui::MENU_SOURCE_MOUSE);
165 } 168 }
166 169
167 if (mouse_event.button != WebMouseEvent::Button::kLeft) 170 if (mouse_event.button != WebMouseEvent::Button::kLeft)
168 return true; 171 return true;
169 172
170 if (mouse_event.GetType() == WebInputEvent::kMouseMove) { 173 if (mouse_event.GetType() == WebInputEvent::kMouseMove) {
171 if (last_mouse_event_was_move_ && 174 if (last_mouse_event_was_move_ &&
172 mouse_event.TimeStampSeconds() < 175 mouse_event.TimeStampSeconds() <
173 last_mouse_move_timestamp_ + kMouseMoveDropIntervalSeconds) 176 last_mouse_move_timestamp_ + kMouseMoveDropIntervalSeconds)
174 return true; 177 return true;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 point.tilt_x = 0; 477 point.tilt_x = 0;
475 point.tilt_y = 0; 478 point.tilt_y = 0;
476 point.pointer_type = blink::WebPointerProperties::PointerType::kTouch; 479 point.pointer_type = blink::WebPointerProperties::PointerType::kTouch;
477 } 480 }
478 481
479 bool TouchEmulator::InPinchGestureMode() const { 482 bool TouchEmulator::InPinchGestureMode() const {
480 return shift_pressed_; 483 return shift_pressed_;
481 } 484 }
482 485
483 } // namespace content 486 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_emulator_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698