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 #include "content/renderer/gpu/input_handler_manager.h" | 5 #include "content/renderer/gpu/input_handler_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/input/input_handler.h" | 9 #include "cc/input/input_handler.h" |
10 #include "content/renderer/gpu/input_event_filter.h" | 10 #include "content/renderer/gpu/input_event_filter.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (input_handlers_.count(routing_id) != 0) | 84 if (input_handlers_.count(routing_id) != 0) |
85 return; | 85 return; |
86 | 86 |
87 TRACE_EVENT0("InputHandlerManager::AddInputHandler", "AddingRoute"); | 87 TRACE_EVENT0("InputHandlerManager::AddInputHandler", "AddingRoute"); |
88 filter_->AddRoute(routing_id); | 88 filter_->AddRoute(routing_id); |
89 input_handlers_[routing_id] = | 89 input_handlers_[routing_id] = |
90 make_scoped_refptr(new InputHandlerWrapper(this, | 90 make_scoped_refptr(new InputHandlerWrapper(this, |
91 routing_id, main_loop, input_handler, render_view_impl)); | 91 routing_id, main_loop, input_handler, render_view_impl)); |
92 } | 92 } |
93 | 93 |
| 94 void InputHandlerManager::SetRootLayerScrollDelegate( |
| 95 int routing_id, |
| 96 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { |
| 97 message_loop_proxy_->PostTask( |
| 98 FROM_HERE, |
| 99 base::Bind( |
| 100 &InputHandlerManager::SetRootLayerScrollDelegateOnCompositorThread, |
| 101 base::Unretained(this), |
| 102 routing_id, |
| 103 base::Unretained(root_layer_scroll_offset_delegate))); |
| 104 } |
| 105 |
| 106 void InputHandlerManager::SetRootLayerScrollDelegateOnCompositorThread( |
| 107 int routing_id, |
| 108 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { |
| 109 input_handlers_[routing_id]->input_handler_proxy() |
| 110 ->SetRootLayerScrollOffsetDelegate(root_layer_scroll_offset_delegate); |
| 111 } |
| 112 |
94 void InputHandlerManager::RemoveInputHandler(int routing_id) { | 113 void InputHandlerManager::RemoveInputHandler(int routing_id) { |
95 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); | 114 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); |
96 | 115 |
97 TRACE_EVENT0("InputHandlerManager::RemoveInputHandler", "RemovingRoute"); | 116 TRACE_EVENT0("InputHandlerManager::RemoveInputHandler", "RemovingRoute"); |
98 | 117 |
99 filter_->RemoveRoute(routing_id); | 118 filter_->RemoveRoute(routing_id); |
100 input_handlers_.erase(routing_id); | 119 input_handlers_.erase(routing_id); |
101 } | 120 } |
102 | 121 |
103 void InputHandlerManager::HandleInputEvent( | 122 void InputHandlerManager::HandleInputEvent( |
104 int routing_id, | 123 int routing_id, |
105 const WebInputEvent* input_event) { | 124 const WebInputEvent* input_event) { |
106 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); | 125 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); |
107 | 126 |
108 InputHandlerMap::iterator it = input_handlers_.find(routing_id); | 127 InputHandlerMap::iterator it = input_handlers_.find(routing_id); |
109 if (it == input_handlers_.end()) { | 128 if (it == input_handlers_.end()) { |
110 TRACE_EVENT0("InputHandlerManager::HandleInputEvent", | 129 TRACE_EVENT0("InputHandlerManager::HandleInputEvent", |
111 "NoInputHandlerFound"); | 130 "NoInputHandlerFound"); |
112 // Oops, we no longer have an interested input handler.. | 131 // Oops, we no longer have an interested input handler.. |
113 filter_->DidNotHandleInputEvent(true); | 132 filter_->DidNotHandleInputEvent(true); |
114 return; | 133 return; |
115 } | 134 } |
116 | 135 |
117 it->second->input_handler_proxy()->HandleInputEvent(*input_event); | 136 it->second->input_handler_proxy()->HandleInputEvent(*input_event); |
118 } | 137 } |
119 | 138 |
120 } // namespace content | 139 } // namespace content |
OLD | NEW |