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