Bug 695165 - Implement plumbing for Forward [r=mfinkle]

Put in support for the "Forward" feature; it can be invoked
by calling doForward() on a Tab. Not yet hooked up to any
UI elements, pending UX decisions.
This commit is contained in:
Kartikaya Gupta 2011-10-31 11:02:34 -04:00
parent c098c1f428
commit e707191418
2 changed files with 12 additions and 0 deletions

View File

@ -183,6 +183,15 @@ public class Tab {
return true;
}
public boolean doForward() {
if (mHistoryIndex + 1 >= mHistory.size()) {
return false;
}
GeckoEvent e = new GeckoEvent("session-forward", "");
GeckoAppShell.sendEventToGecko(e);
return true;
}
void handleSessionHistoryMessage(String event, JSONObject message) throws JSONException {
if (event.equals("New")) {
String uri = message.getString("uri");

View File

@ -133,6 +133,7 @@ var BrowserApp = {
Services.obs.addObserver(this, "Tab:Select", false);
Services.obs.addObserver(this, "Tab:Close", false);
Services.obs.addObserver(this, "session-back", false);
Services.obs.addObserver(this, "session-forward", false);
Services.obs.addObserver(this, "session-reload", false);
Services.obs.addObserver(this, "SaveAs:PDF", false);
Services.obs.addObserver(this, "Preferences:Get", false);
@ -461,6 +462,8 @@ var BrowserApp = {
if (aTopic == "session-back") {
browser.goBack();
} else if (aTopic == "session-forward") {
browser.goForward();
} else if (aTopic == "session-reload") {
browser.reload();
} else if (aTopic == "Tab:Add") {