/**
   * Should be called when this object is no longer needed. Performs necessary listener tear down.
   */
  public void destroy() {
    mIsDestroyed = true;
    AndroidSyncSettings.unregisterObserver(mContext, this);

    mSignInManager.removeSignInStateObserver(this);
    mSignInManager = null;

    mFaviconHelper.destroy();
    mFaviconHelper = null;

    mRecentlyClosedBridge.destroy();
    mRecentlyClosedBridge = null;

    mForeignSessionHelper.destroy();
    mForeignSessionHelper = null;

    mUpdatedCallback = null;

    mNewTabPagePrefs.destroy();
    mNewTabPagePrefs = null;

    InvalidationController.get(mContext).onRecentTabsPageClosed();
  }
 /**
  * Determine whether the sync promo is collapsed.
  *
  * @return Whether the sync promo is collapsed.
  */
 public boolean isSyncPromoCollapsed() {
   return mNewTabPagePrefs.getSyncPromoCollapsed();
 }
 /**
  * Determine the expanded/collapsed state of the recently closed tabs list.
  *
  * @return Whether the recently closed tabs list is collapsed.
  */
 public boolean isRecentlyClosedTabsCollapsed() {
   return mNewTabPagePrefs.getRecentlyClosedTabsCollapsed();
 }
 /**
  * Collapse the sync promo.
  *
  * @param isCollapsed Whether the sync promo is collapsed.
  */
 public void setSyncPromoCollapsed(boolean isCollapsed) {
   if (mIsDestroyed) return;
   mNewTabPagePrefs.setSyncPromoCollapsed(isCollapsed);
 }
 /**
  * Sets the persistent expanded/collapsed state of the recently closed tabs list.
  *
  * @param isCollapsed Whether the recently closed tabs list is collapsed.
  */
 public void setRecentlyClosedTabsCollapsed(boolean isCollapsed) {
   if (mIsDestroyed) return;
   mNewTabPagePrefs.setRecentlyClosedTabsCollapsed(isCollapsed);
 }
 /**
  * Determine the expanded/collapsed state of a foreign session list.
  *
  * @param session foreign session whose state to obtain.
  * @return Whether the session is collapsed.
  */
 public boolean getForeignSessionCollapsed(ForeignSession session) {
   return mNewTabPagePrefs.getForeignSessionCollapsed(session);
 }
 /**
  * Sets the persistent expanded/collapsed state of a foreign session list.
  *
  * @param session foreign session to collapsed.
  * @param isCollapsed Whether the session is collapsed or expanded.
  */
 public void setForeignSessionCollapsed(ForeignSession session, boolean isCollapsed) {
   if (mIsDestroyed) return;
   mNewTabPagePrefs.setForeignSessionCollapsed(session, isCollapsed);
 }
 /**
  * Determine the expanded/collapsed state of the currently open tabs list.
  *
  * @return Whether the currently open tabs list is collapsed.
  */
 public boolean isCurrentlyOpenTabsCollapsed() {
   return mNewTabPagePrefs.getCurrentlyOpenTabsCollapsed();
 }
 /**
  * Sets the persistent expanded/collapsed state of the currently open tabs list.
  *
  * @param isCollapsed Whether the currently open tabs list is collapsed.
  */
 public void setCurrentlyOpenTabsCollapsed(boolean isCollapsed) {
   if (mIsDestroyed) return;
   mNewTabPagePrefs.setCurrentlyOpenTabsCollapsed(isCollapsed);
 }