| 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 #ifndef COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 | 11 |
| 11 namespace ui { | 12 namespace ui { |
| 12 class Event; | 13 class Event; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace mus { | 16 namespace mus { |
| 16 | 17 |
| 17 class Window; | 18 class Window; |
| 18 | 19 |
| 19 namespace mojom { | 20 namespace mojom { |
| 20 enum class EventResult; | 21 enum class EventResult; |
| 21 } | 22 } |
| 22 | 23 |
| 23 // Responsible for processing input events for mus::Window. | 24 // Responsible for processing input events for mus::Window. |
| 24 class InputEventHandler { | 25 class InputEventHandler { |
| 25 public: | 26 public: |
| 26 // The event handler can asynchronously ack the event by taking ownership of | 27 // The event handler can asynchronously ack the event by taking ownership of |
| 27 // the |ack_callback|. The callback takes an EventResult indicating if the | 28 // the |ack_callback|. The callback takes an EventResult indicating if the |
| 28 // handler has consumed the event. If the handler does not take ownership of | 29 // handler has consumed the event. If the handler does not take ownership of |
| 29 // the callback, then WindowTreeClientImpl will ack the event as not consumed. | 30 // the callback, then WindowTreeClientImpl will ack the event as not consumed. |
| 30 virtual void OnWindowInputEvent( | 31 virtual void OnWindowInputEvent( |
| 31 Window* target, | 32 Window* target, |
| 32 const ui::Event& event, | 33 const ui::Event& event, |
| 33 scoped_ptr<base::Callback<void(mojom::EventResult)>>* ack_callback) = 0; | 34 std::unique_ptr<base::Callback<void(mojom::EventResult)>>* |
| 35 ack_callback) = 0; |
| 34 | 36 |
| 35 protected: | 37 protected: |
| 36 virtual ~InputEventHandler() {} | 38 virtual ~InputEventHandler() {} |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 } // namespace mus | 41 } // namespace mus |
| 40 | 42 |
| 41 #endif // COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_ | 43 #endif // COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_ |
| OLD | NEW |