Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GPU_INPUT_HANDLER_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ |
| 6 #define CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ | 6 #define CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 namespace WebKit { | 24 namespace WebKit { |
| 25 class WebInputEvent; | 25 class WebInputEvent; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 | 29 |
| 30 class InputHandlerWrapper; | 30 class InputHandlerWrapper; |
| 31 class InputHandlerManagerClient; | 31 class InputHandlerManagerClient; |
| 32 | 32 |
| 33 // InputEventRewriter class allows client to rewrite incoming input events | |
|
aelias_OOO_until_Jul13
2013/09/13 23:51:44
I don't see why you need this on the impl-thread s
dgozman
2013/09/14 07:42:42
Doesn't main thread get events through regular ren
dgozman
2013/09/19 10:17:11
This is removed.
| |
| 34 // before passing them to the handler. | |
| 35 class InputEventRewriter { | |
| 36 public: | |
| 37 virtual ~InputEventRewriter() {} | |
| 38 | |
| 39 virtual WebKit::WebInputEvent* RewriteInputEvent( | |
| 40 const WebKit::WebInputEvent* event) = 0; | |
| 41 }; | |
| 42 | |
| 33 // InputHandlerManager class manages InputHandlerProxy instances for | 43 // InputHandlerManager class manages InputHandlerProxy instances for |
| 34 // the WebViews in this renderer. | 44 // the WebViews in this renderer. |
| 35 class InputHandlerManager { | 45 class InputHandlerManager { |
| 36 public: | 46 public: |
| 37 // |message_loop_proxy| is the MessageLoopProxy of the compositor thread. Both | 47 // |message_loop_proxy| is the MessageLoopProxy of the compositor thread. Both |
| 38 // the underlying MessageLoop and supplied |client| must outlive this object. | 48 // the underlying MessageLoop and supplied |client| must outlive this object. |
| 39 InputHandlerManager( | 49 InputHandlerManager( |
| 40 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, | 50 const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, |
| 41 InputHandlerManagerClient* client); | 51 InputHandlerManagerClient* client); |
| 42 ~InputHandlerManager(); | 52 ~InputHandlerManager(); |
| 43 | 53 |
| 44 // Callable from the main thread only. | 54 // Callable from the main thread only. |
| 45 void AddInputHandler( | 55 void AddInputHandler( |
| 46 int routing_id, | 56 int routing_id, |
| 47 const base::WeakPtr<cc::InputHandler>& input_handler, | 57 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 48 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 58 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
| 49 | 59 |
| 60 // Callable from the main thread only. This takes ownership of rewriter and | |
| 61 // uses it later on compositor's thread. | |
| 62 void SetInputEventRewriter(int routing_id, | |
| 63 scoped_ptr<InputEventRewriter> rewriter); | |
| 64 | |
| 50 // Callback only from the compositor's thread. | 65 // Callback only from the compositor's thread. |
| 51 void RemoveInputHandler(int routing_id); | 66 void RemoveInputHandler(int routing_id); |
| 52 | 67 |
| 53 // Called from the compositor's thread. | 68 // Called from the compositor's thread. |
| 54 InputEventAckState HandleInputEvent(int routing_id, | 69 InputEventAckState HandleInputEvent(int routing_id, |
| 55 const WebKit::WebInputEvent* input_event, | 70 const WebKit::WebInputEvent* input_event, |
| 56 const ui::LatencyInfo& latency_info); | 71 const ui::LatencyInfo& latency_info); |
| 57 | 72 |
| 58 // Called from the compositor's thread. | 73 // Called from the compositor's thread. |
| 59 void DidOverscroll(int routing_id, const cc::DidOverscrollParams& params); | 74 void DidOverscroll(int routing_id, const cc::DidOverscrollParams& params); |
| 60 | 75 |
| 61 private: | 76 private: |
| 62 // Called from the compositor's thread. | 77 // Called from the compositor's thread. |
| 63 void AddInputHandlerOnCompositorThread( | 78 void AddInputHandlerOnCompositorThread( |
| 64 int routing_id, | 79 int routing_id, |
| 65 const scoped_refptr<base::MessageLoopProxy>& main_loop, | 80 const scoped_refptr<base::MessageLoopProxy>& main_loop, |
| 66 const base::WeakPtr<cc::InputHandler>& input_handler, | 81 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 67 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 82 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
| 83 void SetInputEventRewriterOnCompositorThread( | |
| 84 int routing_id, | |
| 85 scoped_ptr<InputEventRewriter> rewriter); | |
| 68 | 86 |
| 69 typedef std::map<int, // routing_id | 87 typedef std::map<int, // routing_id |
| 70 scoped_refptr<InputHandlerWrapper> > InputHandlerMap; | 88 scoped_refptr<InputHandlerWrapper> > InputHandlerMap; |
| 71 InputHandlerMap input_handlers_; | 89 InputHandlerMap input_handlers_; |
| 72 | 90 |
| 73 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 91 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 74 InputHandlerManagerClient* client_; | 92 InputHandlerManagerClient* client_; |
| 75 }; | 93 }; |
| 76 | 94 |
| 77 } // namespace content | 95 } // namespace content |
| 78 | 96 |
| 79 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ | 97 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ |
| OLD | NEW |