1 // Copyright (c) 2013 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.
5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_OZONE_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_OZONE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_pump_dispatcher.h"
11 #include "base/message_loop/message_pump_libevent.h"
12 #include "base/message_loop/message_pump_observer.h"
13 #include "base/observer_list.h"
17 // This class implements a message-pump for processing events from input devices
18 // Refer to MessagePump for further documentation.
19 class BASE_EXPORT MessagePumpOzone
: public MessagePumpLibevent
,
20 public MessagePumpDispatcher
{
23 virtual ~MessagePumpOzone();
25 // Returns the UI message pump.
26 static MessagePumpOzone
* Current();
28 // Add/Remove the root window dispatcher.
29 void AddDispatcherForRootWindow(MessagePumpDispatcher
* dispatcher
);
30 void RemoveDispatcherForRootWindow(MessagePumpDispatcher
* dispatcher
);
32 void RunWithDispatcher(Delegate
* delegate
, MessagePumpDispatcher
* dispatcher
);
34 // Add / remove an Observer, which will start receiving notifications
36 void AddObserver(MessagePumpObserver
* observer
);
37 void RemoveObserver(MessagePumpObserver
* observer
);
39 // Overridden from MessagePumpDispatcher.
40 virtual bool Dispatch(const NativeEvent
& event
) OVERRIDE
;
43 std::vector
<MessagePumpDispatcher
*> dispatcher_
;
45 DISALLOW_COPY_AND_ASSIGN(MessagePumpOzone
);
48 typedef MessagePumpOzone MessagePumpForUI
;
52 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_OZONE_H_