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

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

Issue 2714853002: Remove kDistroDict from Preferences. (Closed)
Patch Set: kRlzPingDelay -> kRlzPingDelaySeconds 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
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..522b4d7b945d662c8e40fbbb178b54a45075a050 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"
@@ -54,7 +55,6 @@
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/master_preferences_constants.h"
#include "chrome/installer/util/util_constants.h"
-#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/search_engines/template_url_service.h"
#include "components/signin/core/browser/signin_manager.h"
@@ -447,10 +447,11 @@ static base::LazyInstance<base::FilePath> master_prefs_path_for_testing
// object if successful; otherwise, returns NULL.
installer::MasterPreferences* LoadMasterPrefs() {
base::FilePath master_prefs_path;
- if (!master_prefs_path_for_testing.Get().empty())
+ if (!master_prefs_path_for_testing.Get().empty()) {
master_prefs_path = master_prefs_path_for_testing.Get();
- else
+ } else {
master_prefs_path = base::FilePath(first_run::internal::MasterPrefsPath());
+ }
if (master_prefs_path.empty())
return NULL;
installer::MasterPreferences* install_prefs =
@@ -494,9 +495,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 +617,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,16 +656,6 @@ 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);
-}
-
bool SetShowFirstRunBubblePref(FirstRunBubbleOptions show_bubble_option) {
PrefService* local_state = g_browser_process->local_state();
if (!local_state)
@@ -742,16 +728,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.";
}
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698