Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4307)

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 422443008: New avatar menu: Don't show "Go incognito" if incognito is disabled by policy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698