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 SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ | 5 #ifndef SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ |
6 #define SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ | 6 #define SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "mojo/common/strong_binding_set.h" | 9 #include "mojo/common/strong_binding_set.h" |
10 #include "mojo/services/ui/input/interfaces/input_connection.mojom.h" | 10 #include "mojo/services/ui/input/interfaces/input_connection.mojom.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 private: | 22 private: |
23 // InputConnection implementation. | 23 // InputConnection implementation. |
24 // Binds incoming requests to the relevant view token. | 24 // Binds incoming requests to the relevant view token. |
25 class InputConnectionImpl : public mojo::ui::InputConnection { | 25 class InputConnectionImpl : public mojo::ui::InputConnection { |
26 public: | 26 public: |
27 InputConnectionImpl(InputAssociate* associate, | 27 InputConnectionImpl(InputAssociate* associate, |
28 mojo::ui::ViewTokenPtr view_token); | 28 mojo::ui::ViewTokenPtr view_token); |
29 ~InputConnectionImpl() override; | 29 ~InputConnectionImpl() override; |
30 | 30 |
31 private: | 31 private: |
32 void SetListener(mojo::ui::InputListenerPtr listener) override; | 32 void SetListener( |
| 33 mojo::InterfaceHandle<mojo::ui::InputListener> listener) override; |
33 | 34 |
34 InputAssociate* const associate_; | 35 InputAssociate* const associate_; |
35 mojo::ui::ViewTokenPtr view_token_; | 36 mojo::ui::ViewTokenPtr view_token_; |
36 | 37 |
37 DISALLOW_COPY_AND_ASSIGN(InputConnectionImpl); | 38 DISALLOW_COPY_AND_ASSIGN(InputConnectionImpl); |
38 }; | 39 }; |
39 | 40 |
40 // InputDispatcher implementation. | 41 // InputDispatcher implementation. |
41 // Binds incoming requests to the relevant view token. | 42 // Binds incoming requests to the relevant view token. |
42 class InputDispatcherImpl : public mojo::ui::InputDispatcher { | 43 class InputDispatcherImpl : public mojo::ui::InputDispatcher { |
43 public: | 44 public: |
44 InputDispatcherImpl(InputAssociate* associate, | 45 InputDispatcherImpl(InputAssociate* associate, |
45 mojo::ui::ViewTreeTokenPtr view_tree_token); | 46 mojo::ui::ViewTreeTokenPtr view_tree_token); |
46 ~InputDispatcherImpl() override; | 47 ~InputDispatcherImpl() override; |
47 | 48 |
48 private: | 49 private: |
49 void DispatchEvent(mojo::EventPtr event) override; | 50 void DispatchEvent(mojo::EventPtr event) override; |
50 | 51 |
51 InputAssociate* const associate_; | 52 InputAssociate* const associate_; |
52 mojo::ui::ViewTreeTokenPtr view_tree_token_; | 53 mojo::ui::ViewTreeTokenPtr view_tree_token_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(InputDispatcherImpl); | 55 DISALLOW_COPY_AND_ASSIGN(InputDispatcherImpl); |
55 }; | 56 }; |
56 | 57 |
57 // |ViewAssociate|: | 58 // |ViewAssociate|: |
58 void Connect(mojo::ui::ViewInspectorPtr inspector, | 59 void Connect(mojo::InterfaceHandle<mojo::ui::ViewInspector> inspector, |
59 const ConnectCallback& callback) override; | 60 const ConnectCallback& callback) override; |
60 void ConnectToViewService( | 61 void ConnectToViewService( |
61 mojo::ui::ViewTokenPtr view_token, | 62 mojo::ui::ViewTokenPtr view_token, |
62 const mojo::String& service_name, | 63 const mojo::String& service_name, |
63 mojo::ScopedMessagePipeHandle client_handle) override; | 64 mojo::ScopedMessagePipeHandle client_handle) override; |
64 void ConnectToViewTreeService( | 65 void ConnectToViewTreeService( |
65 mojo::ui::ViewTreeTokenPtr view_tree_token, | 66 mojo::ui::ViewTreeTokenPtr view_tree_token, |
66 const mojo::String& service_name, | 67 const mojo::String& service_name, |
67 mojo::ScopedMessagePipeHandle client_handle) override; | 68 mojo::ScopedMessagePipeHandle client_handle) override; |
68 | 69 |
69 // Incoming service calls. | 70 // Incoming service calls. |
70 void SetListener(mojo::ui::ViewToken* view_token, | 71 void SetListener(mojo::ui::ViewToken* view_token, |
71 mojo::ui::InputListenerPtr listener); | 72 mojo::InterfaceHandle<mojo::ui::InputListener> listener); |
72 void DispatchEvent(mojo::ui::ViewTreeToken* view_tree_token, | 73 void DispatchEvent(mojo::ui::ViewTreeToken* view_tree_token, |
73 mojo::EventPtr event); | 74 mojo::EventPtr event); |
74 | 75 |
75 // Callbacks. | 76 // Callbacks. |
76 void OnEventFinished(bool handled); | 77 void OnEventFinished(bool handled); |
77 | 78 |
78 mojo::StrongBindingSet<mojo::ui::InputConnection> input_connections_; | 79 mojo::StrongBindingSet<mojo::ui::InputConnection> input_connections_; |
79 mojo::StrongBindingSet<mojo::ui::InputDispatcher> input_dispatchers_; | 80 mojo::StrongBindingSet<mojo::ui::InputDispatcher> input_dispatchers_; |
80 | 81 |
81 mojo::ui::InputListenerPtr listener_; | 82 mojo::ui::InputListenerPtr listener_; |
82 | 83 |
83 DISALLOW_COPY_AND_ASSIGN(InputAssociate); | 84 DISALLOW_COPY_AND_ASSIGN(InputAssociate); |
84 }; | 85 }; |
85 | 86 |
86 } // namespace input_manager | 87 } // namespace input_manager |
87 | 88 |
88 #endif // SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ | 89 #endif // SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ |
OLD | NEW |