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

Unified Diff: chrome/browser/chromeos/attestation/attestation_policy_observer.cc

Issue 23494053: Remove NOTIFICATION_SYSTEM_SETTING_CHANGED, switch CrosSettings to base::CallbackRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trailing space Created 7 years, 3 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/attestation/attestation_policy_observer.cc
diff --git a/chrome/browser/chromeos/attestation/attestation_policy_observer.cc b/chrome/browser/chromeos/attestation/attestation_policy_observer.cc
index d28dc3fcde8b38ca56aaf9778e22b2e8f978e217..2734706100a73cb695ad10800907262662a7c27e 100644
--- a/chrome/browser/chromeos/attestation/attestation_policy_observer.cc
+++ b/chrome/browser/chromeos/attestation/attestation_policy_observer.cc
@@ -102,7 +102,10 @@ AttestationPolicyObserver::AttestationPolicyObserver(
retry_delay_(kRetryDelay),
weak_factory_(this) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- cros_settings_->AddSettingsObserver(kDeviceAttestationEnabled, this);
+ attestation_subscription_ = cros_settings_->AddSettingsObserver(
+ kDeviceAttestationEnabled,
+ base::Bind(&AttestationPolicyObserver::AttestationSettingChanged,
+ base::Unretained(this)));
Start();
}
@@ -118,26 +121,19 @@ AttestationPolicyObserver::AttestationPolicyObserver(
retry_delay_(kRetryDelay),
weak_factory_(this) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- cros_settings_->AddSettingsObserver(kDeviceAttestationEnabled, this);
+ attestation_subscription_ = cros_settings_->AddSettingsObserver(
+ kDeviceAttestationEnabled,
+ base::Bind(&AttestationPolicyObserver::AttestationSettingChanged,
+ base::Unretained(this)));
Start();
}
AttestationPolicyObserver::~AttestationPolicyObserver() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- cros_settings_->RemoveSettingsObserver(kDeviceAttestationEnabled, this);
}
-void AttestationPolicyObserver::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+void AttestationPolicyObserver::AttestationSettingChanged() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- std::string* path = content::Details<std::string>(details).ptr();
- if (type != chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED ||
- *path != kDeviceAttestationEnabled) {
- LOG(WARNING) << "AttestationPolicyObserver: Unexpected event received.";
- return;
- }
num_retries_ = 0;
Start();
}

Powered by Google App Engine
This is Rietveld 408576698