mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 702778 - Only update the doorhanger popup for the currently selected tab. r=mfinkle
This commit is contained in:
parent
c74dd0c655
commit
21b45c57ac
@ -102,7 +102,7 @@ public class DoorHanger extends LinearLayout implements Button.OnClickListener {
|
||||
|
||||
// This will hide the doorhanger (and hide the popup if there are no
|
||||
// more doorhangers to show)
|
||||
GeckoApp.mDoorHangerPopup.updatePopupForTab(mTab);
|
||||
GeckoApp.mDoorHangerPopup.updatePopup();
|
||||
}
|
||||
|
||||
public void show() {
|
||||
|
@ -103,23 +103,14 @@ public class DoorHangerPopup extends PopupWindow {
|
||||
tab.addDoorHanger(value, dh);
|
||||
mContent.addView(dh);
|
||||
|
||||
updatePopupForTab(tab);
|
||||
updatePopup();
|
||||
}
|
||||
|
||||
// Updates popup contents to show doorhangers associated with tab
|
||||
public void updatePopupForTab(Tab tab) {
|
||||
if (tab == null) {
|
||||
hidePopup();
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide old doorhangers
|
||||
for (int i = 0; i < mContent.getChildCount(); i++) {
|
||||
DoorHanger dh = (DoorHanger) mContent.getChildAt(i);
|
||||
dh.hide();
|
||||
}
|
||||
|
||||
// Updates popup contents to show doorhangers for the selected tab
|
||||
public void updatePopup() {
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
Log.i("DoorHangerPopup", "Showing all doorhangers for tab: " + tab.getId());
|
||||
|
||||
HashMap<String, DoorHanger> doorHangers = tab.getDoorHangers();
|
||||
// Hide the popup if there aren't any doorhangers to show
|
||||
if (doorHangers == null || doorHangers.size() == 0) {
|
||||
@ -127,6 +118,12 @@ public class DoorHangerPopup extends PopupWindow {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide old doorhangers
|
||||
for (int i = 0; i < mContent.getChildCount(); i++) {
|
||||
DoorHanger dh = (DoorHanger) mContent.getChildAt(i);
|
||||
dh.hide();
|
||||
}
|
||||
|
||||
// Show the doorhangers for the tab
|
||||
for (DoorHanger dh : doorHangers.values()) {
|
||||
dh.show();
|
||||
|
@ -583,7 +583,7 @@ abstract public class GeckoApp
|
||||
mBrowserToolbar.setTitle(uri);
|
||||
mBrowserToolbar.setFavicon(null);
|
||||
mBrowserToolbar.setSecurityMode("unknown");
|
||||
mDoorHangerPopup.updatePopupForTab(tab);
|
||||
mDoorHangerPopup.updatePopup();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -812,7 +812,7 @@ abstract public class GeckoApp
|
||||
if (tab == null)
|
||||
return;
|
||||
tab.removeDoorHanger(value);
|
||||
mDoorHangerPopup.updatePopupForTab(tab);
|
||||
mDoorHangerPopup.updatePopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -827,7 +827,7 @@ abstract public class GeckoApp
|
||||
public void run() {
|
||||
if (selected && Tabs.getInstance().isSelectedTab(tab)) {
|
||||
onTabsChanged();
|
||||
mDoorHangerPopup.updatePopupForTab(tab);
|
||||
mDoorHangerPopup.updatePopup();
|
||||
}
|
||||
mBrowserToolbar.updateTabs(Tabs.getInstance().getCount());
|
||||
}
|
||||
@ -843,7 +843,7 @@ abstract public class GeckoApp
|
||||
public void run() {
|
||||
onTabsChanged();
|
||||
mBrowserToolbar.updateTabs(Tabs.getInstance().getCount());
|
||||
mDoorHangerPopup.updatePopupForTab(tab);
|
||||
mDoorHangerPopup.updatePopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -860,7 +860,7 @@ abstract public class GeckoApp
|
||||
mBrowserToolbar.setFavicon(tab.getFavicon());
|
||||
mBrowserToolbar.setSecurityMode(tab.getSecurityMode());
|
||||
mBrowserToolbar.setProgressVisibility(tab.isLoading());
|
||||
mDoorHangerPopup.updatePopupForTab(tab);
|
||||
mDoorHangerPopup.updatePopup();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user