Commit 9d92b21c authored by Ayu Ishii's avatar Ayu Ishii Committed by Commit Bot

Convert base::Bind and base::Callback in components/content_settings to Once/Repeating

Bug: 1007678
Change-Id: I3d0d9155f3a11f73fea58f711889898a77427d4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1940879
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719768}
parent b706824b
......@@ -197,7 +197,7 @@ DefaultProvider::DefaultProvider(PrefService* prefs, bool incognito)
CONTENT_SETTING_NUM_SETTINGS);
#endif
pref_change_registrar_.Init(prefs_);
PrefChangeRegistrar::NamedChangeCallback callback = base::Bind(
PrefChangeRegistrar::NamedChangeCallback callback = base::BindRepeating(
&DefaultProvider::OnPreferenceChanged, base::Unretained(this));
WebsiteSettingsRegistry* website_settings =
WebsiteSettingsRegistry::GetInstance();
......
......@@ -168,8 +168,8 @@ PolicyProvider::PolicyProvider(PrefService* prefs) : prefs_(prefs) {
ReadManagedContentSettings(false);
pref_change_registrar_.Init(prefs_);
PrefChangeRegistrar::NamedChangeCallback callback =
base::Bind(&PolicyProvider::OnPreferenceChanged, base::Unretained(this));
PrefChangeRegistrar::NamedChangeCallback callback = base::BindRepeating(
&PolicyProvider::OnPreferenceChanged, base::Unretained(this));
pref_change_registrar_.Add(
prefs::kManagedAutoSelectCertificateForUrls, callback);
pref_change_registrar_.Add(prefs::kManagedCookiesAllowedForUrls, callback);
......
......@@ -92,9 +92,9 @@ ContentSettingsPref::ContentSettingsPref(
ReadContentSettingsFromPref();
registrar_->Add(
pref_name_,
base::Bind(&ContentSettingsPref::OnPrefChanged, base::Unretained(this)));
registrar_->Add(pref_name_,
base::BindRepeating(&ContentSettingsPref::OnPrefChanged,
base::Unretained(this)));
}
ContentSettingsPref::~ContentSettingsPref() {
......
......@@ -30,10 +30,11 @@ class RuleIterator;
// Represents a single pref for reading/writing content settings of one type.
class ContentSettingsPref {
public:
typedef base::Callback<void(const ContentSettingsPattern&,
const ContentSettingsPattern&,
ContentSettingsType,
const std::string&)> NotifyObserversCallback;
typedef base::RepeatingCallback<void(const ContentSettingsPattern&,
const ContentSettingsPattern&,
ContentSettingsType,
const std::string&)>
NotifyObserversCallback;
ContentSettingsPref(ContentSettingsType content_type,
PrefService* prefs,
......
......@@ -123,18 +123,18 @@ PrefProvider::PrefProvider(PrefService* prefs,
if (!content_type_info || content_type_info->storage_behavior() ==
ContentSettingsInfo::PERSISTENT) {
content_settings_prefs_.insert(std::make_pair(
info->type(),
std::make_unique<ContentSettingsPref>(
info->type(), prefs_, &pref_change_registrar_, info->pref_name(),
off_the_record_,
base::Bind(&PrefProvider::Notify, base::Unretained(this)))));
info->type(), std::make_unique<ContentSettingsPref>(
info->type(), prefs_, &pref_change_registrar_,
info->pref_name(), off_the_record_,
base::BindRepeating(&PrefProvider::Notify,
base::Unretained(this)))));
} else if (info->type() == ContentSettingsType::PLUGINS) {
// TODO(https://crbug.com/850062): Remove after M71, two milestones after
// migration of the Flash permissions to ephemeral provider.
flash_content_settings_pref_ = std::make_unique<ContentSettingsPref>(
info->type(), prefs_, &pref_change_registrar_, info->pref_name(),
off_the_record_,
base::Bind(&PrefProvider::Notify, base::Unretained(this)));
base::BindRepeating(&PrefProvider::Notify, base::Unretained(this)));
}
}
......
......@@ -34,12 +34,12 @@ CookieSettings::CookieSettings(
pref_change_registrar_.Init(prefs);
pref_change_registrar_.Add(
prefs::kBlockThirdPartyCookies,
base::Bind(&CookieSettings::OnCookiePreferencesChanged,
base::Unretained(this)));
base::BindRepeating(&CookieSettings::OnCookiePreferencesChanged,
base::Unretained(this)));
pref_change_registrar_.Add(
prefs::kCookieControlsMode,
base::Bind(&CookieSettings::OnCookiePreferencesChanged,
base::Unretained(this)));
base::BindRepeating(&CookieSettings::OnCookiePreferencesChanged,
base::Unretained(this)));
OnCookiePreferencesChanged();
}
......
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