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

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: oops 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..db6d091bb8d6ee8284604059516fc60b7cc5227f 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,18 @@ 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) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
Darren Krahn 2013/09/18 09:05:37 Was removing this DCHECK intentional? If so, we m
Avi (use Gerrit) 2013/09/18 16:41:44 Not intentional. I'll re-insert.
- 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;
- }
+void AttestationPolicyObserver::AttestationSettingChanged() {
num_retries_ = 0;
Start();
}

Powered by Google App Engine
This is Rietveld 408576698