Fixed last bookmark button hiding behavior.
[chromium-blink-merge.git] / base / message_pump_observer.h
bloba7d2aa7122d0d4c432b0928b981e444c35b73675
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
3 // found in the LICENSE file.
5 #ifndef BASE_MESSAGE_PUMP_OBSERVER_H
6 #define BASE_MESSAGE_PUMP_OBSERVER_H
8 #include "base/base_export.h"
9 #include "base/event_types.h"
11 namespace base {
13 enum EventStatus {
14 EVENT_CONTINUE, // The event should be dispatched as normal.
15 #if defined(USE_X11)
16 EVENT_HANDLED // The event should not be processed any farther.
17 #endif
20 // A MessagePumpObserver is an object that receives global
21 // notifications from the UI MessageLoop with MessagePumpWin or
22 // MessagePumpAuraX11.
24 // NOTE: An Observer implementation should be extremely fast!
26 // For use with MessagePumpAuraX11, please see message_pump_glib.h for more
27 // info about how this is invoked in this environment.
28 class BASE_EXPORT MessagePumpObserver {
29 public:
30 // This method is called before processing a NativeEvent. If the
31 // method returns EVENT_HANDLED, it indicates the event has already
32 // been handled, so the event is not processed any farther. If the
33 // method returns EVENT_CONTINUE, the event dispatching proceeds as
34 // normal.
35 virtual EventStatus WillProcessEvent(const NativeEvent& event) = 0;
37 // This method is called after processing a message. This method
38 // will not be called if WillProcessEvent returns EVENT_HANDLED.
39 virtual void DidProcessEvent(const NativeEvent& event) = 0;
41 protected:
42 virtual ~MessagePumpObserver() {}
45 } // namespace base
47 #endif // BASE_MESSAGE_PUMP_OBSERVER_VIEWS_H