| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.firstrun; | 5 package org.chromium.chrome.browser.firstrun; |
| 6 | 6 |
| 7 import android.accounts.Account; | 7 import android.accounts.Account; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return; | 67 return; |
| 68 } | 68 } |
| 69 | 69 |
| 70 new AndroidEduAndChildAccountHelper() { | 70 new AndroidEduAndChildAccountHelper() { |
| 71 @Override | 71 @Override |
| 72 public void onParametersReady() { | 72 public void onParametersReady() { |
| 73 mIsAndroidEduDevice = isAndroidEduDevice(); | 73 mIsAndroidEduDevice = isAndroidEduDevice(); |
| 74 mHasChildAccount = hasChildAccount(); | 74 mHasChildAccount = hasChildAccount(); |
| 75 processFreEnvironment(); | 75 processFreEnvironment(); |
| 76 } | 76 } |
| 77 }.start(mActivity.getApplicationContext()); | 77 }.start(mActivity); |
| 78 } | 78 } |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * @return Whether the sync could be turned on. | 81 * @return Whether the sync could be turned on. |
| 82 */ | 82 */ |
| 83 @VisibleForTesting | 83 @VisibleForTesting |
| 84 boolean isSyncAllowed() { | 84 boolean isSyncAllowed() { |
| 85 return FeatureUtilities.canAllowSync(mActivity) | 85 return FeatureUtilities.canAllowSync(mActivity) |
| 86 && !SigninManager.get(mActivity.getApplicationContext()).isSigni
nDisabledByPolicy(); | 86 && !SigninManager.get(mActivity.getApplicationContext()).isSigni
nDisabledByPolicy(); |
| 87 } | 87 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 166 } |
| 167 } else { | 167 } else { |
| 168 // If the full FRE has already been shown, don't show Welcome or Sig
n-In pages. | 168 // If the full FRE has already been shown, don't show Welcome or Sig
n-In pages. |
| 169 freProperties.putBoolean(FirstRunActivity.SHOW_WELCOME_PAGE, false); | 169 freProperties.putBoolean(FirstRunActivity.SHOW_WELCOME_PAGE, false); |
| 170 freProperties.putBoolean(FirstRunActivity.SHOW_SIGNIN_PAGE, false); | 170 freProperties.putBoolean(FirstRunActivity.SHOW_SIGNIN_PAGE, false); |
| 171 } | 171 } |
| 172 | 172 |
| 173 freProperties.putBoolean(AccountFirstRunFragment.IS_CHILD_ACCOUNT, mHasC
hildAccount); | 173 freProperties.putBoolean(AccountFirstRunFragment.IS_CHILD_ACCOUNT, mHasC
hildAccount); |
| 174 | 174 |
| 175 onFlowIsKnown(mActivity, freProperties); | 175 onFlowIsKnown(mActivity, freProperties); |
| 176 if (mHasChildAccount || forceEduSignIn) { | |
| 177 // Child and Edu forced signins are processed independently. | |
| 178 FirstRunSigninProcessor.setFirstRunFlowSignInComplete(context, true)
; | |
| 179 } | |
| 180 } | 176 } |
| 181 | 177 |
| 182 /** | 178 /** |
| 183 * Marks a given flow as completed. | 179 * Marks a given flow as completed. |
| 184 * @param activity An activity. | 180 * @param activity An activity. |
| 185 * @param data Resulting FRE properties bundle. | 181 * @param data Resulting FRE properties bundle. |
| 186 */ | 182 */ |
| 187 public static void markFlowAsCompleted(Activity activity, Bundle data) { | 183 public static void markFlowAsCompleted(Activity activity, Bundle data) { |
| 188 // When the user accepts ToS in the Setup Wizard (see ToSAckedReceiver),
we do not | 184 // When the user accepts ToS in the Setup Wizard (see ToSAckedReceiver),
we do not |
| 189 // show the ToS page to the user because the user has already accepted o
ne outside FRE. | 185 // show the ToS page to the user because the user has already accepted o
ne outside FRE. |
| 190 if (!PrefServiceBridge.getInstance().isFirstRunEulaAccepted()) { | 186 if (!PrefServiceBridge.getInstance().isFirstRunEulaAccepted()) { |
| 191 PrefServiceBridge.getInstance().setEulaAccepted(); | 187 PrefServiceBridge.getInstance().setEulaAccepted(); |
| 192 } | 188 } |
| 193 | 189 |
| 194 // Mark the FRE flow as complete and set the sign-in flow preferences if
necessary. | 190 // Mark the FRE flow as complete and set the sign-in flow preferences if
necessary. |
| 195 FirstRunSigninProcessor.finalizeFirstRunFlowState(activity, data); | 191 FirstRunSignInProcessor.finalizeFirstRunFlowState(activity, data); |
| 196 } | 192 } |
| 197 | 193 |
| 198 /** | 194 /** |
| 199 * Checks if the First Run needs to be launched. | 195 * Checks if the First Run needs to be launched. |
| 200 * @return The intent to launch the First Run Experience if necessary, or nu
ll. | 196 * @return The intent to launch the First Run Experience if necessary, or nu
ll. |
| 201 * @param activity The context | 197 * @param activity The context |
| 202 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon | 198 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon |
| 203 */ | 199 */ |
| 204 public static Intent checkIfFirstRunIsNecessary(Context context, boolean fro
mChromeIcon) { | 200 public static Intent checkIfFirstRunIsNecessary(Context context, boolean fro
mChromeIcon) { |
| 205 // If FRE is disabled (e.g. in tests), proceed directly to the intent ha
ndling. | 201 // If FRE is disabled (e.g. in tests), proceed directly to the intent ha
ndling. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 228 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon | 224 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon |
| 229 */ | 225 */ |
| 230 public static Intent createGenericFirstRunIntent(Context context, boolean fr
omChromeIcon) { | 226 public static Intent createGenericFirstRunIntent(Context context, boolean fr
omChromeIcon) { |
| 231 Intent intent = new Intent(); | 227 Intent intent = new Intent(); |
| 232 intent.setClassName(context, FirstRunActivity.class.getName()); | 228 intent.setClassName(context, FirstRunActivity.class.getName()); |
| 233 intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon
); | 229 intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon
); |
| 234 intent.putExtra(FirstRunActivity.USE_FRE_FLOW_SEQUENCER, true); | 230 intent.putExtra(FirstRunActivity.USE_FRE_FLOW_SEQUENCER, true); |
| 235 return intent; | 231 return intent; |
| 236 } | 232 } |
| 237 } | 233 } |
| OLD | NEW |