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

Unified Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 1829703002: Add ArcEnabled policy implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed comments. Created 4 years, 8 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
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.h ('k') | chrome/browser/policy/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..649d2a62329c37495b0b25ddbed46e4becb621a2 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -6,6 +6,8 @@
#include <utility>
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/chromeos/arc/arc_auth_notification.h"
@@ -224,6 +226,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,
+ base::Unretained(this)));
if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) {
OnOptInPreferenceChanged();
} else {
@@ -258,6 +265,7 @@ void ArcAuthService::Shutdown() {
pref_service_syncable->RemoveObserver(this);
pref_service_syncable->RemoveSyncedPrefObserver(prefs::kArcEnabled, this);
}
+ pref_change_registrar_.RemoveAll();
profile_ = nullptr;
}
@@ -321,8 +329,6 @@ void ArcAuthService::OnSyncedPrefChanged(const std::string& path,
? OptInActionType::OPTED_IN
: OptInActionType::OPTED_OUT);
}
-
- OnOptInPreferenceChanged();
}
void ArcAuthService::OnOptInPreferenceChanged() {
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.h ('k') | chrome/browser/policy/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698