Chromium Code Reviews| Index: chrome/browser/ui/ash/chrome_new_window_delegate.cc |
| diff --git a/chrome/browser/ui/ash/chrome_new_window_delegate.cc b/chrome/browser/ui/ash/chrome_new_window_delegate.cc |
| index b0689d930f5b07ff3f3eee30d5140840df67f8e0..494944e03d471bf34530ccb2ac8cd528674d35fe 100644 |
| --- a/chrome/browser/ui/ash/chrome_new_window_delegate.cc |
| +++ b/chrome/browser/ui/ash/chrome_new_window_delegate.cc |
| @@ -97,7 +97,12 @@ void ChromeNewWindowDelegate::NewTab() { |
| } |
| void ChromeNewWindowDelegate::NewWindow(bool is_incognito) { |
| - Profile* profile = ProfileManager::GetActiveUserProfile(); |
| + Profile* profile; |
| + Browser* browser = GetBrowserForActiveWindow(); |
| + if (browser && browser->profile()) |
| + profile = browser->profile(); |
| + else |
| + profile = ProfileManager::GetActiveUserProfile(); |
|
oshima
2016/05/06 18:44:14
optional: conditional operator?
xdai1
2016/05/06 20:25:32
Done.
|
| chrome::NewEmptyWindow(is_incognito ? profile->GetOffTheRecordProfile() |
| : profile); |
| } |