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

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: Added browser test. Created 4 years, 10 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 5085333acddee206667dcc1f4f150ced07be8b16..87592285155e5b6d1e54e441b6437e73df50833b 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc
@@ -134,19 +134,11 @@ 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)));
- OnOptInPreferenceChanged();
- } else {
- auth_code_.clear();
- ArcBridgeService::Get()->HandleStartup();
- SetState(State::ENABLE);
- }
+ pref_change_registrar_.Init(profile_->GetPrefs());
+ pref_change_registrar_.Add(
+ prefs::kArcEnabled, base::Bind(&ArcAuthService::OnOptInPreferenceChanged,
+ base::Unretained(this)));
+ OnOptInPreferenceChanged();
}
void ArcAuthService::Shutdown() {
@@ -196,10 +188,15 @@ void ArcAuthService::OnOptInPreferenceChanged() {
if (profile_->GetPrefs()->GetBoolean(prefs::kArcEnabled)) {
if (state_ != State::ENABLE) {
- CloseUI();
auth_code_.clear();
- SetState(State::FETCHING_CODE);
- FetchAuthCode();
+ if (!IsOptInVerificationDisabled()) {
+ CloseUI();
+ SetState(State::FETCHING_CODE);
+ FetchAuthCode();
+ } else {
+ ArcBridgeService::Get()->HandleStartup();
+ SetState(State::ENABLE);
+ }
}
} else {
ShutdownBridgeAndCloseUI();

Powered by Google App Engine
This is Rietveld 408576698