| 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.signin; | 5 package org.chromium.chrome.browser.signin; |
| 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.Intent; | 9 import android.content.Intent; |
| 10 import android.os.Bundle; | 10 import android.os.Bundle; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 /** | 41 /** |
| 42 * Launches the signin promo if it needs to be displayed. | 42 * Launches the signin promo if it needs to be displayed. |
| 43 * @param activity The parent activity. | 43 * @param activity The parent activity. |
| 44 * @return Whether the signin promo is shown. | 44 * @return Whether the signin promo is shown. |
| 45 */ | 45 */ |
| 46 public static boolean launchSigninPromoIfNeeded(final Activity activity) { | 46 public static boolean launchSigninPromoIfNeeded(final Activity activity) { |
| 47 // The promo is displayed if Chrome is launched directly (i.e., not with
the intent to | 47 // The promo is displayed if Chrome is launched directly (i.e., not with
the intent to |
| 48 // navigate to and view a URL on startup), the instance is part of the f
ield trial, | 48 // navigate to and view a URL on startup), the instance is part of the f
ield trial, |
| 49 // and the promo has been marked to display. | 49 // and the promo has been marked to display. |
| 50 ChromePreferenceManager preferenceManager = ChromePreferenceManager.getI
nstance(activity); | 50 ChromePreferenceManager preferenceManager = ChromePreferenceManager.getI
nstance(activity); |
| 51 if (MultiWindowUtils.getInstance().isMultiWindow(activity)) return false
; | 51 if (MultiWindowUtils.getInstance().isLegacyMultiWindow(activity)) return
false; |
| 52 if (!preferenceManager.getShowSigninPromo()) return false; | 52 if (!preferenceManager.getShowSigninPromo()) return false; |
| 53 preferenceManager.setShowSigninPromo(false); | 53 preferenceManager.setShowSigninPromo(false); |
| 54 | 54 |
| 55 String lastSyncName = PrefServiceBridge.getInstance().getSyncLastAccount
Name(); | 55 String lastSyncName = PrefServiceBridge.getInstance().getSyncLastAccount
Name(); |
| 56 if (SigninManager.getAndroidSigninPromoExperimentGroup() < 0 | 56 if (SigninManager.getAndroidSigninPromoExperimentGroup() < 0 |
| 57 || ChromeSigninController.get(activity).isSignedIn() | 57 || ChromeSigninController.get(activity).isSignedIn() |
| 58 || !TextUtils.isEmpty(lastSyncName)) { | 58 || !TextUtils.isEmpty(lastSyncName)) { |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 SigninPromoUma.recordAction(SigninPromoUma.SIGNIN_PROMO_ACCEPTED_WITH_AD
VANCED); | 155 SigninPromoUma.recordAction(SigninPromoUma.SIGNIN_PROMO_ACCEPTED_WITH_AD
VANCED); |
| 156 dismiss(); | 156 dismiss(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 @Override | 159 @Override |
| 160 public void onFailedToSetForcedAccount(String forcedAccountName) { | 160 public void onFailedToSetForcedAccount(String forcedAccountName) { |
| 161 assert false : "No forced accounts in SigninPromoScreen"; | 161 assert false : "No forced accounts in SigninPromoScreen"; |
| 162 } | 162 } |
| 163 } | 163 } |
| OLD | NEW |