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

Unified Diff: chrome/browser/sessions/restore_on_startup_policy_handler.cc

Issue 1312693005: Remove migration of obsolete value for "session.restore_on_startup". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url-to-restore-on-startup
Patch Set: Change comment for kRestoreOnStartup Created 5 years 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
Index: chrome/browser/sessions/restore_on_startup_policy_handler.cc
diff --git a/chrome/browser/sessions/restore_on_startup_policy_handler.cc b/chrome/browser/sessions/restore_on_startup_policy_handler.cc
index 4e9a2d4eec1ea3a6675a0b365859f3051cec3c70..57c435aef2f969bffdabbcdca3d8ea2d2d85b3b0 100644
--- a/chrome/browser/sessions/restore_on_startup_policy_handler.cc
+++ b/chrome/browser/sessions/restore_on_startup_policy_handler.cc
@@ -32,45 +32,7 @@ void RestoreOnStartupPolicyHandler::ApplyPolicySettings(
int restore_on_startup;
if (!restore_on_startup_value->GetAsInteger(&restore_on_startup))
return;
-
- if (restore_on_startup == SessionStartupPref::kPrefValueHomePage)
- ApplyPolicySettingsFromHomePage(policies, prefs);
- else
- prefs->SetInteger(prefs::kRestoreOnStartup, restore_on_startup);
- }
-}
-
-void RestoreOnStartupPolicyHandler::ApplyPolicySettingsFromHomePage(
- const PolicyMap& policies,
- PrefValueMap* prefs) {
- const base::Value* homepage_is_new_tab_page_value =
- policies.GetValue(key::kHomepageIsNewTabPage);
- if (!homepage_is_new_tab_page_value) {
- // The policy is enforcing 'open the homepage on startup' but not
- // enforcing what the homepage should be. Don't set any prefs.
- return;
- }
-
- bool homepage_is_new_tab_page;
- if (!homepage_is_new_tab_page_value->GetAsBoolean(&homepage_is_new_tab_page))
- return;
-
- if (homepage_is_new_tab_page) {
- prefs->SetInteger(prefs::kRestoreOnStartup,
- SessionStartupPref::kPrefValueNewTab);
- } else {
- const base::Value* homepage_value =
- policies.GetValue(key::kHomepageLocation);
- if (!homepage_value || !homepage_value->IsType(base::Value::TYPE_STRING)) {
- // The policy is enforcing 'open the homepage on startup' but not
- // enforcing what the homepage should be. Don't set any prefs.
- return;
- }
- scoped_ptr<base::ListValue> url_list(new base::ListValue());
- url_list->Append(homepage_value->CreateDeepCopy());
- prefs->SetInteger(prefs::kRestoreOnStartup,
- SessionStartupPref::kPrefValueURLs);
- prefs->SetValue(prefs::kURLsToRestoreOnStartup, url_list.Pass());
+ prefs->SetInteger(prefs::kRestoreOnStartup, restore_on_startup);
}
}
@@ -86,7 +48,7 @@ bool RestoreOnStartupPolicyHandler::CheckPolicySettings(
int restore_value;
CHECK(restore_policy->GetAsInteger(&restore_value)); // Passed type check.
switch (restore_value) {
- case SessionStartupPref::kPrefValueHomePage:
+ case 0: // Deprecated kPrefValueHomePage.
errors->AddError(policy_name(), IDS_POLICY_VALUE_DEPRECATED);
break;
case SessionStartupPref::kPrefValueLast: {

Powered by Google App Engine
This is Rietveld 408576698