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