| 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/public/cpp/view_manager/view.h" | |
| 8 #include "mojo/services/window_manager/view_target.h" | |
| 9 | |
| 10 namespace mojo { | |
| 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 // TODO(erg): In the aura version of this class, we perform a DIP based | |
| 29 // transformation here. Do we want to do any sort of analogous transformation | |
| 30 // here. | |
| 31 } | |
| 32 | |
| 33 bool ViewEventDispatcher::CanDispatchToTarget(ui::EventTarget* target) { | |
| 34 return event_dispatch_target_ == target; | |
| 35 } | |
| 36 | |
| 37 ui::EventDispatchDetails ViewEventDispatcher::PreDispatchEvent( | |
| 38 ui::EventTarget* target, | |
| 39 ui::Event* event) { | |
| 40 // TODO(erg): PreDispatch in aura::WindowEventDispatcher does many, many | |
| 41 // things. It, and the functions split off for different event types, are | |
| 42 // most of the file. | |
| 43 old_dispatch_target_ = event_dispatch_target_; | |
| 44 event_dispatch_target_ = static_cast<ViewTarget*>(target); | |
| 45 return ui::EventDispatchDetails(); | |
| 46 } | |
| 47 | |
| 48 ui::EventDispatchDetails ViewEventDispatcher::PostDispatchEvent( | |
| 49 ui::EventTarget* target, | |
| 50 const ui::Event& event) { | |
| 51 // TODO(erg): Not at all as long as PreDispatchEvent, but still missing core | |
| 52 // details. | |
| 53 event_dispatch_target_ = old_dispatch_target_; | |
| 54 old_dispatch_target_ = nullptr; | |
| 55 return ui::EventDispatchDetails(); | |
| 56 } | |
| 57 | |
| 58 } // namespace mojo | |
| OLD | NEW |