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

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

Issue 203483004: events: Introduce PlatformEventDispatcher and PlatformEventSource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tests Created 6 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_EVENTS_PLATFORM_SCOPED_EVENT_DISPATCHER_H_
6 #define UI_EVENTS_PLATFORM_SCOPED_EVENT_DISPATCHER_H_
7
8 #include "base/auto_reset.h"
9 #include "base/basictypes.h"
10 #include "ui/events/events_export.h"
11
12 namespace ui {
13
14 class PlatformEventDispatcher;
15
16 // A temporary PlatformEventDispatcher can be installed on a
17 // PlatformEventSource that overrides all installed event dispatchers, and
18 // always gets a chance to dispatch the event first. The PlatformEventSource
19 // returns a ScopedEventDispatcher object in such cases. This
20 // ScopedEventDispatcher object can be used to dispatch the event to any
21 // previous overridden dispatcher. When this object is destroyed, it removes the
22 // override-dispatcher, and restores the previous override-dispatcher.
23 class EVENTS_EXPORT ScopedEventDispatcher {
24 public:
25 ScopedEventDispatcher(PlatformEventDispatcher** scoped_dispatcher,
26 PlatformEventDispatcher* new_dispatcher);
27 ~ScopedEventDispatcher();
28
29 operator PlatformEventDispatcher*() const { return original_; }
30
31 private:
32 PlatformEventDispatcher* original_;
33 base::AutoReset<PlatformEventDispatcher*> restore_;
34
35 DISALLOW_COPY_AND_ASSIGN(ScopedEventDispatcher);
36 };
37
38 } // namespace ui
39
40 #endif // UI_EVENTS_PLATFORM_SCOPED_EVENT_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698