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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java

Issue 1357643002: [Android]Don't check for child account/EDU device for every activity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert SignInPreference to avoid 2 sided patch Created 5 years, 3 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 unified diff | Download patch
OLDNEW
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
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); 77 }.start(mActivity.getApplicationContext());
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
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 }
176 } 180 }
177 181
178 /** 182 /**
179 * Marks a given flow as completed. 183 * Marks a given flow as completed.
180 * @param activity An activity. 184 * @param activity An activity.
181 * @param data Resulting FRE properties bundle. 185 * @param data Resulting FRE properties bundle.
182 */ 186 */
183 public static void markFlowAsCompleted(Activity activity, Bundle data) { 187 public static void markFlowAsCompleted(Activity activity, Bundle data) {
184 // When the user accepts ToS in the Setup Wizard (see ToSAckedReceiver), we do not 188 // When the user accepts ToS in the Setup Wizard (see ToSAckedReceiver), we do not
185 // show the ToS page to the user because the user has already accepted o ne outside FRE. 189 // show the ToS page to the user because the user has already accepted o ne outside FRE.
186 if (!PrefServiceBridge.getInstance().isFirstRunEulaAccepted()) { 190 if (!PrefServiceBridge.getInstance().isFirstRunEulaAccepted()) {
187 PrefServiceBridge.getInstance().setEulaAccepted(); 191 PrefServiceBridge.getInstance().setEulaAccepted();
188 } 192 }
189 193
190 // Mark the FRE flow as complete and set the sign-in flow preferences if necessary. 194 // Mark the FRE flow as complete and set the sign-in flow preferences if necessary.
191 FirstRunSignInProcessor.finalizeFirstRunFlowState(activity, data); 195 FirstRunSigninProcessor.finalizeFirstRunFlowState(activity, data);
192 } 196 }
193 197
194 /** 198 /**
195 * Checks if the First Run needs to be launched. 199 * Checks if the First Run needs to be launched.
196 * @return The intent to launch the First Run Experience if necessary, or nu ll. 200 * @return The intent to launch the First Run Experience if necessary, or nu ll.
197 * @param activity The context 201 * @param activity The context
198 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon 202 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon
199 */ 203 */
200 public static Intent checkIfFirstRunIsNecessary(Context context, boolean fro mChromeIcon) { 204 public static Intent checkIfFirstRunIsNecessary(Context context, boolean fro mChromeIcon) {
201 // If FRE is disabled (e.g. in tests), proceed directly to the intent ha ndling. 205 // If FRE is disabled (e.g. in tests), proceed directly to the intent ha ndling.
(...skipping 22 matching lines...) Expand all
224 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon 228 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon
225 */ 229 */
226 public static Intent createGenericFirstRunIntent(Context context, boolean fr omChromeIcon) { 230 public static Intent createGenericFirstRunIntent(Context context, boolean fr omChromeIcon) {
227 Intent intent = new Intent(); 231 Intent intent = new Intent();
228 intent.setClassName(context, FirstRunActivity.class.getName()); 232 intent.setClassName(context, FirstRunActivity.class.getName());
229 intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon ); 233 intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon );
230 intent.putExtra(FirstRunActivity.USE_FRE_FLOW_SEQUENCER, true); 234 intent.putExtra(FirstRunActivity.USE_FRE_FLOW_SEQUENCER, true);
231 return intent; 235 return intent;
232 } 236 }
233 } 237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698