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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java

Issue 207743004: Upstream TabModel and related classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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/tabmodel/TabModelObserver.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java
new file mode 100644
index 0000000000000000000000000000000000000000..e03b2dfa89a19e4830377bab1acc2ca7805a33bd
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelObserver.java
@@ -0,0 +1,88 @@
+// Copyright 2014 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.tabmodel;
+
+import org.chromium.chrome.browser.Tab;
+import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
+import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType;
+
+/**
+ * An interface to be notified about changes to a TabModel.
+ */
+public interface TabModelObserver {
+
+ /**
+ * Called when a tab is selected.
+ *
+ * @param tab The newly selected tab.
+ * @param type The type of selection.
+ * @param lastId The ID of the last selected tab, or {@link Tab#INVALID_TAB_ID} if no tab was
+ * selected.
+ */
+ void didSelectTab(Tab tab, TabSelectionType type, int lastId);
+
+ /**
+ * Called when a tab starts closing.
+ *
+ * @param tab The tab to close.
+ * @param animate Whether or not to animate the closing.
+ */
+ void willCloseTab(Tab tab, boolean animate);
+
+ /**
+ * Called right after {@code tab} has been destroyed.
+ *
+ * @param tab The tab that has been destroyed.
+ */
+ void didCloseTab(Tab tab);
+
+ /**
+ * Called before a tab will be added to the {@link TabModel}.
+ *
+ * @param tab The tab about to be added.
+ * @param type The type of tab launch.
+ */
+ void willAddTab(Tab tab, TabLaunchType type);
+
+ /**
+ * Called after a tab has been added to the {@link TabModel}.
+ *
+ * @param tab The newly added tab.
+ * @param type The type of tab launch.
+ */
+ void didAddTab(Tab tab, TabLaunchType type);
+
+ /**
+ * Called after a tab has been moved from one position in the {@link TabModel} to another.
+ *
+ * @param tab The tab which has been moved.
+ * @param newIndex The new index of the tab in the model.
+ * @param curIndex The old index of the tab in the model.
+ */
+ void didMoveTab(Tab tab, int newIndex, int curIndex);
+
+ /**
+ * Called when a tab is pending closure, i.e. the user has just closed it, but it can still be
+ * undone.
+ *
+ * @param tab The tab that is pending closure.
+ */
+ void tabPendingClosure(Tab tab);
+
+ /**
+ * Called when a tab closure is undone.
+ *
+ * @param tab The tab that has been reopened.
+ */
+ void tabClosureUndone(Tab tab);
+
+ /**
+ * Called when a tab closure is committed and can't be undone anymore.
+ *
+ * @param tab The tab that has been closed.
+ */
+ void tabClosureCommitted(Tab tab);
+
+}

Powered by Google App Engine
This is Rietveld 408576698