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

Side by Side Diff: content/browser/frame_host/cross_process_frame_connector.cc

Issue 2723963003: Remove renderer-to-renderer input event forwarding for OOPIFs (Closed)
Patch Set: Correct test expectation Created 3 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/frame_host/cross_process_frame_connector.h" 5 #include "content/browser/frame_host/cross_process_frame_connector.h"
6 6
7 #include "cc/surfaces/surface.h" 7 #include "cc/surfaces/surface.h"
8 #include "cc/surfaces/surface_hittest.h" 8 #include "cc/surfaces/surface_hittest.h"
9 #include "cc/surfaces/surface_manager.h" 9 #include "cc/surfaces/surface_manager.h"
10 #include "content/browser/compositor/surface_utils.h" 10 #include "content/browser/compositor/surface_utils.h"
(...skipping 22 matching lines...) Expand all
33 33
34 CrossProcessFrameConnector::~CrossProcessFrameConnector() { 34 CrossProcessFrameConnector::~CrossProcessFrameConnector() {
35 // Notify the view of this object being destroyed, if the view still exists. 35 // Notify the view of this object being destroyed, if the view still exists.
36 set_view(nullptr); 36 set_view(nullptr);
37 } 37 }
38 38
39 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) { 39 bool CrossProcessFrameConnector::OnMessageReceived(const IPC::Message& msg) {
40 bool handled = true; 40 bool handled = true;
41 41
42 IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg) 42 IPC_BEGIN_MESSAGE_MAP(CrossProcessFrameConnector, msg)
43 IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardInputEvent, OnForwardInputEvent)
44 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameRectChanged, OnFrameRectChanged) 43 IPC_MESSAGE_HANDLER(FrameHostMsg_FrameRectChanged, OnFrameRectChanged)
45 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateViewportIntersection, 44 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdateViewportIntersection,
46 OnUpdateViewportIntersection) 45 OnUpdateViewportIntersection)
47 IPC_MESSAGE_HANDLER(FrameHostMsg_VisibilityChanged, OnVisibilityChanged) 46 IPC_MESSAGE_HANDLER(FrameHostMsg_VisibilityChanged, OnVisibilityChanged)
48 IPC_MESSAGE_HANDLER(FrameHostMsg_SatisfySequence, OnSatisfySequence) 47 IPC_MESSAGE_HANDLER(FrameHostMsg_SatisfySequence, OnSatisfySequence)
49 IPC_MESSAGE_HANDLER(FrameHostMsg_RequireSequence, OnRequireSequence) 48 IPC_MESSAGE_HANDLER(FrameHostMsg_RequireSequence, OnRequireSequence)
50 IPC_MESSAGE_UNHANDLED(handled = false) 49 IPC_MESSAGE_UNHANDLED(handled = false)
51 IPC_END_MESSAGE_MAP() 50 IPC_END_MESSAGE_MAP()
52 51
53 return handled; 52 return handled;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return root_view->LockMouse(); 229 return root_view->LockMouse();
231 return false; 230 return false;
232 } 231 }
233 232
234 void CrossProcessFrameConnector::UnlockMouse() { 233 void CrossProcessFrameConnector::UnlockMouse() {
235 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); 234 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView();
236 if (root_view) 235 if (root_view)
237 root_view->UnlockMouse(); 236 root_view->UnlockMouse();
238 } 237 }
239 238
240 void CrossProcessFrameConnector::OnForwardInputEvent(
241 const blink::WebInputEvent* event) {
242 if (!view_)
243 return;
244
245 RenderFrameHostManager* manager =
246 frame_proxy_in_parent_renderer_->frame_tree_node()->render_manager();
247 RenderWidgetHostImpl* parent_widget =
248 manager->ForInnerDelegate()
249 ? manager->GetOuterRenderWidgetHostForKeyboardInput()
250 : frame_proxy_in_parent_renderer_->GetRenderViewHost()->GetWidget();
251
252 // TODO(wjmaclean): We should remove these forwarding functions, since they
253 // are directly target using RenderWidgetHostInputEventRouter. But neither
254 // pathway is currently handling gesture events, so that needs to be fixed
255 // in a subsequent CL.
256 if (blink::WebInputEvent::isKeyboardEventType(event->type())) {
257 if (!parent_widget->GetLastKeyboardEvent())
258 return;
259 NativeWebKeyboardEvent keyboard_event(
260 *parent_widget->GetLastKeyboardEvent());
261 view_->ProcessKeyboardEvent(keyboard_event);
262 return;
263 }
264
265 if (blink::WebInputEvent::isMouseEventType(event->type())) {
266 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs.
267 // https://crbug.com/613628
268 ui::LatencyInfo latency_info;
269 view_->ProcessMouseEvent(*static_cast<const blink::WebMouseEvent*>(event),
270 latency_info);
271 return;
272 }
273
274 if (event->type() == blink::WebInputEvent::MouseWheel) {
275 // TODO(wjmaclean): Initialize latency info correctly for OOPIFs.
276 // https://crbug.com/613628
277 ui::LatencyInfo latency_info;
278 view_->ProcessMouseWheelEvent(
279 *static_cast<const blink::WebMouseWheelEvent*>(event), latency_info);
280 return;
281 }
282 }
283
284 void CrossProcessFrameConnector::OnFrameRectChanged( 239 void CrossProcessFrameConnector::OnFrameRectChanged(
285 const gfx::Rect& frame_rect) { 240 const gfx::Rect& frame_rect) {
286 if (!frame_rect.size().IsEmpty()) 241 if (!frame_rect.size().IsEmpty())
287 SetRect(frame_rect); 242 SetRect(frame_rect);
288 } 243 }
289 244
290 void CrossProcessFrameConnector::OnUpdateViewportIntersection( 245 void CrossProcessFrameConnector::OnUpdateViewportIntersection(
291 const gfx::Rect& viewport_intersection) { 246 const gfx::Rect& viewport_intersection) {
292 if (view_) 247 if (view_)
293 view_->UpdateViewportIntersection(viewport_intersection); 248 view_->UpdateViewportIntersection(viewport_intersection);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 329
375 if (parent) { 330 if (parent) {
376 return static_cast<RenderWidgetHostViewBase*>( 331 return static_cast<RenderWidgetHostViewBase*>(
377 parent->current_frame_host()->GetView()); 332 parent->current_frame_host()->GetView());
378 } 333 }
379 334
380 return nullptr; 335 return nullptr;
381 } 336 }
382 337
383 } // namespace content 338 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698