| 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/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "content/renderer/render_view_impl.h" | 11 #include "content/renderer/render_view_impl.h" |
| 12 #include "ipc/ipc_channel_proxy.h" | 12 #include "ipc/ipc_channel_proxy.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 class LayerScrollOffsetDelegate; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace WebKit { | 23 namespace WebKit { |
| 23 class WebInputEvent; | 24 class WebInputEvent; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| 27 | 28 |
| 28 class InputEventFilter; | 29 class InputEventFilter; |
| 29 class InputHandlerWrapper; | 30 class InputHandlerWrapper; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 44 // This MessageFilter should be added to allow input events to be redirected | 45 // This MessageFilter should be added to allow input events to be redirected |
| 45 // to the compositor's thread. | 46 // to the compositor's thread. |
| 46 IPC::ChannelProxy::MessageFilter* GetMessageFilter() const; | 47 IPC::ChannelProxy::MessageFilter* GetMessageFilter() const; |
| 47 | 48 |
| 48 // Callable from the main thread only. | 49 // Callable from the main thread only. |
| 49 void AddInputHandler( | 50 void AddInputHandler( |
| 50 int routing_id, | 51 int routing_id, |
| 51 const base::WeakPtr<cc::InputHandler>& input_handler, | 52 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 52 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 53 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
| 53 | 54 |
| 55 // Callable from the main thread only. |
| 56 // |layer_scroll_delegate| will be accessed from the Compositor Impl thread |
| 57 // and must outlive the InputHandler that it's associated with. |
| 58 void SetRootLayerScrollDelegate( |
| 59 int routing_id, |
| 60 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate); |
| 61 |
| 54 // Callback only from the compositor's thread. | 62 // Callback only from the compositor's thread. |
| 55 void RemoveInputHandler(int routing_id); | 63 void RemoveInputHandler(int routing_id); |
| 56 | 64 |
| 57 // Called from the compositor's thread. | 65 // Called from the compositor's thread. |
| 58 void HandleInputEvent(int routing_id, | 66 void HandleInputEvent(int routing_id, |
| 59 const WebKit::WebInputEvent* input_event); | 67 const WebKit::WebInputEvent* input_event); |
| 60 | 68 |
| 61 // Called from the compositor's thread. | 69 // Called from the compositor's thread. |
| 62 InputEventFilter* filter() { return filter_.get(); } | 70 InputEventFilter* filter() { return filter_.get(); } |
| 63 | 71 |
| 64 private: | 72 private: |
| 65 // Called from the compositor's thread. | 73 // Called from the compositor's thread. |
| 66 void AddInputHandlerOnCompositorThread( | 74 void AddInputHandlerOnCompositorThread( |
| 67 int routing_id, | 75 int routing_id, |
| 68 const scoped_refptr<base::MessageLoopProxy>& main_loop, | 76 const scoped_refptr<base::MessageLoopProxy>& main_loop, |
| 69 const base::WeakPtr<cc::InputHandler>& input_handler, | 77 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 70 const base::WeakPtr<RenderViewImpl>& render_view_impl); | 78 const base::WeakPtr<RenderViewImpl>& render_view_impl); |
| 71 | 79 |
| 80 void SetRootLayerScrollDelegateOnCompositorThread( |
| 81 int routing_id, |
| 82 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate); |
| 83 |
| 72 typedef std::map<int, // routing_id | 84 typedef std::map<int, // routing_id |
| 73 scoped_refptr<InputHandlerWrapper> > InputHandlerMap; | 85 scoped_refptr<InputHandlerWrapper> > InputHandlerMap; |
| 74 InputHandlerMap input_handlers_; | 86 InputHandlerMap input_handlers_; |
| 75 | 87 |
| 76 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 88 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
| 77 scoped_refptr<InputEventFilter> filter_; | 89 scoped_refptr<InputEventFilter> filter_; |
| 78 }; | 90 }; |
| 79 | 91 |
| 80 } // namespace content | 92 } // namespace content |
| 81 | 93 |
| 82 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ | 94 #endif // CONTENT_RENDERER_GPU_INPUT_HANDLER_MANAGER_H_ |
| OLD | NEW |