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