Index: services/ui/input_manager/input_associate.h |
diff --git a/services/ui/input_manager/input_associate.h b/services/ui/input_manager/input_associate.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..945d8f1440e9a5a7c3fa6e04538a8095895f6789 |
--- /dev/null |
+++ b/services/ui/input_manager/input_associate.h |
@@ -0,0 +1,88 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ |
+#define SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ |
+ |
+#include "base/macros.h" |
+#include "mojo/common/strong_binding_set.h" |
+#include "mojo/services/ui/input/interfaces/input_connection.mojom.h" |
+#include "mojo/services/ui/input/interfaces/input_dispatcher.mojom.h" |
+#include "mojo/services/ui/views/interfaces/view_associates.mojom.h" |
+ |
+namespace input_manager { |
+ |
+// InputManager's ViewAssociate interface implementation. |
+class InputAssociate : public mojo::ui::ViewAssociate { |
+ public: |
+ explicit InputAssociate(); |
abarth
2016/01/10 01:42:54
No need for "explicit" here.
jeffbrown
2016/01/26 05:59:12
Done.
|
+ ~InputAssociate() override; |
+ |
+ private: |
+ // InputConnection implementation. |
+ // Binds incoming requests to the relevant view token. |
+ class InputConnectionImpl : public mojo::ui::InputConnection { |
+ public: |
+ InputConnectionImpl(InputAssociate* associate, |
+ mojo::ui::ViewTokenPtr view_token); |
+ ~InputConnectionImpl() override; |
+ |
+ private: |
+ void SetListener(mojo::ui::InputListenerPtr listener) override; |
+ |
+ InputAssociate* const associate_; |
+ mojo::ui::ViewTokenPtr view_token_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(InputConnectionImpl); |
+ }; |
+ |
+ // InputDispatcher implementation. |
+ // Binds incoming requests to the relevant view token. |
+ class InputDispatcherImpl : public mojo::ui::InputDispatcher { |
+ public: |
+ InputDispatcherImpl(InputAssociate* associate, |
+ mojo::ui::ViewTreeTokenPtr view_tree_token); |
+ ~InputDispatcherImpl() override; |
+ |
+ private: |
+ void DispatchEvent(mojo::EventPtr event) override; |
+ |
+ InputAssociate* const associate_; |
+ mojo::ui::ViewTreeTokenPtr view_tree_token_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(InputDispatcherImpl); |
+ }; |
+ |
+ // |ViewAssociate|: |
+ void Connect(mojo::ui::ViewInspectorPtr inspector, |
+ const ConnectCallback& callback) override; |
+ void ConnectToViewService( |
+ mojo::ui::ViewTokenPtr view_token, |
+ const mojo::String& service_name, |
+ mojo::ScopedMessagePipeHandle client_handle) override; |
+ void ConnectToViewTreeService( |
+ mojo::ui::ViewTreeTokenPtr view_tree_token, |
+ const mojo::String& service_name, |
+ mojo::ScopedMessagePipeHandle client_handle) override; |
+ |
+ // Incoming service calls. |
+ void SetListener(mojo::ui::ViewToken* view_token, |
+ mojo::ui::InputListenerPtr listener); |
+ void DispatchEvent(mojo::ui::ViewTreeToken* view_tree_token, |
+ mojo::EventPtr event); |
+ |
+ // Callbacks. |
+ void OnEventFinished(bool handled); |
+ |
+ mojo::StrongBindingSet<mojo::ui::InputConnection> input_connections_; |
+ mojo::StrongBindingSet<mojo::ui::InputDispatcher> input_dispatchers_; |
+ |
+ mojo::ui::InputListenerPtr listener_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(InputAssociate); |
+}; |
+ |
+} // namespace input_manager |
+ |
+#endif // SERVICES_UI_INPUT_MANAGER_INPUT_ASSOCIATE_IMPL_H_ |