Bug 667201 Front end changes for Bug 545070: plugin-problem UI shouldn't say "click here" r=Neil a=IanN a=comm-aurora.
authorPhilip Chee <philip.chee@gmail.com>
Sat, 30 Jul 2011 17:41:28 +0800
changeset 8321 e8172bb6b4f1427f53967292287d889706283994
parent 8320 789f16509ca9039d7ba3267ee9a286b7dc09f1f7
child 8322 8965e28225cc94daf2bb74646241d90a879f8888
push idunknown
push userunknown
push dateunknown
reviewersNeil, IanN, comm-aurora
bugs667201, 545070
Bug 667201 Front end changes for Bug 545070: plugin-problem UI shouldn't say "click here" r=Neil a=IanN a=comm-aurora.
suite/common/bindings/notification.xml
suite/themes/modern/jar.mn
suite/themes/modern/mozapps/plugins/contentPluginMissing.png
suite/themes/modern/mozapps/plugins/pluginProblem.css
--- a/suite/common/bindings/notification.xml
+++ b/suite/common/bindings/notification.xml
@@ -365,28 +365,35 @@
       <method name="pluginUnavailable">
         <parameter name="aEvent"/>
         <parameter name="aNotification"/>
         <parameter name="aMessage"/>
         <parameter name="aButtons"/>
         <parameter name="aPref"/>
         <body>
           <![CDATA[
+            var plugin = aEvent.target;
             // Since we are expecting also untrusted events, make sure
             // that the target is a plugin.
-            if (!(aEvent.target instanceof Components.interfaces.nsIObjectLoadingContent))
+            if (!(plugin instanceof Components.interfaces.nsIObjectLoadingContent))
               return;
 
+            // Save information on the plugin to give to the plugin finder.
+            var pluginInfo = this.getPluginInfo(plugin);
+            this.missingPlugins[pluginInfo.mimetype] = pluginInfo;
+
+            // Hide the in-content UI if it's too big. The crashed plugin handler already does this.
+            var doc = plugin.ownerDocument;
+            var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
+            if (this.isTooSmall(plugin, overlay))
+              overlay.style.visibility = "hidden";
+
             if (this._prefs.getBoolPref(aPref || "plugins.hide_infobar_for_missing_plugin"))
               return;
 
-            // Save information on the plugin to give to the plugin finder.
-            var pluginInfo = this.getPluginInfo(aEvent.target);
-            this.missingPlugins[pluginInfo.mimetype] = pluginInfo;
-
             var notification;
             var notifications = [
               "blocked-plugins",
               "missing-plugins",
               "carbon-failure-plugins",
               "outdated-plugins",
             ];
 
@@ -597,32 +604,22 @@
             link.setAttribute("value", this._stringBundle.GetStringFromName("crashedpluginsMessage.learnMore"));
             this.addLinkClickCallback(link, this.openHelpPage);
             var description = notification.ownerDocument.getAnonymousElementByAttribute(notification, "anonid", "messageText");
             description.appendChild(link);
           ]]>
         </body>
       </method>
 
-      <method name="handleEvent">
-        <parameter name="aEvent"/>
+      <method name="installMissingPlugins">
         <body>
           <![CDATA[
-            if (aEvent.type == "keypress" && aEvent.keyCode != KeyEvent.DOM_VK_RETURN)
-              return;
-
-            var missingPlugins = {};
-            var pluginInfo = this.getPluginInfo(aEvent.target);
-            missingPlugins[pluginInfo.mimetype] = pluginInfo;
-
             window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
-                              "", "chrome,resizable=yes",
-                              {plugins: missingPlugins, browser: this.activeBrowser});
-            aEvent.preventDefault();
-            aEvent.stopPropagation();
+                              "", "chrome,centerscreen,resizable=yes",
+                              {plugins: this.missingPlugins, browser: this.activeBrowser});
           ]]>
         </body>
       </method>
 
       <method name="playSoundForBlockedPopup">
         <body>
           <![CDATA[
             const kCustomSound = 1;
@@ -1507,21 +1504,16 @@
 
           // Force a style flush, so that we ensure our binding is attached.
           plugin.clientTop;
 
           // Configure the crashed-plugin placeholder.
           var doc = plugin.ownerDocument;
           var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
 
-          // The binding has role="link" here, since missing/disabled/blocked
-          // plugin UI has a onclick handler on the whole thing. This isn't needed
-          // for the plugin-crashed UI, because we use actual HTML links in the text.
-          overlay.removeAttribute("role");
-
           var status;
           var statusDiv = doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus");
 
           if (this.CrashSubmit) {
             // Determine which message to show regarding crash reports.
             if (submittedReport) { // submitReports && !doPrompt, handled in observer
               status = "submitted";
             }
@@ -1672,36 +1664,41 @@
           }];
 
           this.pluginUnavailable(event, notification, message, buttons, pref);
         ]]>
       </handler>
 
       <handler event="PluginNotFound">
         <![CDATA[
+          var plugin  = event.target;
           // For broken non-object plugin tags, register a click handler so
           // that the user can click the plugin replacement to get the new
           // plugin. Object tags can, and often do, deal with that themselves,
           // so don't stomp on the page developers toes.
-          if (event.target instanceof Components.interfaces.nsIObjectLoadingContent &&
-              !(event.target instanceof HTMLObjectElement)) {
-            event.target.addEventListener("click", this, true);
-            event.target.addEventListener("keypress", this, true);
+          if (plugin instanceof Components.interfaces.nsIObjectLoadingContent &&
+              !(plugin instanceof HTMLObjectElement)) {
+            // Force a style flush, so that we ensure our binding is attached.
+            plugin.clientTop;
+            // We don't yet check to see if there's actually an installer available.
+            var doc = plugin.ownerDocument;
+            var installStatus = doc.getAnonymousElementByAttribute(plugin, "class", "installStatus");
+            installStatus.setAttribute("status", "ready");
+            var iconStatus = doc.getAnonymousElementByAttribute(plugin, "class", "icon");
+            iconStatus.setAttribute("status", "ready");
+            var installLink = doc.getAnonymousElementByAttribute(plugin, "class", "installPluginLink");
+            this.addLinkClickCallback(installLink, installMissingPlugins);
           }
 
           var messageString = this._stringBundle.GetStringFromName("missingpluginsMessage.title");
           var buttons = [{
             label: this._stringBundle.GetStringFromName("missingpluginsMessage.button.label"),
             accessKey: this._stringBundle.GetStringFromName("missingpluginsMessage.button.accesskey"),
             popup: null,
-            callback: function openPluginInstallerWizard() {
-              window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
-                                "", "chrome,resizable=yes",
-                                {plugins: this.missingPlugins, browser: this.activeBrowser});
-            }.bind(this)
+            callback: this.installMissingPlugins.bind(this)
           }];
 
           this.pluginUnavailable(event, "missing-plugins", messageString, buttons);
         ]]>
       </handler>
 
       <handler event="PluginBlocklisted">
         <![CDATA[
@@ -1710,38 +1707,35 @@
             label: this._stringBundle.GetStringFromName("blockedpluginsMessage.infoButton.label"),
             accessKey: this._stringBundle.GetStringFromName("blockedpluginsMessage.infoButton.accesskey"),
             popup: null,
             callback: this.openURLPref.bind(this, "extensions.blocklist.detailsURL")
           }, {
             label: this._stringBundle.GetStringFromName("blockedpluginsMessage.searchButton.label"),
             accessKey: this._stringBundle.GetStringFromName("blockedpluginsMessage.searchButton.accesskey"),
             popup: null,
-            callback: function openPluginInstallerWizard() {
-              window.openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul",
-                                "", "chrome,resizable=yes",
-                                {plugins: this.missingPlugins, browser: this.activeBrowser});
-            }.bind(this)
+            callback: this.installMissingPlugins.bind(this)
           }];
 
           this.pluginUnavailable(event, "blocked-plugins", messageString, buttons);
         ]]>
       </handler>
 
       <handler event="PluginDisabled">
         <![CDATA[
+          var plugin  = event.target;
           // Since we are expecting also untrusted events, make sure
           // that the target is a plugin
-          if (event.target instanceof Components.interfaces.nsIObjectLoadingContent &&
+          if (plugin instanceof Components.interfaces.nsIObjectLoadingContent &&
               "toEM" in window) {
-            event.target.addEventListener("click", function(aEvent) {
-              aEvent.preventDefault();
-              aEvent.stopPropagation();
-              window.toEM("addons://list/plugin");
-            }, true);
+            // Force a style flush, so that we ensure our binding is attached.
+            plugin.clientTop;
+            var doc = plugin.ownerDocument;
+            var manageLink = doc.getAnonymousElementByAttribute(plugin, "class", "managePluginsLink");
+            this.addLinkClickCallback(manageLink, window.toEM, "addons://list/plugin");
           }
         ]]>
       </handler>
 
       <handler event="NewPluginInstalled">
         <![CDATA[
           this.missingPlugins = {};
 
--- a/suite/themes/modern/jar.mn
+++ b/suite/themes/modern/jar.mn
@@ -568,16 +568,17 @@ modern.jar:
   skin/modern/mozapps/icons/itemEnabledFader.png                   (mozapps/icons/itemEnabledFader.png)
   skin/modern/mozapps/passwordmgr/key-16.png                       (mozapps/passwordmgr/key-16.png)
   skin/modern/mozapps/passwordmgr/key-64.png                       (mozapps/passwordmgr/key-64.png)
   skin/modern/mozapps/passwordmgr/key.png                          (mozapps/passwordmgr/key.png)
   skin/modern/mozapps/plugins/contentPluginBlocked.png             (mozapps/plugins/contentPluginBlocked.png)
   skin/modern/mozapps/plugins/contentPluginCrashed.png             (mozapps/plugins/contentPluginCrashed.png)
   skin/modern/mozapps/plugins/contentPluginDisabled.png            (mozapps/plugins/contentPluginDisabled.png)
   skin/modern/mozapps/plugins/contentPluginDownload.png            (mozapps/plugins/contentPluginDownload.png)
+  skin/modern/mozapps/plugins/contentPluginMissing.png             (mozapps/plugins/contentPluginMissing.png)
   skin/modern/mozapps/plugins/pluginBlocked.png                    (mozapps/plugins/pluginBlocked.png)
   skin/modern/mozapps/plugins/pluginBlocked-16.png                 (mozapps/plugins/pluginBlocked.png)
   skin/modern/mozapps/plugins/pluginDisabled.png                   (mozapps/plugins/pluginDisabled.png)
   skin/modern/mozapps/plugins/pluginDisabled-16.png                (mozapps/plugins/pluginDisabled-16.png)
   skin/modern/mozapps/plugins/pluginGeneric.png                    (mozapps/plugins/pluginGeneric.png)
   skin/modern/mozapps/plugins/pluginGeneric-16.png                 (mozapps/plugins/pluginGeneric-16.png)
   skin/modern/mozapps/plugins/pluginHelp-16.png                    (mozapps/plugins/pluginHelp-16.png)
   skin/modern/mozapps/plugins/pluginInstallerWizard.css            (mozapps/plugins/pluginInstallerWizard.css)
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..9fb2eac26ed3717c2cdffdfec365c484c537984b
GIT binary patch
literal 1572
zc$@(w2HW|GP)<h;3K|Lk000e1NJLTq001xm001xu1^@s6R|5Hm0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU%#z{m$RCwC#SxZYKR}`*icdP9iH4%EU
z%&Z3kGs*NK;ASM?KL|p|Vj%lK7TF}^FC;q`ZXFkrMRtRj$3V=GY?5tW2r3F{zv_AO
zoyxg#EUUX(+o_&~7Y<c*>()8ndER^Lno23-uHChpH#4W-Oi^A_DN6Gkl-HGbce;Ql
zvY2dfZ)GU1nZ|-5ac|r*FO{i)PG-|I4Izx)m-uQ6p;=7}3qd|#O`*V`yr@MfoI-WH
z;FlH)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3!xa1Y>gueW6uyu*0gb~L<|<X
zdDe0XL$7gGF9xs6wy_tMEDt>4k7|64yKE7Qz#WT~@{@iQP{M`j{b`{Jh>ccP`B@?K
z9TVk1%y}@3ut{=|0HksCmBcc6Sb?IGI1@|XNlc2XR2&T>dASl9*Gb|8FzRrC={&@e
zAOHjTXP}Tqp##}AFgS#zTLfe&@IGsQPg{Rj^MLe%#?^NS>DbGgNM5lQa^+`v;5mQ%
zVXB0wA*Fy$;^(QgP<|D9T|%gr7o5C0JZul-%|lk+Jb+Ef&~iY_zOD!Ae0@uQILr_d
z;OqS;V2XLb!j8zsp47qy+bLQBl1Z`&17Q*J%`64v%kSx?*=&A98wviEXB-?HI7KRe
zt*JwQD9+B#O2Fc3TxgFa=B}VtS6AQO-roL$Tu7U9Y%vR+iD?EV@bH35Sb7~Xx#Ayw
z6`}WIm$C2h^@kh2zm+kF2$}~P{BP(Ywk}RYu>N?Fb7p1S@cqDJ7+WZgoz$h@iu?n$
z%J=%`kxHFW71i{=A5$2(!`5%}y|1fF#D@_&!+p*VYlu5Cd72rE^Rf<KBYi%g!~jDa
z4dorg6}ql7t{(cuS^>kje1sVry^lf*-xnJ_j$O?Z!0R4H7p+Y0!S`LeYu9Z52`~V1
WdyupwJ%7;v0000<MNUMnLSTZDO6Cdx
--- a/suite/themes/modern/mozapps/plugins/pluginProblem.css
+++ b/suite/themes/modern/mozapps/plugins/pluginProblem.css
@@ -63,16 +63,19 @@ html|a {
 
 .icon {
   min-width: 48px;
   min-height: 48px;
   background-position: center;
   background-repeat: no-repeat;
 }
 :-moz-type-unsupported .icon {
+  background-image: url(chrome://mozapps/skin/plugins/contentPluginMissing.png);
+}
+:-moz-type-unsupported .icon[status="ready"] {
   background-image: url(chrome://mozapps/skin/plugins/contentPluginDownload.png);
 }
 :-moz-handler-disabled .icon {
   background-image: url(chrome://mozapps/skin/plugins/contentPluginDisabled.png);
 }
 :-moz-handler-blocked .icon {
   background-image: url(chrome://mozapps/skin/plugins/contentPluginBlocked.png);
 }