blob: cefa32ef19dbcb95113254232842b89680dae604 [file] [log] [blame]
Jeff Thompsond51cb582013-03-17 19:00:39 -07001/*
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 * This is called from the NDN toolbar and the doorhanger popup on Firefox for Android.
5 */
6
Jeff Thompson02b9f4d2012-11-29 14:40:57 -08007Components.utils.import("chrome://modules/content/ndn-js.jsm");
Jeff Thompson6ad5c362012-12-27 17:57:02 -08008Components.utils.import("chrome://modules/content/NdnProtocolInfo.jsm");
Jeff Thompson02b9f4d2012-11-29 14:40:57 -08009
Jeff Thompson30779812013-02-04 23:59:45 -080010function ndnToolbarGetVersion(selector) {
Jeff Thompsond51cb582013-03-17 19:00:39 -070011 NdnProtocolInfo.getVersion(selector, window, alert);
Jeff Thompson02b9f4d2012-11-29 14:40:57 -080012}
Jeff Thompson6ad5c362012-12-27 17:57:02 -080013
14/*
15 * This is called when the connected NDN hub changes.
16 */
17function onNdnHubChanged(host, port) {
Jeff Thompsond51cb582013-03-17 19:00:39 -070018 document.getElementById("ndnHubLabel").setAttribute("value", "Hub: " + host + ":" + port);
Jeff Thompson6ad5c362012-12-27 17:57:02 -080019}
20
Jeff Thompsond51cb582013-03-17 19:00:39 -070021if (window)
22 window.addEventListener("load", function() { NdnProtocolInfo.addNdnHubChangedListener(onNdnHubChanged); },
23 false);
Jeff Thompsoneec72672013-03-10 16:45:47 -070024
25function ndnToolbarSetHub() {
Jeff Thompson9c24c472013-03-17 22:11:07 -070026 var message = NdnProtocolInfo.setHub(window);
27 if (message != null)
28 document.getElementById("ndnHubLabel").setAttribute("value", message);
Jeff Thompsoneec72672013-03-10 16:45:47 -070029}