| 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 BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_INPUT_MANAGER_H_ | 5 #ifndef BLIMP_CLIENT_CORE_INPUT_BLIMP_INPUT_MANAGER_H_ |
| 6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_INPUT_MANAGER_H_ | 6 #define BLIMP_CLIENT_CORE_INPUT_BLIMP_INPUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/synchronization/waitable_event.h" | |
| 13 #include "blimp/client/feature/compositor/blimp_input_handler_wrapper.h" | |
| 14 #include "third_party/WebKit/public/web/WebInputEvent.h" | |
| 15 #include "ui/events/gesture_detection/filtered_gesture_provider.h" | 12 #include "ui/events/gesture_detection/filtered_gesture_provider.h" |
| 16 #include "ui/events/gesture_detection/motion_event.h" | 13 |
| 14 namespace base { |
| 15 class SingleThreadTaskRunner; |
| 16 class WaitableEvent; |
| 17 } // namespace base |
| 18 |
| 19 namespace blink { |
| 20 class WebInputEvent; |
| 21 class WebGestureEvent; |
| 22 } // namespace blink |
| 23 |
| 24 namespace cc { |
| 25 class InputHandler; |
| 26 } // namespace cc |
| 27 |
| 28 namespace ui { |
| 29 class MotionEvent; |
| 30 } // namespace ui |
| 17 | 31 |
| 18 namespace blimp { | 32 namespace blimp { |
| 19 namespace client { | 33 namespace client { |
| 34 class BlimpInputHandlerWrapper; |
| 20 | 35 |
| 21 class BlimpInputManagerClient { | 36 class BlimpInputManagerClient { |
| 22 public: | 37 public: |
| 23 virtual void SendWebGestureEvent( | 38 virtual void SendWebGestureEvent( |
| 24 const blink::WebGestureEvent& gesture_event) = 0; | 39 const blink::WebGestureEvent& gesture_event) = 0; |
| 25 }; | 40 }; |
| 26 | 41 |
| 27 // The BlimpInputManager handles input events for a specific web widget. The | 42 // The BlimpInputManager handles input events for a specific web widget. The |
| 28 // class processes ui::events to generate web gesture events which are forwarded | 43 // class processes ui::events to generate web gesture events which are forwarded |
| 29 // to the compositor to be handled on the compositor thread. If the event can | 44 // to the compositor to be handled on the compositor thread. If the event can |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const base::WeakPtr<cc::InputHandler>& input_handler); | 94 const base::WeakPtr<cc::InputHandler>& input_handler); |
| 80 void HandleWebGestureEventOnCompositorThread( | 95 void HandleWebGestureEventOnCompositorThread( |
| 81 const blink::WebGestureEvent& gesture_event); | 96 const blink::WebGestureEvent& gesture_event); |
| 82 void ShutdownOnCompositorThread(base::WaitableEvent* shutdown_event); | 97 void ShutdownOnCompositorThread(base::WaitableEvent* shutdown_event); |
| 83 | 98 |
| 84 bool IsMainThread() const; | 99 bool IsMainThread() const; |
| 85 bool IsCompositorThread() const; | 100 bool IsCompositorThread() const; |
| 86 | 101 |
| 87 BlimpInputManagerClient* client_; | 102 BlimpInputManagerClient* client_; |
| 88 | 103 |
| 104 // Move out the gesture provider bits from the input manager. They should |
| 105 // exist in the document view and the manager should only get web input |
| 106 // events. |
| 89 ui::FilteredGestureProvider gesture_provider_; | 107 ui::FilteredGestureProvider gesture_provider_; |
| 90 | 108 |
| 91 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 109 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 92 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; | 110 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
| 93 | 111 |
| 94 // Used for debug assertions to ensure that the main thread is blocked during | 112 // Used for debug assertions to ensure that the main thread is blocked during |
| 95 // shutdown. Set in the destructor before the main thread is blocked and | 113 // shutdown. Set in the destructor before the main thread is blocked and |
| 96 // read in ShutdownOnCompositorThread. | 114 // read in ShutdownOnCompositorThread. |
| 97 bool main_thread_blocked_; | 115 bool main_thread_blocked_; |
| 98 | 116 |
| 99 std::unique_ptr<BlimpInputHandlerWrapper> input_handler_wrapper_; | 117 std::unique_ptr<BlimpInputHandlerWrapper> input_handler_wrapper_; |
| 100 | 118 |
| 101 base::WeakPtrFactory<BlimpInputManager> weak_factory_; | 119 base::WeakPtrFactory<BlimpInputManager> weak_factory_; |
| 102 | 120 |
| 103 DISALLOW_COPY_AND_ASSIGN(BlimpInputManager); | 121 DISALLOW_COPY_AND_ASSIGN(BlimpInputManager); |
| 104 }; | 122 }; |
| 105 | 123 |
| 106 } // namespace client | 124 } // namespace client |
| 107 } // namespace blimp | 125 } // namespace blimp |
| 108 | 126 |
| 109 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_INPUT_MANAGER_H_ | 127 #endif // BLIMP_CLIENT_CORE_INPUT_BLIMP_INPUT_MANAGER_H_ |
| OLD | NEW |