Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: content/browser/renderer_host/input/synthetic_gesture.h

Issue 62443007: Replace old with new synthetic gesture framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forward declare SyntheticGestureController. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/common/input/synthetic_gesture_params.h" 11 #include "content/common/input/synthetic_gesture_params.h"
12 #include "third_party/WebKit/public/web/WebInputEvent.h" 12 #include "third_party/WebKit/public/web/WebInputEvent.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class SyntheticGestureTarget; 16 class SyntheticGestureTarget;
17 17
18 // Base class for synthetic gesture implementations. A synthetic gesture class 18 // Base class for synthetic gesture implementations. A synthetic gesture class
19 // is responsible for forwaring InputEvents, simulating the gesture, to a 19 // is responsible for forwaring InputEvents, simulating the gesture, to a
20 // SyntheticGestureTarget. 20 // SyntheticGestureTarget.
21 // 21 //
22 // Adding new gesture types involved the following steps: 22 // Adding new gesture types involved the following steps:
23 // 1) Create a sub-type of SyntheticGesture that implements the gesture. 23 // 1) Create a sub-type of SyntheticGesture that implements the gesture.
24 // 2) Extend SyntheticGesture::Create with the new class. 24 // 2) Extend SyntheticGesture::Create with the new class.
25 // 3) Add at least one unit test per supported input source type (touch, 25 // 3) Add at least one unit test per supported input source type (touch,
26 // mouse, etc) to SyntheticGestureController unit tests. The unit tests 26 // mouse, etc) to SyntheticGestureController unit tests. The unit tests
27 // only checks basic functionality and termination. If the gesture is 27 // only checks basic functionality and termination. If the gesture is
28 // hooked up to Telemetry its correctness can additionally be tested there. 28 // hooked up to Telemetry its correctness can additionally be tested there.
29 class CONTENT_EXPORT SyntheticGestureNew { 29 class CONTENT_EXPORT SyntheticGesture {
30 public: 30 public:
31 SyntheticGestureNew(); 31 SyntheticGesture();
32 virtual ~SyntheticGestureNew(); 32 virtual ~SyntheticGesture();
33 33
34 static scoped_ptr<SyntheticGestureNew> Create( 34 static scoped_ptr<SyntheticGesture> Create(
35 const SyntheticGestureParams& gesture_params); 35 const SyntheticGestureParams& gesture_params);
36 36
37 enum Result { 37 enum Result {
38 GESTURE_RUNNING, 38 GESTURE_RUNNING,
39 GESTURE_FINISHED, 39 GESTURE_FINISHED,
40 GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED, 40 GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED,
41 GESTURE_SOURCE_TYPE_NOT_SUPPORTED_BY_PLATFORM, 41 GESTURE_SOURCE_TYPE_NOT_SUPPORTED_BY_PLATFORM,
42 GESTURE_RESULT_MAX = GESTURE_SOURCE_TYPE_NOT_SUPPORTED_BY_PLATFORM 42 GESTURE_RESULT_MAX = GESTURE_SOURCE_TYPE_NOT_SUPPORTED_BY_PLATFORM
43 }; 43 };
44
44 // Update the state of the gesture and forward the appropriate events to the 45 // Update the state of the gesture and forward the appropriate events to the
45 // platform. This function is called repeatedly by the synthetic gesture 46 // platform. This function is called repeatedly by the synthetic gesture
46 // controller until it stops returning GESTURE_RUNNING. 47 // controller until it stops returning GESTURE_RUNNING.
47 virtual Result ForwardInputEvents( 48 virtual Result ForwardInputEvents(
48 const base::TimeDelta& interval, SyntheticGestureTarget* target) = 0; 49 const base::TimeDelta& interval, SyntheticGestureTarget* target) = 0;
49 50
50 private: 51 private:
51 DISALLOW_COPY_AND_ASSIGN(SyntheticGestureNew); 52 DISALLOW_COPY_AND_ASSIGN(SyntheticGesture);
52 }; 53 };
53 54
54 } // namespace content 55 } // namespace content
55 56
56 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_ 57 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_GESTURE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698