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

Side by Side Diff: ui/events/event_dispatcher.h

Issue 24257011: Revert "Revert 224496 "Move ui/base/latency_info* to ui/events"" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gyp bustage Created 7 years, 3 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
« no previous file with comments | « ui/events/event_conversion_gtk.h ('k') | ui/events/event_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_EVENT_DISPATCHER_H_ 5 #ifndef UI_EVENTS_EVENT_DISPATCHER_H_
6 #define UI_EVENTS_EVENT_DISPATCHER_H_ 6 #define UI_EVENTS_EVENT_DISPATCHER_H_
7 7
8 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
9 #include "ui/base/ui_export.h"
10 #include "ui/events/event.h" 9 #include "ui/events/event.h"
11 #include "ui/events/event_constants.h" 10 #include "ui/events/event_constants.h"
12 #include "ui/events/event_target.h" 11 #include "ui/events/event_target.h"
12 #include "ui/events/events_export.h"
13 13
14 namespace ui { 14 namespace ui {
15 15
16 class EventDispatcher; 16 class EventDispatcher;
17 17
18 class UI_EXPORT EventDispatcherDelegate { 18 class EVENTS_EXPORT EventDispatcherDelegate {
19 public: 19 public:
20 EventDispatcherDelegate(); 20 EventDispatcherDelegate();
21 virtual ~EventDispatcherDelegate(); 21 virtual ~EventDispatcherDelegate();
22 22
23 // Returns whether an event can still be dispatched to a target. (e.g. during 23 // Returns whether an event can still be dispatched to a target. (e.g. during
24 // event dispatch, one of the handlers may have destroyed the target, in which 24 // event dispatch, one of the handlers may have destroyed the target, in which
25 // case the event can no longer be dispatched to the target). 25 // case the event can no longer be dispatched to the target).
26 virtual bool CanDispatchToTarget(EventTarget* target) = 0; 26 virtual bool CanDispatchToTarget(EventTarget* target) = 0;
27 27
28 // Returns the event being dispatched (or NULL if no event is being 28 // Returns the event being dispatched (or NULL if no event is being
29 // dispatched). 29 // dispatched).
30 Event* current_event(); 30 Event* current_event();
31 31
32 protected: 32 protected:
33 // Dispatches the event to the target. Returns true if the delegate is still 33 // Dispatches the event to the target. Returns true if the delegate is still
34 // alive after dispatching event, and false if the delegate was destroyed 34 // alive after dispatching event, and false if the delegate was destroyed
35 // during the event dispatch. 35 // during the event dispatch.
36 bool DispatchEvent(EventTarget* target, Event* event); 36 bool DispatchEvent(EventTarget* target, Event* event);
37 37
38 private: 38 private:
39 EventDispatcher* dispatcher_; 39 EventDispatcher* dispatcher_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(EventDispatcherDelegate); 41 DISALLOW_COPY_AND_ASSIGN(EventDispatcherDelegate);
42 }; 42 };
43 43
44 // Dispatches events to appropriate targets. 44 // Dispatches events to appropriate targets.
45 class UI_EXPORT EventDispatcher { 45 class EVENTS_EXPORT EventDispatcher {
46 public: 46 public:
47 explicit EventDispatcher(EventDispatcherDelegate* delegate); 47 explicit EventDispatcher(EventDispatcherDelegate* delegate);
48 virtual ~EventDispatcher(); 48 virtual ~EventDispatcher();
49 49
50 void ProcessEvent(EventTarget* target, Event* event); 50 void ProcessEvent(EventTarget* target, Event* event);
51 51
52 const Event* current_event() const { return current_event_; } 52 const Event* current_event() const { return current_event_; }
53 Event* current_event() { return current_event_; } 53 Event* current_event() { return current_event_; }
54 54
55 bool delegate_destroyed() const { return !delegate_; } 55 bool delegate_destroyed() const { return !delegate_; }
(...skipping 15 matching lines...) Expand all
71 Event* current_event_; 71 Event* current_event_;
72 72
73 EventHandlerList handler_list_; 73 EventHandlerList handler_list_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(EventDispatcher); 75 DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
76 }; 76 };
77 77
78 } // namespace ui 78 } // namespace ui
79 79
80 #endif // UI_EVENTS_EVENT_DISPATCHER_H_ 80 #endif // UI_EVENTS_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « ui/events/event_conversion_gtk.h ('k') | ui/events/event_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698