Commit e8e14cfc authored by James Cook's avatar James Cook Committed by Commit Bot

cros: Fix crash when using screen casting extension

In crrev.com/547515 I removed this block of code from
ChromeViewsDelegate::CreateNativeWidget:

  if (params->context)
    params->context = params->context->GetRootWindow();

The Screencastify extension uses DesktopMediaPickerDialogView, which
apparently supplies a context window with no parent. We were relying
on the code above to make params->context null so it would trigger a
fallback code path.

It's not clear why that code was added in the first place. It
appeared in https://crrev.com/230793 as part of a revert of some
RLZ refactoring. However, we depend on the code now, and I cannot
guarantee that all browser code supplies a context with a valid
root window, so put it back.

TBR=oshima@chromium.org

Bug: 828626, 311339
Test: none
Change-Id: I70b9a884fdf471d34d626237b72b92325cba5df8
Reviewed-on: https://chromium-review.googlesource.com/994461Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547978}
parent 1125e2d9
...@@ -75,6 +75,12 @@ ChromeViewsDelegate::GetOpacityForInitParams( ...@@ -75,6 +75,12 @@ ChromeViewsDelegate::GetOpacityForInitParams(
views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget( views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget(
views::Widget::InitParams* params, views::Widget::InitParams* params,
views::internal::NativeWidgetDelegate* delegate) { views::internal::NativeWidgetDelegate* delegate) {
// The context should be associated with a root window. If the context has a
// null root window (e.g. the context window has no parent) it will trigger
// the fallback case below. https://crbug.com/828626 https://crrev.com/230793
if (params->context)
params->context = params->context->GetRootWindow();
// Classic ash requires a parent or a context that it can use to look up a // Classic ash requires a parent or a context that it can use to look up a
// root window to find a WindowParentingClient. Mash handles window parenting // root window to find a WindowParentingClient. Mash handles window parenting
// inside ash, see ash::CreateAndParentTopLevelWindow(). // inside ash, see ash::CreateAndParentTopLevelWindow().
......
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