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

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

Issue 2149853004: arc: Implement safe access to ArcAuthService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update arc unit tests expectations for not-allowed profiles. 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 b9e6986c54d8648191e565c52f478c4d283041e0..93daf031664f19e2af0311b970f978b5acf57060 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -342,9 +342,6 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
Shutdown();
- profile_ = profile;
- SetState(State::STOPPED);
-
if (!IsAllowedForProfile(profile))
return;
@@ -354,6 +351,9 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
return;
}
+ profile_ = profile;
+ SetState(State::STOPPED);
+
PrefServiceSyncableFromProfile(profile_)->AddSyncedPrefObserver(
prefs::kArcEnabled, this);
@@ -637,6 +637,9 @@ bool ArcAuthService::IsArcManaged() const {
bool ArcAuthService::IsArcEnabled() const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ 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