Chromium Code Reviews| 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(); |
| } |