OLD | NEW |
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.h" | 5 #include "content/browser/renderer_host/input/synthetic_pointer.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_pointer.h" | 8 #include "content/browser/renderer_host/input/synthetic_mouse_pointer.h" |
9 #include "content/browser/renderer_host/input/synthetic_touch_pointer.h" | 9 #include "content/browser/renderer_host/input/synthetic_touch_pointer.h" |
10 #include "third_party/WebKit/public/web/WebInputEvent.h" | 10 #include "third_party/WebKit/public/web/WebInputEvent.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 SyntheticPointer::SyntheticPointer() {} | 14 SyntheticPointer::SyntheticPointer() {} |
15 SyntheticPointer::~SyntheticPointer() {} | 15 SyntheticPointer::~SyntheticPointer() {} |
16 | 16 |
17 // static | 17 // static |
18 std::unique_ptr<SyntheticPointer> SyntheticPointer::Create( | 18 std::unique_ptr<SyntheticPointer> SyntheticPointer::Create( |
19 SyntheticGestureParams::GestureSourceType gesture_source_type) { | 19 SyntheticGestureParams::GestureSourceType gesture_source_type) { |
20 if (gesture_source_type == SyntheticGestureParams::TOUCH_INPUT) { | 20 if (gesture_source_type == SyntheticGestureParams::TOUCH_INPUT) { |
21 return base::WrapUnique(new SyntheticTouchPointer()); | 21 return base::MakeUnique<SyntheticTouchPointer>(); |
22 } else if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) { | 22 } else if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) { |
23 return base::WrapUnique(new SyntheticMousePointer()); | 23 return base::MakeUnique<SyntheticMousePointer>(); |
24 } else { | 24 } else { |
25 NOTREACHED() << "Invalid gesture source type"; | 25 NOTREACHED() << "Invalid gesture source type"; |
26 return std::unique_ptr<SyntheticPointer>(); | 26 return std::unique_ptr<SyntheticPointer>(); |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 // static | 30 // static |
31 double SyntheticPointer::ConvertTimestampToSeconds( | 31 double SyntheticPointer::ConvertTimestampToSeconds( |
32 const base::TimeTicks& timestamp) { | 32 const base::TimeTicks& timestamp) { |
33 return (timestamp - base::TimeTicks()).InSecondsF(); | 33 return (timestamp - base::TimeTicks()).InSecondsF(); |
34 } | 34 } |
35 | 35 |
36 } // namespace content | 36 } // namespace content |
OLD | NEW |