33 if (typeof(ExternalDropHandler) ==
"undefined")
34 Components.utils.import(
"resource://app/jsmodules/DropHelper.jsm");
40 var commandline_module = {};
41 commandline_module.init_once = 0;
42 commandline_module.deinit_once = 0;
44 commandline_module.onLoad =
function()
46 if (commandline_module.init_once++) { dump(
"WARNING: commandline_module double init!!\n");
return; }
47 commandLineItemHandler.init();
50 commandline_module.onUnload =
function()
52 if (commandline_module.deinit_once++) { dump(
"WARNING: commandline_module double deinit!!\n");
return; }
53 commandLineItemHandler.shutdown();
54 window.removeEventListener(
"load", commandline_module.onLoad,
false);
55 window.removeEventListener(
"unload", commandline_module.onUnload,
false);
58 var commandLineItemHandler = {
62 var cmdline = Components.classes[
"@songbirdnest.com/commandlinehandler/general-startup;1?type=songbird"];
64 var cmdline_service = cmdline.getService(Components.interfaces.nsICommandLineHandler);
65 if (cmdline_service) {
66 this.cmdline_mgr = cmdline_service.QueryInterface(Components.interfaces.sbICommandLineManager);
67 this.cmdline_mgr.addItemHandler(
this);
73 if (this.cmdline_mgr) this.cmdline_mgr.removeItemHandler(
this);
76 handleItem:
function(aUriSpec,
aCount, aTotal) {
77 if (aUriSpec.toLowerCase().indexOf(
"http:") == 0 ||
78 aUriSpec.toLowerCase().indexOf(
"https:") == 0 ||
79 aUriSpec.toLowerCase().indexOf(
"ngale:") == 0)
81 if (gBrowser._sessionStore && !gBrowser._sessionStore.tabStateRestored) {
84 gBrowser.addEventListener(
"sessionstore-tabs-restored",
function() {
85 var newTab = gBrowser.loadOneTab(aUriSpec,
null,
null,
null,
false,
false);
86 gBrowser.selectedTab = newTab;
87 gBrowser.removeEventListener(
"sessionstore-tabs-restored",
arguments.callee,
false);
91 var newTab = gBrowser.loadOneTab(aUriSpec,
null,
null,
null,
false,
false);
92 gBrowser.selectedTab = newTab;
95 var typeSniffer = Components.classes[
"@songbirdnest.com/Songbird/Mediacore/TypeSniffer;1"]
96 .createInstance(Components.interfaces.sbIMediacoreTypeSniffer);
97 var
ioService = Components.classes[
"@mozilla.org/network/io-service;1"]
98 .getService(Components.interfaces.nsIIOService);
99 var aUri = ioService.newURI(aUriSpec,
null,
null);
100 if (typeSniffer.isValidPlaylistURL(aUri)) {
101 var list = SBOpenPlaylistURI(aUriSpec);
103 var view =
LibraryUtils.createStandardMediaListView(list);
104 var mm = Components.classes[
"@songbirdnest.com/Songbird/Mediacore/Manager;1"]
105 .getService(Components.interfaces.sbIMediacoreManager);
106 mm.sequencer.playView(view, 0);
109 var dropHandlerListener = {
110 onDropComplete:
function(aTargetList,
113 aInsertedInMediaList,
114 aOtherDropsHandled) {
118 onFirstMediaItem:
function(aTargetList, aFirstMediaItem) {
121 var index = view.getIndexForItem(aFirstMediaItem);
125 gBrowser.showIndexInView(view, index);
129 var mm = Components.classes[
"@songbirdnest.com/Songbird/Mediacore/Manager;1"]
130 .getService(Components.interfaces.sbIMediacoreManager);
131 mm.sequencer.playView(view, index);
134 ExternalDropHandler.dropUrls(
window, [aUriSpec], dropHandlerListener);
141 if (!aIID.equals(Components.interfaces.sbICommandLineItemHandler) &&
142 !aIID.equals(Components.interfaces.nsISupports))
144 throw Components.results.NS_ERROR_NO_INTERFACE;
151 window.addEventListener(
"load", commandline_module.onLoad,
false);
152 window.addEventListener(
"unload", commandline_module.onUnload,
false);
156 dump(
"commandLine.js - " + e +
"\n");
sbOSDControlService prototype QueryInterface
sbDownloadDeviceServicePaneModule prototype shutdown
return!aWindow arguments!aWindow arguments[0]
Javascript wrappers for common library tasks.
restoreHistoryPrecursor aCount