Add ICU message format support
[chromium-blink-merge.git] / content / browser / renderer_host / input / synthetic_gesture.h
blob1d605ff93836e50f552cdd962f131925f11534a6
1 // Copyright 2013 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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h"
10 #include "content/common/content_export.h"
11 #include "content/common/input/synthetic_gesture_params.h"
13 namespace content {
15 class SyntheticGestureTarget;
17 // Base class for synthetic gesture implementations. A synthetic gesture class
18 // is responsible for forwaring InputEvents, simulating the gesture, to a
19 // SyntheticGestureTarget.
21 // Adding new gesture types involved the following steps:
22 // 1) Create a sub-type of SyntheticGesture that implements the gesture.
23 // 2) Extend SyntheticGesture::Create with the new class.
24 // 3) Add at least one unit test per supported input source type (touch,
25 // mouse, etc) to SyntheticGestureController unit tests. The unit tests
26 // only checks basic functionality and termination. If the gesture is
27 // hooked up to Telemetry its correctness can additionally be tested there.
28 class CONTENT_EXPORT SyntheticGesture {
29 public:
30 SyntheticGesture();
31 virtual ~SyntheticGesture();
33 static scoped_ptr<SyntheticGesture> Create(
34 const SyntheticGestureParams& gesture_params);
36 enum Result {
37 GESTURE_RUNNING,
38 GESTURE_FINISHED,
39 GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED,
40 GESTURE_RESULT_MAX = GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED
43 // Update the state of the gesture and forward the appropriate events to the
44 // platform. This function is called repeatedly by the synthetic gesture
45 // controller until it stops returning GESTURE_RUNNING.
46 virtual Result ForwardInputEvents(
47 const base::TimeTicks& timestamp, SyntheticGestureTarget* target) = 0;
49 protected:
50 static double ConvertTimestampToSeconds(const base::TimeTicks& timestamp);
52 DISALLOW_COPY_AND_ASSIGN(SyntheticGesture);
55 } // namespace content
57 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_