Commit 2682d4ed authored by Kevin McNee's avatar Kevin McNee Committed by Commit Bot

Simplify RenderWidgetHostViewAura cast

RenderWidgetHostViewGuest has been removed, so there is no longer a need
to check whether a RWHVAura is related to a guest. We also add a DCHECK
to ensure the view is not a child frame which would make this a bad cast.

Bug: 533069
Change-Id: Ie71f246d3a524865a1217dd4e1521a5c5c60c295
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2017182Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734707}
parent 532819bd
...@@ -101,16 +101,13 @@ WebContentsViewAura::RenderWidgetHostViewCreateFunction ...@@ -101,16 +101,13 @@ WebContentsViewAura::RenderWidgetHostViewCreateFunction
RenderWidgetHostViewAura* ToRenderWidgetHostViewAura( RenderWidgetHostViewAura* ToRenderWidgetHostViewAura(
RenderWidgetHostView* view) { RenderWidgetHostView* view) {
if (!view || (RenderViewHostFactory::has_factory() && if (RenderViewHostFactory::has_factory() &&
!RenderViewHostFactory::is_real_render_view_host())) { !RenderViewHostFactory::is_real_render_view_host()) {
return nullptr; // Can't cast to RenderWidgetHostViewAura in unit tests. return nullptr; // Can't cast to RenderWidgetHostViewAura in unit tests.
} }
RenderViewHost* rvh = RenderViewHost::From(view->GetRenderWidgetHost()); DCHECK(!view || !static_cast<RenderWidgetHostViewBase*>(view)
WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( ->IsRenderWidgetHostViewChildFrame());
rvh ? WebContents::FromRenderViewHost(rvh) : nullptr);
if (BrowserPluginGuest::IsGuest(web_contents))
return nullptr;
return static_cast<RenderWidgetHostViewAura*>(view); return static_cast<RenderWidgetHostViewAura*>(view);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment