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

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

Issue 6313008: Implement pref policy for disabling incognito mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/browser.h ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
===================================================================
--- chrome/browser/ui/browser.cc (revision 72320)
+++ chrome/browser/ui/browser.cc (working copy)
@@ -225,6 +225,8 @@
printing_enabled_.Init(prefs::kPrintingEnabled, local_state, this);
dev_tools_disabled_.Init(prefs::kDevToolsDisabled,
profile_->GetPrefs(), this);
+ incognito_mode_allowed_.Init(prefs::kIncognitoEnabled,
+ profile_->GetPrefs(), this);
Finnur 2011/01/26 13:23:38 Daniel/Matthias: I checked this in after the try s
Finnur 2011/01/26 13:44:35 Hmm... I believe this is because of a missing Dest
InitCommandState();
BrowserList::AddBrowser(this);
@@ -1287,7 +1289,8 @@
void Browser::NewWindow() {
if (browser_defaults::kAlwaysOpenIncognitoWindow &&
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kIncognito)) {
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kIncognito) &&
+ incognito_mode_allowed_.GetValue()) {
NewIncognitoWindow();
return;
}
@@ -1301,6 +1304,11 @@
}
void Browser::NewIncognitoWindow() {
+ if (!incognito_mode_allowed_.GetValue()) {
+ NewWindow();
+ return;
+ }
+
UserMetrics::RecordAction(UserMetricsAction("NewIncognitoWindow"), profile_);
Browser::OpenEmptyWindow(profile_->GetOffTheRecordProfile());
}
@@ -1929,7 +1937,7 @@
switches::kDisableTabbedOptions)) {
ShowOptionsTab(chrome::kLanguageOptionsSubPage);
} else {
- // Language options dialog has been replaced by DOMUI.
+ // Language options dialog has been replaced by DOMUI.
}
}
@@ -2025,6 +2033,7 @@
prefs->RegisterBooleanPref(prefs::kRemotingHasSetupCompleted, false);
prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string());
prefs->RegisterBooleanPref(prefs::kDevToolsDisabled, false);
+ prefs->RegisterBooleanPref(prefs::kIncognitoEnabled, true);
prefs->RegisterRealPref(prefs::kDefaultZoomLevel, 0.0);
prefs->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0);
// We need to register the type of this preference in order to query
@@ -3428,7 +3437,8 @@
// Window management commands
command_updater_.UpdateCommandEnabled(IDC_NEW_WINDOW, true);
- command_updater_.UpdateCommandEnabled(IDC_NEW_INCOGNITO_WINDOW, true);
+ command_updater_.UpdateCommandEnabled(IDC_NEW_INCOGNITO_WINDOW,
+ incognito_mode_allowed_.GetValue());
command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true);
command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true);
command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true);
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698