Commit 83cb313e authored by thestig's avatar thestig Committed by Commit bot

Remove some obsolete prefs.

Review-Url: https://codereview.chromium.org/2320723002
Cr-Commit-Position: refs/heads/master@{#417235}
parent c7870d54
......@@ -9,7 +9,6 @@
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "components/content_settings/core/browser/content_settings_rule.h"
......@@ -29,15 +28,6 @@ namespace content_settings {
namespace {
// Obsolete prefs to be removed from the pref file.
// TODO(msramek): Remove this cleanup code after two releases (i.e. in M50).
const char kObsoleteMetroSwitchToDesktopSetting[] =
"profile.default_content_setting_values.metro_switch_to_desktop";
// TODO(msramek): Remove this cleanup code after two releases (i.e. in M51).
const char kObsoleteMediaStreamSetting[] =
"profile.default_content_setting_values.media_stream";
ContentSetting GetDefaultValue(const WebsiteSettingsInfo* info) {
const base::Value* initial_default = info->initial_default_value();
if (!initial_default)
......@@ -91,17 +81,6 @@ void DefaultProvider::RegisterProfilePrefs(
GetDefaultValue(info),
info->GetPrefRegistrationFlags());
}
// Obsolete prefs -------------------------------------------------------
// The removed content settings type METRO_SWITCH_TO_DESKTOP.
registry->RegisterIntegerPref(
kObsoleteMetroSwitchToDesktopSetting,
0,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
// The removed content settings type MEDIASTREAM.
registry->RegisterIntegerPref(kObsoleteMediaStreamSetting, 0);
}
DefaultProvider::DefaultProvider(PrefService* prefs, bool incognito)
......@@ -110,9 +89,6 @@ DefaultProvider::DefaultProvider(PrefService* prefs, bool incognito)
updating_preferences_(false) {
DCHECK(prefs_);
// Remove the obsolete preferences from the pref file.
DiscardObsoletePreferences();
// Read global defaults.
ReadDefaultSettings();
......@@ -367,9 +343,4 @@ std::unique_ptr<base::Value> DefaultProvider::ReadFromPref(
return ContentSettingToValue(IntToContentSetting(int_value));
}
void DefaultProvider::DiscardObsoletePreferences() {
prefs_->ClearPref(kObsoleteMetroSwitchToDesktopSetting);
prefs_->ClearPref(kObsoleteMediaStreamSetting);
}
} // namespace content_settings
......@@ -72,16 +72,13 @@ class DefaultProvider : public ObservableProvider {
// Called on prefs change.
void OnPreferenceChanged(const std::string& pref_name);
// Clean up the obsolete preferences from the user's profile.
void DiscardObsoletePreferences();
// Copies of the pref data, so that we can read it on the IO thread.
std::map<ContentSettingsType, std::unique_ptr<base::Value>> default_settings_;
PrefService* prefs_;
// Whether this settings map is for an Incognito session.
bool is_incognito_;
const bool is_incognito_;
// Used around accesses to the |default_settings_| object to guarantee
// thread safety.
......
......@@ -15,7 +15,6 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_split.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "components/content_settings/core/browser/content_settings_pref.h"
......@@ -32,18 +31,6 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
namespace {
// Obsolete prefs.
// TODO(msramek): Remove the cleanup code after two releases (i.e. in M50).
const char kObsoleteMetroSwitchToDesktopExceptions[] =
"profile.content_settings.exceptions.metro_switch_to_desktop";
const char kObsoleteMediaStreamExceptions[] =
"profile.content_settings.exceptions.media_stream";
} // namespace
namespace content_settings {
// ////////////////////////////////////////////////////////////////////////////
......@@ -63,14 +50,6 @@ void PrefProvider::RegisterProfilePrefs(
registry->RegisterDictionaryPref(info->pref_name(),
info->GetPrefRegistrationFlags());
}
// Obsolete prefs ----------------------------------------------------------
registry->RegisterDictionaryPref(
kObsoleteMetroSwitchToDesktopExceptions,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterDictionaryPref(kObsoleteMediaStreamExceptions);
}
PrefProvider::PrefProvider(PrefService* prefs, bool incognito)
......@@ -109,8 +88,6 @@ PrefProvider::PrefProvider(PrefService* prefs, bool incognito)
UMA_HISTOGRAM_COUNTS("ContentSettings.NumberOfExceptions",
num_exceptions);
}
DiscardObsoletePreferences();
}
PrefProvider::~PrefProvider() {
......@@ -210,9 +187,4 @@ void PrefProvider::Notify(
resource_identifier);
}
void PrefProvider::DiscardObsoletePreferences() {
prefs_->ClearPref(kObsoleteMetroSwitchToDesktopExceptions);
prefs_->ClearPref(kObsoleteMediaStreamExceptions);
}
} // namespace content_settings
......@@ -80,16 +80,13 @@ class PrefProvider : public ObservableProvider {
ContentSettingsType content_type,
const std::string& resource_identifier);
// Clean up the obsolete preferences from the user's profile.
void DiscardObsoletePreferences();
// Weak; owned by the Profile and reset in ShutdownOnUIThread.
PrefService* prefs_;
// Can be set for testing.
std::unique_ptr<base::Clock> clock_;
bool is_incognito_;
const bool is_incognito_;
PrefChangeRegistrar pref_change_registrar_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment