Commit 319d1d3a authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Signin][Android] Remove old signin promos from Bookmarks and RecentTabs

This CL removes support for old generic signin promos from Bookmarks and
RecentTabs. These promos were superseded by personalized signin promos.
Old promos were implemented in SigninAndSyncView, so this CL also
removes support for signin promos from this class. SigninAndSyncView
will be renamed in follow-up CLs.

Bug: 792430
Change-Id: I752f90339377e34c70766109a13f5e92e5ef1ea7
Reviewed-on: https://chromium-review.googlesource.com/836867Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525336}
parent 8810b5f2
......@@ -35,16 +35,6 @@
android:gravity="center_vertical"
android:orientation="horizontal" >
<Button
android:id="@+id/no_thanks"
style="@style/ButtonCompatBorderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_thanks"
android:textAllCaps="true"
android:textColor="@color/light_active_color"
android:textSize="15sp" />
<org.chromium.ui.widget.ButtonCompat
android:id="@+id/sign_in"
android:layout_width="wrap_content"
......
......@@ -34,14 +34,13 @@ class BookmarkItemsAdapter
* Specifies the view types that the bookmark manager screen can contain.
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef({ViewType.PERSONALIZED_SIGNIN_PROMO, ViewType.GENERIC_SIGNIN_PROMO, ViewType.SYNC_PROMO,
ViewType.FOLDER, ViewType.BOOKMARK})
@IntDef({ViewType.PERSONALIZED_SIGNIN_PROMO, ViewType.SYNC_PROMO, ViewType.FOLDER,
ViewType.BOOKMARK})
private @interface ViewType {
int PERSONALIZED_SIGNIN_PROMO = 0;
int GENERIC_SIGNIN_PROMO = 1;
int SYNC_PROMO = 2;
int FOLDER = 3;
int BOOKMARK = 4;
int SYNC_PROMO = 1;
int FOLDER = 2;
int BOOKMARK = 3;
}
private static final int MAXIMUM_NUMBER_OF_SEARCH_RESULTS = 500;
......@@ -213,8 +212,6 @@ class BookmarkItemsAdapter
switch (viewType) {
case ViewType.PERSONALIZED_SIGNIN_PROMO:
return mPromoHeaderManager.createPersonalizedSigninPromoHolder(parent);
case ViewType.GENERIC_SIGNIN_PROMO:
return mPromoHeaderManager.createGenericSigninPromoHolder(parent);
case ViewType.SYNC_PROMO:
return mPromoHeaderManager.createSyncPromoHolder(parent);
case ViewType.FOLDER:
......@@ -240,7 +237,6 @@ class BookmarkItemsAdapter
PersonalizedSigninPromoView view = (PersonalizedSigninPromoView) holder.itemView;
mPromoHeaderManager.setupPersonalizedSigninPromo(view);
break;
case ViewType.GENERIC_SIGNIN_PROMO:
case ViewType.SYNC_PROMO:
break;
case ViewType.FOLDER:
......@@ -377,9 +373,6 @@ class BookmarkItemsAdapter
case BookmarkPromoHeader.PromoState.PROMO_SIGNIN_PERSONALIZED:
mPromoHeaderSection.add(ViewType.PERSONALIZED_SIGNIN_PROMO);
return;
case BookmarkPromoHeader.PromoState.PROMO_SIGNIN_GENERIC:
mPromoHeaderSection.add(ViewType.GENERIC_SIGNIN_PROMO);
return;
case BookmarkPromoHeader.PromoState.PROMO_SYNC:
mPromoHeaderSection.add(ViewType.SYNC_PROMO);
return;
......
......@@ -17,7 +17,6 @@ import android.view.ViewGroup;
import org.chromium.base.ContextUtils;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.signin.DisplayableProfileData;
import org.chromium.chrome.browser.signin.PersonalizedSigninPromoView;
......@@ -47,21 +46,17 @@ class BookmarkPromoHeader implements AndroidSyncSettingsObserver, SignInStateObs
* Specifies the various states in which the Bookmarks promo can be.
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef({PromoState.PROMO_NONE, PromoState.PROMO_SIGNIN_PERSONALIZED,
PromoState.PROMO_SIGNIN_GENERIC, PromoState.PROMO_SYNC})
@IntDef({PromoState.PROMO_NONE, PromoState.PROMO_SIGNIN_PERSONALIZED, PromoState.PROMO_SYNC})
@interface PromoState {
int PROMO_NONE = 0;
int PROMO_SIGNIN_PERSONALIZED = 1;
int PROMO_SIGNIN_GENERIC = 2;
int PROMO_SYNC = 3;
int PROMO_SYNC = 2;
}
// Personalized signin promo preference.
private static final String PREF_PERSONALIZED_SIGNIN_PROMO_DECLINED =
"signin_promo_bookmarks_declined";
// Generic signin and sync promo preferences.
private static final String PREF_GENERIC_SIGNIN_PROMO_DECLINED =
"enhanced_bookmark_signin_promo_declined";
private static final String PREF_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT =
"enhanced_bookmark_signin_promo_show_count";
// TODO(kkimlabs): Figure out the optimal number based on UMA data.
......@@ -87,9 +82,8 @@ class BookmarkPromoHeader implements AndroidSyncSettingsObserver, SignInStateObs
AndroidSyncSettings.registerObserver(mContext, this);
if (SigninPromoController.arePersonalizedPromosEnabled()
&& SigninPromoController.hasNotReachedImpressionLimit(
SigninAccessPoint.BOOKMARK_MANAGER)) {
if (SigninPromoController.hasNotReachedImpressionLimit(
SigninAccessPoint.BOOKMARK_MANAGER)) {
int imageSize =
mContext.getResources().getDimensionPixelSize(R.dimen.user_picture_size);
mProfileDataCache = new ProfileDataCache(mContext, imageSize);
......@@ -105,17 +99,13 @@ class BookmarkPromoHeader implements AndroidSyncSettingsObserver, SignInStateObs
mSignInManager.addSignInStateObserver(this);
mPromoState = calculatePromoState();
if (mPromoState == PromoState.PROMO_SIGNIN_GENERIC
|| mPromoState == PromoState.PROMO_SYNC) {
if (mPromoState == PromoState.PROMO_SYNC) {
int promoShowCount = ContextUtils.getAppSharedPreferences().getInt(
PREF_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT, 0);
ContextUtils.getAppSharedPreferences()
.edit()
.putInt(PREF_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT, promoShowCount + 1)
.apply();
if (mPromoState == PromoState.PROMO_SIGNIN_GENERIC) {
RecordUserAction.record("Signin_Impression_FromBookmarkManager");
}
}
}
......@@ -154,25 +144,13 @@ class BookmarkPromoHeader implements AndroidSyncSettingsObserver, SignInStateObs
return new ViewHolder(view) {};
}
/**
* TODO(crbug.com/737743): Remove this after rolling out personalized promos.
* @return Generic signin promo header {@link ViewHolder} instance that can be used with
* {@link RecyclerView}.
*/
ViewHolder createGenericSigninPromoHolder(ViewGroup parent) {
// The generic signin promo and the sync promo use the same view.
return createSyncPromoHolder(parent);
}
/**
* @return Sync promo header {@link ViewHolder} instance that can be used with
* {@link RecyclerView}.
*/
ViewHolder createSyncPromoHolder(ViewGroup parent) {
SigninAndSyncView.Listener listener = this::setGenericSigninPromoDeclined;
SigninAndSyncView view =
SigninAndSyncView.create(parent, listener, SigninAccessPoint.BOOKMARK_MANAGER);
SigninAndSyncView.create(parent, SigninAccessPoint.BOOKMARK_MANAGER);
// ViewHolder is abstract and it cannot be instantiated directly.
return new ViewHolder(view) {};
......@@ -213,19 +191,6 @@ class BookmarkPromoHeader implements AndroidSyncSettingsObserver, SignInStateObs
mPromoHeaderChangeAction.run();
}
/**
* Saves that the generic signin promo was declined and updates the UI.
* TODO(crbug.com/737743): Remove this after rolling out personalized promos.
*/
private void setGenericSigninPromoDeclined() {
SharedPreferences.Editor sharedPreferencesEditor =
ContextUtils.getAppSharedPreferences().edit();
sharedPreferencesEditor.putBoolean(PREF_GENERIC_SIGNIN_PROMO_DECLINED, true);
sharedPreferencesEditor.apply();
mPromoState = calculatePromoState();
mPromoHeaderChangeAction.run();
}
/**
* @return Whether the user declined the personalized signin promo.
*/
......@@ -234,15 +199,6 @@ class BookmarkPromoHeader implements AndroidSyncSettingsObserver, SignInStateObs
PREF_PERSONALIZED_SIGNIN_PROMO_DECLINED, false);
}
/**
* TODO(crbug.com/737743): Remove this after rolling out personalized promos.
* @return Whether user tapped "No" button on the generic signin promo.
*/
private boolean wasGenericSigninPromoDeclined() {
return ContextUtils.getAppSharedPreferences().getBoolean(
PREF_GENERIC_SIGNIN_PROMO_DECLINED, false);
}
private @PromoState int calculatePromoState() {
if (sPromoStateForTests != null) {
return sPromoStateForTests;
......@@ -252,36 +208,21 @@ class BookmarkPromoHeader implements AndroidSyncSettingsObserver, SignInStateObs
return PromoState.PROMO_NONE;
}
// If the user is signed in, then we should show the sync promo if Chrome sync is disabled
// and the impression limit has not been reached yet.
if (ChromeSigninController.get().isSignedIn()) {
boolean impressionLimitNotReached = ContextUtils.getAppSharedPreferences().getInt(
PREF_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT, 0)
< MAX_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT;
if (!AndroidSyncSettings.isChromeSyncEnabled(mContext) && impressionLimitNotReached) {
return PromoState.PROMO_SYNC;
}
return PromoState.PROMO_NONE;
}
if (!mSignInManager.isSignInAllowed()) {
return PromoState.PROMO_NONE;
}
if (SigninPromoController.arePersonalizedPromosEnabled()) {
if (SigninPromoController.hasNotReachedImpressionLimit(
SigninAccessPoint.BOOKMARK_MANAGER)
&& !wasPersonalizedSigninPromoDeclined()) {
return PromoState.PROMO_SIGNIN_PERSONALIZED;
if (!ChromeSigninController.get().isSignedIn()) {
boolean impressionLimitReached = !SigninPromoController.hasNotReachedImpressionLimit(
SigninAccessPoint.BOOKMARK_MANAGER);
if (!mSignInManager.isSignInAllowed() || impressionLimitReached
|| wasPersonalizedSigninPromoDeclined()) {
return PromoState.PROMO_NONE;
}
return PromoState.PROMO_NONE;
return PromoState.PROMO_SIGNIN_PERSONALIZED;
}
int numImpressions = ContextUtils.getAppSharedPreferences().getInt(
PREF_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT, 0);
boolean impressionLimitNotReached = numImpressions < MAX_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT;
if (impressionLimitNotReached && !wasGenericSigninPromoDeclined()) {
return PromoState.PROMO_SIGNIN_GENERIC;
boolean impressionLimitNotReached = ContextUtils.getAppSharedPreferences().getInt(
PREF_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT, 0)
< MAX_SIGNIN_AND_SYNC_PROMO_SHOW_COUNT;
if (!AndroidSyncSettings.isChromeSyncEnabled(mContext) && impressionLimitNotReached) {
return PromoState.PROMO_SYNC;
}
return PromoState.PROMO_NONE;
}
......
......@@ -57,13 +57,11 @@ public class RecentTabsManager implements AndroidSyncSettingsObserver, SignInSta
void onUpdated();
}
@Retention(RetentionPolicy.SOURCE)
@IntDef({PromoState.PROMO_NONE, PromoState.PROMO_SIGNIN_PERSONALIZED,
PromoState.PROMO_SIGNIN_GENERIC, PromoState.PROMO_SYNC})
@IntDef({PromoState.PROMO_NONE, PromoState.PROMO_SIGNIN_PERSONALIZED, PromoState.PROMO_SYNC})
@interface PromoState {
int PROMO_NONE = 0;
int PROMO_SIGNIN_PERSONALIZED = 1;
int PROMO_SIGNIN_GENERIC = 2;
int PROMO_SYNC = 3;
int PROMO_SYNC = 2;
}
private static final int RECENTLY_CLOSED_MAX_TAB_COUNT = 5;
......@@ -359,23 +357,19 @@ public class RecentTabsManager implements AndroidSyncSettingsObserver, SignInSta
*/
@PromoState
int getPromoType() {
if (ChromeSigninController.get().isSignedIn()) {
if (AndroidSyncSettings.isSyncEnabled(mContext)
&& AndroidSyncSettings.isChromeSyncEnabled(mContext)
&& !mForeignSessions.isEmpty()) {
if (!ChromeSigninController.get().isSignedIn()) {
if (!SigninManager.get(mContext).isSignInAllowed()) {
return PromoState.PROMO_NONE;
}
return PromoState.PROMO_SYNC;
return PromoState.PROMO_SIGNIN_PERSONALIZED;
}
if (!SigninManager.get(mContext).isSignInAllowed()) {
if (AndroidSyncSettings.isSyncEnabled(mContext)
&& AndroidSyncSettings.isChromeSyncEnabled(mContext)
&& !mForeignSessions.isEmpty()) {
return PromoState.PROMO_NONE;
}
if (SigninPromoController.arePersonalizedPromosEnabled()) {
return PromoState.PROMO_SIGNIN_PERSONALIZED;
}
return PromoState.PROMO_SIGNIN_GENERIC;
return PromoState.PROMO_SYNC;
}
void recordRecentTabMetrics() {
......
......@@ -21,7 +21,6 @@ import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback;
import org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSession;
......@@ -30,7 +29,6 @@ import org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSessionWindow
import org.chromium.chrome.browser.signin.PersonalizedSigninPromoView;
import org.chromium.chrome.browser.signin.SigninAccessPoint;
import org.chromium.chrome.browser.signin.SigninAndSyncView;
import org.chromium.components.signin.ChromeSigninController;
import org.chromium.ui.base.DeviceFormFactor;
import org.chromium.ui.mojom.WindowOpenDisposition;
......@@ -48,7 +46,6 @@ public class RecentTabsRowAdapter extends BaseExpandableListAdapter {
NONE,
DEFAULT_CONTENT,
PERSONALIZED_SIGNIN_PROMO,
GENERIC_SIGNIN_PROMO,
SYNC_PROMO
}
......@@ -392,29 +389,6 @@ public class RecentTabsRowAdapter extends BaseExpandableListAdapter {
}
}
/**
* A group containing the generic signin promo.
* TODO(crbug.com/737743): Remove this after rolling out personalized promos.
*/
class GenericSigninPromoGroup extends PromoGroup {
@Override
public ChildType getChildType() {
return ChildType.GENERIC_SIGNIN_PROMO;
}
@Override
View getChildView(
int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = SigninAndSyncView.create(parent, null, SigninAccessPoint.RECENT_TABS);
}
if (!ChromeSigninController.get().isSignedIn()) {
RecordUserAction.record("Signin_Impression_FromRecentTabs");
}
return convertView;
}
}
/**
* A group containing the sync promo.
*/
......@@ -428,7 +402,7 @@ public class RecentTabsRowAdapter extends BaseExpandableListAdapter {
View getChildView(
int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = SigninAndSyncView.create(parent, null, SigninAccessPoint.RECENT_TABS);
convertView = SigninAndSyncView.create(parent, SigninAccessPoint.RECENT_TABS);
}
return convertView;
}
......@@ -795,9 +769,6 @@ public class RecentTabsRowAdapter extends BaseExpandableListAdapter {
case RecentTabsManager.PromoState.PROMO_SIGNIN_PERSONALIZED:
addGroup(new PersonalizedSigninPromoGroup());
break;
case RecentTabsManager.PromoState.PROMO_SIGNIN_GENERIC:
addGroup(new GenericSigninPromoGroup());
break;
case RecentTabsManager.PromoState.PROMO_SYNC:
addGroup(new SyncPromoGroup());
break;
......
......@@ -131,8 +131,7 @@ public class SignInPreference
return;
}
if (SigninPromoController.hasNotReachedImpressionLimit(SigninAccessPoint.SETTINGS)
&& SigninPromoController.arePersonalizedPromosEnabled()) {
if (SigninPromoController.hasNotReachedImpressionLimit(SigninAccessPoint.SETTINGS)) {
setupPersonalizedPromo();
return;
}
......
......@@ -19,62 +19,35 @@ import org.chromium.base.ThreadUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.preferences.PreferencesLauncher;
import org.chromium.chrome.browser.signin.AccountSigninActivity.AccessPoint;
import org.chromium.chrome.browser.signin.SigninManager.SignInStateObserver;
import org.chromium.chrome.browser.sync.ui.SyncCustomizationFragment;
import org.chromium.components.signin.ChromeSigninController;
import org.chromium.components.sync.AndroidSyncSettings;
import org.chromium.components.sync.AndroidSyncSettings.AndroidSyncSettingsObserver;
import javax.annotation.Nullable;
/**
* A View that shows the user the next step they must complete to start syncing their data (eg.
* Recent Tabs or Bookmarks). For example, if the user is not signed in, the View will prompt them
* to do so and link to the AccountSigninActivity.
* If inflated manually, {@link SigninAndSyncView#init(Listener, int)} must be called before
* If inflated manually, {@link SigninAndSyncView#init(int)} must be called before
* attaching this View to a ViewGroup.
*/
public class SigninAndSyncView extends LinearLayout
implements AndroidSyncSettingsObserver, SignInStateObserver {
private @Nullable Listener mListener;
public class SigninAndSyncView extends LinearLayout implements AndroidSyncSettingsObserver {
private @AccessPoint int mAccessPoint;
private boolean mInitialized;
private final SigninManager mSigninManager;
private TextView mTitle;
private TextView mDescription;
private Button mNegativeButton;
private Button mPositiveButton;
/**
* A listener for the container of the SigninAndSyncView to be informed of certain user
* interactions.
*/
public interface Listener {
/**
* The user has pressed 'no thanks' and expects the view to be removed from its parent.
*/
void onViewDismissed();
}
/**
* A convenience method to inflate and initialize a SigninAndSyncView.
* @param parent A parent used to provide LayoutParams (the SigninAndSyncView will not be
* attached).
* @param listener Listener for user interactions. A null listener marks that the promo is not
* dismissible.
* @param accessPoint Where the SigninAndSyncView is used.
*/
public static SigninAndSyncView create(
ViewGroup parent, @Nullable Listener listener, @AccessPoint int accessPoint) {
if (listener == null) {
assert accessPoint
== SigninAccessPoint.RECENT_TABS
: "The promo should not be dismissible in Recent Tabs!";
}
public static SigninAndSyncView create(ViewGroup parent, @AccessPoint int accessPoint) {
SigninAndSyncView signinView = (SigninAndSyncView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.signin_and_sync_view, parent, false);
signinView.init(listener, accessPoint);
signinView.init(accessPoint);
return signinView;
}
......@@ -83,7 +56,6 @@ public class SigninAndSyncView extends LinearLayout
*/
public SigninAndSyncView(Context context, AttributeSet attrs) {
super(context, attrs);
mSigninManager = SigninManager.get(getContext());
}
@Override
......@@ -92,17 +64,14 @@ public class SigninAndSyncView extends LinearLayout
mTitle = (TextView) findViewById(R.id.title);
mDescription = (TextView) findViewById(R.id.description);
mNegativeButton = (Button) findViewById(R.id.no_thanks);
mPositiveButton = (Button) findViewById(R.id.sign_in);
}
/**
* Provide the information necessary for this class to function.
* @param listener Listener for user interactions.
* @param accessPoint Where this UI component is used.
*/
public void init(Listener listener, @AccessPoint int accessPoint) {
mListener = listener;
public void init(@AccessPoint int accessPoint) {
mAccessPoint = accessPoint;
mInitialized = true;
......@@ -122,16 +91,14 @@ public class SigninAndSyncView extends LinearLayout
private void update() {
ViewState viewState;
if (!ChromeSigninController.get().isSignedIn()) {
viewState = getStateForSignin();
} else if (!AndroidSyncSettings.isMasterSyncEnabled(getContext())) {
if (!AndroidSyncSettings.isMasterSyncEnabled(getContext())) {
viewState = getStateForEnableAndroidSync();
} else if (!AndroidSyncSettings.isChromeSyncEnabled(getContext())) {
viewState = getStateForEnableChromeSync();
} else {
viewState = getStateForStartUsing();
}
viewState.apply(mDescription, mPositiveButton, mNegativeButton);
viewState.apply(mDescription, mPositiveButton);
}
/**
......@@ -142,18 +109,14 @@ public class SigninAndSyncView extends LinearLayout
private static class ViewState {
private final int mDescriptionText;
private final ButtonState mPositiveButtonState;
private final ButtonState mNegativeButtonState;
public ViewState(int mDescriptionText,
ButtonState mPositiveButtonState, ButtonState mNegativeButtonState) {
public ViewState(int mDescriptionText, ButtonState mPositiveButtonState) {
this.mDescriptionText = mDescriptionText;
this.mPositiveButtonState = mPositiveButtonState;
this.mNegativeButtonState = mNegativeButtonState;
}
public void apply(TextView description, Button positiveButton, Button negativeButton) {
public void apply(TextView description, Button positiveButton) {
description.setText(mDescriptionText);
mNegativeButtonState.apply(negativeButton);
mPositiveButtonState.apply(positiveButton);
}
}
......@@ -190,28 +153,6 @@ public class SigninAndSyncView extends LinearLayout
}
}
private ViewState getStateForSignin() {
int descId = mAccessPoint == SigninAccessPoint.BOOKMARK_MANAGER
? R.string.bookmark_sign_in_promo_description
: R.string.recent_tabs_sign_in_promo_description;
ButtonState positiveButton = new ButtonPresent(R.string.sign_in_button, view -> {
Context context = getContext();
context.startActivity(AccountSigninActivity.createIntentForDefaultSigninFlow(
context, mAccessPoint, false));
});
ButtonState negativeButton;
if (mAccessPoint == SigninAccessPoint.RECENT_TABS) {
negativeButton = new ButtonAbsent();
} else {
negativeButton =
new ButtonPresent(R.string.no_thanks, view -> mListener.onViewDismissed());
}
return new ViewState(descId, positiveButton, negativeButton);
}
private ViewState getStateForEnableAndroidSync() {
assert mAccessPoint == SigninAccessPoint.RECENT_TABS
: "Enable Android Sync should not be showing from bookmarks";
......@@ -226,7 +167,7 @@ public class SigninAndSyncView extends LinearLayout
getContext().startActivity(intent);
});
return new ViewState(descId, positiveButton, new ButtonAbsent());
return new ViewState(descId, positiveButton);
}
private ViewState getStateForEnableChromeSync() {
......@@ -238,7 +179,7 @@ public class SigninAndSyncView extends LinearLayout
view -> PreferencesLauncher.launchSettingsPage(
getContext(), SyncCustomizationFragment.class.getName()));
return new ViewState(descId, positiveButton, new ButtonAbsent());
return new ViewState(descId, positiveButton);
}
private ViewState getStateForStartUsing() {
......@@ -247,8 +188,7 @@ public class SigninAndSyncView extends LinearLayout
// visible. I want there to be a guarantee that this state is never seen, but to do so would
// require some code restructuring.
return new ViewState(R.string.ntp_recent_tabs_sync_promo_instructions,
new ButtonAbsent(), new ButtonAbsent());
return new ViewState(R.string.ntp_recent_tabs_sync_promo_instructions, new ButtonAbsent());
}
@Override
......@@ -256,7 +196,6 @@ public class SigninAndSyncView extends LinearLayout
assert mInitialized : "init(...) must be called on SigninAndSyncView before use.";
super.onAttachedToWindow();
mSigninManager.addSignInStateObserver(this);
AndroidSyncSettings.registerObserver(getContext(), this);
update();
}
......@@ -264,21 +203,9 @@ public class SigninAndSyncView extends LinearLayout
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mSigninManager.removeSignInStateObserver(this);
AndroidSyncSettings.unregisterObserver(getContext(), this);
}
// SigninStateObserver
@Override
public void onSignedIn() {
update();
}
@Override
public void onSignedOut() {
update();
}
// AndroidSyncStateObserver
@Override
public void androidSyncSettingsChanged() {
......
......@@ -275,8 +275,7 @@ public class BookmarkTest {
@Test
@MediumTest
public void testSearchBookmarks() throws Exception {
BookmarkPromoHeader.forcePromoStateForTests(
BookmarkPromoHeader.PromoState.PROMO_SIGNIN_GENERIC);
BookmarkPromoHeader.forcePromoStateForTests(BookmarkPromoHeader.PromoState.PROMO_SYNC);
addBookmark(TEST_PAGE_TITLE_GOOGLE, mTestPage);
addBookmark(TEST_PAGE_TITLE_FOO, mTestPageFoo);
openBookmarkManager();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment