| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_EXO_TOUCH_H_ | 5 #ifndef COMPONENTS_EXO_TOUCH_H_ |
| 6 #define COMPONENTS_EXO_TOUCH_H_ | 6 #define COMPONENTS_EXO_TOUCH_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/exo/surface_observer.h" | 11 #include "components/exo/surface_observer.h" |
| 12 #include "ui/events/event_handler.h" | 12 #include "ui/events/event_handler.h" |
| 13 #include "ui/gfx/geometry/point_f.h" |
| 13 | 14 |
| 14 namespace ui { | 15 namespace ui { |
| 15 class TouchEvent; | 16 class TouchEvent; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace exo { | 19 namespace exo { |
| 19 class TouchDelegate; | 20 class TouchDelegate; |
| 21 class TouchStylusDelegate; |
| 20 | 22 |
| 21 // This class implements a client touch device that represents one or more | 23 // This class implements a client touch device that represents one or more |
| 22 // touch devices. | 24 // touch devices. |
| 23 class Touch : public ui::EventHandler, public SurfaceObserver { | 25 class Touch : public ui::EventHandler, public SurfaceObserver { |
| 24 public: | 26 public: |
| 25 explicit Touch(TouchDelegate* delegate); | 27 explicit Touch(TouchDelegate* delegate); |
| 26 ~Touch() override; | 28 ~Touch() override; |
| 27 | 29 |
| 30 // Set delegate for stylus events. |
| 31 void SetStylusDelegate(TouchStylusDelegate* delegate); |
| 32 bool HasStylusDelegate() const; |
| 33 |
| 28 // Overridden from ui::EventHandler: | 34 // Overridden from ui::EventHandler: |
| 29 void OnTouchEvent(ui::TouchEvent* event) override; | 35 void OnTouchEvent(ui::TouchEvent* event) override; |
| 30 | 36 |
| 31 // Overridden from SurfaceObserver: | 37 // Overridden from SurfaceObserver: |
| 32 void OnSurfaceDestroying(Surface* surface) override; | 38 void OnSurfaceDestroying(Surface* surface) override; |
| 33 | 39 |
| 34 private: | 40 private: |
| 35 // Returns the effective target for |event|. | 41 // Returns the effective target for |event|. |
| 36 Surface* GetEffectiveTargetForEvent(ui::Event* event) const; | 42 Surface* GetEffectiveTargetForEvent(ui::Event* event) const; |
| 37 | 43 |
| 38 // The delegate instance that all events are dispatched to. | 44 // The delegate instance that all events are dispatched to. |
| 39 TouchDelegate* const delegate_; | 45 TouchDelegate* const delegate_; |
| 40 | 46 |
| 47 // The delegate instance that all stylus related events are dispatched to. |
| 48 TouchStylusDelegate* stylus_delegate_ = nullptr; |
| 49 |
| 41 // The current focus surface for the touch device. | 50 // The current focus surface for the touch device. |
| 42 Surface* focus_ = nullptr; | 51 Surface* focus_ = nullptr; |
| 43 | 52 |
| 44 // Vector of touch points in focus surface. | 53 // Vector of touch points in focus surface. |
| 45 std::vector<int> touch_points_; | 54 std::vector<int> touch_points_; |
| 46 | 55 |
| 47 DISALLOW_COPY_AND_ASSIGN(Touch); | 56 DISALLOW_COPY_AND_ASSIGN(Touch); |
| 48 }; | 57 }; |
| 49 | 58 |
| 50 } // namespace exo | 59 } // namespace exo |
| 51 | 60 |
| 52 #endif // COMPONENTS_EXO_TOUCH_H_ | 61 #endif // COMPONENTS_EXO_TOUCH_H_ |
| OLD | NEW |