OLD | NEW |
| (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 #include "mojo/services/window_manager/view_event_dispatcher.h" | |
6 | |
7 #include "mojo/services/window_manager/view_target.h" | |
8 | |
9 namespace mojo { | |
10 | |
11 ViewEventDispatcher::ViewEventDispatcher() | |
12 : event_dispatch_target_(nullptr), | |
13 old_dispatch_target_(nullptr) { | |
14 } | |
15 | |
16 ViewEventDispatcher::~ViewEventDispatcher() {} | |
17 | |
18 void ViewEventDispatcher::SetRootViewTarget(ViewTarget* root_view_target) { | |
19 root_view_target_.reset(root_view_target); | |
20 } | |
21 | |
22 ui::EventTarget* ViewEventDispatcher::GetRootTarget() { | |
23 return root_view_target_.get(); | |
24 } | |
25 | |
26 void ViewEventDispatcher::OnEventProcessingStarted(ui::Event* event) { | |
27 // TODO(erg): In the aura version of this class, we perform a DIP based | |
28 // transformation here. Do we want to do any sort of analogous transformation | |
29 // here. | |
30 } | |
31 | |
32 bool ViewEventDispatcher::CanDispatchToTarget(ui::EventTarget* target) { | |
33 return event_dispatch_target_ == target; | |
34 } | |
35 | |
36 ui::EventDispatchDetails ViewEventDispatcher::PreDispatchEvent( | |
37 ui::EventTarget* target, | |
38 ui::Event* event) { | |
39 // TODO(erg): PreDispatch in aura::WindowEventDispatcher does many, many | |
40 // things. It, and the functions split off for different event types, are | |
41 // most of the file. | |
42 old_dispatch_target_ = event_dispatch_target_; | |
43 event_dispatch_target_ = static_cast<ViewTarget*>(target); | |
44 return ui::EventDispatchDetails(); | |
45 } | |
46 | |
47 ui::EventDispatchDetails ViewEventDispatcher::PostDispatchEvent( | |
48 ui::EventTarget* target, | |
49 const ui::Event& event) { | |
50 // TODO(erg): Not at all as long as PreDispatchEvent, but still missing core | |
51 // details. | |
52 event_dispatch_target_ = old_dispatch_target_; | |
53 old_dispatch_target_ = nullptr; | |
54 return ui::EventDispatchDetails(); | |
55 } | |
56 | |
57 } // namespace mojo | |
OLD | NEW |