| 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..d6e4beca28799b43a13034144a469213dde48eca 100644
|
| --- a/chrome/browser/ui/views/chrome_views_delegate.cc
|
| +++ b/chrome/browser/ui/views/chrome_views_delegate.cc
|
| @@ -50,6 +50,7 @@
|
|
|
| #if defined(USE_AURA)
|
| #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
|
| +#include "chrome/browser/ui/views/theme_profile_key.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| #endif
|
| @@ -450,9 +451,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) {
|
| - params->native_widget = new views::DesktopNativeWidgetAura(delegate);
|
| - } else if (use_non_toplevel_window) {
|
| + gfx::NativeWindow parent_or_context =
|
| + params->parent ? params->parent : params->context;
|
| + Profile* profile = nullptr;
|
| + if (parent_or_context)
|
| + profile = GetThemeProfileForWindow(parent_or_context);
|
| + aura::Window* window = nullptr;
|
| + if ((!params->parent && !params->context && !params->child) ||
|
| + !use_non_toplevel_window) {
|
| + views::DesktopNativeWidgetAura* native_widget =
|
| + new views::DesktopNativeWidgetAura(delegate);
|
| + params->native_widget = native_widget;
|
| + window = native_widget->GetNativeWindow();
|
| + } else {
|
| views::NativeWidgetAura* native_widget =
|
| new views::NativeWidgetAura(delegate);
|
| if (params->parent) {
|
| @@ -462,9 +473,9 @@ void ChromeViewsDelegate::OnBeforeWidgetInit(
|
| parent_profile);
|
| }
|
| params->native_widget = native_widget;
|
| - } else {
|
| - params->native_widget = new views::DesktopNativeWidgetAura(delegate);
|
| + window = native_widget->GetNativeWindow();
|
| }
|
| + SetThemeProfileForWindow(window, profile);
|
| #endif
|
| }
|
|
|
|
|