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 c02c35b4f57e5343dea420b4a75df82c676dceda..f3f3763bb48a4a6a8c5a57bd16fe503f50fb3fd8 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) { |
| + gfx::NativeWindow parent_or_context = |
| + params->parent ? params->parent : params->context; |
| + void* profile = nullptr; |
| + if (parent_or_context) { |
| + profile = |
| + parent_or_context->GetNativeWindowProperty(Profile::kThemeProfileKey); |
| + } |
| + if ((!params->parent && !params->context && !params->child) || |
| + !use_non_toplevel_window) { |
| + views::DesktopNativeWidgetAura* native_widget = |
| + new views::DesktopNativeWidgetAura(delegate); |
| + params->native_widget = native_widget; |
| + native_widget->SetNativeWindowProperty(Profile::kThemeProfileKey, profile); |
| + } else { |
| views::NativeWidgetAura* native_widget = |
| new views::NativeWidgetAura(delegate); |
| - if (params->parent) { |
| - Profile* parent_profile = reinterpret_cast<Profile*>( |
|
Tom (Use chromium acct)
2017/02/16 00:39:57
note that we no longer set kProfileKey from the pa
|
| - params->parent->GetNativeWindowProperty(Profile::kProfileKey)); |
| - native_widget->SetNativeWindowProperty(Profile::kProfileKey, |
| - parent_profile); |
| - } |
| params->native_widget = native_widget; |
| - } else { |
| - params->native_widget = new views::DesktopNativeWidgetAura(delegate); |
| + native_widget->SetNativeWindowProperty(Profile::kThemeProfileKey, profile); |
| } |
| #endif |
| } |