private RecentlyClosedBridge buildRecentlyClosedBridge(Profile profile) {
   RecentlyClosedBridge bridge = new RecentlyClosedBridge(profile);
   bridge.setRecentlyClosedCallback(
       new RecentlyClosedCallback() {
         @Override
         public void onUpdated() {
           updateRecentlyClosedTabs();
           postUpdate();
         }
       });
   return bridge;
 }
  /**
   * 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();
  }
 /** Clears the list of recently closed tabs. */
 public void clearRecentlyClosedTabs() {
   if (mIsDestroyed) return;
   mRecentlyClosedBridge.clearRecentlyClosedTabs();
 }
 /**
  * Restores a recently closed tab.
  *
  * @param tab The tab to open.
  * @param windowDisposition The WindowOpenDisposition value specifying whether the tab should be
  *     restored into the current tab or a new tab.
  */
 public void openRecentlyClosedTab(RecentlyClosedTab tab, int windowDisposition) {
   if (mIsDestroyed) return;
   NewTabPageUma.recordAction(NewTabPageUma.ACTION_OPENED_RECENTLY_CLOSED_ENTRY);
   mRecentlyClosedBridge.openRecentlyClosedTab(mTab, tab, windowDisposition);
 }
 private void updateRecentlyClosedTabs() {
   mRecentlyClosedTabs =
       mRecentlyClosedBridge.getRecentlyClosedTabs(RECENTLY_CLOSED_MAX_TAB_COUNT);
 }