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

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

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new instances Created 4 years, 4 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
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/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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2); 134 gfx::Point(cursor_image.Width() / 2, cursor_image.Height() / 2);
135 135
136 cursor->InitFromCursorInfo(cursor_info); 136 cursor->InitFromCursorInfo(cursor_info);
137 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale); 137 return gfx::ScaleSize(gfx::SizeF(cursor_image.Size()), 1.f / scale);
138 } 138 }
139 139
140 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) { 140 bool TouchEmulator::HandleMouseEvent(const WebMouseEvent& mouse_event) {
141 if (!enabled()) 141 if (!enabled())
142 return false; 142 return false;
143 143
144 if (mouse_event.button == WebMouseEvent::ButtonRight && 144 if (mouse_event.button == WebMouseEvent::Button::Right &&
145 mouse_event.type == WebInputEvent::MouseDown) { 145 mouse_event.type == WebInputEvent::MouseDown) {
146 client_->ShowContextMenuAtPoint(gfx::Point(mouse_event.x, mouse_event.y)); 146 client_->ShowContextMenuAtPoint(gfx::Point(mouse_event.x, mouse_event.y));
147 } 147 }
148 148
149 if (mouse_event.button != WebMouseEvent::ButtonLeft) 149 if (mouse_event.button != WebMouseEvent::Button::Left)
150 return true; 150 return true;
151 151
152 if (mouse_event.type == WebInputEvent::MouseMove) { 152 if (mouse_event.type == WebInputEvent::MouseMove) {
153 if (last_mouse_event_was_move_ && 153 if (last_mouse_event_was_move_ &&
154 mouse_event.timeStampSeconds < last_mouse_move_timestamp_ + 154 mouse_event.timeStampSeconds < last_mouse_move_timestamp_ +
155 kMouseMoveDropIntervalSeconds) 155 kMouseMoveDropIntervalSeconds)
156 return true; 156 return true;
157 157
158 last_mouse_event_was_move_ = true; 158 last_mouse_event_was_move_ = true;
159 last_mouse_move_timestamp_ = mouse_event.timeStampSeconds; 159 last_mouse_move_timestamp_ = mouse_event.timeStampSeconds;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 point.tiltX = 0; 453 point.tiltX = 0;
454 point.tiltY = 0; 454 point.tiltY = 0;
455 point.pointerType = blink::WebPointerProperties::PointerType::Touch; 455 point.pointerType = blink::WebPointerProperties::PointerType::Touch;
456 } 456 }
457 457
458 bool TouchEmulator::InPinchGestureMode() const { 458 bool TouchEmulator::InPinchGestureMode() const {
459 return shift_pressed_; 459 return shift_pressed_;
460 } 460 }
461 461
462 } // namespace content 462 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698