Skip to content

Commit

Permalink
[iOS][Enterprise] Skips old FRE when SyncDisabled is On
Browse files Browse the repository at this point in the history
This CL skips the sign in flow of the old FRE when SyncDisabled policy
is On.

(cherry picked from commit ff0ce8a)

Bug: 1257951
Change-Id: I980ec501805793e5dbe95da53218f0aecd9a8dfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3211707
Reviewed-by: Gauthier Ambard <gambard@chromium.org>
Commit-Queue: Ewann Pellé <ewannpv@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#929663}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3216688
Cr-Commit-Position: refs/branch-heads/4664@{#17}
Cr-Branched-From: 24dc4ee-refs/heads/main@{#929512}
  • Loading branch information
Ewann authored and Chromium LUCI CQ committed Oct 11, 2021
1 parent defe3be commit b873e8a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions ios/chrome/browser/ui/first_run/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ source_set("first_run") {
"//ios/chrome/browser/geolocation",
"//ios/chrome/browser/main",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/sync",
"//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/authentication/signin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "components/metrics/metrics_pref_names.h"
#include "components/metrics/metrics_reporting_default_state.h"
#include "components/prefs/pref_service.h"
#include "components/sync/driver/sync_service.h"
#include "components/web_resource/web_resource_pref_names.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
Expand All @@ -23,6 +24,8 @@
#include "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/signin/chrome_account_manager_service.h"
#import "ios/chrome/browser/signin/chrome_account_manager_service_factory.h"
#include "ios/chrome/browser/sync/sync_service_factory.h"
#include "ios/chrome/browser/sync/sync_setup_service.h"
#import "ios/chrome/browser/ui/authentication/signin/signin_constants.h"
#import "ios/chrome/browser/ui/authentication/signin/signin_coordinator.h"
#import "ios/chrome/browser/ui/authentication/signin/signin_utils.h"
Expand Down Expand Up @@ -228,8 +231,15 @@ - (void)welcomeToChromeViewDidTapOKButton:(WelcomeToChromeView*)view {
self.mainBrowser->GetBrowserState());
self.firstRunConfig.hasSSOAccount = accountManagerService->HasIdentities();

if (!signin::IsSigninAllowedByPolicy()) {
// Sign-in is disabled by policy. Skip the sign-in flow.
syncer::SyncService* syncService = SyncServiceFactory::GetForBrowserState(
self.mainBrowser->GetBrowserState());
BOOL shouldSkipSignInFlow =
syncService->GetDisableReasons().Has(
syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY) ||
!signin::IsSigninAllowedByPolicy();

if (shouldSkipSignInFlow) {
// Sign-in or sync is disabled by policy. Skip the sign-in flow.
self.firstRunConfig.signInAttemptStatus =
first_run::SignInAttemptStatus::SKIPPED_BY_POLICY;
SigninCompletionInfo* completionInfo =
Expand Down

0 comments on commit b873e8a

Please sign in to comment.