| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // underlying MessageLoop and supplied |client| and the |renderer_scheduler| | 43 // underlying MessageLoop and supplied |client| and the |renderer_scheduler| |
| 44 // must outlive this object. The RendererScheduler needs to know when input | 44 // must outlive this object. The RendererScheduler needs to know when input |
| 45 // events and fling animations occur, which is why it's passed in here. | 45 // events and fling animations occur, which is why it's passed in here. |
| 46 InputHandlerManager( | 46 InputHandlerManager( |
| 47 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 47 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 48 InputHandlerManagerClient* client, | 48 InputHandlerManagerClient* client, |
| 49 scheduler::RendererScheduler* renderer_scheduler); | 49 scheduler::RendererScheduler* renderer_scheduler); |
| 50 ~InputHandlerManager(); | 50 ~InputHandlerManager(); |
| 51 | 51 |
| 52 // Callable from the main thread only. | 52 // Callable from the main thread only. |
| 53 void AddInputHandler( | 53 void AddInputHandler(int routing_id, |
| 54 int routing_id, | 54 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 55 const base::WeakPtr<cc::InputHandler>& input_handler, | 55 const base::WeakPtr<RenderViewImpl>& render_view_impl, |
| 56 const base::WeakPtr<RenderViewImpl>& render_view_impl, | 56 bool enable_smooth_scrolling, |
| 57 bool enable_smooth_scrolling); | 57 bool enable_wheel_gestures); |
| 58 | 58 |
| 59 void ObserveWheelEventAndResultOnMainThread( | 59 void ObserveWheelEventAndResultOnMainThread( |
| 60 int routing_id, | 60 int routing_id, |
| 61 const blink::WebMouseWheelEvent& wheel_event, | 61 const blink::WebMouseWheelEvent& wheel_event, |
| 62 const cc::InputHandlerScrollResult& scroll_result); | 62 const cc::InputHandlerScrollResult& scroll_result); |
| 63 | 63 |
| 64 void NonBlockingInputEventHandledOnMainThread(int routing_id, |
| 65 blink::WebInputEvent::Type); |
| 66 |
| 64 // Callback only from the compositor's thread. | 67 // Callback only from the compositor's thread. |
| 65 void RemoveInputHandler(int routing_id); | 68 void RemoveInputHandler(int routing_id); |
| 66 | 69 |
| 67 // Called from the compositor's thread. | 70 // Called from the compositor's thread. |
| 68 InputEventAckState HandleInputEvent(int routing_id, | 71 InputEventAckState HandleInputEvent(int routing_id, |
| 69 const blink::WebInputEvent* input_event, | 72 const blink::WebInputEvent* input_event, |
| 70 ui::LatencyInfo* latency_info); | 73 ui::LatencyInfo* latency_info); |
| 71 | 74 |
| 72 // Called from the compositor's thread. | 75 // Called from the compositor's thread. |
| 73 void DidOverscroll(int routing_id, const DidOverscrollParams& params); | 76 void DidOverscroll(int routing_id, const DidOverscrollParams& params); |
| 74 | 77 |
| 75 // Called from the compositor's thread. | 78 // Called from the compositor's thread. |
| 76 void DidStopFlinging(int routing_id); | 79 void DidStopFlinging(int routing_id); |
| 77 | 80 |
| 78 // Called from the compositor's thread. | 81 // Called from the compositor's thread. |
| 79 void DidAnimateForInput(); | 82 void DidAnimateForInput(); |
| 80 | 83 |
| 81 private: | 84 private: |
| 82 // Called from the compositor's thread. | 85 // Called from the compositor's thread. |
| 83 void AddInputHandlerOnCompositorThread( | 86 void AddInputHandlerOnCompositorThread( |
| 84 int routing_id, | 87 int routing_id, |
| 85 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, | 88 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, |
| 86 const base::WeakPtr<cc::InputHandler>& input_handler, | 89 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 87 const base::WeakPtr<RenderViewImpl>& render_view_impl, | 90 const base::WeakPtr<RenderViewImpl>& render_view_impl, |
| 88 bool enable_smooth_scrolling); | 91 bool enable_smooth_scrolling, |
| 92 bool enable_wheel_gestures); |
| 89 | 93 |
| 90 void ObserveWheelEventAndResultOnCompositorThread( | 94 void ObserveWheelEventAndResultOnCompositorThread( |
| 91 int routing_id, | 95 int routing_id, |
| 92 const blink::WebMouseWheelEvent& wheel_event, | 96 const blink::WebMouseWheelEvent& wheel_event, |
| 93 const cc::InputHandlerScrollResult& scroll_result); | 97 const cc::InputHandlerScrollResult& scroll_result); |
| 94 | 98 |
| 99 void NonBlockingInputEventHandledOnCompositorThread( |
| 100 int routing_id, |
| 101 blink::WebInputEvent::Type); |
| 102 |
| 95 typedef base::ScopedPtrHashMap<int, // routing_id | 103 typedef base::ScopedPtrHashMap<int, // routing_id |
| 96 scoped_ptr<InputHandlerWrapper>> | 104 scoped_ptr<InputHandlerWrapper>> |
| 97 InputHandlerMap; | 105 InputHandlerMap; |
| 98 InputHandlerMap input_handlers_; | 106 InputHandlerMap input_handlers_; |
| 99 | 107 |
| 100 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 108 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 101 InputHandlerManagerClient* client_; | 109 InputHandlerManagerClient* client_; |
| 102 scheduler::RendererScheduler* renderer_scheduler_; // Not owned. | 110 scheduler::RendererScheduler* renderer_scheduler_; // Not owned. |
| 103 }; | 111 }; |
| 104 | 112 |
| 105 } // namespace content | 113 } // namespace content |
| 106 | 114 |
| 107 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 115 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| OLD | NEW |