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

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

Issue 1684063002: Add ArcEnabled policy implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26869593
Patch Set: Fixed GuestModeOptionsUIBrowserTest.testSections Created 4 years, 9 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 | « no previous file | 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 0c12cb97c2f2c5d033fcf5c624760fb23445bf31..c6a31462bab58b2285f250a83a5e07baf5797101 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -194,24 +194,17 @@ void ArcAuthService::OnPrimaryUserProfilePrepared(Profile* profile) {
profile_, GURL(site_url));
CHECK(storage_partition_);
- // 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 {
- if (!disable_ui_for_testing && profile_->IsNewProfile()) {
- PrefServiceSyncableFromProfile(profile_)->AddObserver(this);
- OnIsSyncingChanged();
- }
- }
+ 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 {
- auth_code_.clear();
- StartArc();
+ if (!disable_ui_for_testing && profile_->IsNewProfile()) {
+ PrefServiceSyncableFromProfile(profile_)->AddObserver(this);
+ OnIsSyncingChanged();
+ }
}
}
@@ -291,16 +284,20 @@ void ArcAuthService::OnOptInPreferenceChanged() {
if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) {
if (state_ != State::ACTIVE) {
- CloseUI();
auth_code_.clear();
- if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) {
- // Need pre-fetch auth code and show OptIn UI if needed.
- initial_opt_in_ = true;
- SetState(State::FETCHING_CODE);
- FetchAuthCode();
+ if (!IsOptInVerificationDisabled()) {
+ CloseUI();
+ if (!profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) {
+ // Need pre-fetch auth code and show OptIn UI if needed.
+ initial_opt_in_ = true;
+ SetState(State::FETCHING_CODE);
+ FetchAuthCode();
+ } else {
+ // Ready to start Arc.
+ StartArc();
+ }
} else {
- // Ready to start Arc.
StartArc();
}
}
« no previous file with comments | « no previous file | chrome/browser/policy/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698