diff options
author | rustema@google.com <rustema@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 02:31:08 +0000 |
---|---|---|
committer | rustema@google.com <rustema@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 02:31:08 +0000 |
commit | 6b0dd2abe7f0ee59d91410c84d64c37250fde2f5 (patch) | |
tree | af2822bccd77442a3b0615190d24e0ef4a0715f4 | |
parent | 6565395c162774ed5321a32ed9ef62455e021e8e (diff) | |
download | chromium_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
-rw-r--r-- | chrome/app/policy/policy_templates.json | 16 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 3 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/prefs/command_line_pref_store.cc | 1 | ||||
-rw-r--r-- | chrome/browser/ui/browser.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/browser_init.cc | 6 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 1 |
8 files changed, 34 insertions, 4 deletions
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json index ab98226..b739b00 100644 --- a/chrome/app/policy/policy_templates.json +++ b/chrome/app/policy/policy_templates.json @@ -94,7 +94,7 @@ # persistent IDs for all fields (but not for groups!) are needed. These are # specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs, # because doing so would break the deployed wire format! -# For your editing convenience: highest ID currently used: 92 +# For your editing convenience: highest ID currently used: 93 # # Placeholders: # The following placeholder strings are automatically substituted: @@ -281,6 +281,20 @@ If this setting is disabled, users cannot open web pages in incognito mode.''', }, { + 'name': 'IncognitoForced', + 'type': 'main', + 'supported_on': ['chrome.*:14-', 'chrome_os:0.14-'], + 'features': {'dynamic_refresh': 1}, + 'example_value': False, + 'id': 93, + 'caption': '''Force Incognito mode''', + 'desc': '''Forces every session into Incognito mode in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. + + If this setting is enabled, users can open pages only in incognito mode. + + If this setting is disabled or not configured, users can use the browser in normal mode as well.''', + }, + { 'name': 'SavingBrowserHistoryDisabled', 'type': 'main', 'supported_on': ['chrome.*:8-', 'chrome_os:0.11-'], 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(); } diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index e24ce6c..22eb921 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -163,6 +163,9 @@ const char kSafeBrowsingReportingEnabled[] = // Boolean that is true when Incognito support is enabled. const char kIncognitoEnabled[] = "incognito.enabled"; +// Boolean that specifies if all user sessions should be forced into Incognito. +const char kIncognitoForced[] = "incognito.forced"; + // Boolean that is true when Suggest support is enabled. const char kSearchSuggestEnabled[] = "search.suggest_enabled"; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index c92355d..368855b 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -67,6 +67,7 @@ extern const char kAutologinEnabled[]; extern const char kSafeBrowsingEnabled[]; extern const char kSafeBrowsingReportingEnabled[]; extern const char kIncognitoEnabled[]; +extern const char kIncognitoForced[]; extern const char kSearchSuggestEnabled[]; extern const char kConfirmToQuitEnabled[]; extern const char kCookieBehavior[]; // OBSOLETE |