- add sources.
[platform/framework/web/crosswalk.git] / src / content / common / input / synthetic_gesture_params.h
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.
4
5 #ifndef CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PARAMS_H_
6 #define CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PARAMS_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "content/common/content_export.h"
10
11 namespace content {
12
13 // Base class for storing parameters of synthetic gestures. Sending an object
14 // over IPC is handled by encapsulating it in a SyntheticGesturePacket object.
15 //
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/.
19 //
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();
34
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
43   };
44   GestureSourceType gesture_source_type;
45
46   enum GestureType {
47     SMOOTH_SCROLL_GESTURE,
48     SYNTHETIC_GESTURE_TYPE_MAX = SMOOTH_SCROLL_GESTURE
49   };
50   virtual GestureType GetGestureType() const = 0;
51 };
52
53 }  // namespace content
54
55 #endif  // CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PARAMS_H_