| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_EVENTS_EVENT_TARGET_H_ | 5 #ifndef UI_BASE_EVENTS_EVENT_TARGET_H_ |
| 6 #define UI_BASE_EVENTS_EVENT_TARGET_H_ | 6 #define UI_BASE_EVENTS_EVENT_TARGET_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "ui/base/events/event_handler.h" | 9 #include "ui/base/events/event_handler.h" |
| 10 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 return target_->pre_target_list_; | 25 return target_->pre_target_list_; |
| 26 } | 26 } |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 TestApi(); | 29 TestApi(); |
| 30 EventTarget* target_; | 30 EventTarget* target_; |
| 31 | 31 |
| 32 DISALLOW_COPY_AND_ASSIGN(TestApi); | 32 DISALLOW_COPY_AND_ASSIGN(TestApi); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class DispatcherApi { |
| 36 public: |
| 37 explicit DispatcherApi(EventTarget* target) : target_(target) {} |
| 38 |
| 39 const EventHandlerList& pre_target_list() const { |
| 40 return target_->pre_target_list_; |
| 41 } |
| 42 |
| 43 private: |
| 44 DispatcherApi(); |
| 45 EventTarget* target_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(DispatcherApi); |
| 48 }; |
| 49 |
| 35 EventTarget(); | 50 EventTarget(); |
| 36 virtual ~EventTarget(); | 51 virtual ~EventTarget(); |
| 37 | 52 |
| 38 virtual bool CanAcceptEvents() = 0; | 53 virtual bool CanAcceptEvents() = 0; |
| 39 virtual EventTarget* GetParentTarget() = 0; | 54 virtual EventTarget* GetParentTarget() = 0; |
| 40 | 55 |
| 41 // Adds a handler to receive events before the target. The handler must be | 56 // Adds a handler to receive events before the target. The handler must be |
| 42 // explicitly removed from the target before the handler is destroyed. The | 57 // explicitly removed from the target before the handler is destroyed. The |
| 43 // EventTarget does not take ownership of the handler. | 58 // EventTarget does not take ownership of the handler. |
| 44 void AddPreTargetHandler(EventHandler* handler); | 59 void AddPreTargetHandler(EventHandler* handler); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 EventHandlerList pre_target_list_; | 93 EventHandlerList pre_target_list_; |
| 79 EventHandlerList post_target_list_; | 94 EventHandlerList post_target_list_; |
| 80 EventHandler* target_handler_; | 95 EventHandler* target_handler_; |
| 81 | 96 |
| 82 DISALLOW_COPY_AND_ASSIGN(EventTarget); | 97 DISALLOW_COPY_AND_ASSIGN(EventTarget); |
| 83 }; | 98 }; |
| 84 | 99 |
| 85 } // namespace ui | 100 } // namespace ui |
| 86 | 101 |
| 87 #endif // UI_BASE_EVENTS_EVENT_TARGET_H_ | 102 #endif // UI_BASE_EVENTS_EVENT_TARGET_H_ |
| OLD | NEW |