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

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

Issue 2201493002: [Merge to M53] arc: Implement safe access to ArcAuthService. (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2785
Patch Set: Created 4 years, 5 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/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 dae02bfa2427efbb74604d8a8b795ce5b103eda7..502097c461b8453ac834de5cb3f041e454f95e69 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -348,9 +348,6 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
Shutdown();
- profile_ = profile;
- SetState(State::STOPPED);
-
if (!IsAllowedForProfile(profile))
return;
@@ -360,6 +357,9 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
return;
}
+ profile_ = profile;
+ SetState(State::STOPPED);
+
PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver(
prefs::kArcEnabled, this);
@@ -641,6 +641,9 @@ bool ArcAuthService::IsArcManaged() const {
bool ArcAuthService::IsArcEnabled() const {
DCHECK(thread_checker.Get().CalledOnValidThread());
+ if (!IsAllowed())
+ return false;
+
DCHECK(profile_);
return profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled);
}
« no previous file with comments | « chrome/browser/chromeos/arc/arc_auth_service.h ('k') | chrome/browser/chromeos/arc/arc_auth_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698