Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/chrome_new_window_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_new_window_delegate.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 10 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 chrome::ScopedTabbedBrowserDisplayer displayer( | 90 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 91 ProfileManager::GetActiveUserProfile()); | 91 ProfileManager::GetActiveUserProfile()); |
| 92 browser = displayer.browser(); | 92 browser = displayer.browser(); |
| 93 chrome::NewTab(browser); | 93 chrome::NewTab(browser); |
| 94 } | 94 } |
| 95 | 95 |
| 96 browser->SetFocusToLocationBar(false); | 96 browser->SetFocusToLocationBar(false); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ChromeNewWindowDelegate::NewWindow(bool is_incognito) { | 99 void ChromeNewWindowDelegate::NewWindow(bool is_incognito) { |
| 100 Profile* profile = ProfileManager::GetActiveUserProfile(); | 100 Profile* profile; |
| 101 Browser* browser = GetBrowserForActiveWindow(); | |
| 102 if (browser && browser->profile()) | |
| 103 profile = browser->profile(); | |
| 104 else | |
| 105 profile = ProfileManager::GetActiveUserProfile(); | |
|
oshima
2016/05/06 18:44:14
optional: conditional operator?
xdai1
2016/05/06 20:25:32
Done.
| |
| 101 chrome::NewEmptyWindow(is_incognito ? profile->GetOffTheRecordProfile() | 106 chrome::NewEmptyWindow(is_incognito ? profile->GetOffTheRecordProfile() |
| 102 : profile); | 107 : profile); |
| 103 } | 108 } |
| 104 | 109 |
| 105 void ChromeNewWindowDelegate::RestoreTab() { | 110 void ChromeNewWindowDelegate::RestoreTab() { |
| 106 if (tab_restore_helper_.get()) { | 111 if (tab_restore_helper_.get()) { |
| 107 DCHECK(!tab_restore_helper_->tab_restore_service()->IsLoaded()); | 112 DCHECK(!tab_restore_helper_->tab_restore_service()->IsLoaded()); |
| 108 return; | 113 return; |
| 109 } | 114 } |
| 110 | 115 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 127 } | 132 } |
| 128 } | 133 } |
| 129 | 134 |
| 130 void ChromeNewWindowDelegate::ShowTaskManager() { | 135 void ChromeNewWindowDelegate::ShowTaskManager() { |
| 131 chrome::OpenTaskManager(NULL); | 136 chrome::OpenTaskManager(NULL); |
| 132 } | 137 } |
| 133 | 138 |
| 134 void ChromeNewWindowDelegate::OpenFeedbackPage() { | 139 void ChromeNewWindowDelegate::OpenFeedbackPage() { |
| 135 chrome::OpenFeedbackDialog(GetBrowserForActiveWindow()); | 140 chrome::OpenFeedbackDialog(GetBrowserForActiveWindow()); |
| 136 } | 141 } |
| OLD | NEW |