1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5package org.chromium.chrome.browser.tabmodel; 6 7import org.chromium.chrome.browser.Tab; 8 9/** 10 * A read only list of {@link Tab}s. This list understands the concept of an incognito list as 11 * well as a currently selected tab (see {@link #index}). 12 */ 13public interface TabList { 14 public static final int INVALID_TAB_INDEX = -1; 15 16 /** 17 * @return Whether this tab model contains only incognito tabs or only normal tabs. 18 */ 19 boolean isIncognito(); 20 21 /** 22 * @return The index of the current tab, or {@link #INVALID_TAB_INDEX} if there are no tabs. 23 */ 24 int index(); 25 26 /** 27 * @return the number of open tabs in this model 28 */ 29 int getCount(); 30 31 /** 32 * Get the tab at the specified position 33 * 34 * @param index The index of the {@link Tab} to return. 35 * @return The {@code Tab} at position {@code index}, or {@code null} if {@code index} < 0 36 * or {@code index} >= {@link #getCount()}. 37 */ 38 Tab getTabAt(int index); 39 40 /** 41 * @return index of the given tab in the order of the tab stack. 42 */ 43 int indexOf(Tab tab); 44 45 /** 46 * @param tabId The id of the {@link Tab} that might have a pending closure. 47 * @return Whether or not the {@link Tab} specified by {@code tabId} has a pending 48 * closure. 49 */ 50 boolean isClosurePending(int tabId); 51}