Chromium Code Reviews| 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..91509ebae0239eeda58c8bb4f50b6dd9373f5955 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentlyClosedTabManager.java |
| @@ -0,0 +1,62 @@ |
| +// 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 org.chromium.chrome.browser.tab.Tab; |
| + |
| +import java.util.List; |
| + |
| +/** |
| + * Manages a list of recently closed tabs. |
| + */ |
| +public interface RecentlyClosedTabManager { |
| + /** |
| + * Callback interface for getting notified when the list of recently closed tabs is updated. |
| + */ |
| + interface RecentlyClosedCallback { |
|
Bernhard Bauer
2017/01/04 11:54:16
This name sounds a bit like it's called when a tab
Michael van Ouwerkerk
2017/01/05 11:02:14
Yes, it's an awkward name. This is not new code :-
|
| + /** |
| + * This method will be called every time the list of recently closed tabs is updated. |
| + * |
| + * It's a good place to call {@link #getRecentlyClosedTabs} to get the |
| + * updated list of tabs. |
| + */ |
| + void onUpdated(); |
| + } |
| + |
| + /** |
| + * Sets the callback to be called whenever the list of recently closed tabs changes. |
| + * @param callback The RecentlyClosedCallback to be notified, or null. |
| + */ |
| + void setRecentlyClosedCallback(RecentlyClosedCallback callback); |
| + |
| + /** |
| + * @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 by reading data from the native tab restore |
| + * service. |
| + */ |
| + void openRecentlyClosedTab(); |
| + |
| + /** |
| + * Clears all recently closed tabs. |
| + */ |
| + void clearRecentlyClosedTabs(); |
| +} |