summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorrustema@google.com <rustema@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 02:31:08 +0000
committerrustema@google.com <rustema@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 02:31:08 +0000
commit6b0dd2abe7f0ee59d91410c84d64c37250fde2f5 (patch)
treeaf2822bccd77442a3b0615190d24e0ef4a0715f4 /chrome/browser
parent6565395c162774ed5321a32ed9ef62455e021e8e (diff)
downloadchromium_src-6b0dd2abe7f0ee59d91410c84d64c37250fde2f5.zip
chromium_src-6b0dd2abe7f0ee59d91410c84d64c37250fde2f5.tar.gz
chromium_src-6b0dd2abe7f0ee59d91410c84d64c37250fde2f5.tar.bz2
Incognito mode forced.
Clear local cache on exit BUG=69580 TEST=configuration_policy_pref_store_unittest.cc Review URL: http://codereview.chromium.org/7399021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store.cc3
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store_unittest.cc2
-rw-r--r--chrome/browser/prefs/command_line_pref_store.cc1
-rw-r--r--chrome/browser/ui/browser.cc6
-rw-r--r--chrome/browser/ui/browser_init.cc6
5 files changed, 15 insertions, 3 deletions
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc
index 0e54865..4dd9c73 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc
@@ -193,6 +193,8 @@ const ConfigurationPolicyPrefKeeper::PolicyToPreferenceMapEntry
prefs::kWebKitJavascriptEnabled },
{ Value::TYPE_BOOLEAN, kPolicyIncognitoEnabled,
prefs::kIncognitoEnabled },
+ { Value::TYPE_BOOLEAN, kPolicyIncognitoForced,
+ prefs::kIncognitoForced },
{ Value::TYPE_BOOLEAN, kPolicySavingBrowserHistoryDisabled,
prefs::kSavingBrowserHistoryDisabled },
{ Value::TYPE_BOOLEAN, kPolicyClearSiteDataOnExit,
@@ -993,6 +995,7 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() {
{ kPolicyPrintingEnabled, Value::TYPE_BOOLEAN, key::kPrintingEnabled },
{ kPolicyJavascriptEnabled, Value::TYPE_BOOLEAN, key::kJavascriptEnabled },
{ kPolicyIncognitoEnabled, Value::TYPE_BOOLEAN, key::kIncognitoEnabled },
+ { kPolicyIncognitoForced, Value::TYPE_BOOLEAN, key::kIncognitoForced },
{ kPolicySavingBrowserHistoryDisabled, Value::TYPE_BOOLEAN,
key::kSavingBrowserHistoryDisabled },
{ kPolicyClearSiteDataOnExit, Value::TYPE_BOOLEAN,
diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
index 23ea447..18ff7aa5 100644
--- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
@@ -202,6 +202,8 @@ INSTANTIATE_TEST_CASE_P(
prefs::kWebKitJavascriptEnabled),
TypeAndName(kPolicyIncognitoEnabled,
prefs::kIncognitoEnabled),
+ TypeAndName(kPolicyIncognitoForced,
+ prefs::kIncognitoForced),
TypeAndName(kPolicyCloudPrintProxyEnabled,
prefs::kCloudPrintProxyEnabled),
TypeAndName(kPolicySavingBrowserHistoryDisabled,
diff --git a/chrome/browser/prefs/command_line_pref_store.cc b/chrome/browser/prefs/command_line_pref_store.cc
index 021be74..a0e94dc 100644
--- a/chrome/browser/prefs/command_line_pref_store.cc
+++ b/chrome/browser/prefs/command_line_pref_store.cc
@@ -42,6 +42,7 @@ const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry
prefs::kWebKitAllowDisplayingInsecureContent, false },
{ switches::kAllowCrossOriginAuthPrompt,
prefs::kAllowCrossOriginAuthPrompt, true },
+ { switches::kIncognito, prefs::kIncognitoForced, true },
};
CommandLinePrefStore::CommandLinePrefStore(const CommandLine* command_line)
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 9469c4b..c60e012 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1467,7 +1467,8 @@ void Browser::Stop() {
void Browser::NewWindow() {
if (browser_defaults::kAlwaysOpenIncognitoWindow &&
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kIncognito) &&
+ (CommandLine::ForCurrentProcess()->HasSwitch(switches::kIncognito) ||
+ profile_->GetPrefs()->GetBoolean(prefs::kIncognitoForced)) &&
profile_->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) {
NewIncognitoWindow();
return;
@@ -2244,6 +2245,9 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kIncognitoEnabled,
true,
PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterBooleanPref(prefs::kIncognitoForced,
+ false,
+ PrefService::UNSYNCABLE_PREF);
prefs->RegisterIntegerPref(prefs::kDevToolsSplitLocation,
-1,
PrefService::UNSYNCABLE_PREF);
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index eacbe8e..bd70c32 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -364,7 +364,8 @@ SessionStartupPref GetSessionStartupPref(const CommandLine& command_line,
SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile);
if (command_line.HasSwitch(switches::kRestoreLastSession))
pref.type = SessionStartupPref::LAST;
- if (command_line.HasSwitch(switches::kIncognito) &&
+ if ((command_line.HasSwitch(switches::kIncognito) ||
+ profile->GetPrefs()->GetBoolean(prefs::kIncognitoForced)) &&
pref.type == SessionStartupPref::LAST &&
profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) {
// We don't store session information when incognito. If the user has
@@ -536,7 +537,8 @@ bool BrowserInit::LaunchBrowser(const CommandLine& command_line,
#endif
// Continue with the incognito profile from here on if --incognito
- if (command_line.HasSwitch(switches::kIncognito) &&
+ if ((command_line.HasSwitch(switches::kIncognito) ||
+ profile->GetPrefs()->GetBoolean(prefs::kIncognitoForced)) &&
profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) {
profile = profile->GetOffTheRecordProfile();
}