OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SERVICES_UI_INPUT_MANAGER_INPUT_DISPATCHER_IMPL_H_ |
| 6 #define SERVICES_UI_INPUT_MANAGER_INPUT_DISPATCHER_IMPL_H_ |
| 7 |
| 8 #include <queue> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "mojo/public/cpp/bindings/binding.h" |
| 13 #include "mojo/public/cpp/bindings/interface_request.h" |
| 14 #include "mojo/services/geometry/interfaces/geometry.mojom.h" |
| 15 #include "mojo/services/ui/input/interfaces/input_dispatcher.mojom.h" |
| 16 #include "mojo/services/ui/views/interfaces/view_trees.mojom.h" |
| 17 #include "mojo/ui/associates/view_tree_hit_tester_client.h" |
| 18 |
| 19 namespace input_manager { |
| 20 |
| 21 class InputAssociate; |
| 22 |
| 23 // InputDispatcher implementation. |
| 24 // Binds incoming requests to the relevant view token. |
| 25 class InputDispatcherImpl : public mojo::ui::InputDispatcher { |
| 26 public: |
| 27 InputDispatcherImpl( |
| 28 InputAssociate* associate, |
| 29 mojo::ui::ViewTreeTokenPtr view_tree_token, |
| 30 mojo::InterfaceRequest<mojo::ui::InputDispatcher> request); |
| 31 ~InputDispatcherImpl() override; |
| 32 |
| 33 const mojo::ui::ViewTreeToken* view_tree_token() const { |
| 34 return view_tree_token_.get(); |
| 35 } |
| 36 |
| 37 // |mojo::ui::InputDispatcher| |
| 38 void DispatchEvent(mojo::EventPtr event) override; |
| 39 |
| 40 private: |
| 41 void ProcessNextEvent(); |
| 42 void DeliverEvent(mojo::EventPtr event); |
| 43 void OnHitTestResult(scoped_ptr<mojo::ui::ResolvedHits> resolved_hits); |
| 44 |
| 45 InputAssociate* const associate_; |
| 46 mojo::ui::ViewTreeTokenPtr view_tree_token_; |
| 47 scoped_refptr<mojo::ui::ViewTreeHitTesterClient> hit_tester_; |
| 48 |
| 49 // TODO(jeffbrown): Replace this with a proper pipeline. |
| 50 std::queue<mojo::EventPtr> pending_events_; |
| 51 |
| 52 // TODO(jeffbrown): This hack is just for scaffolding. Redesign later. |
| 53 mojo::ui::ViewTokenPtr focused_view_token_; |
| 54 mojo::TransformPtr focused_view_transform_; |
| 55 |
| 56 mojo::Binding<mojo::ui::InputDispatcher> binding_; |
| 57 |
| 58 base::WeakPtrFactory<InputDispatcherImpl> weak_factory_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(InputDispatcherImpl); |
| 61 }; |
| 62 |
| 63 } // namespace input_manager |
| 64 |
| 65 #endif // SERVICES_UI_INPUT_MANAGER_INPUT_DISPATCHER_IMPL_H_ |
OLD | NEW |