Chromium Code Reviews| Index: chrome/browser/chromeos/arc/arc_auth_service.cc |
| diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc |
| index 0781a0124631387d85c13cfb7c5d9cf4099043be..4d352259d0a9b39ce7ba60d3d340fabb9813a58d 100644 |
| --- a/chrome/browser/chromeos/arc/arc_auth_service.cc |
| +++ b/chrome/browser/chromeos/arc/arc_auth_service.cc |
| @@ -224,6 +224,11 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) { |
| // In case UI is disabled we assume that ARC is opted-in. |
| if (!IsOptInVerificationDisabled()) { |
| + pref_change_registrar_.Init(profile_->GetPrefs()); |
| + pref_change_registrar_.Add( |
| + prefs::kArcEnabled, |
| + base::Bind(&ArcAuthService::OnOptInPreferenceChanged, |
|
bartfab (slow)
2016/04/04 11:57:03
Nit: #include "base/bind.h"
Polina Bondarenko
2016/04/04 12:03:21
Done.
|
| + base::Unretained(this))); |
|
bartfab (slow)
2016/04/04 11:57:03
Nit: #include "base/bind_helpers.h"
Polina Bondarenko
2016/04/04 12:03:21
Done.
|
| if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) { |
| OnOptInPreferenceChanged(); |
| } else { |
| @@ -258,6 +263,7 @@ void ArcAuthService::Shutdown() { |
| pref_service_syncable->RemoveObserver(this); |
| pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this); |
| } |
| + pref_change_registrar_.RemoveAll(); |
| profile_ = nullptr; |
| } |
| @@ -321,8 +327,6 @@ void ArcAuthService::OnSyncedPrefChanged(const std::string& path, |
| ? OptInActionType::OPTED_IN |
| : OptInActionType::OPTED_OUT); |
| } |
| - |
| - OnOptInPreferenceChanged(); |
| } |
| void ArcAuthService::OnOptInPreferenceChanged() { |