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..b3ae5c049e88cd153fdbcdd57fc3f7993ae7b025 100644 |
| --- a/chrome/browser/ui/views/chrome_views_delegate.cc |
| +++ b/chrome/browser/ui/views/chrome_views_delegate.cc |
| @@ -450,20 +450,24 @@ 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) { |
| - 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; |
| + gfx::NativeWindow parent_or_context = |
| + params->parent ? params->parent : params->context; |
| + void* profile = |
| + parent_or_context |
| + ? parent_or_context->GetNativeWindowProperty(Profile::kProfileKey) |
| + : nullptr; |
| + if (!params->parent && !params->context && !params->child && |
| + !use_non_toplevel_window) { |
| + views::DesktopNativeWidgetAura* widget = |
| + new views::DesktopNativeWidgetAura(delegate); |
| + params->native_widget = widget; |
| + if (profile) |
| + widget->SetNativeWindowProperty(Profile::kProfileKey, nullptr); |
|
sky
2017/01/31 17:37:18
Don't you want profile here? Also, you should be a
Tom (Use chromium acct)
2017/01/31 18:10:29
Done. Yes it was broken with nullptr
|
| } else { |
| - params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
| + views::NativeWidgetAura* widget = new views::NativeWidgetAura(delegate); |
| + params->native_widget = widget; |
| + if (profile) |
| + widget->SetNativeWindowProperty(Profile::kProfileKey, nullptr); |
| } |
| #endif |
| } |