Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: base/message_pump_observer.h

Issue 8113028: Consolidate ui::NativeEvent and base::NativeEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 BASE_MESSAGE_PUMP_OBSERVER_H 5 #ifndef BASE_MESSAGE_PUMP_OBSERVER_H
6 #define BASE_MESSAGE_PUMP_OBSERVER_H 6 #define BASE_MESSAGE_PUMP_OBSERVER_H
7 #pragma once
7 8
8 #if defined(USE_X11) 9 #include "base/event_types.h"
9 typedef union _XEvent XEvent;
10 #endif
11 10
12 namespace base { 11 namespace base {
13 12
14 #if defined(OS_WIN)
15 typedef MSG NativeEvent;
16 #elif defined(USE_X11)
17 typedef XEvent* NativeEvent;
18 #endif
19
20 enum EventStatus { 13 enum EventStatus {
21 EVENT_CONTINUE, // The event should be dispatched as normal. 14 EVENT_CONTINUE, // The event should be dispatched as normal.
22 #if defined(USE_X11) 15 #if defined(USE_X11)
23 EVENT_HANDLED // The event should not be processed any farther. 16 EVENT_HANDLED // The event should not be processed any farther.
24 #endif 17 #endif
25 }; 18 };
26 19
27 // A MessagePumpObserver is an object that receives global 20 // A MessagePumpObserver is an object that receives global
28 // notifications from the UI MessageLoop with MessagePumpWin or 21 // notifications from the UI MessageLoop with MessagePumpWin or
29 // MessagePumpX. 22 // MessagePumpX.
30 // 23 //
31 // NOTE: An Observer implementation should be extremely fast! 24 // NOTE: An Observer implementation should be extremely fast!
32 // 25 //
33 // For use with MessagePumpX, please see message_pump_glib.h for more 26 // For use with MessagePumpX, please see message_pump_glib.h for more
34 // info about how this is invoked in this environment. 27 // info about how this is invoked in this environment.
35 class BASE_EXPORT MessagePumpObserver { 28 class BASE_EXPORT MessagePumpObserver {
36 public: 29 public:
37 // This method is called before processing a NativeEvent. If the 30 // This method is called before processing a NativeEvent. If the
38 // method returns EVENT_HANDLED, it indicates the event has already 31 // method returns EVENT_HANDLED, it indicates the event has already
39 // been handled, so the event is not processed any farther. If the 32 // been handled, so the event is not processed any farther. If the
40 // method returns EVENT_CONTINUE, the event dispatching proceeds as 33 // method returns EVENT_CONTINUE, the event dispatching proceeds as
41 // normal. 34 // normal.
42 virtual EventStatus WillProcessEvent(const NativeEvent& event) = 0; 35 virtual EventStatus WillProcessEvent(const base::NativeEvent& event) = 0;
msw 2011/10/04 18:10:37 The base namespace qualifier isn't needed here or
oshima 2011/10/04 19:42:48 Done.
43 36
44 // This method is called after processing a message. This method 37 // This method is called after processing a message. This method
45 // will not be called if WillProcessEvent returns EVENT_HANDLED. 38 // will not be called if WillProcessEvent returns EVENT_HANDLED.
46 virtual void DidProcessEvent(const NativeEvent& event) = 0; 39 virtual void DidProcessEvent(const base::NativeEvent& event) = 0;
47 40
48 protected: 41 protected:
49 virtual ~MessagePumpObserver() {} 42 virtual ~MessagePumpObserver() {}
50 }; 43 };
51 44
52 } // namespace base 45 } // namespace base
53 46
54 #endif // BASE_MESSAGE_PUMP_OBSERVER_VIEWS_H 47 #endif // BASE_MESSAGE_PUMP_OBSERVER_VIEWS_H
OLDNEW
« no previous file with comments | « base/event_types.h ('k') | ui/aura/event.h » ('j') | ui/base/events.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698