| Index: content/browser/renderer_host/input/content_gesture_provider.h
|
| diff --git a/content/browser/renderer_host/input/content_gesture_provider.h b/content/browser/renderer_host/input/content_gesture_provider.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..18c21541bccb502c68be0851adc9be532db65806
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/input/content_gesture_provider.h
|
| @@ -0,0 +1,67 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_CONTENT_GESTURE_PROVIDER_H_
|
| +#define CONTENT_BROWSER_RENDERER_HOST_INPUT_CONTENT_GESTURE_PROVIDER_H_
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "content/browser/renderer_host/input/gesture_event_packet.h"
|
| +#include "content/browser/renderer_host/input/touch_disposition_gesture_filter.h"
|
| +#include "ui/events/gesture_detection/gesture_provider.h"
|
| +
|
| +namespace content {
|
| +
|
| +class ContentGestureProviderClient {
|
| + public:
|
| + virtual ~ContentGestureProviderClient() {}
|
| + virtual void OnGestureEvent(const blink::WebGestureEvent& event) = 0;
|
| +};
|
| +
|
| +// Provides gesture detection and dispatch given a sequence of touch events
|
| +// and touch event acks.
|
| +class ContentGestureProvider : public TouchDispositionGestureFilterClient,
|
| + public ui::GestureProviderClient {
|
| + public:
|
| + ContentGestureProvider(ContentGestureProviderClient* client,
|
| + float touch_to_gesture_scale);
|
| +
|
| + // Returns true if |event| was both valid and successfully handled by the
|
| + // gesture detector. Otherwise, returns false, in which case the caller
|
| + // should drop |event|, not forwarding it to the renderer.
|
| + bool OnTouchEvent(const ui::MotionEvent& event);
|
| +
|
| + // To be called upon ack of an event that was forwarded after a successful
|
| + // call to |OnTouchEvent()|.
|
| + void OnTouchEventAck(InputEventAckState ack_state);
|
| +
|
| + // Methods delegated to |gesture_provider_|.
|
| + void ResetGestureDetectors();
|
| + void CancelActiveTouchSequence();
|
| + void UpdateMultiTouchSupport(bool support_multi_touch_zoom);
|
| + void UpdateDoubleTapSupportForPlatform(bool support_double_tap);
|
| + void UpdateDoubleTapSupportForPage(bool support_double_tap);
|
| +
|
| + private:
|
| + // ui::GestureProviderClient
|
| + virtual void OnGestureEvent(const ui::GestureEventParams& params) OVERRIDE;
|
| +
|
| + // TouchDispositionGestureFilterClient
|
| + virtual void ForwardGestureEvent(const blink::WebGestureEvent& event)
|
| + OVERRIDE;
|
| +
|
| + ContentGestureProviderClient* const client_;
|
| + float touch_to_gesture_scale_;
|
| +
|
| + ui::GestureProvider gesture_provider_;
|
| + TouchDispositionGestureFilter gesture_filter_;
|
| +
|
| + bool handling_event_;
|
| + GestureEventPacket pending_gesture_packet_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ContentGestureProvider);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_CONTENT_GESTURE_PROVIDER_H_
|
|
|