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

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

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

Powered by Google App Engine
This is Rietveld 408576698