Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / renderer_host / input / touchscreen_tap_suppression_controller.h
blob706e9d8610e7f791c3ce801afdabd1e2ca8f8b74
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_BROWSER_RENDERER_HOST_INPUT_TOUCHSCREEN_TAP_SUPPRESSION_CONTROLLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHSCREEN_TAP_SUPPRESSION_CONTROLLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/renderer_host/event_with_latency_info.h"
10 #include "content/browser/renderer_host/input/tap_suppression_controller.h"
11 #include "content/browser/renderer_host/input/tap_suppression_controller_client.h"
13 namespace content {
15 class GestureEventQueue;
17 // Controls the suppression of touchscreen taps immediately following the
18 // dispatch of a GestureFlingCancel event.
19 class TouchscreenTapSuppressionController
20 : public TapSuppressionControllerClient {
21 public:
22 TouchscreenTapSuppressionController(
23 GestureEventQueue* geq,
24 const TapSuppressionController::Config& config);
25 virtual ~TouchscreenTapSuppressionController();
27 // Should be called on arrival of GestureFlingCancel events.
28 void GestureFlingCancel();
30 // Should be called on arrival of ACK for a GestureFlingCancel event.
31 // |processed| is true if the GestureFlingCancel successfully stopped a fling.
32 void GestureFlingCancelAck(bool processed);
34 // Should be called on arrival of any tap-related events. Returns true if the
35 // caller should stop normal handling of the gesture.
36 bool FilterTapEvent(const GestureEventWithLatencyInfo& event);
38 private:
39 // TapSuppressionControllerClient implementation.
40 virtual void DropStashedTapDown() OVERRIDE;
41 virtual void ForwardStashedTapDown() OVERRIDE;
43 GestureEventQueue* gesture_event_queue_;
45 typedef scoped_ptr<GestureEventWithLatencyInfo> ScopedGestureEvent;
46 ScopedGestureEvent stashed_tap_down_;
47 ScopedGestureEvent stashed_show_press_;
49 // The core controller of tap suppression.
50 TapSuppressionController controller_;
52 DISALLOW_COPY_AND_ASSIGN(TouchscreenTapSuppressionController);
55 } // namespace content
57 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCHSCREEN_TAP_SUPPRESSION_CONTROLLER_H_