Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(815)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentlyClosedTabManager.java

Issue 2610143002: Add RecentTabsPageTest (Closed)
Patch Set: Address review comments from bauerb. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentlyClosedTabManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentlyClosedTabManager.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentlyClosedTabManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..f1985d4b9845f30406b501d9bebb1240e607a8f7
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentlyClosedTabManager.java
@@ -0,0 +1,56 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.ntp;
+
+import android.support.annotation.Nullable;
+
+import org.chromium.chrome.browser.tab.Tab;
+
+import java.util.List;
+
+/**
+ * Manages a list of recently closed tabs.
+ */
+public interface RecentlyClosedTabManager {
+ /**
+ * Sets the {@link Runnable} to be called whenever the list of recently closed tabs changes.
+ * @param runnable The {@link Runnable} to be called, or null.
+ */
+ void setTabsUpdatedRunnable(@Nullable Runnable runnable);
+
+ /**
+ * @param maxTabCount The maximum number of recently closed tabs to return.
+ * @return The list of recently closed tabs, with up to maxTabCount elements.
+ */
+ List<RecentlyClosedTab> getRecentlyClosedTabs(int maxTabCount);
+
+ /**
+ * Opens a recently closed tab in the current tab or a new tab. If opened in the current tab,
+ * the current tab's entire history is replaced.
+ *
+ * @param tab The current Tab.
+ * @param recentTab The RecentlyClosedTab to open.
+ * @param windowOpenDisposition The WindowOpenDisposition value specifying whether to open in
+ * the current tab or a new tab.
+ * @return Whether the tab was successfully opened.
+ */
+ boolean openRecentlyClosedTab(Tab tab, RecentlyClosedTab recentTab, int windowOpenDisposition);
+
+ /**
+ * Opens the most recently closed tab in a new tab.
+ */
+ void openRecentlyClosedTab();
+
+ /**
+ * Clears all recently closed tabs.
+ */
+ void clearRecentlyClosedTabs();
+
+ /**
+ * To be called before this instance is abandoned to the garbage collector so it can do any
+ * necessary cleanups. This instance must not be used after this method is called.
+ */
+ void destroy();
+}

Powered by Google App Engine
This is Rietveld 408576698