| 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 |
| 28 // Overridden from ui::EventHandler: | 33 // Overridden from ui::EventHandler: |
| 29 void OnTouchEvent(ui::TouchEvent* event) override; | 34 void OnTouchEvent(ui::TouchEvent* event) override; |
| 30 | 35 |
| 31 // Overridden from SurfaceObserver: | 36 // Overridden from SurfaceObserver: |
| 32 void OnSurfaceDestroying(Surface* surface) override; | 37 void OnSurfaceDestroying(Surface* surface) override; |
| 33 | 38 |
| 34 private: | 39 private: |
| 35 // Returns the effective target for |event|. | 40 // Returns the effective target for |event|. |
| 36 Surface* GetEffectiveTargetForEvent(ui::Event* event) const; | 41 Surface* GetEffectiveTargetForEvent(ui::Event* event) const; |
| 37 | 42 |
| 38 // The delegate instance that all events are dispatched to. | 43 // The delegate instance that all events are dispatched to. |
| 39 TouchDelegate* const delegate_; | 44 TouchDelegate* const delegate_; |
| 40 | 45 |
| 46 // The delegate instance that all stylus related events are dispatched to. |
| 47 TouchStylusDelegate* stylus_delegate_ = nullptr; |
| 48 |
| 41 // The current focus surface for the touch device. | 49 // The current focus surface for the touch device. |
| 42 Surface* focus_ = nullptr; | 50 Surface* focus_ = nullptr; |
| 43 | 51 |
| 44 // Vector of touch points in focus surface. | 52 // Vector of touch points in focus surface. |
| 45 std::vector<int> touch_points_; | 53 std::vector<int> touch_points_; |
| 46 | 54 |
| 47 DISALLOW_COPY_AND_ASSIGN(Touch); | 55 DISALLOW_COPY_AND_ASSIGN(Touch); |
| 48 }; | 56 }; |
| 49 | 57 |
| 50 } // namespace exo | 58 } // namespace exo |
| 51 | 59 |
| 52 #endif // COMPONENTS_EXO_TOUCH_H_ | 60 #endif // COMPONENTS_EXO_TOUCH_H_ |
| OLD | NEW |