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

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

Issue 2633233002: Add the pointer type of pen to the synthetic WebMousEvent (Closed)
Patch Set: Make disallow copy private Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/synthetic_pointer_driver.h" 5 #include "content/browser/renderer_host/input/synthetic_pointer_driver.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "content/browser/renderer_host/input/synthetic_mouse_driver.h" 8 #include "content/browser/renderer_host/input/synthetic_mouse_driver.h"
9 #include "content/browser/renderer_host/input/synthetic_pen_driver.h"
9 #include "content/browser/renderer_host/input/synthetic_touch_driver.h" 10 #include "content/browser/renderer_host/input/synthetic_touch_driver.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 SyntheticPointerDriver::SyntheticPointerDriver() {} 14 SyntheticPointerDriver::SyntheticPointerDriver() {}
14 SyntheticPointerDriver::~SyntheticPointerDriver() {} 15 SyntheticPointerDriver::~SyntheticPointerDriver() {}
15 16
16 // static 17 // static
17 std::unique_ptr<SyntheticPointerDriver> SyntheticPointerDriver::Create( 18 std::unique_ptr<SyntheticPointerDriver> SyntheticPointerDriver::Create(
18 SyntheticGestureParams::GestureSourceType gesture_source_type) { 19 SyntheticGestureParams::GestureSourceType gesture_source_type) {
19 if (gesture_source_type == SyntheticGestureParams::TOUCH_INPUT) { 20 switch (gesture_source_type) {
20 return base::MakeUnique<SyntheticTouchDriver>(); 21 case SyntheticGestureParams::TOUCH_INPUT:
21 } else if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) { 22 return base::MakeUnique<SyntheticTouchDriver>();
22 return base::MakeUnique<SyntheticMouseDriver>(); 23 case SyntheticGestureParams::MOUSE_INPUT:
23 } else { 24 return base::MakeUnique<SyntheticMouseDriver>();
24 NOTREACHED() << "Invalid gesture source type"; 25 case SyntheticGestureParams::PEN_INPUT:
25 return std::unique_ptr<SyntheticPointerDriver>(); 26 return base::MakeUnique<SyntheticPenDriver>();
27 case SyntheticGestureParams::DEFAULT_INPUT:
28 return std::unique_ptr<SyntheticPointerDriver>();
26 } 29 }
30 NOTREACHED();
31 return std::unique_ptr<SyntheticPointerDriver>();
27 } 32 }
28 33
29 // static 34 // static
30 double SyntheticPointerDriver::ConvertTimestampToSeconds( 35 double SyntheticPointerDriver::ConvertTimestampToSeconds(
31 const base::TimeTicks& timestamp) { 36 const base::TimeTicks& timestamp) {
32 return (timestamp - base::TimeTicks()).InSecondsF(); 37 return (timestamp - base::TimeTicks()).InSecondsF();
33 } 38 }
34 39
35 } // namespace content 40 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698