OLD | NEW |
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 #include "ui/events/event_dispatcher.h" | 5 #include "ui/events/event_dispatcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ui/events/event_target.h" | 9 #include "ui/events/event_target.h" |
10 #include "ui/events/event_targeter.h" | 10 #include "ui/events/event_targeter.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (!event->handled() && | 54 if (!event->handled() && |
55 !details.dispatcher_destroyed && | 55 !details.dispatcher_destroyed && |
56 !details.target_destroyed) { | 56 !details.target_destroyed) { |
57 details = DispatchEventToTarget(target, event); | 57 details = DispatchEventToTarget(target, event); |
58 } | 58 } |
59 bool target_destroyed_during_dispatch = details.target_destroyed; | 59 bool target_destroyed_during_dispatch = details.target_destroyed; |
60 if (!details.dispatcher_destroyed) { | 60 if (!details.dispatcher_destroyed) { |
61 details = PostDispatchEvent(target_destroyed_during_dispatch ? | 61 details = PostDispatchEvent(target_destroyed_during_dispatch ? |
62 NULL : target, *event); | 62 NULL : target, *event); |
63 } | 63 } |
64 | |
65 details.target_destroyed |= target_destroyed_during_dispatch; | 64 details.target_destroyed |= target_destroyed_during_dispatch; |
66 return details; | 65 return details; |
67 } | 66 } |
68 | 67 |
69 EventDispatchDetails EventDispatcherDelegate::PreDispatchEvent( | 68 EventDispatchDetails EventDispatcherDelegate::PreDispatchEvent( |
70 EventTarget* target, Event* event) { | 69 EventTarget* target, Event* event) { |
71 return EventDispatchDetails(); | 70 return EventDispatchDetails(); |
72 } | 71 } |
73 | 72 |
74 EventDispatchDetails EventDispatcherDelegate::PostDispatchEvent( | 73 EventDispatchDetails EventDispatcherDelegate::PostDispatchEvent( |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 return; | 184 return; |
186 } | 185 } |
187 | 186 |
188 base::AutoReset<Event*> event_reset(¤t_event_, event); | 187 base::AutoReset<Event*> event_reset(¤t_event_, event); |
189 handler->OnEvent(event); | 188 handler->OnEvent(event); |
190 if (!delegate_ && event->cancelable()) | 189 if (!delegate_ && event->cancelable()) |
191 event->StopPropagation(); | 190 event->StopPropagation(); |
192 } | 191 } |
193 | 192 |
194 } // namespace ui | 193 } // namespace ui |
OLD | NEW |