Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc |
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
index 90c45761f6863ac48421d0daf863bbee66533df3..42624ced483225344bc866b011c0360fae24051b 100644 |
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
@@ -8,6 +8,7 @@ |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/lifetime/application_lifetime.h" |
+#include "chrome/browser/prefs/incognito_mode_prefs.h" |
#include "chrome/browser/profiles/profile_avatar_icon_util.h" |
#include "chrome/browser/profiles/profile_info_cache.h" |
#include "chrome/browser/profiles/profile_manager.h" |
@@ -661,7 +662,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender, |
if (browser_->profile()->IsGuestSession()) |
profiles::CloseGuestProfileWindows(); |
} else if (sender == go_incognito_button_) { |
- DCHECK(!browser_->profile()->IsGuestSession()); |
+ DCHECK(ShouldShowGoIncognito()); |
chrome::NewIncognitoWindow(browser_); |
} else if (sender == lock_button_) { |
profiles::LockProfile(browser_->profile()); |
@@ -1242,7 +1243,7 @@ views::View* ProfileChooserView::CreateOptionsView(bool enable_lock) { |
layout->StartRow(1, 0); |
layout->AddView(users_button_); |
- if (!browser_->profile()->IsGuestSession()) { |
+ if (ShouldShowGoIncognito()) { |
layout->StartRow(1, 0); |
layout->AddView(new views::Separator(views::Separator::HORIZONTAL)); |
@@ -1533,3 +1534,10 @@ views::View* ProfileChooserView::CreateEndPreviewView() { |
return TitleCard::AddPaddedTitleCard( |
view, title_card, kFixedAccountRemovalViewWidth); |
} |
+ |
+bool ProfileChooserView::ShouldShowGoIncognito() const { |
+ bool incognito_available = |
+ IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
+ IncognitoModePrefs::DISABLED; |
+ return incognito_available && !browser_->profile()->IsGuestSession(); |
+} |