home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / xulrunner-1.9.0.14 / chrome / toolkit.jar / content / mozapps / extensions / extensions.xml < prev    next >
Encoding:
Extensible Markup Language  |  2008-04-01  |  37.0 KB  |  966 lines

  1. <?xml version="1.0"?>
  2.  
  3.  
  4.  
  5. <!DOCTYPE bindings [
  6.   <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
  7.   <!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/extensions.dtd" >
  8.   %brandDTD;
  9.   %extensionsDTD;
  10. ]>
  11.  
  12. <bindings id="addonBindings"
  13.           xmlns="http://www.mozilla.org/xbl"
  14.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  15.           xmlns:xbl="http://www.mozilla.org/xbl">
  16.  
  17.   <binding id="addons" extends="chrome://global/content/bindings/richlistbox.xml#richlistbox">
  18.     <implementation>
  19.       <field name="_addonStrings">
  20.         document.getElementById("extensionsStrings");
  21.       </field>
  22.  
  23.       <field name="_brandShortName">null</field>
  24.       <method name="getBrandShortName">
  25.         <body>
  26.           if (!this._brandShortName)
  27.             this._brandShortName = document.getElementById("brandStrings").getString("brandShortName");
  28.           return this._brandShortName;
  29.         </body>
  30.       </method>
  31.  
  32.       <field name="_appVersion">null</field>
  33.       <method name="getAppVersion">
  34.         <body>
  35.           if (!this._appVersion) {
  36.             var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
  37.                                     .getService(Components.interfaces.nsIXULAppInfo)
  38.                                     .QueryInterface(Components.interfaces.nsIXULRuntime);
  39.             this._appVersion = appInfo.version;
  40.           }
  41.           return this._appVersion;
  42.         </body>
  43.       </method>
  44.     </implementation>
  45.   </binding>
  46.  
  47.   <binding id="addon-base" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
  48.     <resources>
  49.       <stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
  50.     </resources>
  51.  
  52.     <implementation>
  53.       <field name="eventPrefix">"extension-"</field>
  54.       <property name="type" onget="return parseInt(this.getAttribute('type'));"/>
  55.       <property name="isCompatible" onget="return this.getAttribute('compatible') == 'true';"/>
  56.       <property name="isBlocklisted" onget="return this.getAttribute('blocklisted') == 'true';"/>
  57.       <property name="isDisabled" onget="return this.getAttribute('isDisabled') == 'true';"/>
  58.       <property name="providesUpdatesSecurely" onget="return this.getAttribute('providesUpdatesSecurely') == 'true';"/>
  59.       <property name="satisfiesDependencies" onget="return this.getAttribute('satisfiesDependencies') == 'true';"/>
  60.       <property name="opType">
  61.         <getter>
  62.           <![CDATA[
  63.             var opType = this.getAttribute('opType');
  64.             return opType == 'none' ? null : opType;
  65.           ]]>
  66.         </getter>
  67.       </property>
  68.  
  69.       <method name="fireEvent">
  70.         <parameter name="aEventType"/>
  71.         <body>
  72.           var e = document.createEvent("Events");
  73.           e.initEvent(this.eventPrefix + aEventType, true, true);
  74.           this.dispatchEvent(e);
  75.         </body>
  76.       </method>
  77.     </implementation>
  78.  
  79.     <handlers>
  80.       <handler event="DOMMenuItemActive">
  81.         // only ensureElementIsVisible if it wasn't selected
  82.         if (this.parentNode.getAttribute("last-selected") != this.getAttribute("id"))
  83.           this.parentNode.ensureElementIsVisible(this);
  84.       </handler>
  85.     </handlers>
  86.   </binding>
  87.  
  88.   <binding id="addon" extends="chrome://mozapps/content/extensions/extensions.xml#addon-base">
  89.     <content>
  90.       <xul:hbox flex="1">
  91.         <xul:vbox class="addon-icon" xbl:inherits="iconURL"/>
  92.         <xul:vbox flex="1" class="addonTextBox">
  93.           <xul:hbox class="addon-name-version" xbl:inherits="name, version"/>
  94.           <xul:hbox anonid="addonDescription" class="addon-description" xbl:inherits="description, opType"/>
  95.         </xul:vbox>
  96.       </xul:hbox>
  97.     </content>
  98.     <implementation implements="nsIAccessibleProvider, nsIDOMXULSelectControlItemElement">
  99.       <field name="_addonDescription">
  100.         document.getAnonymousElementByAttribute(this, "anonid", "addonDescription");
  101.       </field>
  102.  
  103.       <property name="label" readonly="true">
  104.         <getter>
  105.           <![CDATA[
  106.             var labelPieces = [];
  107.  
  108.             // Add name and version
  109.             labelPieces.push(this.getAttribute("name"));
  110.             labelPieces.push(this.getAttribute("version"));
  111.  
  112.             // Add description
  113.             var description = this.getAttribute("description");
  114.             labelPieces.push(description);
  115.  
  116.             // Add status message, if any
  117.             // description is always in this.getAttribute("description"), but
  118.             // description is also sometimes in anonNodes[0].value.  But other
  119.             // times (like when there's an actual status message) the binding
  120.             // of that hbox gets changed dynamically so anonNodes[0].value
  121.             // is the status message.  The easiest way to sort it out is
  122.             // to check for duplicate strings.
  123.             // xxxpilgrim There is some additional weirdness here.  Visually,
  124.             // the description is not displayed on non-selected items if
  125.             // the item contains a status message.  However, when you arrow
  126.             // up and down through the list selecting different items, we want
  127.             // the accessible name during the OBJ_FOCUS event to include both
  128.             // the description and the status message.  You would think this
  129.             // would be handled automatically because the binding changes
  130.             // (to "addon-selected", below) when the item gets selected.
  131.             // However, when the OBJ_FOCUS event occurs, the binding hasn't
  132.             // changed yet, so this property gets queried for the accessible name.
  133.             // Bottom line, we need to this property in the first place to
  134.             // ensure that items have any accessible name at all when you
  135.             // arrow through the list (bug 352388), _and_ we need to include
  136.             // both the description and the status message to make the
  137.             // accessible name you get during the OBJ_FOCUS event match the
  138.             // accessible name you would get if you queried the object
  139.             // after it was already focused (i.e. after the binding had
  140.             // changed to "addon-selected").
  141.             var anonNodes = document.getAnonymousNodes(this._addonDescription);
  142.             if (anonNodes) {
  143.               var statusMessage = anonNodes[0].value;
  144.               if (description != statusMessage)
  145.                 labelPieces.push(statusMessage);
  146.             }
  147.             return labelPieces.join(" ");
  148.           ]]>
  149.         </getter>
  150.       </property>
  151.     </implementation>
  152.   </binding>
  153.  
  154.   <binding id="addon-selected" extends="chrome://mozapps/content/extensions/extensions.xml#addon-base">
  155.     <content>
  156.       <xul:hbox flex="1">
  157.         <xul:vbox class="addon-icon" xbl:inherits="iconURL"/>
  158.         <xul:vbox flex="1" class="addonTextBox">
  159.           <xul:hbox anonid="addonNameVersion" class="addon-name-version" xbl:inherits="name, version"/>
  160.           <xul:label anonid="addonDescriptionWrap" class="descriptionWrap" xbl:inherits="xbl:text=description"/>
  161.           <xul:vbox anonid="addonSelectedStatusMsgs" class="selectedStatusMsgs">
  162.             <xul:hbox anonid="addonOpType" class="addon-optype attention" align="center" xbl:inherits="newVersion"/>
  163.             <xul:hbox flex="1" class="updateAvailableBox attention">
  164.               <xul:label xbl:inherits="value=updateAvailableMsg" crop="end"/>
  165.             </xul:hbox>
  166.             <xul:hbox flex="1" class="incompatibleBox attention">
  167.               <xul:label anonid="incompatibleLabel" crop="end"/>
  168.             </xul:hbox>
  169.             <xul:hbox flex="1" class="insecureUpdateBox attention">
  170.               <xul:label value="&insecureUpdate.label;" crop="end"/>
  171.             </xul:hbox>
  172.             <xul:hbox flex="1" class="needsDependenciesBox attention">
  173.               <xul:label value="&needsDependencies.label;" crop="end"/>
  174.             </xul:hbox>
  175.             <xul:hbox flex="1" class="blocklistedBox attention" align="center">
  176.               <xul:label value="&blocklisted.label;" crop="end"/>
  177.               <xul:label anonid="blocklistMoreInfo" class="text-link" value="&moreInfo.label;"
  178.                          onclick="openURL(this.getAttribute('moreInfoURL'));"/>
  179.             </xul:hbox>
  180.           </xul:vbox>
  181.           <xul:hbox anonid="selectedButtons" flex="1" class="selectedButtons">
  182.             <xul:button class="uninstallHide optionsButton"
  183.               label="&cmd.optionsUnix.label;" accesskey="&cmd.optionsUnix.accesskey;"
  184.               tooltiptext="&cmd.optionsUnix.tooltip;"
  185.               command="cmd_options"/>
  186.             <xul:button class="uninstallHide themeButton useThemeButton" label="&cmd.useTheme.label;"
  187.                         accesskey="&cmd.useTheme.accesskey;" tooltiptext="&cmd.useTheme.tooltip;"
  188.                         command="cmd_useTheme"/>
  189.             <xul:spacer flex="1"/>
  190.             <xul:button class="disableShow enableHide uninstallHide enableButton" label="&cmd.enable.label;"
  191.                         accesskey="&cmd.enable.accesskey;" tooltiptext="&cmd.enable.tooltip;"
  192.                         command="cmd_enable"/>
  193.             <xul:button class="enableShow disableHide uninstallHide disableButton" label="&cmd.disable.label;"
  194.                         accesskey="&cmd.disable.accesskey;" tooltiptext="&cmd.disable.tooltip;"
  195.                         command="cmd_disable"/>
  196.             <xul:button class="uninstallHide uninstallButton" label="&cmd.uninstall.label;"
  197.                         accesskey="&cmd.uninstall2.accesskey;" tooltiptext="&cmd.uninstall2.tooltip;"
  198.                         command="cmd_uninstall"/>
  199.             <xul:button class="uninstallShow cancelUninstallButton" label="&cancel.label;"
  200.                         accesskey="&cancel.accesskey;" tooltiptext="&cmd.cancelUninstall.tooltip;"
  201.                         command="cmd_cancelUninstall"/>
  202.             <xul:button class="installShow cancelInstallButton" label="&cancelInstall.label;"
  203.                         accesskey="&cancelInstall.accesskey;" tooltiptext="&cmd.cancelInstall.tooltip;"
  204.                         command="cmd_cancelInstall"/>
  205.             <xul:button class="upgradeShow cancelUpgradeButton" label="&cancelUpgrade.label;"
  206.                         accesskey="&cancelUpgrade.accesskey;" tooltiptext="&cmd.cancelUpgrade.tooltip;"
  207.                         command="cmd_cancelUpgrade"/>
  208.           </xul:hbox>
  209.         </xul:vbox>
  210.       </xul:hbox>
  211.     </content>
  212.  
  213.     <implementation implements="nsIAccessibleProvider, nsIDOMXULSelectControlItemElement">
  214.       <constructor>
  215.         <![CDATA[
  216.           if (this.isBlocklisted) {
  217.             try {
  218.               var blocklistMoreInfo = document.getAnonymousElementByAttribute(this, "anonid", "blocklistMoreInfo");
  219.               var prefs = Components.classes["@mozilla.org/preferences-service;1"]
  220.                                     .getService(Components.interfaces.nsIPrefBranch);
  221.               var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
  222.                                         .getService(Components.interfaces.nsIURLFormatter);
  223.               var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
  224.               blocklistMoreInfo.setAttribute("moreInfoURL", url);
  225.             } catch(e) {
  226.               blocklistMoreInfo.hidden = true;
  227.             }
  228.           }
  229.  
  230.           if (!this.isCompatible) {
  231.             var label = document.getAnonymousElementByAttribute(this, "anonid", "incompatibleLabel");
  232.             label.setAttribute("value", this.parentNode._addonStrings.getFormattedString("incompatibleAddonMsg",
  233.                                         [this.parentNode.getBrandShortName(), this.parentNode.getAppVersion()]));
  234.           }
  235.  
  236.           var updatedVersion = this.getAttribute('availableUpdateVersion');
  237.           if (updatedVersion) {
  238.             var msg = this.parentNode._addonStrings.getFormattedString("updateAvailableMsg", [updatedVersion]);
  239.             this.setAttribute("updateAvailableMsg", msg);
  240.           }
  241.         ]]>
  242.       </constructor>
  243.  
  244.       <field name="_nameVersion">
  245.         document.getAnonymousElementByAttribute(this, "anonid", "addonNameVersion");
  246.       </field>
  247.  
  248.       <field name="_descriptionWrap">
  249.         document.getAnonymousElementByAttribute(this, "anonid", "addonDescriptionWrap");
  250.       </field>
  251.  
  252.       <field name="_selectedStatusMsgs">
  253.         document.getAnonymousElementByAttribute(this, "anonid", "addonSelectedStatusMsgs");
  254.       </field>
  255.  
  256.       <field name="_opType">
  257.         document.getAnonymousElementByAttribute(this, "anonid", "addonOpType");
  258.       </field>
  259.  
  260.       <property name="label" readonly="true">
  261.         <getter>
  262.           <![CDATA[
  263.             var labelPieces = [];
  264.  
  265.             // Add name and version
  266.             labelPieces.push(this._nameVersion.getAttribute("name"));
  267.             labelPieces.push(this._nameVersion.getAttribute("version"));
  268.  
  269.             // Add description
  270.             labelPieces.push(this._descriptionWrap.textContent);
  271.  
  272.             // Add operation message (if any)
  273.             // Note 1: must handle this separately from other the labels
  274.             // because this message is in an anonymous content node
  275.             // within an hbox which is dynamically bound to a different
  276.             // "addon-needs-*" binding based on the operation type.
  277.             // Note 2: must check hbox's CSS "display" property with
  278.             // getComputedStyle, because the XUL "hidden" attribute
  279.             // never changes.
  280.             // Note 3: can't just check whether the hbox has anonymous
  281.             // child nodes.  If (for example) you disable an extension,
  282.             // the hbox gets bound to "addon-needs-disable".  But if
  283.             // you then immediately re-enable the same extension without
  284.             // closing the Add-ons window, the hbox is still bound to
  285.             // "addon-needs-disable" (and thus still has the anonymous
  286.             // content child nodes with the label containing the now-unused
  287.             // &toBeDisabled.label text), but the hbox is no longer visible.
  288.             if (document.defaultView.getComputedStyle(this._opType, '').display != 'none')
  289.               labelPieces.push(document.getAnonymousNodes(this._opType)[0].value);
  290.  
  291.             // Add selected status messages, if any are visible.
  292.             // Note 1: visibility of status messages is set by CSS rule,
  293.             // not XUL attributes, so we need to use getComputedStyle.
  294.             // Note 2: relevant CSS rule is set on the label's parent node;
  295.             // the label node itself always has "display:-moz-box" which is
  296.             // not useful.
  297.             var labels = this._selectedStatusMsgs.getElementsByTagNameNS(
  298.               "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
  299.               "label");
  300.             var numLabels = labels.length;
  301.             for (var i = 0; i < numLabels; i++) {
  302.               var label = labels[i];
  303.               var parentStyle = document.defaultView.getComputedStyle(label.parentNode, "");
  304.  
  305.               // Optimization: we only check a few cases here that we know
  306.               // are used by the Add-ons window.  For example, the generic
  307.               // richlistbox.xml label getter checks label.collapsed, but
  308.               // we don't check that here because we know that the Add-ons
  309.               // window doesn't use it.
  310.               if (!label.hidden &&
  311.                   label.className != "text-link" &&
  312.                   parentStyle.display != "none") {
  313.                 labelPieces.push(label.value);
  314.               }
  315.             }
  316.  
  317.             return labelPieces.join(" ");
  318.           ]]>
  319.         </getter>
  320.       </property>
  321.     </implementation>
  322.  
  323.     <handlers>
  324. <!-- When an add-on displays a status messages the element may extend below the
  325.      bottom of the list This will ensure that the element is visible for the
  326.      most common cases. -->
  327.       <handler event="DOMAttrModified">
  328.         <![CDATA[
  329.           if (event.attrName != "disabled" ||
  330.               !this.parentNode.selectedItem ||
  331.               !event.originalTarget.hasAttribute("command"))
  332.             return;
  333.  
  334.           var cmd = event.originalTarget.getAttribute("command");
  335.           var opType = this.getAttribute("opType");
  336.           if (opType == "needs-uninstall" && cmd == "cmd_uninstall" ||
  337.               opType == "needs-disable" && cmd == "cmd_disable" && !this.isDisabled ||
  338.               opType == "needs-enable" && cmd == "cmd_disable" && this.isDisabled)
  339.             this.parentNode.ensureElementIsVisible(this);
  340.         ]]>
  341.       </handler>
  342.     </handlers>
  343.   </binding>
  344.   
  345.   <binding id="searchresult" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
  346.     <resources>
  347.       <stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
  348.     </resources>
  349.  
  350.     <content>
  351.       <xul:hbox flex="1">
  352.         <xul:vbox class="addon-icon" xbl:inherits="iconURL"/>
  353.         <xul:vbox flex="1" class="addonTextBox">
  354.           <xul:hbox align="center">
  355.             <xul:hbox anonid="addonNameVersion" class="addon-name-version" xbl:inherits="name, version"/>
  356.             <xul:spacer flex="1"/>
  357.             <xul:image class="addonRating" xbl:inherits="rating"/>
  358.           </xul:hbox>
  359.           <xul:hbox anonid="addonDescription" class="addon-description" xbl:inherits="description, opType"/>
  360.         </xul:vbox>
  361.       </xul:hbox>
  362.     </content>
  363.  
  364.     <implementation extends="nsIAccessibleProvider">
  365.       <property name="label" readonly="true">
  366.         <getter>
  367.           return this.getAttribute("name") + " " +
  368.             this.getAttribute("version") + " " +
  369.             this.getAttribute("description");
  370.         </getter>
  371.       </property>
  372.  
  373.       <constructor>
  374.         if (!this.hasAttribute("thumbnailURL")) {
  375.           this._hideImage();
  376.           return;
  377.         }
  378.  
  379.         if (this.hasAttribute("thumbwidth")) {
  380.           this._displayImage();
  381.           return;
  382.         }
  383.  
  384.         var image = new Image();
  385.         var id = this.id;
  386.         image.onload = function() {
  387.           document.getElementById(id)._imageLoaded(image);
  388.         };
  389.         image.onerror = function() {
  390.           document.getElementById(id)._hideImage();
  391.         };
  392.         image.src = this.getAttribute("thumbnailURL");
  393.       </constructor>
  394.  
  395.       <field name="_maxSize">125</field>
  396.  
  397.       <method name="_displayImage">
  398.         <body>
  399.         </body>
  400.       </method>
  401.  
  402.       <method name="_hideImage">
  403.         <body>
  404.         </body>
  405.       </method>
  406.  
  407.       <method name="_imageLoaded">
  408.         <parameter name="image"/>
  409.         <body>
  410.         <![CDATA[
  411.           if ((this._maxSize >= image.width) &&
  412.               (this._maxSize >= image.height)) {
  413.             var width = image.width;
  414.             var height = image.height;
  415.           }
  416.           else if (image.width > image.height) {
  417.             width = this._maxSize;
  418.             height = (this._maxSize / image.width) * image.height;
  419.           }
  420.           else {
  421.             height = this._maxSize;
  422.             width = (this._maxSize / image.height) * image.width;
  423.           }
  424.  
  425.           this.setAttribute("thumbwidth", width);
  426.           this.setAttribute("thumbheight", height);
  427.           this._displayImage();
  428.         ]]>
  429.         </body>
  430.       </method>
  431.     </implementation>
  432.   </binding>
  433.   
  434.   <binding id="searchresult-selected" extends="chrome://mozapps/content/extensions/extensions.xml#searchresult">
  435.     <content>
  436.       <xul:hbox flex="1">
  437.         <xul:vbox class="addon-icon" xbl:inherits="iconURL"/>
  438.         <xul:vbox flex="1" class="addonTextBox">
  439.           <xul:hbox align="center">
  440.             <xul:hbox anonid="addonNameVersion" class="addon-name-version" xbl:inherits="name, version"/>
  441.             <xul:spacer flex="1"/>
  442.             <xul:image class="addonRating" xbl:inherits="rating"/>
  443.           </xul:hbox>
  444.           <xul:hbox flex="1" align="stretch" class="addon-search-details">
  445.             <xul:vbox pack="start">
  446.               <xul:deck class="addonThumbnailContainer" selectedIndex="0">
  447.                 <xul:vbox flex="1" align="center" pack="center">
  448.                   <xul:image class="addonThrobber"/>
  449.                 </xul:vbox>
  450.                 <xul:vbox flex="1" align="center" pack="center">
  451.                   <xul:image class="addonThumbnail"/>
  452.                 </xul:vbox>
  453.                 <xul:vbox flex="1" align="center" pack="center">
  454.                   <xul:label class="addonMissingThumbnail" value="&missingThumbnail.label;"/>
  455.                 </xul:vbox>
  456.               </xul:deck>
  457.             </xul:vbox>
  458.             <xul:vbox flex="1">
  459.               <xul:label anonid="addonDescriptionWrap" class="descriptionWrap"
  460.                          xbl:inherits="xbl:text=description"/>
  461.               <xul:hbox pack="start">
  462.                 <xul:label class="addonLearnMore text-link" xbl:inherits="homepageURL"
  463.                            value="&searchResultHomepage.value;"
  464.                            onclick="openURL(this.getAttribute('homepageURL'));"/>
  465.               </xul:hbox>
  466.               <xul:spacer flex="1"/>
  467.               <xul:hbox anonid="selectedButtons" class="selectedButtons">
  468.                 <xul:hbox align="center" class="addonType addonTypeExtension">
  469.                   <xul:image/>
  470.                   <xul:label value="&addonTypeExtension.label;"/>
  471.                 </xul:hbox>
  472.                 <xul:hbox align="center" class="addonType addonTypeTheme">
  473.                   <xul:image/>
  474.                   <xul:label value="&addonTypeTheme.label;"/>
  475.                 </xul:hbox>
  476.                 <xul:spacer flex="1"/>
  477.                 <xul:hbox align="center" class="searchResultConnecting">
  478.                   <xul:image class="addonThrobber"/>
  479.                   <xul:label value="&searchResultConnecting.label;"/>
  480.                 </xul:hbox>
  481.                 <xul:hbox align="center" class="searchResultInstalling">
  482.                   <xul:image class="addonThrobber"/>
  483.                   <xul:label value="&searchResultInstalling.label;"/>
  484.                 </xul:hbox>
  485.                 <xul:hbox align="center" class="searchResultFailed">
  486.                   <xul:label value="&searchResultFailed.label;"/>
  487.                 </xul:hbox>
  488.                 <xul:hbox align="center" class="searchResultInstalled">
  489.                   <xul:label value="&searchResultInstalled.label;"/>
  490.                 </xul:hbox>
  491.                 <xul:button class="addonInstallButton"
  492.                             label="&cmd.installSearchResult.label;"
  493.                             accesskey="&cmd.installSearchResult.accesskey;"
  494.                             tooltiptext="&cmd.installSearchResult.tooltip;"
  495.                             command="cmd_installSearchResult"/>
  496.               </xul:hbox>
  497.             </xul:vbox>
  498.           </xul:hbox>
  499.         </xul:vbox>
  500.       </xul:hbox>
  501.     </content>
  502.  
  503.     <implementation implements="nsIAccessibleProvider">
  504.       <field name="_thumbnailContainer">
  505.         document.getAnonymousElementByAttribute(this, "class", "addonThumbnailContainer");
  506.       </field>
  507.       <field name="_thumbnail">
  508.         document.getAnonymousElementByAttribute(this, "class", "addonThumbnail");
  509.       </field>
  510.       
  511.       <method name="_displayImage">
  512.         <body>
  513.           this._thumbnail.style.width = this.getAttribute("thumbwidth") + "px";
  514.           this._thumbnail.style.height = this.getAttribute("thumbheight") + "px";
  515.           this._thumbnail.src = this.getAttribute("thumbnailURL");
  516.           this._thumbnailContainer.selectedIndex = 1;
  517.         </body>
  518.       </method>
  519.  
  520.       <method name="_hideImage">
  521.         <body>
  522.           this._thumbnailContainer.selectedIndex = 2;
  523.         </body>
  524.       </method>
  525.     </implementation>
  526.   </binding>
  527.  
  528.   <binding id="status-search-failure">
  529.     <content align="center">
  530.       <xul:hbox align="center" pack="center">
  531.         <xul:image class="addonFailure"/>
  532.         <xul:label value="&searchFailed.label;"/>
  533.       </xul:hbox>
  534.       <xul:button command="cmd_resetSearch" label="&searchFailed.button;"/>
  535.     </content>
  536.   </binding>
  537.  
  538.   <binding id="status-recommended-failure">
  539.     <content>
  540.       <xul:hbox align="center" pack="center">
  541.         <xul:image class="addonFailure"/>
  542.         <xul:label value="&searchFailed.label;"/>
  543.       </xul:hbox>
  544.     </content>
  545.   </binding>
  546.  
  547.   <binding id="status-header-recommended">
  548.     <content>
  549.       <xul:label value="&recommendedHeader.label;"/>
  550.     </content>
  551.   </binding>
  552.  
  553.   <binding id="status-message-nosearchresults">
  554.     <content>
  555.       <xul:hbox align="center" pack="center">
  556.         <xul:label value="&noSearchResults.label;"/>
  557.       </xul:hbox>
  558.     </content>
  559.   </binding>
  560.  
  561.   <binding id="status-message-norecommended">
  562.     <content>
  563.       <xul:hbox align="center" pack="center">
  564.         <xul:label value="&noRecommendedResults.label;"/>
  565.       </xul:hbox>
  566.     </content>
  567.   </binding>
  568.  
  569.   <binding id="status-footer-recommended">
  570.     <content align="end">
  571.       <xul:label class="text-link" xbl:inherits="recommendedURL=link" value="&recommendedResults.label;"
  572.                  onclick="openURL(this.getAttribute('recommendedURL'));"/>
  573.     </content>
  574.   </binding>
  575.  
  576.   <binding id="status-footer-search">
  577.     <content align="stretch">
  578.       <xul:hbox align="center">
  579.         <xul:label class="text-link" xbl:inherits="searchURL=link" anonid="searchLink"
  580.                    onclick="openURL(this.getAttribute('searchURL'));"/>
  581.         <xul:spacer flex="1"/>
  582.         <xul:button command="cmd_resetSearch" label="&resetSearch.label;"/>
  583.       </xul:hbox>
  584.     </content>
  585.  
  586.     <implementation>
  587.       <constructor>
  588.         var strings = [this.getAttribute("count")];
  589.         var text = document.getElementById("extensionsStrings")
  590.                            .getFormattedString("searchResults", strings);
  591.         var label = document.getAnonymousElementByAttribute(this, "anonid", "searchLink");
  592.         label.value = text;
  593.       </constructor>
  594.     </implementation>
  595.   </binding>
  596.  
  597.   <binding id="status-footer-search-empty">
  598.     <content align="center">
  599.       <xul:label value="&emptySearch.label;"/>
  600.       <xul:button command="cmd_resetSearch" label="&emptySearch.button;"/>
  601.     </content>
  602.   </binding>
  603.  
  604.   <binding id="status-retrieve-search">
  605.     <content align="center">
  606.       <xul:hbox align="center" pack="center">
  607.         <xul:image class="addonThrobber"/>
  608.         <xul:label value="&searchThrobber.label;"/>
  609.       </xul:hbox>
  610.       <xul:button command="cmd_resetSearch" label="&cancelSearch.button;"/>
  611.     </content>
  612.   </binding>
  613.  
  614.   <binding id="status-retrieve-recommended">
  615.     <content>
  616.       <xul:hbox align="center" pack="center">
  617.         <xul:image class="addonThrobber"/>
  618.         <xul:label value="&recommendedThrobber.label;"/>
  619.       </xul:hbox>
  620.     </content>
  621.   </binding>
  622.  
  623.   <binding id="addon-icon">
  624.     <content>
  625.       <xul:stack class="addonIconStack">
  626.         <xul:vbox pack="center" align="center" class="addonIcon">
  627.           <xul:image xbl:inherits="src=iconURL"/>
  628.         </xul:vbox>
  629.         <xul:vbox pack="start" align="start" class="addonIcon pluginIcon">
  630.           <xul:image src="chrome://mozapps/skin/plugins/pluginGeneric.png"/>
  631.         </xul:vbox>
  632.         <xul:vbox pack="end" align="start">
  633.           <xul:image class="notifyBadge"/>
  634.         </xul:vbox>
  635.         <xul:vbox pack="end" align="end">
  636.           <xul:image class="updateBadge"/>
  637.         </xul:vbox>
  638.       </xul:stack>
  639.       <xul:spacer flex="1"/>
  640.     </content>
  641.   </binding>
  642.  
  643.   <binding id="addon-name-version">
  644.     <content>
  645.       <xul:label class="addonName" crop="end" xbl:inherits="value=name"/>
  646.       <xul:label class="addonVersion" xbl:inherits="value=version"/>
  647.     </content>
  648.   </binding>
  649.  
  650.   <binding id="addon-description-crop">
  651.     <content>
  652.       <xul:label class="descriptionCrop" xbl:inherits="value=description" flex="1" crop="end"/>
  653.     </content>
  654.   </binding>
  655.  
  656.   <binding id="addon-needs-install">
  657.     <content>
  658.       <xul:label value="&toBeInstalled.label;" crop="end"/>
  659.     </content>
  660.   </binding>
  661.  
  662.   <binding id="addon-needs-upgrade">
  663.     <content>
  664.       <xul:label value="&toBeUpdated.label;" crop="end"/>
  665.     </content>
  666.   </binding>
  667.  
  668.   <binding id="addon-needs-uninstall">
  669.     <content>
  670.       <xul:label value="&toBeUninstalled.label;" crop="end"/>
  671.     </content>
  672.   </binding>
  673.  
  674.   <binding id="addon-needs-enable">
  675.     <content>
  676.       <xul:label value="&toBeEnabled.label;" crop="end"/>
  677.     </content>
  678.   </binding>
  679.  
  680.   <binding id="addon-needs-disable">
  681.     <content>
  682.       <xul:label value="&toBeDisabled.label;" crop="end"/>
  683.     </content>
  684.   </binding>
  685.  
  686.   <binding id="update-checking" extends="chrome://mozapps/content/extensions/extensions.xml#addon-base">
  687.     <content>
  688.       <xul:hbox flex="1">
  689.         <xul:stack class="addonIconStack">
  690.           <xul:vbox pack="start" align="start">
  691.             <xul:image class="addonIcon" xbl:inherits="src=iconURL"/>
  692.           </xul:vbox>
  693.           <xul:vbox pack="end" align="end">
  694.             <xul:image class="updateBadge"/>
  695.           </xul:vbox>
  696.           <xul:vbox pack="end" align="start">
  697.             <xul:image class="notifyBadge"/>
  698.           </xul:vbox>
  699.         </xul:stack>
  700.         <xul:vbox flex="1">
  701.           <xul:hbox class="addon-name-version" xbl:inherits="name, version"/>
  702.           <xul:hbox>
  703.             <xul:label xbl:inherits="value=updateStatus" flex="1" crop="end"/>
  704.           </xul:hbox>
  705.         </xul:vbox>
  706.       </xul:hbox>
  707.     </content>
  708.   </binding>
  709.  
  710.   <binding id="update-found" extends="chrome://mozapps/content/extensions/extensions.xml#addon-base">
  711.     <content>
  712.       <xul:hbox flex="1">
  713.         <xul:vbox pack="start" align="start">
  714.           <xul:image class="addonIcon" xbl:inherits="src=iconURL"/>
  715.         </xul:vbox>
  716.         <xul:vbox flex="1">
  717.           <xul:hbox class="addon-name-version" xbl:inherits="name, version"/>
  718.           <xul:hbox>
  719.             <xul:label xbl:inherits="value=updateAvailableMsg" flex="1" crop="end"/>
  720.           </xul:hbox>
  721.           <xul:hbox pack="end" align="end">
  722.             <xul:checkbox anonid="includeUpdate" class="includeUpdate" checked="true"
  723.             label="&includeUpdate.label;" tooltiptext="&includeUpdate.tooltip;"
  724.             includeUpdateAccesskey="&includeUpdate.accesskey;" accesskey="&includeUpdate.accesskey;"/>
  725.           </xul:hbox>
  726.         </xul:vbox>
  727.       </xul:hbox>
  728.     </content>
  729.  
  730.     <implementation>
  731.       <constructor>
  732.         var updatedVersion = this.getAttribute('availableUpdateVersion');
  733.         var msg = this.parentNode._addonStrings.getFormattedString("updateAvailableMsg", [updatedVersion]);
  734.         this.setAttribute("updateAvailableMsg", msg);
  735.       </constructor>
  736.     </implementation>
  737.  
  738.     <handlers>
  739.       <handler event="DOMMenuItemActive">
  740.         <![CDATA[
  741.           // 
  742.           var children = this.parentNode.children;
  743.           for (var i = 0; i < children.length; ++i) {
  744.             var checkbox = document.getAnonymousElementByAttribute(children[i], "anonid", "includeUpdate");
  745.             if (checkbox.hasAttribute("accesskey"))
  746.               checkbox.removeAttribute("accesskey");
  747.           }
  748.           checkbox = document.getAnonymousElementByAttribute(this, "anonid", "includeUpdate");
  749.           checkbox.setAttribute("accesskey", checkbox.getAttribute("includeUpdateAccesskey"));
  750.         ]]>
  751.       </handler>
  752.     </handlers>
  753.   </binding>
  754.  
  755.   <binding id="install" extends="chrome://mozapps/content/extensions/extensions.xml#addon-base">
  756.     <content>
  757.       <xul:hbox flex="1">
  758.         <xul:vbox>
  759.           <xul:stack class="addonIcon-stack">
  760.             <xul:vbox pack="start" align="start">
  761.               <xul:image class="addonIcon" xbl:inherits="src=iconURL"/>
  762.             </xul:vbox>
  763.           </xul:stack>
  764.         </xul:vbox>
  765.         <xul:vbox flex="1">
  766.           <xul:hbox class="addon-name-version" xbl:inherits="name, version=newVersion"/>
  767.           <xul:hbox class="addon-install-status" xbl:inherits="state"/>
  768.         </xul:vbox>
  769.       </xul:hbox>
  770.     </content>
  771.   </binding>
  772.  
  773.   <binding id="addon-install-waiting">
  774.     <content>
  775.       <xul:label value="&installWaiting.label;" flex="1" crop="end"/>
  776.     </content>
  777.   </binding>
  778.  
  779.   <binding id="addon-install-incompatibleUpdate">
  780.     <content>
  781.       <xul:label value="&installIncompatibleUpdate.label;" flex="1" crop="end"/>
  782.     </content>
  783.   </binding>
  784.  
  785.   <binding id="addon-install-finishing">
  786.     <content>
  787.       <xul:label value="&installFinishing.label;" flex="1" crop="end"/>
  788.     </content>
  789.   </binding>
  790.  
  791.   <binding id="addon-install-success">
  792.     <content>
  793.       <xul:label value="&installSuccess.label;" flex="1" crop="end"/>
  794.     </content>
  795.   </binding>
  796.  
  797.   <binding id="addon-install-fail">
  798.     <content>
  799.       <xul:label value="&installFailure.label;" flex="1" crop="end"/>
  800.     </content>
  801.   </binding>
  802.  
  803.   <binding id="addon-install-restart">
  804.     <content>
  805.       <xul:label value="&installSuccessRestart.label;" flex="1" crop="end"/>
  806.     </content>
  807.   </binding>
  808.  
  809.   <binding id="addon-upgrade-restart">
  810.     <content>
  811.       <xul:label value="&updateSuccessRestart.label;" flex="1" crop="end"/>
  812.     </content>
  813.   </binding>
  814.  
  815.   <binding id="addon-install-updated">
  816.     <content>
  817.       <xul:label value="&updateSuccess.label;" flex="1" crop="end"/>
  818.     </content>
  819.   </binding>
  820.  
  821.   <binding id="install-downloading" extends="chrome://mozapps/content/extensions/extensions.xml#addon-base">
  822.     <content>
  823.       <xul:hbox flex="1">
  824.         <xul:vbox pack="start">
  825.           <xul:image class="addonIcon" xbl:inherits="src=iconURL"/>
  826.         </xul:vbox>
  827.         <xul:vbox flex="1" class="addonTextBox">
  828.           <xul:hbox class="addon-name-version" xbl:inherits="name, version"/>
  829.           <xul:progressmeter class="extension-item-progress" xbl:inherits="value=progress"/>
  830.           <xul:label class="extension-item-status" xbl:inherits="value=status" value="&installWaiting.label;"/>
  831.         </xul:vbox>
  832.       </xul:hbox>
  833.     </content>  
  834.   </binding>
  835.  
  836.   <binding id="search-textbox" extends="xul:box">
  837.     <resources>
  838.       <stylesheet src="chrome://global/skin/textbox.css"/>
  839.     </resources>
  840.  
  841.     <content align="center">
  842.       <xul:textbox class="plain"
  843.                    xbl:inherits="emptytext,onfocus,onblur,spellcheck,value,maxlength,disabled,size,readonly,tabindex,accesskey"/>
  844.       <xul:button class="searchbox-search" xbl:inherits="disabled" oncommand="this.parentNode.startSearch()"/>
  845.       <xul:button class="searchbox-cancel" xbl:inherits="disabled" hidden="true" oncommand="this.parentNode.clearSearch()"/>
  846.     </content>
  847.  
  848.     <implementation>
  849.       <field name="textbox">
  850.         document.getAnonymousNodes(this)[0];
  851.       </field>
  852.  
  853.       <field name="_searchButton">
  854.         document.getAnonymousElementByAttribute(this, "class", "searchbox-search");
  855.       </field>
  856.  
  857.       <field name="_cancelButton">
  858.         document.getAnonymousElementByAttribute(this, "class", "searchbox-cancel");
  859.       </field>
  860.  
  861.       <property name="value" onget="return this.textbox.value">
  862.         <setter>
  863.           this.textbox.value = val;
  864.           this.setAttribute("value", val);
  865.           this._cancelButton.hidden = !val;
  866.           this._searchButton.hidden = !!val;
  867.         </setter>
  868.       </property>
  869.  
  870.       <property name="disabled" onget="return this.textbox.disabled">
  871.         <setter>
  872.           if (val)
  873.             this.setAttribute("disabled", "true");
  874.           else
  875.             this.removeAttribute("disabled");
  876.         </setter>
  877.       </property>
  878.  
  879.       <constructor>
  880.         if (this.value) {
  881.           this._cancelButton.hidden = false;
  882.           this._searchButton.hidden = true;
  883.         }
  884.       </constructor>
  885.  
  886.       <method name="startSearch">
  887.         <body>
  888.           if (this.value) {
  889.             this._cancelButton.hidden = false;
  890.             this._searchButton.hidden = true;
  891.           }
  892.           this.setAttribute("value", this.value);
  893.         </body>
  894.       </method>
  895.  
  896.       <method name="clearSearch">
  897.         <body>
  898.           this.value = "";
  899.           this.setAttribute("value", "");
  900.           this._cancelButton.hidden = true;
  901.           this._searchButton.hidden = false;
  902.           this.focus();
  903.         </body>
  904.       </method>
  905.  
  906.       <method name="_dispatchCommandEvent">
  907.         <parameter name="aEvent"/>
  908.         <body>
  909.           var event = document.createEvent("commandevent");
  910.           event.initCommandEvent("command", true, true, window, null,
  911.                                  false, false, false, false, aEvent);
  912.           this.dispatchEvent(event);
  913.         </body>
  914.       </method>
  915.     </implementation>
  916.     
  917.     <handlers>
  918.       <handler event="focus" phase="capturing">
  919.         if (event.originalTarget == this)
  920.           this.textbox.focus(); // Forward focus to actual textbox
  921.       </handler>
  922.  
  923.       <handler event="keypress" keycode="VK_ENTER">
  924.         if (event.originalTarget == this.textbox.inputField) {
  925.           this.startSearch();
  926.           this._dispatchCommandEvent(event);
  927.         }
  928.       </handler>
  929.  
  930.       <handler event="keypress" keycode="VK_RETURN">
  931.         if (event.originalTarget == this.textbox.inputField) {
  932.           this.startSearch();
  933.           this._dispatchCommandEvent(event);
  934.         }
  935.       </handler>
  936.  
  937.       <handler event="input">
  938.         this._cancelButton.hidden = true;
  939.         this._searchButton.hidden = false;
  940.       </handler>
  941.  
  942.     </handlers>
  943.   </binding>
  944.  
  945. <!-- based on preferences.xml paneButton -->
  946.   <binding id="viewbutton" extends="chrome://global/content/bindings/radio.xml#radio">
  947.     <resources>
  948.       <stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
  949.     </resources>
  950.     <content>
  951.       <xul:image class="viewButtonIcon" xbl:inherits="src"/>
  952.       <xul:label class="viewButtonLabel" xbl:inherits="value=label"/>
  953.     </content>
  954.     <implementation implements="nsIAccessibleProvider">
  955.       <property name="accessibleType" readonly="true">
  956.         <getter>
  957.           <![CDATA[
  958.             return Components.interfaces.nsIAccessibleProvider.XULListitem;
  959.           ]]>
  960.         </getter>
  961.       </property>
  962.     </implementation>
  963.   </binding>
  964.  
  965. </bindings>
  966.