| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_COMMON_DEPRECATED_EVENT_SYS_H_ | 5 #ifndef CHROME_COMMON_DEPRECATED_EVENT_SYS_H_ |
| 6 #define CHROME_COMMON_DEPRECATED_EVENT_SYS_H_ | 6 #define CHROME_COMMON_DEPRECATED_EVENT_SYS_H_ |
| 7 | 7 |
| 8 // TODO: This class should be removed or moved to Notifier code. | 8 // TODO: This class should be removed or moved to Notifier code. |
| 9 // See Bug 42450 (http://code.google.com/p/chromium/issues/detail?id=42450). | 9 // See Bug 42450 (http://code.google.com/p/chromium/issues/detail?id=42450). |
| 10 | 10 |
| 11 class AutoLock; | 11 class AutoLock; |
| 12 class Lock; | 12 class Lock; |
| 13 | 13 |
| 14 // An abstract base class for listening to events. | 14 // An abstract base class for listening to events. |
| 15 // | 15 // |
| 16 // Don't inherit from this class yourself. Using NewEventListenerHookup() is | 16 // Don't inherit from this class yourself. Using NewEventListenerHookup() is |
| 17 // much easier. | 17 // much easier. |
| 18 template <typename EventType> | 18 template <typename EventType> |
| 19 class EventListener { | 19 class EventListener { |
| 20 public: | 20 public: |
| 21 virtual void HandleEvent(const EventType& event) = 0; | 21 virtual void HandleEvent(const EventType& event) = 0; |
| 22 |
| 23 protected: |
| 24 virtual ~EventListener() {} |
| 22 }; | 25 }; |
| 23 | 26 |
| 24 // See the -inl.h for details about the following. | 27 // See the -inl.h for details about the following. |
| 25 | 28 |
| 26 template <typename EventTraits, typename NotifyLock = Lock, | 29 template <typename EventTraits, typename NotifyLock = Lock, |
| 27 typename ScopedNotifyLocker = AutoLock> | 30 typename ScopedNotifyLocker = AutoLock> |
| 28 class EventChannel; | 31 class EventChannel; |
| 29 | 32 |
| 30 class EventListenerHookup; | 33 class EventListenerHookup; |
| 31 | 34 |
| 32 template <typename EventChannel, typename CallbackObject, | 35 template <typename EventChannel, typename CallbackObject, |
| 33 typename CallbackMethod> | 36 typename CallbackMethod> |
| 34 EventListenerHookup* NewEventListenerHookup(EventChannel* channel, | 37 EventListenerHookup* NewEventListenerHookup(EventChannel* channel, |
| 35 CallbackObject* cbobject, | 38 CallbackObject* cbobject, |
| 36 CallbackMethod cbmethod); | 39 CallbackMethod cbmethod); |
| 37 | 40 |
| 38 template <typename EventChannel, typename CallbackObject, | 41 template <typename EventChannel, typename CallbackObject, |
| 39 typename CallbackMethod, typename CallbackArg0> | 42 typename CallbackMethod, typename CallbackArg0> |
| 40 EventListenerHookup* NewEventListenerHookup(EventChannel* channel, | 43 EventListenerHookup* NewEventListenerHookup(EventChannel* channel, |
| 41 CallbackObject* cbobject, | 44 CallbackObject* cbobject, |
| 42 CallbackMethod cbmethod, | 45 CallbackMethod cbmethod, |
| 43 CallbackArg0 arg0); | 46 CallbackArg0 arg0); |
| 44 | 47 |
| 45 #endif // CHROME_COMMON_DEPRECATED_EVENT_SYS_H_ | 48 #endif // CHROME_COMMON_DEPRECATED_EVENT_SYS_H_ |
| OLD | NEW |