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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 if (input_handlers_.count(routing_id) != 0) | 65 if (input_handlers_.count(routing_id) != 0) |
66 return; | 66 return; |
67 | 67 |
68 TRACE_EVENT0("InputHandlerManager::AddInputHandler", "AddingRoute"); | 68 TRACE_EVENT0("InputHandlerManager::AddInputHandler", "AddingRoute"); |
69 filter_->AddRoute(routing_id); | 69 filter_->AddRoute(routing_id); |
70 input_handlers_[routing_id] = | 70 input_handlers_[routing_id] = |
71 make_scoped_refptr(new InputHandlerWrapper(this, | 71 make_scoped_refptr(new InputHandlerWrapper(this, |
72 routing_id, main_loop, input_handler, render_view_impl)); | 72 routing_id, main_loop, input_handler, render_view_impl)); |
73 } | 73 } |
74 | 74 |
| 75 void InputHandlerManager::SetRootLayerScrollDelegate( |
| 76 int routing_id, |
| 77 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) { |
| 78 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); |
| 79 |
| 80 input_handlers_[routing_id]->input_handler_proxy() |
| 81 ->SetRootLayerScrollOffsetDelegate(root_layer_scroll_offset_delegate); |
| 82 } |
| 83 |
75 void InputHandlerManager::RemoveInputHandler(int routing_id) { | 84 void InputHandlerManager::RemoveInputHandler(int routing_id) { |
76 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); | 85 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); |
77 | 86 |
78 TRACE_EVENT0("InputHandlerManager::RemoveInputHandler", "RemovingRoute"); | 87 TRACE_EVENT0("InputHandlerManager::RemoveInputHandler", "RemovingRoute"); |
79 | 88 |
80 filter_->RemoveRoute(routing_id); | 89 filter_->RemoveRoute(routing_id); |
81 input_handlers_.erase(routing_id); | 90 input_handlers_.erase(routing_id); |
82 } | 91 } |
83 | 92 |
84 void InputHandlerManager::HandleInputEvent( | 93 void InputHandlerManager::HandleInputEvent( |
85 int routing_id, | 94 int routing_id, |
86 const WebInputEvent* input_event) { | 95 const WebInputEvent* input_event) { |
87 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); | 96 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); |
88 | 97 |
89 InputHandlerMap::iterator it = input_handlers_.find(routing_id); | 98 InputHandlerMap::iterator it = input_handlers_.find(routing_id); |
90 if (it == input_handlers_.end()) { | 99 if (it == input_handlers_.end()) { |
91 TRACE_EVENT0("InputHandlerManager::HandleInputEvent", | 100 TRACE_EVENT0("InputHandlerManager::HandleInputEvent", |
92 "NoInputHandlerFound"); | 101 "NoInputHandlerFound"); |
93 // Oops, we no longer have an interested input handler.. | 102 // Oops, we no longer have an interested input handler.. |
94 filter_->DidNotHandleInputEvent(true); | 103 filter_->DidNotHandleInputEvent(true); |
95 return; | 104 return; |
96 } | 105 } |
97 | 106 |
98 it->second->input_handler_proxy()->HandleInputEvent(*input_event); | 107 it->second->input_handler_proxy()->HandleInputEvent(*input_event); |
99 } | 108 } |
100 | 109 |
101 } // namespace content | 110 } // namespace content |
OLD | NEW |