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

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

Issue 2682833003: Skip ARC initial screen when everything is set up by policy (Closed)
Patch Set: Make tests parametric Created 3 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_session_manager.cc
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc
index a1c81b713bd2a33a40eb4b5fe71b2cb9f5b83bdc..5010545010ab306a6eec15816cfe678968e53f26 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -118,8 +118,12 @@ void ArcSessionManager::RegisterProfilePrefs(
registry->RegisterBooleanPref(prefs::kArcEnabled, false);
registry->RegisterBooleanPref(prefs::kArcSignedIn, false);
registry->RegisterBooleanPref(prefs::kArcTermsAccepted, false);
- registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, true);
- registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, true);
+ // Note that ArcBackupRestoreEnabled and ArcLocationServiceEnabled prefs have
+ // to be off by default, until an explicit gesture from the user to enable
+ // them is received. This is crucial in the cases when these prefs transition
+ // from a previous managed state to the unmanaged.
+ registry->RegisterBooleanPref(prefs::kArcBackupRestoreEnabled, false);
+ registry->RegisterBooleanPref(prefs::kArcLocationServiceEnabled, false);
}
// static
@@ -502,6 +506,8 @@ void ArcSessionManager::OnOptInPreferenceChanged() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(profile_);
+ PrefService* const prefs = profile_->GetPrefs();
+
const bool arc_enabled = IsArcEnabled();
if (!IsArcManaged()) {
// Update UMA only for non-Managed cases.
@@ -523,10 +529,8 @@ void ArcSessionManager::OnOptInPreferenceChanged() {
// Hide auth notification if it was opened before and arc.enabled pref was
// explicitly set to true or false.
- if (!g_disable_ui_for_testing &&
- profile_->GetPrefs()->HasPrefPath(prefs::kArcEnabled)) {
+ if (!g_disable_ui_for_testing && prefs->HasPrefPath(prefs::kArcEnabled))
ArcAuthNotification::Hide();
- }
if (!arc_enabled) {
// Reset any pending request to re-enable ARC.
@@ -554,14 +558,24 @@ void ArcSessionManager::OnOptInPreferenceChanged() {
// there will be no one who is eligible to accept them.
// TODO(poromov): Move to more Kiosk dedicated set-up phase.
if (IsArcKioskMode())
- profile_->GetPrefs()->SetBoolean(prefs::kArcTermsAccepted, true);
+ prefs->SetBoolean(prefs::kArcTermsAccepted, true);
+
+ // Skip to show UI asking users to enable/disable their preference for
+ // backup-restore and location-service, if both are managed by the admin
+ // policy. Note that the ToS agreement is anyway not shown in the case of the
+ // managed ARC.
+ if (IsArcManaged() &&
+ prefs->IsManagedPreference(prefs::kArcBackupRestoreEnabled) &&
+ prefs->IsManagedPreference(prefs::kArcLocationServiceEnabled)) {
+ prefs->SetBoolean(prefs::kArcTermsAccepted, true);
+ }
// If it is marked that sign in has been successfully done, then directly
// start ARC.
- // For testing, and for Kisok mode, we also skip ToS negotiation procedure.
+ // For testing, and for Kiosk mode, we also skip ToS negotiation procedure.
// For backward compatibility, this check needs to be prior to the
// kArcTermsAccepted check below.
- if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn) ||
+ if (prefs->GetBoolean(prefs::kArcSignedIn) ||
IsArcOptInVerificationDisabled() || IsArcKioskMode()) {
StartArc();
@@ -595,10 +609,12 @@ void ArcSessionManager::OnOptInPreferenceChanged() {
// 1) User accepted the Terms of service on OOBE flow.
// 2) User accepted the Terms of service on Opt-in flow, but logged out
// before ARC sign in procedure was done. Then, logs in again.
- if (profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) {
+ if (prefs->GetBoolean(prefs::kArcTermsAccepted)) {
// Don't show UI for this progress if it was not shown.
- if (support_host_->ui_page() != ArcSupportHost::UIPage::NO_PAGE)
+ if (support_host_ &&
+ support_host_->ui_page() != ArcSupportHost::UIPage::NO_PAGE) {
support_host_->ShowArcLoading();
+ }
StartArcAndroidManagementCheck();
return;
}

Powered by Google App Engine
This is Rietveld 408576698