Bug 888292 - De-emphasize the plugin icon in the address bar when it doesn't need to catch the user's attention. With this change, the only time the icon will be "alert blue" is when a plugin is click-to-activate and it's too small to show the overlay inline in the page. Icons provided by shorlander. ui-review=lco r=jaws

--HG--
extra : rebase_source : 29f8c8ad4fd0234f1d2bf14451416ac7f744c6fb
This commit is contained in:
Benjamin Smedberg 2013-07-19 10:02:48 -04:00
parent 5bc7d39cbd
commit c5d1e4d1ad
22 changed files with 147 additions and 27 deletions

View File

@ -250,6 +250,7 @@ var gPluginHandler = {
}
}
let shouldShowNotification = false;
let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document);
switch (eventType) {
@ -275,7 +276,7 @@ var gPluginHandler = {
case "PluginBlocklisted":
case "PluginOutdated":
this._showClickToPlayNotification(browser);
shouldShowNotification = true;
break;
case "PluginVulnerableUpdatable":
@ -297,7 +298,7 @@ var gPluginHandler = {
let vulnerabilityText = doc.getAnonymousElementByAttribute(plugin, "anonid", "vulnerabilityStatus");
vulnerabilityText.textContent = vulnerabilityString;
}
this._showClickToPlayNotification(browser);
shouldShowNotification = true;
break;
case "PluginPlayPreview":
@ -307,12 +308,12 @@ var gPluginHandler = {
case "PluginDisabled":
let manageLink = doc.getAnonymousElementByAttribute(plugin, "class", "managePluginsLink");
this.addLinkClickCallback(manageLink, "managePlugins");
this._showClickToPlayNotification(browser);
shouldShowNotification = true;
break;
case "PluginInstantiated":
case "PluginRemoved":
this._showClickToPlayNotification(browser);
shouldShowNotification = true;
break;
}
@ -322,6 +323,12 @@ var gPluginHandler = {
if (overlay != null && this.isTooSmall(plugin, overlay))
overlay.style.visibility = "hidden";
}
// Only show the notification after we've done the isTooSmall check, so
// that the notification can decide whether to show the "alert" icon
if (shouldShowNotification) {
this._showClickToPlayNotification(browser);
}
},
isKnownPlugin: function PH_isKnownPlugin(objLoadingContent) {
@ -754,6 +761,7 @@ var gPluginHandler = {
let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
let contentWindow = aBrowser.contentWindow;
let contentDoc = aBrowser.contentDocument;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let plugins = cwu.plugins;
@ -764,12 +772,23 @@ var gPluginHandler = {
return;
}
let haveVulnerablePlugin = plugins.some(function(plugin) {
let icon = 'plugins-notification-icon';
for (let plugin of plugins) {
let fallbackType = plugin.pluginFallbackType;
return fallbackType == plugin.PLUGIN_VULNERABLE_UPDATABLE ||
fallbackType == plugin.PLUGIN_VULNERABLE_NO_UPDATE ||
fallbackType == plugin.PLUGIN_BLOCKLISTED;
});
if (fallbackType == plugin.PLUGIN_VULNERABLE_UPDATABLE ||
fallbackType == plugin.PLUGIN_VULNERABLE_NO_UPDATE ||
fallbackType == plugin.PLUGIN_BLOCKLISTED) {
icon = 'blocked-plugins-notification-icon';
break;
}
if (fallbackType == plugin.PLUGIN_CLICK_TO_PLAY) {
let overlay = contentDoc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
if (!overlay || overlay.style.visibility == 'hidden') {
icon = 'alert-plugins-notification-icon';
}
}
}
let dismissed = notification ? notification.dismissed : true;
if (aPrimaryPlugin)
dismissed = false;
@ -784,7 +803,6 @@ var gPluginHandler = {
eventCallback: this._clickToPlayNotificationEventCallback,
primaryPlugin: primaryPluginPermission
};
let icon = haveVulnerablePlugin ? "blocked-plugins-notification-icon" : "plugins-notification-icon";
PopupNotifications.show(aBrowser, "click-to-play-plugins",
"", icon,
null, null, options);

View File

@ -505,6 +505,7 @@
<image id="webapps-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="plugins-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="web-notifications-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="alert-plugins-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="blocked-plugins-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="plugin-install-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="mixed-content-blocked-notification-icon" class="notification-anchor-icon" role="button"/>

View File

@ -1285,11 +1285,33 @@ toolbar[iconsize="small"] #webrtc-status-button {
}
#plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric-16.png);
list-style-image: url(chrome://browser/skin/notification-pluginNormal.png);
}
#alert-plugins-notification-icon {
list-style-image: url(chrome://browser/skin/notification-pluginAlert.png);
}
#blocked-plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/notifyPluginBlocked.png);
list-style-image: url(chrome://browser/skin/notification-pluginBlocked.png);
}
#plugins-notification-icon,
#alert-plugins-notification-icon,
#blocked-plugins-notification-icon {
-moz-image-region: rect(0, 16px, 16px, 0);
}
#plugins-notification-icon:hover,
#alert-plugins-notification-icon:hover,
#blocked-plugins-notification-icon:hover {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
#plugins-notification-icon:active,
#alert-plugins-notification-icon:active,
#blocked-plugins-notification-icon:active {
-moz-image-region: rect(0, 48px, 16px, 32px);
}
#plugin-install-notification-icon {

View File

@ -235,3 +235,6 @@ browser.jar:
#endif
skin/classic/browser/webapps-16.png
skin/classic/browser/webapps-64.png
skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
skin/classic/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png)

View File

@ -3144,16 +3144,64 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
}
#plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric-16.png);
list-style-image: url(chrome://browser/skin/notification-pluginNormal.png);
}
#alert-plugins-notification-icon {
list-style-image: url(chrome://browser/skin/notification-pluginAlert.png);
}
#blocked-plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/notifyPluginBlocked.png);
list-style-image: url(chrome://browser/skin/notification-pluginBlocked.png);
}
#plugins-notification-icon,
#alert-plugins-notification-icon,
#blocked-plugins-notification-icon {
-moz-image-region: rect(0, 16px, 16px, 0);
}
#plugins-notification-icon:hover,
#alert-plugins-notification-icon:hover,
#blocked-plugins-notification-icon:hover {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
#plugins-notification-icon:active,
#alert-plugins-notification-icon:active,
#blocked-plugins-notification-icon:active {
-moz-image-region: rect(0, 48px, 16px, 32px);
}
@media (min-resolution: 2dppx) {
#plugins-notification-icon {
list-style-image: url(chrome://browser/skin/notification-pluginNormal@2x.png);
}
#alert-plugins-notification-icon {
list-style-image: url(chrome://browser/skin/notification-pluginAlert@2x.png);
}
#blocked-plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/pluginBlocked.png);
list-style-image: url(chrome://browser/skin/notification-pluginBlocked@2x.png);
}
#plugins-notification-icon,
#alert-plugins-notification-icon,
#blocked-plugins-notification-icon {
-moz-image-region: rect(0, 32px, 32px, 0);
}
#plugins-notification-icon:hover,
#alert-plugins-notification-icon:hover,
#blocked-plugins-notification-icon:hover {
-moz-image-region: rect(0, 64px, 32px, 32px);
}
#plugins-notification-icon:active,
#alert-plugins-notification-icon:active,
#blocked-plugins-notification-icon:active {
-moz-image-region: rect(0, 96px, 32px, 64px);
}
}

View File

@ -331,6 +331,12 @@ browser.jar:
skin/classic/browser/webapps-16.png
skin/classic/browser/webapps-16@2x.png
skin/classic/browser/webapps-64.png
skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
skin/classic/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png)
skin/classic/browser/notification-pluginNormal@2x.png (../shared/plugins/notification-pluginNormal@2x.png)
skin/classic/browser/notification-pluginAlert@2x.png (../shared/plugins/notification-pluginAlert@2x.png)
skin/classic/browser/notification-pluginBlocked@2x.png (../shared/plugins/notification-pluginBlocked@2x.png)
% override chrome://browser/skin/keyhole-circle.png chrome://browser/skin/lion/keyhole-circle.png os=Darwin osversion>=10.7
% override chrome://browser/skin/Toolbar.png chrome://browser/skin/lion/Toolbar.png os=Darwin osversion>=10.7

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

View File

@ -2537,11 +2537,33 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
}
#plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric-16.png);
list-style-image: url(chrome://browser/skin/notification-pluginNormal.png);
}
#alert-plugins-notification-icon {
list-style-image: url(chrome://browser/skin/notification-pluginAlert.png);
}
#blocked-plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/notifyPluginBlocked.png);
list-style-image: url(chrome://browser/skin/notification-pluginBlocked.png);
}
#plugins-notification-icon,
#alert-plugins-notification-icon,
#blocked-plugins-notification-icon {
-moz-image-region: rect(0, 16px, 16px, 0);
}
#plugins-notification-icon:hover,
#alert-plugins-notification-icon:hover,
#blocked-plugins-notification-icon:hover {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
#plugins-notification-icon:active,
#alert-plugins-notification-icon:active,
#blocked-plugins-notification-icon:active {
-moz-image-region: rect(0, 48px, 16px, 32px);
}
#plugin-install-notification-icon {

View File

@ -72,6 +72,9 @@ browser.jar:
skin/classic/browser/urlbar-history-dropmarker.png
skin/classic/browser/webapps-16.png
skin/classic/browser/webapps-64.png
skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
skin/classic/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png)
skin/classic/browser/webRTC-shareDevice-16.png
skin/classic/browser/webRTC-shareDevice-64.png
skin/classic/browser/webRTC-sharingDevice-16.png
@ -326,6 +329,9 @@ browser.jar:
skin/classic/aero/browser/urlbar-history-dropmarker.png
skin/classic/aero/browser/webapps-16.png
skin/classic/aero/browser/webapps-64.png
skin/classic/aero/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
skin/classic/aero/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
skin/classic/aero/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png)
skin/classic/aero/browser/webRTC-shareDevice-16.png
skin/classic/aero/browser/webRTC-shareDevice-64.png
skin/classic/aero/browser/webRTC-sharingDevice-16.png

View File

@ -74,8 +74,10 @@
</content>
<implementation>
<constructor>
// Notify browser-plugins.js that we were attached
this.dispatchEvent(new CustomEvent("PluginBindingAttached"));
// Notify browser-plugins.js that we were attached, on a delay because
// this binding doesn't complete layout until the constructor
// completes.
setTimeout(() => { this.dispatchEvent(new CustomEvent("PluginBindingAttached")) }, 0);
</constructor>
</implementation>
</binding>

View File

@ -29,10 +29,8 @@ toolkit.jar:
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key-16.png)
+ skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
+ skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
+ skin/classic/mozapps/plugins/notifyPluginBlocked.png (plugins/pluginBlocked-16.png)
+ skin/classic/mozapps/plugins/notifyPluginCrashed.png (plugins/pluginGeneric-16.png)
+ skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/pluginGeneric-16.png)
+ skin/classic/mozapps/plugins/notifyPluginOutdated.png (plugins/pluginBlocked-16.png)
+ skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
+ skin/classic/mozapps/plugins/pluginDisabled.png (plugins/pluginDisabled.png)
+ skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

View File

@ -63,10 +63,8 @@ toolkit.jar:
skin/classic/mozapps/plugins/contentPluginMissing.png (plugins/contentPluginMissing.png)
skin/classic/mozapps/plugins/contentPluginClickToPlay.png (plugins/contentPluginClickToPlay.png)
skin/classic/mozapps/plugins/contentPluginClickToPlayPlain.png (plugins/contentPluginClickToPlayPlain.png)
skin/classic/mozapps/plugins/notifyPluginBlocked.png (plugins/pluginBlocked-16.png)
skin/classic/mozapps/plugins/notifyPluginCrashed.png (plugins/notifyPluginGeneric.png)
skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/notifyPluginGeneric.png)
skin/classic/mozapps/plugins/notifyPluginOutdated.png (plugins/notifyPluginGeneric.png)
skin/classic/mozapps/plugins/pluginProblem.css (plugins/pluginProblem.css)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginDisabled.png (plugins/pluginDisabled.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

View File

@ -67,10 +67,8 @@ toolkit.jar:
skin/classic/mozapps/plugins/contentPluginMissing.png (plugins/contentPluginMissing.png)
skin/classic/mozapps/plugins/contentPluginClickToPlay.png (plugins/contentPluginClickToPlay.png)
skin/classic/mozapps/plugins/contentPluginClickToPlayPlain.png (plugins/contentPluginClickToPlayPlain.png)
skin/classic/mozapps/plugins/notifyPluginBlocked.png (plugins/pluginBlocked-16.png)
skin/classic/mozapps/plugins/notifyPluginCrashed.png (plugins/pluginGeneric-16.png)
skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/pluginGeneric-16.png)
skin/classic/mozapps/plugins/notifyPluginOutdated.png (plugins/pluginBlocked-16.png)
skin/classic/mozapps/plugins/pluginProblem.css (plugins/pluginProblem.css)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginDisabled.png (plugins/pluginDisabled.png)
@ -150,10 +148,8 @@ toolkit.jar:
skin/classic/aero/mozapps/plugins/contentPluginMissing.png (plugins/contentPluginMissing.png)
skin/classic/aero/mozapps/plugins/contentPluginClickToPlay.png (plugins/contentPluginClickToPlay.png)
skin/classic/aero/mozapps/plugins/contentPluginClickToPlayPlain.png (plugins/contentPluginClickToPlayPlain.png)
skin/classic/aero/mozapps/plugins/notifyPluginBlocked.png (plugins/pluginBlocked-16-aero.png)
skin/classic/aero/mozapps/plugins/notifyPluginCrashed.png (plugins/pluginGeneric-16-aero.png)
skin/classic/aero/mozapps/plugins/notifyPluginGeneric.png (plugins/pluginGeneric-16-aero.png)
skin/classic/aero/mozapps/plugins/notifyPluginOutdated.png (plugins/pluginBlocked-16-aero.png)
skin/classic/aero/mozapps/plugins/pluginProblem.css (plugins/pluginProblem.css)
skin/classic/aero/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric-aero.png)
skin/classic/aero/mozapps/plugins/pluginDisabled.png (plugins/pluginDisabled-aero.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B