| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "services/window_manager/native_viewport_event_dispatcher_impl.h" | 5 #include "services/window_manager/native_viewport_event_dispatcher_impl.h" |
| 6 | 6 |
| 7 #include "mojo/converters/input_events/input_events_type_converters.h" | 7 #include "mojo/converters/input_events/input_events_type_converters.h" |
| 8 #include "services/window_manager/view_event_dispatcher.h" | 8 #include "services/window_manager/view_event_dispatcher.h" |
| 9 #include "services/window_manager/window_manager_app.h" | 9 #include "services/window_manager/window_manager_app.h" |
| 10 | 10 |
| 11 namespace window_manager { | 11 namespace window_manager { |
| 12 | 12 |
| 13 NativeViewportEventDispatcherImpl::NativeViewportEventDispatcherImpl( | 13 NativeViewportEventDispatcherImpl::NativeViewportEventDispatcherImpl( |
| 14 WindowManagerApp* app) | 14 WindowManagerApp* app, |
| 15 : app_(app) { | 15 mojo::InterfaceRequest<mojo::NativeViewportEventDispatcher> request) |
| 16 : app_(app), binding_(this, request.Pass()) { |
| 16 } | 17 } |
| 17 NativeViewportEventDispatcherImpl::~NativeViewportEventDispatcherImpl() { | 18 NativeViewportEventDispatcherImpl::~NativeViewportEventDispatcherImpl() { |
| 18 } | 19 } |
| 19 | 20 |
| 20 ui::EventProcessor* NativeViewportEventDispatcherImpl::GetEventProcessor() { | 21 ui::EventProcessor* NativeViewportEventDispatcherImpl::GetEventProcessor() { |
| 21 return app_->event_dispatcher(); | 22 return app_->event_dispatcher(); |
| 22 } | 23 } |
| 23 | 24 |
| 24 void NativeViewportEventDispatcherImpl::OnEvent( | 25 void NativeViewportEventDispatcherImpl::OnEvent( |
| 25 mojo::EventPtr event, | 26 mojo::EventPtr event, |
| 26 const mojo::Callback<void()>& callback) { | 27 const mojo::Callback<void()>& callback) { |
| 27 scoped_ptr<ui::Event> ui_event = event.To<scoped_ptr<ui::Event>>(); | 28 scoped_ptr<ui::Event> ui_event = event.To<scoped_ptr<ui::Event>>(); |
| 28 | 29 |
| 29 if (ui_event) | 30 if (ui_event) |
| 30 SendEventToProcessor(ui_event.get()); | 31 SendEventToProcessor(ui_event.get()); |
| 31 | 32 |
| 32 callback.Run(); | 33 callback.Run(); |
| 33 } | 34 } |
| 34 | 35 |
| 35 } // namespace window_manager | 36 } // namespace window_manager |
| OLD | NEW |