Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: content/renderer/input/input_event_filter.cc

Issue 283623002: Add support for passing an arbitrary parameter to an IPC message handler. The motivation is for Web… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "content/renderer/input/input_event_filter.h" 5 #include "content/renderer/input/input_event_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 "InputEventFilter::ForwardToHandler::ForwardToMainListener", 139 "InputEventFilter::ForwardToHandler::ForwardToMainListener",
140 TRACE_EVENT_SCOPE_THREAD); 140 TRACE_EVENT_SCOPE_THREAD);
141 main_loop_->PostTask( 141 main_loop_->PostTask(
142 FROM_HERE, 142 FROM_HERE,
143 base::Bind(&InputEventFilter::ForwardToMainListener, 143 base::Bind(&InputEventFilter::ForwardToMainListener,
144 this, message)); 144 this, message));
145 return; 145 return;
146 } 146 }
147 147
148 int routing_id = message.routing_id(); 148 int routing_id = message.routing_id();
149 ui::LatencyInfo latency_info; 149 InputMsg_HandleInputEvent::Param params;
150 const WebInputEvent* event = NULL; 150 if (!InputMsg_HandleInputEvent::Read(&message, &params))
151 bool is_keyboard_shortcut;
152 if (!InputMsg_HandleInputEvent::Read(
153 &message, &event, &latency_info, &is_keyboard_shortcut))
154 return; 151 return;
152 const WebInputEvent* event = params.a;
153 ui::LatencyInfo latency_info = params.b;
154 bool is_keyboard_shortcut = params.c;
155 DCHECK(event); 155 DCHECK(event);
156 156
157 InputEventAckState ack = handler_.Run(routing_id, event, &latency_info); 157 InputEventAckState ack = handler_.Run(routing_id, event, &latency_info);
158 158
159 if (ack == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) { 159 if (ack == INPUT_EVENT_ACK_STATE_NOT_CONSUMED) {
160 TRACE_EVENT_INSTANT0( 160 TRACE_EVENT_INSTANT0(
161 "input", 161 "input",
162 "InputEventFilter::ForwardToHandler::ForwardToMainListener", 162 "InputEventFilter::ForwardToHandler::ForwardToMainListener",
163 TRACE_EVENT_SCOPE_THREAD); 163 TRACE_EVENT_SCOPE_THREAD);
164 IPC::Message new_msg = InputMsg_HandleInputEvent( 164 IPC::Message new_msg = InputMsg_HandleInputEvent(
(...skipping 28 matching lines...) Expand all
193 void InputEventFilter::SendMessageOnIOThread(const IPC::Message& message) { 193 void InputEventFilter::SendMessageOnIOThread(const IPC::Message& message) {
194 DCHECK(io_loop_->BelongsToCurrentThread()); 194 DCHECK(io_loop_->BelongsToCurrentThread());
195 195
196 if (!sender_) 196 if (!sender_)
197 return; // Filter was removed. 197 return; // Filter was removed.
198 198
199 sender_->Send(new IPC::Message(message)); 199 sender_->Send(new IPC::Message(message));
200 } 200 }
201 201
202 } // namespace content 202 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/browser_plugin/browser_plugin_manager_impl.cc ('k') | content/renderer/input/input_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698