| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_VIEWS_VIEW_TARGETER_H_ | 5 #ifndef UI_VIEWS_VIEW_TARGETER_H_ |
| 6 #define UI_VIEWS_VIEW_TARGETER_H_ | 6 #define UI_VIEWS_VIEW_TARGETER_H_ |
| 7 | 7 |
| 8 #include "ui/events/event_targeter.h" | 8 #include "ui/events/event_targeter.h" |
| 9 #include "ui/views/views_export.h" | 9 #include "ui/views/views_export.h" |
| 10 | 10 |
| 11 namespace views { | 11 namespace views { |
| 12 | 12 |
| 13 namespace internal { |
| 14 class RootView; |
| 15 } // namespace internal |
| 16 |
| 13 class View; | 17 class View; |
| 14 class ViewTargeterDelegate; | 18 class ViewTargeterDelegate; |
| 15 | 19 |
| 16 // A ViewTargeter is installed on a View that wishes to use the custom | 20 // A ViewTargeter is installed on a View that wishes to use the custom |
| 17 // hit-testing or event-targeting behaviour defined by |delegate|. | 21 // hit-testing or event-targeting behaviour defined by |delegate|. |
| 18 class VIEWS_EXPORT ViewTargeter : public ui::EventTargeter { | 22 class VIEWS_EXPORT ViewTargeter : public ui::EventTargeter { |
| 19 public: | 23 public: |
| 20 explicit ViewTargeter(ViewTargeterDelegate* delegate); | 24 explicit ViewTargeter(ViewTargeterDelegate* delegate); |
| 21 virtual ~ViewTargeter(); | 25 virtual ~ViewTargeter(); |
| 22 | 26 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 virtual ui::EventTarget* FindNextBestTarget(ui::EventTarget* previous_target, | 37 virtual ui::EventTarget* FindNextBestTarget(ui::EventTarget* previous_target, |
| 34 ui::Event* event) OVERRIDE; | 38 ui::Event* event) OVERRIDE; |
| 35 virtual bool SubtreeCanAcceptEvent( | 39 virtual bool SubtreeCanAcceptEvent( |
| 36 ui::EventTarget* target, | 40 ui::EventTarget* target, |
| 37 const ui::LocatedEvent& event) const OVERRIDE; | 41 const ui::LocatedEvent& event) const OVERRIDE; |
| 38 virtual bool EventLocationInsideBounds( | 42 virtual bool EventLocationInsideBounds( |
| 39 ui::EventTarget* target, | 43 ui::EventTarget* target, |
| 40 const ui::LocatedEvent& event) const OVERRIDE; | 44 const ui::LocatedEvent& event) const OVERRIDE; |
| 41 | 45 |
| 42 private: | 46 private: |
| 47 // TODO(tdanderson): Un-friend RootView once RootView::DispatchGestureEvent() |
| 48 // has been removed. |
| 49 friend class internal::RootView; |
| 50 |
| 43 View* FindTargetForKeyEvent(View* root, const ui::KeyEvent& key); | 51 View* FindTargetForKeyEvent(View* root, const ui::KeyEvent& key); |
| 44 View* FindTargetForScrollEvent(View* root, const ui::ScrollEvent& scroll); | 52 View* FindTargetForScrollEvent(View* root, const ui::ScrollEvent& scroll); |
| 45 | 53 |
| 54 virtual View* FindTargetForGestureEvent(View* root, |
| 55 const ui::GestureEvent& gesture); |
| 56 virtual ui::EventTarget* FindNextBestTargetForGestureEvent( |
| 57 ui::EventTarget* previous_target, |
| 58 const ui::GestureEvent& gesture); |
| 59 |
| 46 // ViewTargeter does not own the |delegate_|, but |delegate_| must | 60 // ViewTargeter does not own the |delegate_|, but |delegate_| must |
| 47 // outlive the targeter. | 61 // outlive the targeter. |
| 48 ViewTargeterDelegate* delegate_; | 62 ViewTargeterDelegate* delegate_; |
| 49 | 63 |
| 50 DISALLOW_COPY_AND_ASSIGN(ViewTargeter); | 64 DISALLOW_COPY_AND_ASSIGN(ViewTargeter); |
| 51 }; | 65 }; |
| 52 | 66 |
| 53 } // namespace views | 67 } // namespace views |
| 54 | 68 |
| 55 #endif // UI_VIEWS_VIEW_TARGETER_H_ | 69 #endif // UI_VIEWS_VIEW_TARGETER_H_ |
| OLD | NEW |