Index: lib/appIntegration.js |
=================================================================== |
--- a/lib/appIntegration.js |
+++ b/lib/appIntegration.js |
@@ -60,6 +60,32 @@ |
if (urlbar && urlbar.handleCommand && "urlfixerOldHandler" in urlbar.handleCommand) |
urlbar.handleCommand = urlbar.handleCommand.urlfixerOldHandler; |
}; |
+ |
+ exports.openInfobar = function(window, id, message, buttons, persistence) |
+ { |
+ let browser = exports.getBrowser(window); |
+ let infobar = browser.getNotificationBox(); |
+ let notif = infobar.getNotificationWithValue(id); |
Wladimir Palant
2012/09/28 09:29:34
As mentioned before - you don't need to save chara
|
+ |
+ if (notif) |
+ { |
+ infobar.removeNotification(notif); |
+ } |
+ |
+ notif = infobar.appendNotification( |
+ message, |
+ id, |
+ require("info").addonRoot + "icon64.png", |
+ infobar.PRIORITY_INFO_HIGH, |
+ buttons |
+ ); |
+ notif.persistence = persistence; |
+ }; |
+ |
+ exports.loadURI = function(uri) |
+ { |
+ exports.getBrowser(Services.wm.getMostRecentWindow("navigator:browser")).loadURI(uri); |
Wladimir Palant
2012/09/28 09:29:34
This will load the address in *some* browser windo
|
+ }; |
break; |
} |
@@ -106,6 +132,32 @@ |
if (window.handleURLBarCommand && "urlfixerOldHandler" in window.handleURLBarCommand) |
window.handleURLBarCommand = window.handleURLBarCommand.urlfixerOldHandler; |
}; |
+ |
+ exports.openInfobar = function(window, id, message, buttons, persistence) |
+ { |
+ let browser = exports.getBrowser(window); |
+ let infobar = browser.getNotificationBox(); |
+ let notif = infobar.getNotificationWithValue(id); |
+ |
+ if (notif) |
+ { |
+ infobar.removeNotification(notif); |
+ } |
+ |
+ notif = infobar.appendNotification( |
+ message, |
+ id, |
+ require("info").addonRoot + "icon64.png", |
+ infobar.PRIORITY_INFO_HIGH, |
+ buttons |
+ ); |
+ notif.persistence = persistence; |
+ }; |
+ |
+ exports.loadURI = function(uri) |
+ { |
+ exports.getBrowser(Services.wm.getMostRecentWindow("navigator:browser")).loadURI(uri); |
+ }; |
break; |
} |
@@ -152,6 +204,16 @@ |
if ("BrowserUI" in window && window.BrowserUI.goToURI && "urlfixerOldHandler" in window.BrowserUI.goToURI) |
window.BrowserUI.goToURI = window.BrowserUI.goToURI.urlfixerOldHandler; |
}; |
+ |
+ exports.openInfobar = function() |
+ { |
+ // TODO: Implement infobar |
+ }; |
+ |
+ exports.loadURI = function(window, uri) |
+ { |
+ // TODO: Implement infobar |
+ }; |
break; |
} |
@@ -226,6 +288,25 @@ |
if ("BrowserApp" in window && window.BrowserApp.observe && "urlfixerOldHandler" in window.BrowserApp.observe) |
window.BrowserApp.observe = window.BrowserApp.observe.urlfixerOldHandler; |
}; |
+ |
+ exports.openInfobar = function(window, id, message, buttons, persistence) |
+ { |
+ if ("BrowserApp" in window && "selectedTab" in window.BrowserApp) |
+ { |
+ window.NativeWindow.doorhanger.show(message, id, buttons, window.BrowserApp.selectedTab.id, |
+ { |
+ persistence: persistence |
+ } |
+ ); |
+ } |
+ }; |
+ |
+ exports.loadURI = function(uri) |
+ { |
+ let window = Services.wm.getMostRecentWindow("navigator:browser"); |
+ if ("BrowserApp" in window && "loadURI" in window.BrowserApp) |
+ window.BrowserApp.loadURI(uri); |
+ }; |
break; |
} |