mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 700153 - Allow opening tabs in the background. r=mfinkle
This commit is contained in:
parent
4ccd2b5e01
commit
590de5a3a0
@ -756,7 +756,8 @@ abstract public class GeckoApp
|
||||
Log.i(LOG_NAME, "Created a new tab");
|
||||
int tabId = message.getInt("tabID");
|
||||
String uri = message.getString("uri");
|
||||
handleAddTab(tabId, uri);
|
||||
Boolean selected = message.getBoolean("selected");
|
||||
handleAddTab(tabId, uri, selected);
|
||||
} else if (event.equals("Tab:Closed")) {
|
||||
Log.i(LOG_NAME, "Destroyed a tab");
|
||||
int tabId = message.getInt("tabID");
|
||||
@ -833,13 +834,19 @@ abstract public class GeckoApp
|
||||
});
|
||||
}
|
||||
|
||||
void handleAddTab(final int tabId, final String uri) {
|
||||
void handleAddTab(final int tabId, final String uri, final boolean selected) {
|
||||
final Tab tab = Tabs.getInstance().addTab(tabId, uri);
|
||||
if (selected) {
|
||||
Tabs.getInstance().selectTab(tabId);
|
||||
}
|
||||
|
||||
mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
onTabsChanged();
|
||||
if (selected && Tabs.getInstance().isSelectedTab(tab)) {
|
||||
onTabsChanged();
|
||||
mDoorHangerPopup.showForTab(tab);
|
||||
}
|
||||
mBrowserToolbar.updateTabs(Tabs.getInstance().getCount());
|
||||
mDoorHangerPopup.showForTab(tab);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -75,7 +75,6 @@ public class Tabs implements GeckoEventListener {
|
||||
tabs.put(id, tab);
|
||||
order.add(tab);
|
||||
Log.i(LOG_NAME, "Added a tab with id: " + id + ", url: " + url);
|
||||
selectedTab = id;
|
||||
return tab;
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,8 @@ var BrowserApp = {
|
||||
browser.loadURIWithFlags(aURI, flags, referrerURI, charset, postData);
|
||||
},
|
||||
|
||||
addTab: function addTab(aURI) {
|
||||
let newTab = new Tab(aURI);
|
||||
addTab: function addTab(aURI, aParams) {
|
||||
let newTab = new Tab(aURI, aParams);
|
||||
this._tabs.push(newTab);
|
||||
return newTab;
|
||||
},
|
||||
@ -667,7 +667,7 @@ var NativeWindow = {
|
||||
this.linkContext,
|
||||
function(aTarget) {
|
||||
let url = NativeWindow.contextmenus._getLinkURL(aTarget);
|
||||
BrowserApp.addTab(url);
|
||||
BrowserApp.addTab(url, {selected: false});
|
||||
});
|
||||
|
||||
this.add(Strings.browser.GetStringFromName("contextmenu.changeInputMethod"),
|
||||
@ -882,14 +882,14 @@ nsBrowserAccess.prototype = {
|
||||
|
||||
let gTabIDFactory = 0;
|
||||
|
||||
function Tab(aURL) {
|
||||
function Tab(aURL, aParams) {
|
||||
this.browser = null;
|
||||
this.id = 0;
|
||||
this.create(aURL);
|
||||
this.create(aURL, aParams);
|
||||
}
|
||||
|
||||
Tab.prototype = {
|
||||
create: function(aURL) {
|
||||
create: function(aURL, aParams) {
|
||||
if (this.browser)
|
||||
return;
|
||||
|
||||
@ -899,11 +899,13 @@ Tab.prototype = {
|
||||
this.browser.stop();
|
||||
|
||||
this.id = ++gTabIDFactory;
|
||||
let aParams = aParams || { selected: true };
|
||||
let message = {
|
||||
gecko: {
|
||||
type: "Tab:Added",
|
||||
tabID: this.id,
|
||||
uri: aURL
|
||||
uri: aURL,
|
||||
selected: ("selected" in aParams) ? aParams.selected : true
|
||||
}
|
||||
};
|
||||
sendMessageToJava(message);
|
||||
|
Loading…
Reference in New Issue
Block a user