Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / common / input / synthetic_gesture_params.h
blob1c40ca98fd2a025e0d3898110e5b4bda6e1c9bb0
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_COMMON_INPUT_SYNTHETIC_GESTURE_PARAMS_H_
6 #define CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PARAMS_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/common/content_export.h"
11 namespace content {
13 // Base class for storing parameters of synthetic gestures. Sending an object
14 // over IPC is handled by encapsulating it in a SyntheticGesturePacket object.
16 // The subclasses of this class only store data on synthetic gestures.
17 // The logic for dispatching input events that implement the gesture lives
18 // in separate classes in content/browser/renderer_host/input/.
20 // Adding new gesture types involves the following steps:
21 // 1) Create a new sub-type of SyntheticGestureParams with the parameters
22 // needed for the new gesture.
23 // 2) Use IPC macros to create serialization methods for the new type in
24 // content/common/input_messages.h.
25 // 3) Extend ParamTraits<content::SyntheticGesturePacket>::Write/Read/Log in
26 // content/common/input/input_param_traits.cc.
27 // 4) Add a new unit test to make sure that sending the type over IPC works
28 // correctly.
29 // The details of each step should become clear when looking at other types.
30 struct CONTENT_EXPORT SyntheticGestureParams {
31 SyntheticGestureParams();
32 SyntheticGestureParams(const SyntheticGestureParams& other);
33 virtual ~SyntheticGestureParams();
35 // Describes which type of input events synthetic gesture objects should
36 // generate. When specifying DEFAULT_INPUT the platform will be queried for
37 // the preferred input event type.
38 enum GestureSourceType {
39 DEFAULT_INPUT,
40 TOUCH_INPUT,
41 MOUSE_INPUT,
42 GESTURE_SOURCE_TYPE_MAX = MOUSE_INPUT
44 GestureSourceType gesture_source_type;
46 enum GestureType {
47 SMOOTH_SCROLL_GESTURE,
48 SMOOTH_DRAG_GESTURE,
49 PINCH_GESTURE,
50 TAP_GESTURE,
51 SYNTHETIC_GESTURE_TYPE_MAX = TAP_GESTURE
53 virtual GestureType GetGestureType() const = 0;
55 // Returns true if the specific gesture source type is supported on this
56 // platform.
57 static bool IsGestureSourceTypeSupported(
58 GestureSourceType gesture_source_type);
61 } // namespace content
63 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PARAMS_H_