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

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

Issue 235003005: Consolidate all touch/gesture related constants in content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compilation fixes Created 6 years, 7 months 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_TOUCHPAD_TAP_SUPPRESSION_CONTROLLER_ H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHPAD_TAP_SUPPRESSION_CONTROLLER_ H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHPAD_TAP_SUPPRESSION_CONTROLLER_ H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHPAD_TAP_SUPPRESSION_CONTROLLER_ H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "content/browser/renderer_host/input/tap_suppression_controller.h"
9 #include "content/browser/renderer_host/input/tap_suppression_controller_client. h" 9 #include "content/browser/renderer_host/input/tap_suppression_controller_client. h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "content/port/browser/event_with_latency_info.h" 11 #include "content/port/browser/event_with_latency_info.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 TapSuppressionController; 16 class TapSuppressionController;
17 17
18 class CONTENT_EXPORT TouchpadTapSuppressionControllerClient { 18 class CONTENT_EXPORT TouchpadTapSuppressionControllerClient {
19 public: 19 public:
20 virtual ~TouchpadTapSuppressionControllerClient() {} 20 virtual ~TouchpadTapSuppressionControllerClient() {}
21 virtual void SendMouseEventImmediately( 21 virtual void SendMouseEventImmediately(
22 const MouseEventWithLatencyInfo& event) = 0; 22 const MouseEventWithLatencyInfo& event) = 0;
23 }; 23 };
24 24
25 // Controls the suppression of touchpad taps immediately following the dispatch 25 // Controls the suppression of touchpad taps immediately following the dispatch
26 // of a GestureFlingCancel event. 26 // of a GestureFlingCancel event.
27 class TouchpadTapSuppressionController : public TapSuppressionControllerClient { 27 class TouchpadTapSuppressionController : public TapSuppressionControllerClient {
28 public: 28 public:
29 // The |client| must outlive the TouchpadTapSupressionController. 29 // The |client| must outlive the TouchpadTapSupressionController.
30 explicit TouchpadTapSuppressionController( 30 TouchpadTapSuppressionController(
31 TouchpadTapSuppressionControllerClient* client); 31 TouchpadTapSuppressionControllerClient* client,
32 const TapSuppressionController::Config& config);
32 virtual ~TouchpadTapSuppressionController(); 33 virtual ~TouchpadTapSuppressionController();
33 34
34 // Should be called on arrival of GestureFlingCancel events. 35 // Should be called on arrival of GestureFlingCancel events.
35 void GestureFlingCancel(); 36 void GestureFlingCancel();
36 37
37 // Should be called on arrival of ACK for a GestureFlingCancel event. 38 // Should be called on arrival of ACK for a GestureFlingCancel event.
38 // |processed| is true if the GestureFlingCancel successfully stopped a fling. 39 // |processed| is true if the GestureFlingCancel successfully stopped a fling.
39 void GestureFlingCancelAck(bool processed); 40 void GestureFlingCancelAck(bool processed);
40 41
41 // Should be called on arrival of MouseDown events. Returns true if the caller 42 // Should be called on arrival of MouseDown events. Returns true if the caller
42 // should stop normal handling of the MouseDown. In this case, the caller is 43 // should stop normal handling of the MouseDown. In this case, the caller is
43 // responsible for saving the event for later use, if needed. 44 // responsible for saving the event for later use, if needed.
44 bool ShouldDeferMouseDown(const MouseEventWithLatencyInfo& event); 45 bool ShouldDeferMouseDown(const MouseEventWithLatencyInfo& event);
45 46
46 // Should be called on arrival of MouseUp events. Returns true if the caller 47 // Should be called on arrival of MouseUp events. Returns true if the caller
47 // should stop normal handling of the MouseUp. 48 // should stop normal handling of the MouseUp.
48 bool ShouldSuppressMouseUp(); 49 bool ShouldSuppressMouseUp();
49 50
50 private: 51 private:
51 friend class MockRenderWidgetHost; 52 friend class MockRenderWidgetHost;
52 53
53 // TapSuppressionControllerClient implementation. 54 // TapSuppressionControllerClient implementation.
54 virtual int MaxCancelToDownTimeInMs() OVERRIDE;
55 virtual int MaxTapGapTimeInMs() OVERRIDE;
56 virtual void DropStashedTapDown() OVERRIDE; 55 virtual void DropStashedTapDown() OVERRIDE;
57 virtual void ForwardStashedTapDown() OVERRIDE; 56 virtual void ForwardStashedTapDown() OVERRIDE;
58 57
59 TouchpadTapSuppressionControllerClient* client_; 58 TouchpadTapSuppressionControllerClient* client_;
60 MouseEventWithLatencyInfo stashed_mouse_down_; 59 MouseEventWithLatencyInfo stashed_mouse_down_;
61 60
62 // The core controller of tap suppression. 61 // The core controller of tap suppression.
63 scoped_ptr<TapSuppressionController> controller_; 62 TapSuppressionController controller_;
64 63
65 DISALLOW_COPY_AND_ASSIGN(TouchpadTapSuppressionController); 64 DISALLOW_COPY_AND_ASSIGN(TouchpadTapSuppressionController);
66 }; 65 };
67 66
68 } // namespace content 67 } // namespace content
69 68
70 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHPAD_TAP_SUPPRESSION_CONTROLL ER_H_ 69 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHPAD_TAP_SUPPRESSION_CONTROLL ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698