| 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" |
| 11 #include "content/common/input/input_event_ack_state.h" | 11 #include "content/common/input/input_event_ack_state.h" |
| 12 #include "content/renderer/render_view_impl.h" | 12 #include "content/renderer/render_view_impl.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class MessageLoopProxy; | 15 class MessageLoopProxy; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 class InputHandler; | 19 class InputHandler; |
| 20 struct InputHandlerScrollResult; | 20 struct InputHandlerScrollResult; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace blink { | 23 namespace blink { |
| 24 class WebInputEvent; | 24 class WebInputEvent; |
| 25 class WebMouseWheelEvent; | 25 class WebMouseWheelEvent; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace scheduler { |
| 29 class RendererScheduler; |
| 30 } |
| 31 |
| 28 namespace content { | 32 namespace content { |
| 29 | 33 |
| 30 class InputHandlerWrapper; | 34 class InputHandlerWrapper; |
| 31 class InputHandlerManagerClient; | 35 class InputHandlerManagerClient; |
| 32 struct DidOverscrollParams; | 36 struct DidOverscrollParams; |
| 33 class RendererScheduler; | |
| 34 | 37 |
| 35 // InputHandlerManager class manages InputHandlerProxy instances for | 38 // InputHandlerManager class manages InputHandlerProxy instances for |
| 36 // the WebViews in this renderer. | 39 // the WebViews in this renderer. |
| 37 class InputHandlerManager { | 40 class InputHandlerManager { |
| 38 public: | 41 public: |
| 39 // |message_loop_proxy| is the MessageLoopProxy of the compositor thread. The | 42 // |message_loop_proxy| is the MessageLoopProxy of the compositor thread. The |
| 40 // underlying MessageLoop and supplied |client| and the |renderer_scheduler| | 43 // underlying MessageLoop and supplied |client| and the |renderer_scheduler| |
| 41 // must outlive this object. The RendererScheduler needs to know when input | 44 // must outlive this object. The RendererScheduler needs to know when input |
| 42 // 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. |
| 43 InputHandlerManager( | 46 InputHandlerManager( |
| 44 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, | 47 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, |
| 45 InputHandlerManagerClient* client, | 48 InputHandlerManagerClient* client, |
| 46 RendererScheduler* renderer_scheduler); | 49 scheduler::RendererScheduler* renderer_scheduler); |
| 47 ~InputHandlerManager(); | 50 ~InputHandlerManager(); |
| 48 | 51 |
| 49 // Callable from the main thread only. | 52 // Callable from the main thread only. |
| 50 void AddInputHandler( | 53 void AddInputHandler( |
| 51 int routing_id, | 54 int routing_id, |
| 52 const base::WeakPtr<cc::InputHandler>& input_handler, | 55 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 53 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 56 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
| 54 | 57 |
| 55 void ObserveWheelEventAndResultOnMainThread( | 58 void ObserveWheelEventAndResultOnMainThread( |
| 56 int routing_id, | 59 int routing_id, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 int routing_id, | 92 int routing_id, |
| 90 const blink::WebMouseWheelEvent& wheel_event, | 93 const blink::WebMouseWheelEvent& wheel_event, |
| 91 const cc::InputHandlerScrollResult& scroll_result); | 94 const cc::InputHandlerScrollResult& scroll_result); |
| 92 | 95 |
| 93 typedef base::ScopedPtrHashMap<int, // routing_id | 96 typedef base::ScopedPtrHashMap<int, // routing_id |
| 94 InputHandlerWrapper> InputHandlerMap; | 97 InputHandlerWrapper> InputHandlerMap; |
| 95 InputHandlerMap input_handlers_; | 98 InputHandlerMap input_handlers_; |
| 96 | 99 |
| 97 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 100 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 98 InputHandlerManagerClient* client_; | 101 InputHandlerManagerClient* client_; |
| 99 RendererScheduler* renderer_scheduler_; // Not owned. | 102 scheduler::RendererScheduler* renderer_scheduler_; // Not owned. |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 } // namespace content | 105 } // namespace content |
| 103 | 106 |
| 104 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 107 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| OLD | NEW |