Bug 828349 - Return the tab count of the current private state. r=mfinkle

This commit is contained in:
Brian Nicholson 2013-02-15 22:42:12 -08:00
Родитель 43e64f47dc
Коммит b88847ffd7
3 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -516,7 +516,7 @@ abstract public class BrowserApp extends GeckoApp
}
private void showTabs(TabsPanel.Panel panel) {
if (Tabs.getInstance().getCount() == 0)
if (Tabs.getInstance().getDisplayCount() == 0)
return;
mTabsPanel.show(panel);

Просмотреть файл

@ -401,7 +401,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
break;
case RESTORED:
updateTabCount(Tabs.getInstance().getCount());
updateTabCount(Tabs.getInstance().getDisplayCount());
break;
case SELECTED:
mAnimateSiteSecurity = false;
@ -415,7 +415,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
break;
case CLOSED:
case ADDED:
updateTabCountAndAnimate(Tabs.getInstance().getCount());
updateTabCountAndAnimate(Tabs.getInstance().getDisplayCount());
if (Tabs.getInstance().isSelectedTab(tab)) {
updateBackButton(tab.canDoBack());
updateForwardButton(tab.canDoForward());
@ -1156,7 +1156,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
setSecurityMode(tab.getSecurityMode());
setReaderMode(tab.getReaderEnabled());
setShadowVisibility(true);
updateTabCount(Tabs.getInstance().getCount());
updateTabCount(Tabs.getInstance().getDisplayCount());
updateBackButton(tab.canDoBack());
updateForwardButton(tab.canDoForward());

Просмотреть файл

@ -99,8 +99,15 @@ public class Tabs implements GeckoEventListener {
}
}
public int getCount() {
return mTabs.size();
public int getDisplayCount() {
boolean getPrivate = mSelectedTab != null && mSelectedTab.isPrivate();
int count = 0;
for (Tab tab : mTabs.values()) {
if (tab.isPrivate() == getPrivate) {
count++;
}
}
return count;
}
private void lazyRegisterBookmarkObserver() {
@ -199,7 +206,7 @@ public class Tabs implements GeckoEventListener {
}
public Tab getTab(int id) {
if (getCount() == 0)
if (mTabs.size() == 0)
return null;
if (!mTabs.containsKey(id))