Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/view_manager/event_dispatcher.h" | 5 #include "components/view_manager/event_dispatcher.h" |
| 6 | 6 |
| 7 #include "components/view_manager/connection_manager.h" | 7 #include "components/view_manager/connection_manager.h" |
| 8 #include "components/view_manager/server_view.h" | 8 #include "components/view_manager/server_view.h" |
| 9 #include "components/view_manager/view_coordinate_conversions.h" | 9 #include "components/view_manager/view_coordinate_conversions.h" |
| 10 #include "components/view_manager/view_locator.h" | 10 #include "components/view_manager/view_locator.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 mojo::EventFlags flags) { | 24 mojo::EventFlags flags) { |
| 25 accelerators_.insert(Accelerator(keyboard_code, flags)); | 25 accelerators_.insert(Accelerator(keyboard_code, flags)); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void EventDispatcher::RemoveAccelerator(mojo::KeyboardCode keyboard_code, | 28 void EventDispatcher::RemoveAccelerator(mojo::KeyboardCode keyboard_code, |
| 29 mojo::EventFlags flags) { | 29 mojo::EventFlags flags) { |
| 30 accelerators_.erase(Accelerator(keyboard_code, flags)); | 30 accelerators_.erase(Accelerator(keyboard_code, flags)); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void EventDispatcher::OnEvent(mojo::EventPtr event, | 33 void EventDispatcher::OnEvent(mojo::EventPtr event, |
| 34 const OnEventCallback& callback) { | 34 const mojo::Callback<void()>& callback) { |
|
sky
2015/06/04 22:37:57
I don't think you need callback anymore. I'm ok wi
Fady Samuel
2015/06/05 22:14:31
Done.
| |
| 35 callback.Run(); | 35 callback.Run(); |
| 36 | 36 |
| 37 if (event->pointer_data) { | 37 if (event->pointer_data) { |
| 38 const gfx::Point root_point(static_cast<int>(event->pointer_data->x), | 38 const gfx::Point root_point(static_cast<int>(event->pointer_data->x), |
| 39 static_cast<int>(event->pointer_data->y)); | 39 static_cast<int>(event->pointer_data->y)); |
| 40 ServerView* target = connection_manager_->GetFocusedView(); | 40 ServerView* target = connection_manager_->GetFocusedView(); |
| 41 ; | 41 ; |
| 42 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target) { | 42 if (event->action == mojo::EVENT_TYPE_POINTER_DOWN || !target) { |
| 43 target = FindDeepestVisibleView(connection_manager_->root(), root_point); | 43 target = FindDeepestVisibleView(connection_manager_->root(), root_point); |
| 44 CHECK(target); | 44 CHECK(target); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 56 connection_manager_->view_manager_root_client()->OnAccelerator( | 56 connection_manager_->view_manager_root_client()->OnAccelerator( |
| 57 event.Pass()); | 57 event.Pass()); |
| 58 } else { | 58 } else { |
| 59 ServerView* focused_view = connection_manager_->GetFocusedView(); | 59 ServerView* focused_view = connection_manager_->GetFocusedView(); |
| 60 if (focused_view) | 60 if (focused_view) |
| 61 connection_manager_->DispatchInputEventToView(focused_view, event.Pass()); | 61 connection_manager_->DispatchInputEventToView(focused_view, event.Pass()); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace view_manager | 65 } // namespace view_manager |
| OLD | NEW |