25 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
26 Components.utils.import(
"resource://app/jsmodules/ArrayConverter.jsm");
27 Components.utils.import(
"resource://app/jsmodules/DebugUtils.jsm");
29 const Ci = Components.interfaces;
53 this.m_Context.commands =
this;
55 this.m_menus =
new Array();
56 var menuitem = {
id :
null,
59 this.m_menus.push(menuitem);
60 this.m_listeners =
new Array();
62 this.parentCommandObject =
null;
82 implementorContext:
null,
84 Ci.sbIPlaylistCommandsBuilderContext]),
89 m_InitCallback :
null,
90 m_ShutdownCallback :
null,
91 m_VisibleCallback :
null,
104 init:
function PlaylistCommandsBuilder_init(aId)
106 this.m_menus[0].id = aId;
110 appendSubmenu:
function
111 PlaylistCommandsBuilder_appendSubmenu(aParentSubMenuId,
116 var props = { m_Name : aLabel,
117 m_Tooltip : aTooltipText };
127 insertSubmenuBefore:
function
128 PlaylistCommandsBuilder_insertSubmenuBefore(aParentSubMenuId,
134 var props = { m_Name : aLabel,
135 m_Tooltip : aTooltipText };
145 insertSubmenuAfter:
function
146 PlaylistCommandsBuilder_insertSubmenuAfter(aParentSubMenuId,
152 var props = { m_Name : aLabel,
153 m_Tooltip : aTooltipText };
167 appendAction:
function
168 PlaylistCommandsBuilder_appendAction(aParentSubMenuId,
174 var props = { m_Name : aLabel,
175 m_Tooltip : aTooltipText,
176 m_TriggerCallback : aTriggerCallback }
187 function PlaylistCommandsBuilder_insertActionBefore(aParentSubMenuId,
194 var props = { m_Name : aLabel,
195 m_Tooltip : aTooltipText,
196 m_TriggerCallback : aTriggerCallback }
206 insertActionAfter:
function
207 PlaylistCommandsBuilder_insertActionAfter(aParentSubMenuId,
214 var props = { m_Name : aLabel,
215 m_Tooltip : aTooltipText,
216 m_TriggerCallback : aTriggerCallback }
230 appendSeparator:
function
231 PlaylistCommandsBuilder_appendSeparator(aParentSubMenuId, aId)
240 insertSeparatorBefore:
function
241 PlaylistCommandsBuilder_insertSeparatorBefore(aParentSubMenuId,
252 insertSeparatorAfter:
function
253 PlaylistCommandsBuilder_insertSeparatorAfter(aParentSubMenuId,
269 PlaylistCommandsBuilder_appendFlag(aParentSubMenuId,
276 var props = { m_Name : aLabel,
277 m_Tooltip : aTooltipText,
278 m_TriggerCallback : aTriggerCallback,
279 m_ValueCallback : aValueCallback };
290 insertFlagBefore:
function
291 PlaylistCommandsBuilder_insertFlagBefore(aParentSubMenuId,
299 var props = { m_Name : aLabel,
300 m_Tooltip : aTooltipText,
301 m_TriggerCallback : aTriggerCallback,
302 m_ValueCallback : aValueCallback };
312 insertFlagAfter:
function
313 PlaylistCommandsBuilder_insertFlagAfter(aParentSubMenuId,
321 var props = { m_Name : aLabel,
322 m_Tooltip : aTooltipText,
323 m_TriggerCallback : aTriggerCallback,
324 m_ValueCallback : aValueCallback };
338 appendValue:
function
339 PlaylistCommandsBuilder_appendValue(aParentSubMenuId,
346 var props = { m_Name : aLabel,
347 m_Tooltip : aTooltipText,
348 m_TriggerCallback : aTriggerCallback,
349 m_ValueCallback : aValueCallback };
359 insertValueBefore:
function
360 PlaylistCommandsBuilder_insertValueBefore(aParentSubMenuId,
368 var props = { m_Name : aLabel,
369 m_Tooltip : aTooltipText,
370 m_TriggerCallback : aTriggerCallback,
371 m_ValueCallback : aValueCallback };
381 insertValueAfter:
function
382 PlaylistCommandsBuilder_insertValueAfter(aParentSubMenuId,
390 var props = { m_Name : aLabel,
391 m_Tooltip : aTooltipText,
392 m_TriggerCallback : aTriggerCallback,
393 m_ValueCallback : aValueCallback };
407 appendChoiceMenu:
function
408 PlaylistCommandsBuilder_appendChoiceMenu(aParentSubMenuId,
414 var props = { m_Name : aLabel,
415 m_Tooltip : aTooltipText,
416 m_ItemCallback : aItemCallback };
426 insertChoiceMenuBefore:
function
427 PlaylistCommandsBuilder_insertChoiceMenuBefore(aParentSubMenuId,
434 var props = { m_Name : aLabel,
435 m_Tooltip : aTooltipText,
436 m_ItemCallback : aItemCallback };
446 insertChoiceMenuAfter:
function
447 PlaylistCommandsBuilder_insertChoiceMenuAfter(aParentSubMenuId,
454 var props = { m_Name : aLabel,
455 m_Tooltip : aTooltipText,
456 m_ItemCallback : aItemCallback };
470 appendChoiceMenuItem:
function
471 PlaylistCommandsBuilder_appendChoiceMenuItem(aParentSubMenuId,
477 var props = { m_Name : aLabel,
478 m_Tooltip : aTooltipText,
479 m_TriggerCallback : aTriggerCallback };
489 insertChoiceMenuItemBefore:
function
490 PlaylistCommandsBuilder_insertChoiceMenuItemBefore(aParentSubMenuId,
497 var props = { m_Name : aLabel,
498 m_Tooltip : aTooltipText,
499 m_TriggerCallback : aTriggerCallback };
509 insertChoiceMenuItemAfter:
function
510 PlaylistCommandsBuilder_insertChoiceMenuItemAfter(aParentSubMenuId,
517 var props = { m_Name : aLabel,
518 m_Tooltip : aTooltipText,
519 m_TriggerCallback : aTriggerCallback };
533 appendCustomItem:
function
534 PlaylistCommandsBuilder_appendCustomItem(aParentSubMenuId,
536 aInstantiationCallback,
539 var props = { m_InstantiationCallback : aInstantiationCallback,
540 m_RefreshCallback : aRefreshCallback};
550 insertCustomItemBefore:
function
551 PlaylistCommandsBuilder_insertCustomItemBefore(aParentSubMenuId,
554 aInstantiationCallback,
557 var props = { m_InstantiationCallback : aInstantiationCallback,
558 m_RefreshCallback : aRefreshCallback};
568 insertCustomItemAfter:
function
569 PlaylistCommandsBuilder_insertCustomItemAfter(aParentSubMenuId,
572 aInstantiationCallback,
575 var props = { m_InstantiationCallback : aInstantiationCallback,
576 m_RefreshCallback : aRefreshCallback};
590 appendPlaylistCommands:
function
591 PlaylistCommandsBuilder_appendPlaylistCommands(aParentSubMenuId,
604 insertPlaylistCommandsBefore:
function
605 PlaylistCommandsBuilder_insertPlaylistCommandsBefore(aParentSubMenuId,
619 insertPlaylistCommandsAfter:
function
620 PlaylistCommandsBuilder_insertPlaylistCommandsAfter(aParentSubMenuId,
636 setCommandShortcut:
function
637 PlaylistCommandsBuilder_setCommandShortcut(aParentSubMenuId,
644 var props = { m_ShortcutKey : aShortcutKey,
645 m_ShortcutKeycode : aShortcutKeyCode,
646 m_ShortcutModifiers : aShortcutModifiers,
647 m_ShortcutIsLocal : aShortcutIsLocal };
649 this._setCommandProperties(aParentSubMenuId, aCommandId, props);
652 setCommandEnabledCallback:
function
653 PlaylistCommandsBuilder_setCommandEnabledCallback(aParentSubMenuId,
657 var props = { m_EnabledCallback : aEnabledCallback };
659 this._setCommandProperties(aParentSubMenuId, aCommandId, props);
662 setCommandVisibleCallback:
function
663 PlaylistCommandsBuilder_setCommandVisibleCallback(aParentSubMenuId,
667 var props = { m_VisibleCallback : aVisibleCallback };
669 this._setCommandProperties(aParentSubMenuId, aCommandId, props);
672 setInitCallback:
function
673 PlaylistCommandsBuilder_setInitCallback(aInitCallback)
675 this.m_InitCallback = aInitCallback;
678 setShutdownCallback:
function
679 PlaylistCommandsBuilder_setShutdownCallback(aShutdownCallback)
681 this.m_ShutdownCallback = aShutdownCallback;
684 setVisibleCallback:
function
685 PlaylistCommandsBuilder_setVisibleCallback(aVisibleCallback)
687 this.m_VisibleCallback = aVisibleCallback;
692 removeCommand:
function
693 PlaylistCommandsBuilder_removeCommand(aParentSubMenuId,
696 var
menu = this._getMenu(aParentSubMenuId);
697 var index = this._getCommandIndex(menu, aCommandId);
700 this._removeCommandTree(menu, index);
703 this.
LOG(
"A command object with an id of " + aCommandId +
704 " could not be found for removal");
708 removeAllCommands:
function
709 PlaylistCommandsBuilder_removeAllCommands(aParentSubMenuId)
711 var
menu = this._getMenu(aParentSubMenuId);
712 while (menu.length) {
713 this._removeCommandTree(menu, 0);
715 if (!aParentSubMenuId) {
717 if (this.m_menus.length != 1) {
718 throw new Error(
"Menu list is not empty after removeAllCommands (item 1 = " +
719 this.m_menus[1].
id +
")");
724 shutdown:
function PlaylistCommandsBuilder_shutdown()
728 this.removeAllCommands();
730 this.m_InitCallback =
null;
731 this.m_ShutdownCallback =
null;
732 this.m_VisibleCallback =
null;
736 this.m_Context.playlist =
null;
737 this.m_Context.medialist =
null;
738 this.m_Context.window =
null;
739 this.m_Context.commands =
this;
740 this.m_Context =
null;
741 this.m_CommandSubObject =
null;
742 this.parentCommandObject =
null;
748 _insertCommand:
function
749 PlaylistCommandsBuilder__insertCommand(aInsertHow,
771 throw new Error(
"Unknown type in insertCommand");
773 var
menu = this._getMenu(aParentSubMenuId);
774 var index = this._getCommandIndex(menu, aId);
776 throw new Error(
"Duplicate command '" +
779 (aParentSubMenuId ? aParentSubMenuId :
"<rootmenu>"));
783 this._getCommandIndex(menu, aRefPointId) : -1;
784 var vrefindex = refindex;
785 switch (aInsertHow) {
793 throw new Error(
"Reference command '" +
795 "' not found in menu '" +
796 (aParentSubMenuId ? aParentSubMenuId :
"<rootmenu>"));
800 this._insertCommandInArray(menu,
808 _insertCommandInArray:
function
809 PlaylistCommandsBuilder__insertCommandInArray(aMenu,
816 var item = { m_ParentMenu : aMenu,
820 for (var
i in aPropArray) {
821 item[
i] = aPropArray[
i];
828 item.m_Name =
"*separator*";
831 if (!aCommandSubObject)
return 0;
832 aCommandSubObject = aCommandSubObject.QueryInterface(Components.
835 aCommandSubObject.parentCommandObject =
this;
836 item.m_CommandSubObject = aCommandSubObject;
840 var menuitem = {
id : aId,
842 m_Menu :
new Array() };
844 menuitem.m_ItemCallback = aPropArray.m_ItemCallback;
846 this.m_menus.push(menuitem);
851 if (aInsertionIndex < 0 || aInsertionIndex >= aMenu.length)
854 aMenu.splice(aInsertionIndex, 0, item);
857 _removeCommandTree:
function
858 PlaylistCommandsBuilder__removeCommandTree(aMenu, aIndex) {
859 if (aIndex >= aMenu.length || aIndex < 0) {
860 throw new Error(
"Invalid index " + aIndex +
" in _removeCommandTree");
863 var item = aMenu[aIndex];
867 var submenu = this._getMenu(item.id);
869 while(submenu.length > 0) {
870 this._removeCommandTree(submenu, 0);
872 var idx = this._getMenuIndex(item.id);
873 if (idx > 0 && idx < this.m_menus.length) {
875 this.m_menus[idx].m_ItemCallback =
null;
877 this.m_menus[idx].m_Menu =
null;
879 this.m_menus.splice(idx, 1);
885 aMenu[aIndex].m_InstantiationCallback =
null;
886 aMenu[aIndex].m_RefreshCallback =
null;
887 aMenu[aIndex].m_ValueCallback =
null;
888 aMenu[aIndex].m_EnabledCallback =
null;
889 aMenu[aIndex].m_VisibleCallback =
null;
890 aMenu[aIndex].m_TriggerCallback =
null;
891 aMenu.splice(aIndex, 1);
894 _getMenu:
function PlaylistCommandsBuilder__getMenu(aSubMenuId)
898 for (var
i=0;
i<this.m_menus.length;
i++) {
899 if (this.m_menus[
i].
id == aSubMenuId) {
900 return this.m_menus[
i].m_Menu;
903 throw new Error(
"Submenu " + aSubMenuId +
" not found");
906 _getMenuIndex:
function PlaylistCommandsBuilder__getMenuIndex(aSubMenuId)
908 if (!aSubMenuId)
return 0;
909 for (var
i=0;
i<this.m_menus.length;
i++) {
910 if (this.m_menus[
i].
id == aSubMenuId) {
914 throw new Error(
"Submenu " + aSubMenuId +
" not found");
918 _getCommandIndex:
function
919 PlaylistCommandsBuilder__getCommandIndex(aSubMenu, aCommandId)
921 if (!aSubMenu)
return -1;
922 for (var
i=0;
i<aSubMenu.length;
i++) {
923 if (aSubMenu[
i].
id == aCommandId) {
930 _getCommandProperty:
function
931 PlaylistCommandsBuilder__getCommandProperty(aSubMenuId,
938 var
menu = this._getMenu(aSubMenuId);
939 if (!menu)
return aDefault;
940 if (aIndex >= menu.length)
return aDefault;
941 var prop = menu[aIndex][aProperty];
942 if (prop === undefined)
return aDefault;
943 if (typeof(prop) ==
"object" && prop.handleCallback) {
944 return prop.handleCallback(this.m_Context,
948 aProperty.substr(2));
952 this.
LOG(
"_getCommandProperty(" + aSubMenuId +
", " + aIndex +
" (" +
953 menu[aIndex].
id +
"), " +
aHost +
", " + aProperty +
", " +
954 aDefault +
") - " + e);
959 _getMenuProperty:
function
960 PlaylistCommandsBuilder__getMenuProperty(aMenu,
aHost, aProperty, aDefault)
963 var prop = aMenu[aProperty];
964 if (prop === undefined)
return aDefault;
965 if (typeof(prop) ==
"object" && prop.handleCallback) {
966 return prop.handleCallback(this.m_Context,
970 aProperty.substr(2));
974 this.
LOG(
"_getMenuProperty(" + aMenu.id +
", " +
aHost +
975 ", " + aProperty +
", " + aDefault +
") - " + e);
980 _setCommandProperties:
function
981 PlaylistCommandsBuilder__setCommandProperties(aSubMenuId, aCommandId, aPropArray)
983 var
menu = this._getMenu(aSubMenuId);
984 var index = this._getCommandIndex(menu, aCommandId);
985 if (index >= menu.length || index < 0) {
986 throw new Error(
"Invalid command index " + index +
" in _setCommandProperties");
988 for (var
i in aPropArray) {
989 menu[index][
i] = aPropArray[
i];
995 _setMenuProperties:
function
996 PlaylistCommandsBuilder__setMenuProperties(aMenu, aPropArray)
998 for (var
i in aPropArray) {
999 aMenu[
i] = aPropArray[
i];
1008 addCommandObject:
function PlaylistCommandsBuilder_addCommandObject
1011 this.appendPlaylistCommands(
null,
1015 this.notifyListeners(
"onCommandAdded", aCommandObject);
1018 removeCommandObject:
function PlaylistCommandsBuilder_removeCommandObject
1021 this.removeCommand(
null, aCommandObject.id);
1023 this.notifyListeners(
"onCommandRemoved", aCommandObject);
1026 addListener:
function PlaylistCommandsBuilder_addListener ( aListener )
1028 this.m_listeners.push(aListener);
1031 removeListener:
function PlaylistCommandsBuilder_removeListener ( aListener )
1033 let index = this.m_listeners.indexOf(aListener);
1036 this.m_listeners.splice(index, 1);
1040 notifyListeners:
function PlaylistCommandsBuilder_notifyListeners
1041 ( aTriggerFunction, aCommandObject )
1043 for (var
i = 0 ;
i < this.m_listeners.length;
i++) {
1045 if (listener instanceof
Ci.sbIPlaylistCommandsListener)
1049 listener[aTriggerFunction](aCommandObject);
1052 Components.utils.reportError(
"Could not signal " + aTriggerFunction +
1053 " to PlaylistCommandsListener. Failed with error: " + err.description);
1058 if (this.parentCommandObject)
1061 this.parentCommandObject.notifyListeners(aTriggerFunction, aCommandObject);
1065 getVisible:
function PlaylistCommandsBuilder_getVisible(
aHost )
1067 if (this.m_VisibleCallback &&
1068 typeof(this.m_VisibleCallback) ==
"object" &&
1069 this.m_VisibleCallback.handleCallback) {
1070 return this.m_VisibleCallback.handleCallback(this.m_Context,
aHost,
"Visible");
1075 getNumCommands:
function
1076 PlaylistCommandsBuilder_getNumCommands( aSubMenuId,
aHost )
1078 var
menu = this._getMenu(aSubMenuId);
1082 getCommandId:
function
1083 PlaylistCommandsBuilder_getCommandId( aSubMenuId, aIndex,
aHost )
1085 return this._getCommandProperty(aSubMenuId,
1092 getCommandType:
function
1093 PlaylistCommandsBuilder_getCommandType( aSubMenuId, aIndex,
aHost )
1095 return this._getCommandProperty(aSubMenuId,
1102 getCommandText:
function
1103 PlaylistCommandsBuilder_getCommandText( aSubMenuId, aIndex,
aHost )
1105 return this._getCommandProperty(aSubMenuId,
1112 getCommandFlex:
function
1113 PlaylistCommandsBuilder_getCommandFlex( aSubMenuId, aIndex,
aHost )
1115 return this._getCommandProperty(aSubMenuId,
1122 getCommandToolTipText:
function
1123 PlaylistCommandsBuilder_getCommandToolTipText( aSubMenuId, aIndex,
aHost )
1125 return this._getCommandProperty(aSubMenuId,
1132 getCommandValue:
function
1133 PlaylistCommandsBuilder_getCommandValue( aSubMenuId, aIndex,
aHost )
1135 return this._getCommandProperty(aSubMenuId,
1142 instantiateCustomCommand:
function
1143 PlaylistCommandsBuilder_instantiateCustomCommand( aSubMenuId,
1149 var
menu = this._getMenu(aSubMenuId);
1150 if (aIndex >= menu.length || aIndex < 0) {
1151 throw new Error(
"Invalid index " + index +
" in instantiateCustomCommand");
1153 var cb = menu[aIndex].m_InstantiationCallback;
1154 if (cb)
return cb.handleCallback(this.m_Context,
1155 menu[aIndex].m_ParentMenu,
1159 throw new Error(
"No custom command instantiation callback defined for command " + aId);
1162 refreshCustomCommand:
function
1163 PlaylistCommandsBuilder_refreshCustomCommand( aSubMenuId,
1169 var
menu = this._getMenu(aSubMenuId);
1170 if (aIndex >= menu.length || aIndex < 0) {
1171 throw new Error(
"Invalid index " + index +
" in refreshCustomCommand");
1173 var cb = menu[aIndex].m_RefreshCallback;
1174 if (cb) cb.handleCallback(this.m_Context,
1175 menu[aIndex].m_ParentMenu,
1181 getCommandVisible:
function
1182 PlaylistCommandsBuilder_getCommandVisible( aSubMenuId, aIndex,
aHost )
1184 return this._getCommandProperty(aSubMenuId,
1187 "m_VisibleCallback",
1191 getCommandFlag:
function
1192 PlaylistCommandsBuilder_getCommandFlag( aSubMenuId, aIndex,
aHost )
1194 return this._getCommandProperty(aSubMenuId,
1201 getCommandChoiceItem:
function
1202 PlaylistCommandsBuilder_getCommandChoiceItem( aChoiceMenu,
aHost )
1204 var menuindex = this._getMenuIndex(aChoiceMenu);
1205 if (menuindex < 0 || menuindex >= this.m_menus.length) {
1206 throw new Error(
"Choice menu id not found : " + aChoiceMenu +
" in getCommandChoiceItem");
1208 var
menu = this.m_menus[menuindex];
1210 return this._getMenuProperty(menu,
aHost,
"m_ItemCallback",
"");
1213 getCommandEnabled:
function
1214 PlaylistCommandsBuilder_getCommandEnabled( aSubMenuId, aIndex,
aHost )
1216 return this._getCommandProperty(aSubMenuId,
1219 "m_EnabledCallback",
1223 getCommandShortcutModifiers:
function
1224 PlaylistCommandsBuilder_getCommandShortcutModifiers( aSubMenuId, aIndex,
aHost )
1226 return this._getCommandProperty(aSubMenuId,
1229 "m_ShortcutModifiers",
1233 getCommandShortcutKey:
function
1234 PlaylistCommandsBuilder_getCommandShortcutKey( aSubMenuId, aIndex,
aHost )
1236 return this._getCommandProperty(aSubMenuId,
1243 getCommandShortcutKeycode:
function
1244 PlaylistCommandsBuilder_getCommandShortcutKeycode( aSubMenuId, aIndex,
aHost )
1246 return this._getCommandProperty(aSubMenuId,
1249 "m_ShortcutKeycode",
1253 getCommandShortcutLocal:
function
1254 PlaylistCommandsBuilder_getCommandShortcutLocal( aSubMenuId, aIndex,
aHost )
1256 return this._getCommandProperty(aSubMenuId,
1259 "m_ShortcutIsLocal",
1263 getCommandSubObject:
function
1264 PlaylistCommandsBuilder_getCommandSubObject( aSubMenuId, aIndex,
aHost )
1266 return this._getCommandProperty(aSubMenuId,
1269 "m_CommandSubObject",
1273 getChildrenCommandObjects:
function
1274 PlaylistCommandsBuilder_getChildrenCommandObjects()
1276 var subCommandArray =
new Array();
1277 for (var
i=0;
i < this.getNumCommands(
null,
null);
i++) {
1278 var subCommand = this.getCommandSubObject(
"",
i,
"");
1279 subCommandArray.push(subCommand);
1281 return ArrayConverter.enumerator(subCommandArray);
1285 PlaylistCommandsBuilder_onCommand(aSubMenuId, aIndex,
aHost,
id,
value)
1287 var
menu = this._getMenu(aSubMenuId);
1288 if (aIndex >= menu.length || aIndex < 0) {
1289 throw new Error(
"Invalid index " + index +
" in PlaylistCommandsBuilder::onCommand");
1292 if (menu[aIndex].
id !=
id) {
1293 throw new Error(
"Id do not match in PlaylistCommandsBuilder::onCommand (" +
1299 var cb = menu[aIndex].m_TriggerCallback;
1300 if (cb === undefined || !cb.handleCallback) {
1301 throw new Error(
"No callback defined for command " +
id);
1303 cb.handleCallback(this.m_Context,
1310 duplicate:
function PlaylistCommandsBuilder_duplicate()
1313 var obj = this.dupObject(
this);
1317 obj.m_menus =
new Array();
1318 for (var
i=0;
i<this.m_menus.length;
i++) {
1319 var menuitem = this.dupObject(this.m_menus[
i]);
1320 menuitem.m_Menu =
new Array();
1321 for (var j=0;j<this.m_menus[
i].m_Menu.length;j++) {
1322 var item = this.dupObject(this.m_menus[i].m_Menu[j]);
1324 if (item.m_CommandSubObject) {
1325 item.m_CommandSubObject = item.m_CommandSubObject.duplicate();
1327 menuitem.m_Menu.push(item);
1329 obj.m_menus.push(menuitem);
1331 obj.m_root_commands = obj.m_menus[0].m_Menu;
1332 obj.m_Context = this.dupObject(this.m_Context);
1338 dupObject:
function PlaylistCommandsBuilder_dupObject(obj) {
1340 for ( var
i in obj )
1347 initCommands:
function PlaylistCommandsBuilder_initCommands(
aHost) {
1348 for (var
i=0;
i<this.m_menus.length;
i++) {
1349 for (var j=0;j<this.m_menus[
i].m_Menu.length;j++) {
1350 if (this.m_menus[
i].m_Menu[j].m_CommandSubObject) {
1351 this.m_menus[
i].m_Menu[j].m_CommandSubObject.initCommands(
aHost);
1355 if (this.m_InitCallback &&
1356 typeof(this.m_InitCallback) ==
"object" &&
1357 this.m_InitCallback.handleCallback) {
1358 this.m_InitCallback.handleCallback(this.m_Context,
aHost,
null);
1362 shutdownCommands:
function PlaylistCommandsBuilder_shutdownCommands() {
1363 for (var
i=0;
i<this.m_menus.length;
i++) {
1364 for (var j=0;j<this.m_menus[
i].m_Menu.length;j++) {
1365 if (this.m_menus[
i].m_Menu[j].m_CommandSubObject) {
1367 this.m_menus[
i].m_Menu[j].m_CommandSubObject.shutdownCommands();
1371 Components.utils.reportError(e);
1376 if (this.m_ShutdownCallback &&
1377 typeof(this.m_ShutdownCallback) ==
"object" &&
1378 this.m_ShutdownCallback.handleCallback) {
1379 this.m_ShutdownCallback.handleCallback(this.m_Context,
null,
null);
1384 setContext:
function PlaylistCommandsBuilder_setContext( context )
1386 for (var
i=0;
i<this.m_menus.length;
i++) {
1387 for (var j=0;j<this.m_menus[
i].m_Menu.length;j++) {
1388 if (this.m_menus[
i].m_Menu[j].m_CommandSubObject) {
1389 this.m_menus[
i].m_Menu[j].m_CommandSubObject.setContext(context);
1394 this.m_Context.playlist = context.playlist;
1395 this.m_Context.medialist = context.medialist;
1396 this.m_Context.window = context.window;
1397 this.m_Context.commands =
this;
1403 LOG: DebugUtils.generateLogFunction(
"sbPlaylistCommandsBuilder"),
1411 Ci.sbIPlaylistCommandsBuilder]),
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_CHOICE
const SONGBIRD_PLAYLISTCOMMANDSBUILDER_BEFORE
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_CHOICEITEM
sbDeviceFirmwareAutoCheckForUpdate prototype contractID
sbOSDControlService prototype QueryInterface
sbDeviceFirmwareAutoCheckForUpdate prototype classDescription
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_CUSTOM
function PlaylistCommandsBuilder()
sbDownloadDeviceServicePaneModule prototype shutdown
const SONGBIRD_PLAYLISTCOMMANDSBUILDER_CLASSNAME
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_VALUE
_collectFormDataForFrame aDocument
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_ACTION
An interface that represents the set of command buttons and context menu items available on a display...
const SONGBIRD_PLAYLISTCOMMANDSBUILDER_AFTER
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_SEPARATOR
SBPlaylistCommand_DownloadToPlaylist m_root_commands
sbDeviceFirmwareAutoCheckForUpdate prototype classID
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_SUBOBJECT
sbDeviceFirmwareAutoCheckForUpdate prototype interfaces
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_FLAG
const SONGBIRD_PLAYLISTCOMMANDSBUILDER_IID
function NSGetModule(compMgr, fileSpec)
_getSelectedPageStyle s i
const SONGBIRD_PLAYLISTCOMMANDSBUILDER_CONTRACTID
const SONGBIRD_PLAYLISTCOMMANDSBUILDER_CID
const SONGBIRD_PLAYLISTCOMMANDSBUILDER_APPEND
const SONGBIRD_PLAYLISTCOMMANDS_TYPE_MENU