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..a2ea686aee4144bdefbae3fc7768accb0d697b2e 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()); |
@@ -825,12 +826,6 @@ bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, |
return false; |
} |
-void ProfileChooserView::PostActionPerformed( |
- ProfileMetrics::ProfileDesktopMenu action_performed) { |
- ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
- gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
-} |
- |
views::View* ProfileChooserView::CreateProfileChooserView( |
AvatarMenu* avatar_menu, |
profiles::TutorialMode last_tutorial_mode) { |
@@ -1242,7 +1237,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 +1528,16 @@ 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(); |
+} |
+ |
+void ProfileChooserView::PostActionPerformed( |
+ ProfileMetrics::ProfileDesktopMenu action_performed) { |
+ ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
+ gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
+} |