Bug 819992 - Only open the click-to-play doorhanger once per window per session. Use the red blocked plugin icon and flash the icon to bring extra attention. r=dao

This commit is contained in:
Jared Wein 2012-12-11 22:41:32 -05:00
Родитель 0045689f9f
Коммит 8e2e5f06a2
7 изменённых файлов: 71 добавлений и 5 удалений

Просмотреть файл

@ -251,6 +251,7 @@ var gPluginHandler = {
}
},
_notificationDisplayedOnce: false,
handlePluginScripted: function PH_handlePluginScripted(aBrowser) {
let contentWindow = aBrowser.contentWindow;
if (!contentWindow)
@ -278,9 +279,10 @@ var gPluginHandler = {
});
let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
if (notification && !haveVisibleCTPPlugin) {
if (notification && !haveVisibleCTPPlugin && !this._notificationDisplayedOnce) {
notification.dismissed = false;
PopupNotifications._update(notification.anchorElement);
this._notificationDisplayedOnce = true;
}
aBrowser._pluginScriptedState = PLUGIN_SCRIPTED_STATE_DONE;
@ -643,8 +645,9 @@ var gPluginHandler = {
let notification = PopupNotifications.getNotification("click-to-play-plugins", aBrowser);
let dismissed = notification ? notification.dismissed : true;
let options = { dismissed: dismissed, centerActions: centerActions };
let icon = haveVulnerablePlugin ? "blocked-plugins-notification-icon" : "plugins-notification-icon"
PopupNotifications.show(aBrowser, "click-to-play-plugins",
messageString, "plugins-notification-icon",
messageString, icon,
mainAction, secondaryActions, options);
},

Просмотреть файл

@ -557,6 +557,7 @@
<image id="password-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="webapps-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="plugins-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="blocked-plugins-notification-icon" class="notification-anchor-icon" role="button"/>
</box>
<!-- Use onclick instead of normal popup= syntax since the popup
code fires onmousedown, and hence eats our favicon drag events.

Просмотреть файл

@ -23,11 +23,15 @@ function test() {
gTestBrowser.addEventListener("load", pageLoad, true);
gTestBrowser.addEventListener("PluginScripted", pluginScripted, true);
// This list is iterated in reverse order, since it uses Array.pop to get the next test.
gNextTestList = [
{ func: testExpectPopupPart1,
// Doesn't show a popup since not the first instance of a small plugin
{ func: testExpectNoPopupPart1,
url: gHttpTestRoot + "plugin_test_scriptedPopup1.html" },
{ func: testExpectPopupPart1,
// Doesn't show a popup since not the first instance of a small plugin
{ func: testExpectNoPopupPart1,
url: gHttpTestRoot + "plugin_test_scriptedPopup2.html" },
// Shows a popup since it is the first instance of a small plugin
{ func: testExpectPopupPart1,
url: gHttpTestRoot + "plugin_test_scriptedPopup3.html" },
{ func: testExpectNoPopupPart1,

Просмотреть файл

@ -1271,6 +1271,23 @@ toolbar[iconsize="small"] #feed-button {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric-16.png);
}
#blocked-plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/notifyPluginBlocked.png);
}
#blocked-plugins-notification-icon[showing] {
animation: pluginBlockedNotification 500ms ease 0s 5 alternate both;
}
@keyframes pluginBlockedNotification {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#webRTC-notification-icon {
list-style-image: url(chrome://browser/skin/webRTC-shareDevice-16.png);
}

Просмотреть файл

@ -3049,6 +3049,30 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
#plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric-16.png);
}
#blocked-plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/notifyPluginBlocked.png);
}
@media (min-resolution: 2dppx) {
#blocked-plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/pluginBlocked.png);
}
}
#blocked-plugins-notification-icon[showing] {
animation: pluginBlockedNotification 500ms ease 0s 5 alternate both;
}
@keyframes pluginBlockedNotification {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@media (min-resolution: 2dppx) {
#plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric.png);

Просмотреть файл

@ -2400,6 +2400,23 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://mozapps/skin/plugins/pluginGeneric-16.png);
}
#blocked-plugins-notification-icon {
list-style-image: url(chrome://mozapps/skin/plugins/notifyPluginBlocked.png);
}
#blocked-plugins-notification-icon[showing] {
animation: pluginBlockedNotification 500ms ease 0s 5 alternate both;
}
@keyframes pluginBlockedNotification {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#webRTC-notification-icon {
list-style-image: url(chrome://browser/skin/webRTC-shareDevice-16.png);
}

Просмотреть файл

@ -60,7 +60,7 @@ toolkit.jar:
skin/classic/mozapps/plugins/contentPluginDownload.png (plugins/contentPluginDownload.png)
skin/classic/mozapps/plugins/contentPluginMissing.png (plugins/contentPluginMissing.png)
skin/classic/mozapps/plugins/contentPluginClickToPlay.png (plugins/contentPluginClickToPlay.png)
skin/classic/mozapps/plugins/notifyPluginBlocked.png (plugins/notifyPluginGeneric.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)