Chromium Code Reviews| Index: chrome/browser/ui/views/chrome_views_delegate.cc |
| diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc |
| index 96f14b1e5e8cb7e254ffe4a62e89f2e160e8a484..e802b3b96f1f630b854d4cb688696611dcaee5c6 100644 |
| --- a/chrome/browser/ui/views/chrome_views_delegate.cc |
| +++ b/chrome/browser/ui/views/chrome_views_delegate.cc |
| @@ -450,20 +450,19 @@ void ChromeViewsDelegate::OnBeforeWidgetInit( |
| // While the majority of the time, context wasn't plumbed through due to the |
| // existence of a global WindowParentingClient, if this window is toplevel, |
| // it's possible that there is no contextual state that we can use. |
| - if (params->parent == NULL && params->context == NULL && !params->child) { |
| + if (!params->parent && !params->context && !params->child) |
| params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
| - } else if (use_non_toplevel_window) { |
| - views::NativeWidgetAura* native_widget = |
| - new views::NativeWidgetAura(delegate); |
| - if (params->parent) { |
| - Profile* parent_profile = reinterpret_cast<Profile*>( |
| - params->parent->GetNativeWindowProperty(Profile::kProfileKey)); |
| - native_widget->SetNativeWindowProperty(Profile::kProfileKey, |
| - parent_profile); |
| - } |
| - params->native_widget = native_widget; |
| - } else { |
| + else if (use_non_toplevel_window) |
| + params->native_widget = new views::NativeWidgetAura(delegate); |
| + else |
| params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
| + gfx::NativeWindow window = params->parent ? params->parent : params->context; |
| + if (window) { |
| + auto* native_widget = static_cast<views::internal::NativeWidgetPrivate*>( |
|
sky
2017/01/31 05:14:31
Sorry, one more. While params->native_widget is de
|
| + params->native_widget); |
| + native_widget->SetNativeWindowProperty( |
| + Profile::kProfileKey, |
| + window->GetNativeWindowProperty(Profile::kProfileKey)); |
| } |
| #endif |
| } |