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