Home | History | Annotate | Download | only in browser

Lines Matching refs:Tab

32     // next Tab ID, starting at 1
39 void onThumbnailUpdated(Tab t);
45 private ArrayList<Tab> mTabs;
47 private ArrayList<Tab> mTabQueue;
61 mTabs = new ArrayList<Tab>(mMaxTabs);
62 mTabQueue = new ArrayList<Tab>(mMaxTabs);
70 * Return the current tab's main WebView. This will always return the main
71 * WebView for a given tab and not a subwindow.
72 * @return The current tab's WebView.
75 Tab t = getTab(mCurrentTab);
83 * Return the current tab's top-level WebView. This can return a subwindow
85 * @return The top-level WebView of the current tab.
88 Tab t = getTab(mCurrentTab);
96 * Return the current tab's subwindow if it exists.
97 * @return The subwindow of the current tab or null if it doesn't exist.
100 Tab t = getTab(mCurrentTab);
110 List<Tab> getTabs() {
115 * Return the tab at the specified position.
116 * @return The Tab for the specified position or null if the tab does not
119 Tab getTab(int position) {
127 * Return the current tab.
128 * @return The current tab.
130 Tab getCurrentTab() {
135 * Return the current tab position.
136 * @return The current tab position
143 * Given a Tab, find it's position
144 * @param Tab to find
145 * @return position of Tab or -1 if not found
147 int getTabPosition(Tab tab) {
148 if (tab == null) {
151 return mTabs.indexOf(tab);
163 for (Tab tab : mTabs) {
164 if (tab.getWebView() != null
165 && tab.getWebView().isPrivateBrowsingEnabled()) {
172 void addPreloadedTab(Tab tab) {
173 for (Tab current : mTabs) {
174 if (current != null && current.getId() == tab.getId()) {
175 throw new IllegalStateException("Tab with id " + tab.getId() + " already exists: "
179 mTabs.add(tab);
180 tab.setController(mController);
181 mController.onSetWebView(tab, tab.getWebView());
182 tab.putInBackground();
186 * Create a new tab.
190 Tab createNewTab(boolean privateBrowsing) {
194 Tab createNewTab(Bundle state, boolean privateBrowsing) {
203 // Create a new tab and add it to the tab list
204 Tab t = new Tab(mController, w, state);
206 // Initially put the tab in the background.
212 * Create a new tab with default values for closeOnExit(false),
215 Tab createNewTab() {
229 for (Tab tab : mTabs) {
230 tab.removeFromTree();
235 * Remove the tab from the list. If the tab is the current tab shown, the
236 * last created tab will be shown.
237 * @param t The tab to be removed.
239 boolean removeTab(Tab t) {
244 // Grab the current tab before modifying the list.
245 Tab current = getCurrentTab();
250 // Put the tab in the background only if it is the current one.
255 // If a tab that is earlier in the list gets removed, the current
256 // index no longer points to the correct tab.
260 // destroy the tab
274 for (Tab t : mTabs) {
290 * save the tab state:
292 * position sorted array of tab ids
293 * for each tab id, save the tab state
304 for (Tab tab : mTabs) {
305 Bundle tabState = tab.saveState();
307 ids[i++] = tab.getId();
308 String key = Long.toString(tab.getId());
310 // Dump the tab state for debugging purposes
311 for (Tab dt : mTabs) {
315 "Error saving state, duplicate tab ids!");
321 tab.deleteThumbnail();
326 Tab current = getCurrentTab();
337 * current tab id is returned. This can be passed to restoreState below
338 * in order to restore the correct tab. Otherwise, -1 is returned and the
351 // pick first non incognito tab
364 Bundle tab = state.getBundle(Long.toString(id));
365 return ((tab != null) && !tab.isEmpty());
371 return tabstate.getBoolean(Tab.INCOGNITO);
378 * @param currentId The tab id to restore.
381 * @param restoreAll All webviews get restored, not just the current tab
391 HashMap<Long, Tab> tabMap = new HashMap<Long, Tab>();
399 // Skip tab
402 && state.getBoolean(Tab.INCOGNITO)) {
403 // ignore tab
405 Tab t = createNewTab(state, false);
412 // Me must set the current tab before restoring the state
418 // Create a new tab and don't restore the state yet, add it
419 // to the tab list
420 Tab t = new Tab(mController, state);
423 // added the tab to the front as they are not current
439 final Tab tab = tabMap.get(id);
441 if ((b != null) && (tab != null)) {
442 final long parentId = b.getLong(Tab.PARENTTAB, -1);
444 final Tab parent = tabMap.get(parentId);
446 parent.addChildTab(tab);
461 Vector<Tab> tabs = getHalfLeastUsedTabs(getCurrentTab());
464 for (Tab t : tabs) {
467 // destroy the tab
481 private Vector<Tab> getHalfLeastUsedTabs(Tab current) {
482 Vector<Tab> tabsToGo = new Vector<Tab>();
484 // Don't do anything if we only have 1 tab or if the current tab is
495 // available tabs which are not the current tab or the parent of the
496 // current tab.
498 for (Tab t : mTabQueue) {
515 Tab getLeastUsedTab(Tab current) {
522 // find a tab which is not the current tab or the parent of the
523 // current tab
524 for (Tab t : mTabQueue) {
535 * Show the tab that contains the given WebView.
536 * @param view The WebView used to find the tab.
538 Tab getTabFromView(WebView view) {
539 for (Tab t : mTabs) {
548 * Return the tab with the matching application id.
551 Tab getTabFromAppId(String id) {
555 for (Tab t : mTabs) {
567 for (Tab t : mTabs) {
579 // This method checks if a tab matches the given url.
580 private boolean tabMatchesUrl(Tab t, String url) {
585 * Return the tab that matches the given url.
588 Tab findTabWithUrl(String url) {
592 // Check the current tab first.
593 Tab currentTab = getCurrentTab();
598 for (Tab tab : mTabs) {
599 if (tabMatchesUrl(tab, url)) {
600 return tab;
607 * Recreate the main WebView of the given tab.
609 void recreateWebView(Tab t) {
614 // Create a new WebView. If this tab is the current tab, we need to put
615 // back all the clients so force it to be the current tab.
639 * Put the current tab in the background and set newTab as the current tab.
640 * @param newTab The new tab. If newTab is null, the current tab is not
643 boolean setCurrentTab(Tab newTab) {
650 private boolean setCurrentTab(Tab newTab, boolean force) {
651 Tab current = getTab(mCurrentTab);
670 // Display the new current tab
675 // Same work as in createNewTab() except don't do new Tab()
685 for (Tab t : mTabs) {