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

Side by Side Diff: ui/events/platform/platform_event_dispatcher.h

Issue 666673005: Explicitly coerce PostDispatchAction to uint32_t in DispatchEvent() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui_enums
Patch Set: sigh. Windows. Created 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 UI_EVENTS_PLATFORM_PLATFORM_EVENT_DISPATCHER_H_ 5 #ifndef UI_EVENTS_PLATFORM_PLATFORM_EVENT_DISPATCHER_H_
6 #define UI_EVENTS_PLATFORM_PLATFORM_EVENT_DISPATCHER_H_ 6 #define UI_EVENTS_PLATFORM_PLATFORM_EVENT_DISPATCHER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "ui/events/events_export.h" 9 #include "ui/events/events_export.h"
10 #include "ui/events/platform/platform_event_types.h" 10 #include "ui/events/platform/platform_event_types.h"
11 11
12 namespace ui { 12 namespace ui {
13 13
14 // See documentation for |PlatformEventDispatcher::DispatchEvent()| for 14 // See documentation for |PlatformEventDispatcher::DispatchEvent()| for
15 // explanation of the meaning of the flags. 15 // explanation of the meaning of the flags.
16 enum PostDispatchAction { 16 typedef uint32_t PostDispatchAction;
17 POST_DISPATCH_NONE = 0x0, 17 const PostDispatchAction kPostDispatchNone = 0;
sky 2014/10/20 20:58:37 I prefer the enum. It's more typical of how we do
18 POST_DISPATCH_PERFORM_DEFAULT = 0x1, 18 const PostDispatchAction kPostDispatchPerformDefault = 1 << 0;
19 POST_DISPATCH_STOP_PROPAGATION = 0x2, 19 const PostDispatchAction kPostDispatchStopPropagation = 1 << 1;
20 };
21 20
22 // PlatformEventDispatcher receives events from a PlatformEventSource and 21 // PlatformEventDispatcher receives events from a PlatformEventSource and
23 // dispatches them. 22 // dispatches them.
24 class EVENTS_EXPORT PlatformEventDispatcher { 23 class EVENTS_EXPORT PlatformEventDispatcher {
25 public: 24 public:
26 // Returns whether this dispatcher wants to dispatch |event|. 25 // Returns whether this dispatcher wants to dispatch |event|.
27 virtual bool CanDispatchEvent(const PlatformEvent& event) = 0; 26 virtual bool CanDispatchEvent(const PlatformEvent& event) = 0;
28 27
29 // Dispatches |event|. If this is not the default dispatcher, then the 28 // Dispatches |event|. If this is not the default dispatcher, then the
30 // dispatcher can request that the default dispatcher gets a chance to 29 // dispatcher can request that the default dispatcher gets a chance to
31 // dispatch the event by setting POST_DISPATCH_PERFORM_DEFAULT to the return 30 // dispatch the event by setting kPostDispatchPerformDefault to the return
32 // value. If the dispatcher has processed the event, and no other dispatcher 31 // value. If the dispatcher has processed the event, and no other dispatcher
33 // should be allowed to dispatch the event, then the dispatcher should set 32 // should be allowed to dispatch the event, then the dispatcher should set
34 // POST_DISPATCH_STOP_PROPAGATION flag on the return value. 33 // kPostDispatchStopPropagation flag on the return value.
35 virtual uint32_t DispatchEvent(const PlatformEvent& event) = 0; 34 virtual PostDispatchAction DispatchEvent(const PlatformEvent& event) = 0;
36 35
37 protected: 36 protected:
38 virtual ~PlatformEventDispatcher() {} 37 virtual ~PlatformEventDispatcher() {}
39 }; 38 };
40 39
41 } // namespace ui 40 } // namespace ui
42 41
43 #endif // UI_EVENTS_PLATFORM_PLATFORM_EVENT_DISPATCHER_H_ 42 #endif // UI_EVENTS_PLATFORM_PLATFORM_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « ui/display/chromeos/x11/native_display_event_dispatcher_x11.cc ('k') | ui/events/platform/platform_event_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698