OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/native_widget_factory.h" | 5 #include "chrome/browser/ui/views/native_widget_factory.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/views/theme_profile_key.h" | 8 #include "chrome/browser/ui/views/theme_profile_key.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 10 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 new views::NativeWidgetAura(delegate); | 35 new views::NativeWidgetAura(delegate); |
36 if (params->parent) { | 36 if (params->parent) { |
37 Profile* parent_profile = reinterpret_cast<Profile*>( | 37 Profile* parent_profile = reinterpret_cast<Profile*>( |
38 params->parent->GetNativeWindowProperty(Profile::kProfileKey)); | 38 params->parent->GetNativeWindowProperty(Profile::kProfileKey)); |
39 native_widget_aura->SetNativeWindowProperty(Profile::kProfileKey, | 39 native_widget_aura->SetNativeWindowProperty(Profile::kProfileKey, |
40 parent_profile); | 40 parent_profile); |
41 } | 41 } |
42 window = native_widget_aura->GetNativeWindow(); | 42 window = native_widget_aura->GetNativeWindow(); |
43 native_widget = native_widget_aura; | 43 native_widget = native_widget_aura; |
44 } | 44 } |
45 SetThemeProfileForWindow(window, profile); | 45 // Use the original profile because |window| may outlive the profile |
46 // of the context window. This can happen with incognito profiles. | |
47 // However, the original profile will stick around until shutdown. | |
48 SetThemeProfileForWindow(window, profile->GetOriginalProfile()); | |
sky
2017/05/04 23:24:09
I think it's worth a comment that BrowserView rese
Tom (Use chromium acct)
2017/05/09 05:12:26
Done.
| |
46 return native_widget; | 49 return native_widget; |
47 } | 50 } |
OLD | NEW |