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

Unified Diff: chrome/browser/ui/browser_command_controller.cc

Issue 601283003: Disable New Incognito Window command for guest profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TODO added per bauerb Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_command_controller.cc
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 0c7943129f524cf44b86a6f05a28eb6d63be4ef9..4e6c9e14b3a152a6c246c0c68a9936ddd811ebad 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/shell_integration.h"
@@ -1027,6 +1028,8 @@ void BrowserCommandController::InitCommandState() {
void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability(
CommandUpdater* command_updater,
Profile* profile) {
+ const bool guest_session = profile->IsGuestSession();
+ // TODO(mlerman): Make GetAvailability account for profile->IsGuestSession().
IncognitoModePrefs::Availability incognito_availability =
IncognitoModePrefs::GetAvailability(profile->GetPrefs());
command_updater->UpdateCommandEnabled(
@@ -1034,9 +1037,8 @@ void BrowserCommandController::UpdateSharedCommandsForIncognitoAvailability(
incognito_availability != IncognitoModePrefs::FORCED);
command_updater->UpdateCommandEnabled(
IDC_NEW_INCOGNITO_WINDOW,
- incognito_availability != IncognitoModePrefs::DISABLED);
+ incognito_availability != IncognitoModePrefs::DISABLED && !guest_session);
- const bool guest_session = profile->IsGuestSession();
const bool forced_incognito =
incognito_availability == IncognitoModePrefs::FORCED ||
guest_session; // Guest always runs in Incognito mode.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698