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"
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
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
{
42 GESTURE_SOURCE_TYPE_MAX
= MOUSE_INPUT
44 GestureSourceType gesture_source_type
;
47 SMOOTH_SCROLL_GESTURE
,
50 SYNTHETIC_GESTURE_TYPE_MAX
= TAP_GESTURE
52 virtual GestureType
GetGestureType() const = 0;
54 // Returns true if the specific gesture source type is supported on this
56 static bool IsGestureSourceTypeSupported(
57 GestureSourceType gesture_source_type
);
60 } // namespace content
62 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PARAMS_H_