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

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

Issue 2714853002: Remove kDistroDict from Preferences. (Closed)
Patch Set: Format and hide constant behind flag too Created 3 years, 10 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/first_run/first_run.cc
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index a13c299c3ac9743173c7146daf6fbc8d08dcc7da..d2b30dd9518b96f89fb8e671a58c3f530271e3ef 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/first_run/first_run.h"
#include <algorithm>
+#include <memory>
#include <utility>
#include "base/command_line.h"
@@ -69,6 +70,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/common/one_shot_event.h"
#include "google_apis/gaia/gaia_auth_util.h"
+#include "rlz/features/features.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
@@ -494,9 +496,6 @@ void SetupMasterPrefsFromInstallPrefs(
ConvertStringVectorToGURLVector(
install_prefs.GetFirstRunTabs(), &out_prefs->new_tabs);
- install_prefs.GetInt(installer::master_preferences::kDistroPingDelay,
- &out_prefs->ping_delay);
-
bool value = false;
if (install_prefs.GetBool(
installer::master_preferences::kDistroImportSearchPref, &value)) {
@@ -619,14 +618,12 @@ FirstRunState DetermineFirstRunState(bool has_sentinel,
} // namespace internal
MasterPrefs::MasterPrefs()
- : ping_delay(0),
- homepage_defined(false),
+ : homepage_defined(false),
do_import_items(0),
dont_import_items(0),
make_chrome_default_for_user(false),
suppress_first_run_default_browser_prompt(false),
- welcome_page_on_os_upgrade_enabled(true) {
-}
+ welcome_page_on_os_upgrade_enabled(true) {}
MasterPrefs::~MasterPrefs() {}
@@ -660,14 +657,10 @@ void CreateSentinelIfNeeded() {
internal::CreateSentinel();
}
-std::string GetPingDelayPrefName() {
- return base::StringPrintf("%s.%s",
- installer::master_preferences::kDistroDict,
- installer::master_preferences::kDistroPingDelay);
-}
-
void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
- registry->RegisterIntegerPref(GetPingDelayPrefName().c_str(), 0);
+#if BUILDFLAG(ENABLE_RLZ)
+ registry->RegisterIntegerPref(prefs::kRlzPingDelay, 90);
grt (UTC plus 2) 2017/02/24 07:42:20 this doesn't feel like the right place. rlz isn't
grt (UTC plus 2) 2017/02/24 07:42:20 while 90 has been the default, should it really be
Roger Tawa OOO till Jul 10th 2017/02/24 16:02:17 See my other comment. I believe this is a bug tha
Roger Tawa OOO till Jul 10th 2017/02/24 16:02:17 Could be moved to c/b/rlz/chrome_rlz_tracker_deleg
gab 2017/02/28 19:54:45 Done.
gab 2017/02/28 19:54:45 I think it's intentionally tied to the default pro
+#endif
}
bool SetShowFirstRunBubblePref(FirstRunBubbleOptions show_bubble_option) {
@@ -742,16 +735,21 @@ ProcessMasterPreferencesResult ProcessMasterPreferences(
std::unique_ptr<installer::MasterPreferences> install_prefs(
LoadMasterPrefs());
- // Default value in case master preferences is missing or corrupt, or
- // ping_delay is missing.
- out_prefs->ping_delay = 90;
if (install_prefs.get()) {
if (!internal::ShowPostInstallEULAIfNeeded(install_prefs.get()))
return EULA_EXIT_NOW;
+ std::unique_ptr<base::DictionaryValue> master_dictionary =
+ install_prefs->master_dictionary().CreateDeepCopy();
+ // The distribution dictionary (and any prefs below it) are never registered
+ // for use in Chrome's PrefService. Strip them from the master dictionary
+ // before mapping it to prefs.
+ master_dictionary->RemoveWithoutPathExpansion(
+ installer::master_preferences::kDistroDict, nullptr);
+
if (!chrome_prefs::InitializePrefsFromMasterPrefs(
profiles::GetDefaultProfileDir(user_data_dir),
- install_prefs->master_dictionary())) {
+ std::move(master_dictionary))) {
DLOG(ERROR) << "Failed to initialize from master_preferences.";
}

Powered by Google App Engine
This is Rietveld 408576698