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

Unified Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 287083003: Multi-profile flag cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Created 6 years, 7 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
Index: chrome/browser/chromeos/login/login_utils.cc
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index c0570563fdd9ed210c77ba5682d5a2a6499f1935..496b3308ecc03a6eeab48d983a6dc1b99d6abba3 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -155,6 +155,9 @@ class LoginUtilsImpl
private:
typedef std::set<std::string> SessionRestoreStateSet;
+ // Removes obsolete about://flags entries from user profile preferences.
+ void RemoveObsoleteFlags(PrefService* prefs);
+
// DoBrowserLaunch is split into two parts.
// This one is called after anynchronous locale switch.
void DoBrowserLaunchOnLocaleLoadedImpl(Profile* profile,
@@ -297,6 +300,26 @@ void LoginUtilsImpl::DoBrowserLaunchOnLocaleLoaded(
context->profile, context->display_host);
}
+void LoginUtilsImpl::RemoveObsoleteFlags(PrefService* prefs) {
+ about_flags::PrefServiceFlagsStorage flags_storage(prefs);
+ std::set<std::string> flags = flags_storage.GetFlags();
+ bool removed_any = false;
+ // Entries from about://flags that we need to remove since they are obsolete.
+ const char* const kObsoleteSwitchesToRemove[] = {
+ ::switches::kMultiProfilesObsolete,
+ };
+ for (size_t i = 0; i < arraysize(kObsoleteSwitchesToRemove); ++i) {
+ std::set<std::string>::iterator iter =
+ flags.find(kObsoleteSwitchesToRemove[i]);
+ if (iter != flags.end()) {
+ flags.erase(iter);
+ removed_any = true;
+ }
+ }
+ if (removed_any)
+ flags_storage.SetFlags(flags);
+}
+
// Called from DoBrowserLaunch() or from
// DoBrowserLaunchOnLocaleLoaded() depending on
// if locale switch was needed.
@@ -309,6 +332,7 @@ void LoginUtilsImpl::DoBrowserLaunchOnLocaleLoadedImpl(
}
CommandLine user_flags(CommandLine::NO_PROGRAM);
+ RemoveObsoleteFlags(profile->GetPrefs());
about_flags::PrefServiceFlagsStorage flags_storage_(profile->GetPrefs());
about_flags::ConvertFlagsToSwitches(&flags_storage_, &user_flags,
about_flags::kAddSentinels);

Powered by Google App Engine
This is Rietveld 408576698