Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / events / event_processor.cc
blob3077cc85b168aea483a9e506021af80b5e64375e
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
3 // found in the LICENSE file.
5 #include "ui/events/event_processor.h"
7 #include "ui/events/event_target.h"
8 #include "ui/events/event_targeter.h"
10 namespace ui {
12 EventDispatchDetails EventProcessor::OnEventFromSource(Event* event) {
13 EventTarget* root = GetRootTarget();
14 CHECK(root);
15 EventTargeter* targeter = root->GetEventTargeter();
16 CHECK(targeter);
18 PrepareEventForDispatch(event);
19 EventTarget* target = targeter->FindTargetForEvent(root, event);
21 while (target) {
22 EventDispatchDetails details = DispatchEvent(target, event);
23 if (details.dispatcher_destroyed ||
24 details.target_destroyed ||
25 event->handled()) {
26 return details;
29 target = targeter->FindNextBestTarget(target, event);
32 return EventDispatchDetails();
35 void EventProcessor::PrepareEventForDispatch(Event* event) {
38 } // namespace ui