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

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

Issue 2237293003: [FRE] Change the First Run Experience launching behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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;
11 import android.os.Bundle; 11 import android.os.Bundle;
12 import android.text.TextUtils;
13 12
14 import org.chromium.base.ApiCompatibilityUtils; 13 import org.chromium.base.ApiCompatibilityUtils;
15 import org.chromium.base.CommandLine; 14 import org.chromium.base.CommandLine;
16 import org.chromium.base.FieldTrialList; 15 import org.chromium.base.FieldTrialList;
17 import org.chromium.base.VisibleForTesting; 16 import org.chromium.base.VisibleForTesting;
18 import org.chromium.chrome.browser.ChromeSwitches; 17 import org.chromium.chrome.browser.ChromeSwitches;
19 import org.chromium.chrome.browser.IntentHandler;
20 import org.chromium.chrome.browser.IntentHandler.ExternalAppId;
21 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; 18 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
22 import org.chromium.chrome.browser.preferences.PrefServiceBridge; 19 import org.chromium.chrome.browser.preferences.PrefServiceBridge;
23 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ; 20 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ;
24 import org.chromium.chrome.browser.services.AndroidEduAndChildAccountHelper; 21 import org.chromium.chrome.browser.services.AndroidEduAndChildAccountHelper;
25 import org.chromium.chrome.browser.signin.SigninManager; 22 import org.chromium.chrome.browser.signin.SigninManager;
26 import org.chromium.chrome.browser.util.FeatureUtilities; 23 import org.chromium.chrome.browser.util.FeatureUtilities;
27 import org.chromium.components.sync.signin.AccountManagerHelper; 24 import org.chromium.components.sync.signin.AccountManagerHelper;
28 import org.chromium.components.sync.signin.ChromeSigninController; 25 import org.chromium.components.sync.signin.ChromeSigninController;
29 26
30 /** 27 /**
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 211 }
215 212
216 // Mark the FRE flow as complete and set the sign-in flow preferences if necessary. 213 // Mark the FRE flow as complete and set the sign-in flow preferences if necessary.
217 FirstRunSignInProcessor.finalizeFirstRunFlowState(activity, data); 214 FirstRunSignInProcessor.finalizeFirstRunFlowState(activity, data);
218 } 215 }
219 216
220 /** 217 /**
221 * Checks if the First Run needs to be launched. 218 * Checks if the First Run needs to be launched.
222 * @return The intent to launch the First Run Experience if necessary, or nu ll. 219 * @return The intent to launch the First Run Experience if necessary, or nu ll.
223 * @param context The context. 220 * @param context The context.
224 * @param fromIntent The intent that was used to launch Chrome. It contains the information of 221 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon.
225 * the client to launch different types of the First Run Experience. 222 * @param forLightweightFre Whether this is a check for the Lightweight Firs t Run Experience.
226 */ 223 */
227 public static Intent checkIfFirstRunIsNecessary(Context context, Intent from Intent) { 224 public static Intent checkIfFirstRunIsNecessary(
225 Context context, boolean fromChromeIcon, boolean forLightweightFre) {
228 // If FRE is disabled (e.g. in tests), proceed directly to the intent ha ndling. 226 // If FRE is disabled (e.g. in tests), proceed directly to the intent ha ndling.
229 if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN _EXPERIENCE) 227 if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN _EXPERIENCE)
230 || ApiCompatibilityUtils.isDemoUser(context)) { 228 || ApiCompatibilityUtils.isDemoUser(context)) {
231 return null; 229 return null;
232 } 230 }
233 231
234 // If Chrome isn't opened via the Chrome icon, and the user accepted the ToS 232 // If Chrome isn't opened via the Chrome icon, and the user accepted the ToS
235 // in the Setup Wizard, skip any First Run Experience screens and procee d directly 233 // in the Setup Wizard, skip any First Run Experience screens and procee d directly
236 // to the intent handling. 234 // to the intent handling.
237 final boolean fromChromeIcon =
Bernhard Bauer 2016/08/16 23:20:08 Is there a reason you're moving this out to the ca
gogerald1 2016/08/17 14:44:10 Done. just made the parameter a little specific, m
238 fromIntent != null && TextUtils.equals(fromIntent.getAction(), I ntent.ACTION_MAIN);
239 if (!fromChromeIcon && ToSAckedReceiver.checkAnyUserHasSeenToS(context)) return null; 235 if (!fromChromeIcon && ToSAckedReceiver.checkAnyUserHasSeenToS(context)) return null;
240 236
241 final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete(c ontext); 237 final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete(c ontext);
242 if (!baseFreComplete) { 238 if (!baseFreComplete) {
243 // Show full First Run Experience if Chrome is opened via Chrome ico n or GSA (Google 239 if (!forLightweightFre) {
Bernhard Bauer 2016/08/16 23:20:08 Invert the check to put the positive branch first?
gogerald1 2016/08/17 14:44:11 Done.
244 // Search App).
245 if (fromChromeIcon
246 || (fromIntent != null
247 && IntentHandler.determineExternalIntentSource(
248 context.getPackageName(), fromIntent) == ExternalApp Id.GSA)) {
249 return createGenericFirstRunIntent(context, fromChromeIcon); 240 return createGenericFirstRunIntent(context, fromChromeIcon);
250 } 241 } else {
251 242 if (!FirstRunStatus.shouldSkipWelcomePage(context)
252 // Show lightweight First Run Experience if the user has not accepte d the ToS. 243 && !FirstRunStatus.getLightweightFirstRunFlowComplete(co ntext)) {
253 if (!FirstRunStatus.shouldSkipWelcomePage(context) 244 return createLightweightFirstRunIntent(context, fromChromeIc on);
254 && !FirstRunStatus.getLightweightFirstRunFlowComplete(contex t)) { 245 }
255 return createLightweightFirstRunIntent(context, fromChromeIcon);
256 } 246 }
257 } 247 }
258 248
259 // Promo pages are removed, so there is nothing else to show in FRE. 249 // Promo pages are removed, so there is nothing else to show in FRE.
260 return null; 250 return null;
261 } 251 }
262 252
263 private static Intent createLightweightFirstRunIntent(Context context, boole an fromChromeIcon) { 253 private static Intent createLightweightFirstRunIntent(Context context, boole an fromChromeIcon) {
264 Intent intent = new Intent(); 254 Intent intent = new Intent();
265 intent.setClassName(context, LightweightFirstRunActivity.class.getName() ); 255 intent.setClassName(context, LightweightFirstRunActivity.class.getName() );
266 intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon ); 256 intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon );
267 intent.putExtra(FirstRunActivity.START_LIGHTWEIGHT_FRE, true); 257 intent.putExtra(FirstRunActivity.START_LIGHTWEIGHT_FRE, true);
268 return intent; 258 return intent;
269 } 259 }
270 260
271 /** 261 /**
272 * @return A generic intent to show the First Run Activity. 262 * @return A generic intent to show the First Run Activity.
273 * @param context The context 263 * @param context The context
274 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon 264 * @param fromChromeIcon Whether Chrome is opened via the Chrome icon
275 */ 265 */
276 public static Intent createGenericFirstRunIntent(Context context, boolean fr omChromeIcon) { 266 public static Intent createGenericFirstRunIntent(Context context, boolean fr omChromeIcon) {
277 Intent intent = new Intent(); 267 Intent intent = new Intent();
278 intent.setClassName(context, FirstRunActivity.class.getName()); 268 intent.setClassName(context, FirstRunActivity.class.getName());
279 intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon ); 269 intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon );
280 intent.putExtra(FirstRunActivity.USE_FRE_FLOW_SEQUENCER, true); 270 intent.putExtra(FirstRunActivity.USE_FRE_FLOW_SEQUENCER, true);
281 return intent; 271 return intent;
282 } 272 }
283 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698