Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java |
| index 3d2a9a5bb7fff697aa8c2770899c23152db56cd4..321cdf32171022361174890118d255163956ca9c 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java |
| @@ -15,6 +15,7 @@ import org.chromium.base.CommandLine; |
| import org.chromium.base.FieldTrialList; |
| import org.chromium.base.VisibleForTesting; |
| import org.chromium.chrome.browser.ChromeSwitches; |
| +import org.chromium.chrome.browser.IntentHandler.ExternalAppId; |
| import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
| import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager; |
| import org.chromium.chrome.browser.services.AndroidEduAndChildAccountHelper; |
| @@ -215,8 +216,10 @@ public abstract class FirstRunFlowSequencer { |
| * @return The intent to launch the First Run Experience if necessary, or null. |
| * @param context The context |
| * @param fromChromeIcon Whether Chrome is opened via the Chrome icon |
| + * @param fromExternalApp The external app opens Chrome. |
| */ |
| - public static Intent checkIfFirstRunIsNecessary(Context context, boolean fromChromeIcon) { |
| + public static Intent checkIfFirstRunIsNecessary( |
| + Context context, boolean fromChromeIcon, ExternalAppId fromExternalApp) { |
| // If FRE is disabled (e.g. in tests), proceed directly to the intent handling. |
| if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)) { |
| return null; |
| @@ -227,16 +230,32 @@ public abstract class FirstRunFlowSequencer { |
| // to the intent handling. |
| if (!fromChromeIcon && ToSAckedReceiver.checkAnyUserHasSeenToS(context)) return null; |
| - // If the user hasn't been through the First Run Activity -- it must be shown. |
| final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete(context); |
| if (!baseFreComplete) { |
| - return createGenericFirstRunIntent(context, fromChromeIcon); |
| + // Show full First Run Experience if Chrome is opened via Chrome icon or GSA (Google |
| + // Search App). |
| + if (fromChromeIcon || fromExternalApp == ExternalAppId.GSA) { |
| + return createGenericFirstRunIntent(context, fromChromeIcon); |
| + } else { |
|
Bernhard Bauer
2016/06/16 16:35:36
The else is not necessary if you have a return sta
gogerald1
2016/06/16 18:59:20
Done.
|
| + // Show lightweight First Run Experience if the user has not accepted the ToS. |
| + if (!PrefServiceBridge.getInstance().isFirstRunEulaAccepted()) { |
| + return createLightweightFirstRunIntent(context, fromChromeIcon); |
| + } |
| + } |
| } |
| // Promo pages are removed, so there is nothing else to show in FRE. |
| return null; |
| } |
| + private static Intent createLightweightFirstRunIntent(Context context, boolean fromChromeIcon) { |
| + Intent intent = new Intent(); |
| + intent.setClassName(context, LightweightFirstRunActivity.class.getName()); |
| + intent.putExtra(FirstRunActivity.COMING_FROM_CHROME_ICON, fromChromeIcon); |
| + intent.putExtra(FirstRunActivity.USE_FRE_FLOW_SEQUENCER, false); |
| + return intent; |
| + } |
| + |
| /** |
| * @return A generic intent to show the First Run Activity. |
| * @param context The context |