Commit e01e6de4 authored by mlerman's avatar mlerman Committed by Commit bot

Disable New Incognito Window command for guest profile.

This will disable the keyboard accelerator on all OSes and will disable
the File menu item on Mac.

BUG=413932, 103846

Review URL: https://codereview.chromium.org/601283003

Cr-Commit-Position: refs/heads/master@{#297229}
parent c5e6f0ac
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment