diff options
author | jam <jam@chromium.org> | 2015-04-22 13:38:16 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-22 20:39:00 +0000 |
commit | 81a5661f60738efa7dbbee0a72f2c1e15f6690f9 (patch) | |
tree | 27fe82ed9e8d8b504f6c731365df1fc9e2c3d1f6 /components/html_viewer/touch_handler.h | |
parent | aa86d5f0d050b3322ed02d81e5f51787726f5511 (diff) | |
download | chromium_src-81a5661f60738efa7dbbee0a72f2c1e15f6690f9.zip chromium_src-81a5661f60738efa7dbbee0a72f2c1e15f6690f9.tar.gz chromium_src-81a5661f60738efa7dbbee0a72f2c1e15f6690f9.tar.bz2 |
Move html_viewer from mojo/services to components.
BUG=479353
TBR=jochen for DEPS
Review URL: https://codereview.chromium.org/1099303002
Cr-Commit-Position: refs/heads/master@{#326369}
Diffstat (limited to 'components/html_viewer/touch_handler.h')
-rw-r--r-- | components/html_viewer/touch_handler.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/components/html_viewer/touch_handler.h b/components/html_viewer/touch_handler.h new file mode 100644 index 0000000..460a3d5 --- /dev/null +++ b/components/html_viewer/touch_handler.h @@ -0,0 +1,62 @@ +// Copyright 2015 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 COMPONENTS_HTML_VIEWER_TOUCH_HANDLER_H_ +#define COMPONENTS_HTML_VIEWER_TOUCH_HANDLER_H_ + +#include "base/basictypes.h" +#include "ui/events/gesture_detection/filtered_gesture_provider.h" + +namespace blink { +class WebView; +} + +namespace mojo { +class Event; +} + +namespace ui { +class MotionEventGeneric; +} + +namespace html_viewer { + +// TouchHandler is responsible for converting touch events into gesture events. +// It does this by converting mojo::Events into a MotionEventGeneric and using +// FilteredGestureProvider. +class TouchHandler : public ui::GestureProviderClient { + public: + explicit TouchHandler(blink::WebView* web_view); + ~TouchHandler() override; + + void OnTouchEvent(const mojo::Event& event); + + // ui::GestureProviderClient implementation. + void OnGestureEvent(const ui::GestureEventData& gesture) override; + + private: + // Updates |current_motion_event_| from |event|. Returns true on success. + bool UpdateMotionEvent(const mojo::Event& event); + + // Sends |current_motion_event_| to the GestureProvider and WebView. + void SendMotionEventToGestureProvider(); + + // Does post processing after sending |current_motion_event_| to the + // GestureProvider. + void PostProcessMotionEvent(const mojo::Event& event); + + blink::WebView* web_view_; + + ui::FilteredGestureProvider gesture_provider_; + + // As touch events are received they are converted to this event. If null no + // touch events are in progress. + scoped_ptr<ui::MotionEventGeneric> current_motion_event_; + + DISALLOW_COPY_AND_ASSIGN(TouchHandler); +}; + +} // namespace html_viewer + +#endif // COMPONENTS_HTML_VIEWER_TOUCH_HANDLER_H_ |