Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_processor.h" | 5 #include "ui/events/event_processor.h" |
| 6 | 6 |
| 7 #include "ui/events/event_target.h" | 7 #include "ui/events/event_target.h" |
| 8 #include "ui/events/event_targeter.h" | 8 #include "ui/events/event_targeter.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 | 11 |
| 12 EventDispatchDetails EventProcessor::OnEventFromSource(Event* event) { | 12 EventDispatchDetails EventProcessor::OnEventFromSource(Event* event) { |
| 13 EventTarget* root = GetRootTarget(); | 13 EventTarget* root = GetRootTarget(); |
| 14 CHECK(root); | 14 CHECK(root); |
| 15 EventTargeter* targeter = root->GetEventTargeter(); | 15 EventTargeter* targeter = root->GetEventTargeter(); |
| 16 CHECK(targeter); | 16 CHECK(targeter); |
| 17 | 17 |
| 18 // If |event| is in the process of being dispatched or has already been | 18 // If |event| is in the process of being dispatched or has already been |
| 19 // dispatched, then dispatch a copy of the event instead. | 19 // dispatched, then dispatch a copy of the event instead. |
| 20 bool dispatch_original_event = event->phase() == EP_PREDISPATCH; | 20 bool dispatch_original_event = event->phase() == EP_PREDISPATCH; |
| 21 Event* event_to_dispatch = event; | 21 Event* event_to_dispatch = event; |
| 22 scoped_ptr<Event> event_copy; | 22 scoped_ptr<Event> event_copy; |
| 23 if (!dispatch_original_event) { | 23 if (!dispatch_original_event) { |
| 24 event_copy = Event::Clone(*event); | 24 event_copy = Event::Clone(*event); |
| 25 event_to_dispatch = event_copy.get(); | 25 event_to_dispatch = event_copy.get(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 // OnEventProcessingStarted() marks the event as handled if targeting and | |
| 29 // dispatch of the event is not permitted. | |
|
sadrul
2014/10/02 19:23:04
The comment for OnEventProcessingStarted() already
tdanderson
2014/10/02 19:35:12
Done.
I realize it's duplicated documentation, b
| |
| 28 OnEventProcessingStarted(event_to_dispatch); | 30 OnEventProcessingStarted(event_to_dispatch); |
| 29 EventTarget* target = NULL; | 31 EventTarget* target = NULL; |
| 30 if (!event_to_dispatch->handled()) | 32 if (!event_to_dispatch->handled()) |
| 31 target = targeter->FindTargetForEvent(root, event_to_dispatch); | 33 target = targeter->FindTargetForEvent(root, event_to_dispatch); |
| 32 | 34 |
| 33 EventDispatchDetails details; | 35 EventDispatchDetails details; |
| 34 while (target) { | 36 while (target) { |
| 35 details = DispatchEvent(target, event_to_dispatch); | 37 details = DispatchEvent(target, event_to_dispatch); |
| 36 | 38 |
| 37 if (!dispatch_original_event) { | 39 if (!dispatch_original_event) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 54 return details; | 56 return details; |
| 55 } | 57 } |
| 56 | 58 |
| 57 void EventProcessor::OnEventProcessingStarted(Event* event) { | 59 void EventProcessor::OnEventProcessingStarted(Event* event) { |
| 58 } | 60 } |
| 59 | 61 |
| 60 void EventProcessor::OnEventProcessingFinished(Event* event) { | 62 void EventProcessor::OnEventProcessingFinished(Event* event) { |
| 61 } | 63 } |
| 62 | 64 |
| 63 } // namespace ui | 65 } // namespace ui |
| OLD | NEW |