Bug 1398972 - Remove plugin doorhanger XBL r=Felipe

MozReview-Commit-ID: 6BI6ChGxQwa

--HG--
extra : rebase_source : a6236a7c325834d87c945cb67560d79bbbda2208
This commit is contained in:
Doug Thayer 2017-10-20 15:01:24 -07:00
Родитель f55615a8df
Коммит a6dea0eb89
5 изменённых файлов: 5 добавлений и 582 удалений

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

@ -2548,518 +2548,4 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
</method>
</implementation>
</binding>
<binding id="plugin-popupnotification-center-item">
<content align="center">
<xul:vbox pack="center" anonid="itemBox" class="itemBox">
<xul:description anonid="center-item-label" class="center-item-label" />
<xul:hbox flex="1" pack="start" align="center" anonid="center-item-warning">
<xul:image anonid="center-item-warning-icon" class="center-item-warning-icon"/>
<xul:label anonid="center-item-warning-label"/>
<xul:label anonid="center-item-link" value="&checkForUpdates;" class="text-link"/>
</xul:hbox>
</xul:vbox>
<xul:vbox pack="center">
<xul:menulist class="center-item-menulist"
anonid="center-item-menulist">
<xul:menupopup>
<xul:menuitem anonid="allownow" value="allownow"
label="&pluginActivateNow.label;" />
<xul:menuitem anonid="allowalways" value="allowalways"
label="&pluginActivateAlways.label;" />
<xul:menuitem anonid="block" value="block"
label="&pluginBlockNow.label;" />
</xul:menupopup>
</xul:menulist>
</xul:vbox>
</content>
<resources>
<stylesheet src="chrome://global/skin/notification.css"/>
</resources>
<implementation>
<constructor><![CDATA[
document.getAnonymousElementByAttribute(this, "anonid", "center-item-label").value = this.action.pluginName;
let curState = "block";
if (this.action.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
if (this.action.pluginPermissionType == Ci.nsIPermissionManager.EXPIRE_SESSION) {
curState = "allownow";
} else {
curState = "allowalways";
}
}
document.getAnonymousElementByAttribute(this, "anonid", "center-item-menulist").value = curState;
let warningString = "";
let linkString = "";
let link = document.getAnonymousElementByAttribute(this, "anonid", "center-item-link");
let url;
let linkHandler;
if (this.action.pluginTag.enabledState == Ci.nsIPluginTag.STATE_DISABLED) {
document.getAnonymousElementByAttribute(this, "anonid", "center-item-menulist").hidden = true;
warningString = gNavigatorBundle.getString("pluginActivateDisabled.label");
linkString = gNavigatorBundle.getString("pluginActivateDisabled.manage");
linkHandler = function(event) {
event.preventDefault();
gPluginHandler.managePlugins();
};
document.getAnonymousElementByAttribute(this, "anonid", "center-item-warning-icon").hidden = true;
} else {
url = this.action.detailsLink;
switch (this.action.blocklistState) {
case Ci.nsIBlocklistService.STATE_NOT_BLOCKED:
document.getAnonymousElementByAttribute(this, "anonid", "center-item-warning").hidden = true;
break;
case Ci.nsIBlocklistService.STATE_BLOCKED:
document.getAnonymousElementByAttribute(this, "anonid", "center-item-menulist").hidden = true;
warningString = gNavigatorBundle.getString("pluginActivateBlocked.label");
linkString = gNavigatorBundle.getString("pluginActivate.learnMore");
break;
case Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE:
warningString = gNavigatorBundle.getString("pluginActivateOutdated.label");
linkString = gNavigatorBundle.getString("pluginActivate.updateLabel");
break;
case Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE:
warningString = gNavigatorBundle.getString("pluginActivateVulnerable.label");
linkString = gNavigatorBundle.getString("pluginActivate.riskLabel");
break;
}
}
document.getAnonymousElementByAttribute(this, "anonid", "center-item-warning-label").value = warningString;
let chromeWin = window.QueryInterface(Ci.nsIDOMChromeWindow);
let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(chromeWin);
if (isWindowPrivate) {
// TODO: temporary compromise of hiding some privacy leaks, remove once bug 892487 is fixed
let allowalways = document.getAnonymousElementByAttribute(this, "anonid", "allowalways");
let block = document.getAnonymousElementByAttribute(this, "anonid", "block");
let allownow = document.getAnonymousElementByAttribute(this, "anonid", "allownow");
allowalways.hidden = curState !== "allowalways";
block.hidden = curState !== "block";
allownow.hidden = curState === "allowalways";
}
if (url || linkHandler) {
link.value = linkString;
if (url) {
link.href = url;
}
if (linkHandler) {
link.addEventListener("click", linkHandler);
}
} else {
link.hidden = true;
}
]]></constructor>
<property name="value">
<getter>
return document.getAnonymousElementByAttribute(this, "anonid",
"center-item-menulist").value;
</getter>
<setter><!-- This should be used only in automated tests -->
document.getAnonymousElementByAttribute(this, "anonid",
"center-item-menulist").value = val;
</setter>
</property>
</implementation>
</binding>
<binding id="click-to-play-plugins-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
<content align="start" style="width: &pluginNotification.width;;">
<xul:vbox flex="1" align="stretch" class="click-to-play-plugins-notification-main-box"
xbl:inherits="popupid">
<xul:hbox class="click-to-play-plugins-notification-description-box" flex="1" align="start">
<xul:description class="click-to-play-plugins-outer-description" flex="1">
<html:span anonid="click-to-play-plugins-notification-description" />
<html:br/>
<xul:label class="text-link click-to-play-plugins-notification-link popup-notification-learnmore-link"
anonid="click-to-play-plugins-notification-link" />
</xul:description>
</xul:hbox>
<xul:grid anonid="click-to-play-plugins-notification-center-box"
class="click-to-play-plugins-notification-center-box">
<xul:columns>
<xul:column flex="1"/>
<xul:column/>
</xul:columns>
<xul:rows>
<children includes="row"/>
<xul:hbox pack="start" anonid="plugin-notification-showbox">
<xul:button label="&pluginNotification.showAll.label;"
accesskey="&pluginNotification.showAll.accesskey;"
class="plugin-notification-showbutton"
oncommand="document.getBindingParent(this)._setState(2)"/>
</xul:hbox>
</xul:rows>
</xul:grid>
<xul:hbox anonid="button-container"
class="click-to-play-plugins-notification-button-container"
pack="center" align="center">
<xul:button anonid="primarybutton"
class="click-to-play-popup-button popup-notification-button"
oncommand="document.getBindingParent(this)._onButton(this)"
flex="1"/>
<xul:button anonid="secondarybutton"
default="true"
highlight="true"
class="click-to-play-popup-button popup-notification-button"
oncommand="document.getBindingParent(this)._onButton(this);"
flex="1"/>
</xul:hbox>
<xul:box hidden="true">
<children/>
</xul:box>
</xul:vbox>
</content>
<resources>
<stylesheet src="chrome://global/skin/notification.css"/>
</resources>
<implementation>
<field name="_states">
({SINGLE: 0, MULTI_COLLAPSED: 1, MULTI_EXPANDED: 2})
</field>
<field name="_primaryButton">
document.getAnonymousElementByAttribute(this, "anonid", "primarybutton");
</field>
<field name="_secondaryButton">
document.getAnonymousElementByAttribute(this, "anonid", "secondarybutton")
</field>
<field name="_buttonContainer">
document.getAnonymousElementByAttribute(this, "anonid", "button-container")
</field>
<field name="_brandShortName">
document.getElementById("bundle_brand").getString("brandShortName")
</field>
<field name="_items">[]</field>
<constructor><![CDATA[
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let sortedActions = [];
for (let action of this.notification.options.pluginData.values()) {
sortedActions.push(action);
}
sortedActions.sort((a, b) => a.pluginName.localeCompare(b.pluginName));
for (let action of sortedActions) {
let item = document.createElementNS(XUL_NS, "row");
item.setAttribute("class", "plugin-popupnotification-centeritem");
item.action = action;
this.appendChild(item);
this._items.push(item);
}
switch (this._items.length) {
case 0:
PopupNotifications._dismiss();
break;
case 1:
this._setState(this._states.SINGLE);
break;
default:
if (this.notification.options.primaryPlugin) {
this._setState(this._states.MULTI_COLLAPSED);
} else {
this._setState(this._states.MULTI_EXPANDED);
}
}
]]></constructor>
<method name="_setState">
<parameter name="state" />
<body><![CDATA[
var grid = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-center-box");
if (this._states.SINGLE == state) {
grid.hidden = true;
this._setupSingleState();
return;
}
let prePath = this.notification.options.principal.URI.prePath;
this._setupDescription("pluginActivateMultiple.message", null, prePath);
var showBox = document.getAnonymousElementByAttribute(this, "anonid", "plugin-notification-showbox");
var dialogStrings = Services.strings.createBundle("chrome://global/locale/dialog.properties");
this._primaryButton.label = dialogStrings.GetStringFromName("button-accept");
this._primaryButton.setAttribute("default", "true");
this._secondaryButton.label = dialogStrings.GetStringFromName("button-cancel");
this._primaryButton.setAttribute("action", "_multiAccept");
this._secondaryButton.setAttribute("action", "_cancel");
grid.hidden = false;
if (this._states.MULTI_COLLAPSED == state) {
for (let child of this.childNodes) {
if (child.tagName != "row") {
continue;
}
child.hidden = this.notification.options.primaryPlugin !=
child.action.permissionString;
}
showBox.hidden = false;
} else {
for (let child of this.childNodes) {
if (child.tagName != "row") {
continue;
}
child.hidden = false;
}
showBox.hidden = true;
}
this._setupLink(null);
]]></body>
</method>
<method name="_setupSingleState">
<body><![CDATA[
var action = this._items[0].action;
var prePath = action.pluginPermissionPrePath;
let chromeWin = window.QueryInterface(Ci.nsIDOMChromeWindow);
let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(chromeWin);
let label, linkLabel, button1, button2;
if (action.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE) {
button1 = {
label: "pluginBlockNow.label",
accesskey: "pluginBlockNow.accesskey",
action: "_singleBlock"
};
button2 = {
label: "pluginContinue.label",
accesskey: "pluginContinue.accesskey",
action: "_singleContinue",
default: true
};
switch (action.blocklistState) {
case Ci.nsIBlocklistService.STATE_NOT_BLOCKED:
label = "pluginEnabled.message";
linkLabel = "pluginActivate.learnMore";
break;
case Ci.nsIBlocklistService.STATE_BLOCKED:
Cu.reportError(Error("Cannot happen!"));
break;
case Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE:
label = "pluginEnabledOutdated.message";
linkLabel = "pluginActivate.updateLabel";
break;
case Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE:
label = "pluginEnabledVulnerable.message";
linkLabel = "pluginActivate.riskLabel"
break;
default:
Cu.reportError(Error("Unexpected blocklist state"));
}
// TODO: temporary compromise, remove this once bug 892487 is fixed
if (isWindowPrivate) {
this._buttonContainer.hidden = true;
}
} else if (action.pluginTag.enabledState == Ci.nsIPluginTag.STATE_DISABLED) {
let linkElement =
document.getAnonymousElementByAttribute(
this, "anonid", "click-to-play-plugins-notification-link");
linkElement.textContent = gNavigatorBundle.getString("pluginActivateDisabled.manage");
linkElement.setAttribute("onclick", "gPluginHandler.managePlugins()");
let descElement = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-description");
descElement.textContent = gNavigatorBundle.getFormattedString(
"pluginActivateDisabled.message", [action.pluginName, this._brandShortName]) + " ";
this._buttonContainer.hidden = true;
return;
} else if (action.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
let descElement = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-description");
descElement.textContent = gNavigatorBundle.getFormattedString(
"pluginActivateBlocked.message", [action.pluginName, this._brandShortName]) + " ";
this._setupLink("pluginActivate.learnMore", action.detailsLink);
this._buttonContainer.hidden = true;
return;
} else {
button1 = {
label: "pluginActivateNow.label",
accesskey: "pluginActivateNow.accesskey",
action: "_singleActivateNow"
};
button2 = {
label: "pluginActivateAlways.label",
accesskey: "pluginActivateAlways.accesskey",
action: "_singleActivateAlways"
};
switch (action.blocklistState) {
case Ci.nsIBlocklistService.STATE_NOT_BLOCKED:
label = "pluginActivate2.message";
linkLabel = "pluginActivate.learnMore";
button2.default = true;
break;
case Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE:
label = "pluginActivateOutdated.message";
linkLabel = "pluginActivate.updateLabel";
button1.default = true;
break;
case Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE:
label = "pluginActivateVulnerable.message";
linkLabel = "pluginActivate.riskLabel"
button1.default = true;
break;
default:
Cu.reportError(Error("Unexpected blocklist state"));
}
// TODO: temporary compromise, remove this once bug 892487 is fixed
if (isWindowPrivate) {
button1.default = true;
this._secondaryButton.hidden = true;
}
}
this._setupDescription(label, action.pluginName, prePath);
this._setupLink(linkLabel, action.detailsLink);
this._primaryButton.label = gNavigatorBundle.getString(button1.label);
this._primaryButton.accessKey = gNavigatorBundle.getString(button1.accesskey);
this._primaryButton.setAttribute("action", button1.action);
this._secondaryButton.label = gNavigatorBundle.getString(button2.label);
this._secondaryButton.accessKey = gNavigatorBundle.getString(button2.accesskey);
this._secondaryButton.setAttribute("action", button2.action);
if (button1.default) {
this._primaryButton.setAttribute("default", "true");
} else if (button2.default) {
this._secondaryButton.setAttribute("default", "true");
}
if (this._primaryButton.hidden) {
this._secondaryButton.setAttribute("alone", "true");
} else if (this._secondaryButton.hidden) {
this._primaryButton.setAttribute("alone", "true");
}
]]></body>
</method>
<method name="_setupDescription">
<parameter name="baseString" />
<parameter name="pluginName" /> <!-- null for the multiple-plugin case -->
<parameter name="prePath" />
<body><![CDATA[
var span = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-description");
while (span.lastChild) {
span.removeChild(span.lastChild);
}
var args = ["__prepath__", this._brandShortName];
if (pluginName) {
args.unshift(pluginName);
}
var bases = gNavigatorBundle.getFormattedString(baseString, args).
split("__prepath__", 2);
span.appendChild(document.createTextNode(bases[0]));
var prePathSpan = document.createElementNS("http://www.w3.org/1999/xhtml", "em");
prePathSpan.appendChild(document.createTextNode(prePath));
span.appendChild(prePathSpan);
span.appendChild(document.createTextNode(bases[1] + " "));
]]></body>
</method>
<method name="_setupLink">
<parameter name="linkString"/>
<parameter name="linkUrl" />
<body><![CDATA[
var link = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-link");
if (!linkString || !linkUrl) {
link.hidden = true;
return;
}
link.hidden = false;
link.textContent = gNavigatorBundle.getString(linkString);
link.href = linkUrl;
]]></body>
</method>
<method name="_onButton">
<parameter name="aButton" />
<body><![CDATA[
let methodName = aButton.getAttribute("action");
this[methodName]();
]]></body>
</method>
<method name="_singleActivateNow">
<body><![CDATA[
gPluginHandler._updatePluginPermission(this.notification,
this._items[0].action,
"allownow");
this._cancel();
]]></body>
</method>
<method name="_singleBlock">
<body><![CDATA[
gPluginHandler._updatePluginPermission(this.notification,
this._items[0].action,
"block");
this._cancel();
]]></body>
</method>
<method name="_singleActivateAlways">
<body><![CDATA[
gPluginHandler._updatePluginPermission(this.notification,
this._items[0].action,
"allowalways");
this._cancel();
]]></body>
</method>
<method name="_singleContinue">
<body><![CDATA[
gPluginHandler._updatePluginPermission(this.notification,
this._items[0].action,
"continue");
this._cancel();
]]></body>
</method>
<method name="_multiAccept">
<body><![CDATA[
for (let item of this._items) {
let action = item.action;
if (action.pluginTag.enabledState == Ci.nsIPluginTag.STATE_DISABLED ||
action.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
continue;
}
gPluginHandler._updatePluginPermission(this.notification,
item.action, item.value);
}
this._cancel();
]]></body>
</method>
<method name="_cancel">
<body><![CDATA[
PopupNotifications._dismiss();
]]></body>
</method>
<method name="_accept">
<parameter name="aEvent" />
<body><![CDATA[
if (aEvent.defaultPrevented)
return;
aEvent.preventDefault();
if (this._primaryButton.getAttribute("default") == "true") {
this._primaryButton.click();
} else if (this._secondaryButton.getAttribute("default") == "true") {
this._secondaryButton.click();
}
]]></body>
</method>
</implementation>
<handlers>
<!-- The _accept method checks for .defaultPrevented so that if focus is in a button,
enter activates the button and not this default action -->
<handler event="keypress" keycode="VK_RETURN" group="system" action="this._accept(event);"/>
</handlers>
</binding>
</bindings>

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

@ -213,11 +213,6 @@ html|*#webRTC-previewVideo {
.popup-notification-icon[popupid="addon-install-restart"] {
list-style-image: url(chrome://browser/skin/addons/addon-install-restart.svg);
}
.popup-notification-icon[popupid="click-to-play-plugins"] {
list-style-image: url(chrome://mozapps/skin/plugins/pluginBlocked.svg);
}
/* OFFLINE APPS */
.popup-notification-icon[popupid*="offline-app-requested"],
@ -232,6 +227,11 @@ html|*#webRTC-previewVideo {
transition: fill 1.5s;
}
.plugin-blocked-icon {
list-style-image: url(chrome://browser/skin/notification-icons/plugin-blocked.svg);
transition: fill 1.5s;
}
#plugin-icon-badge {
list-style-image: url(chrome://browser/skin/notification-icons/plugin-badge.svg);
opacity: 0;

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

@ -1,57 +1,3 @@
#notification-popup[popupid="click-to-play-plugins"] > .panel-arrowcontainer > .panel-arrowcontent {
padding: 0px;
}
.click-to-play-plugins-notification-center-box {
border: 1px solid ThreeDShadow;
margin: 10px;
}
.plugin-popupnotification-centeritem:nth-child(odd) {
background-color: rgba(0,0,0,0.1);
}
.center-item-label {
margin-inline-start: 6px;
margin-bottom: 0;
text-overflow: ellipsis;
}
.center-item-warning-icon {
background-image: url("chrome://mozapps/skin/extensions/alerticon-info-negative.svg");
background-repeat: no-repeat;
width: 16px;
height: 15px;
margin-inline-start: 6px;
}
.click-to-play-plugins-notification-button-container {
background-color: var(--arrowpanel-dimmed);
margin-top: 5px;
display: flex;
}
.click-to-play-popup-button {
width: 50%;
}
.click-to-play-plugins-notification-description-box {
padding: 10px;
}
.click-to-play-plugins-outer-description {
margin-top: 8px;
}
.click-to-play-plugins-notification-link,
.center-item-link {
margin: 0;
}
.click-to-play-plugins-notification-main-box {
width: 100%;
}
.messageImage[value="plugin-hidden"] {
list-style-image: url(chrome://browser/skin/notification-icons/plugin.svg);
}

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

@ -26,7 +26,6 @@
skin/classic/mozapps/extensions/alerticon-info-negative.svg (../../shared/extensions/alerticon-info-negative.svg)
skin/classic/mozapps/extensions/category-legacy.svg (../../shared/extensions/category-legacy.svg)
skin/classic/mozapps/plugins/pluginGeneric.svg (../../shared/extensions/category-plugins.svg)
skin/classic/mozapps/plugins/pluginBlocked.svg (../../shared/plugins/pluginBlocked.svg)
skin/classic/mozapps/plugins/pluginProblem.css (../../shared/plugins/pluginProblem.css)
skin/classic/mozapps/aboutNetworking.css (../../shared/aboutNetworking.css)
#ifndef ANDROID

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

@ -1,8 +0,0 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path d="M6 7h6a2 2 0 0 0 0-4H6a2 2 0 0 0 0 4zm14 0h6a2 2 0 0 0 0-4h-6a2 2 0 0 0 0 4zm8 2H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h11.349A9.987 9.987 0 0 1 30 16.014V11a2 2 0 0 0-2-2z" fill="#ff0039"/>
<circle cx="24" cy="24" r="8" fill="#a4000f"/>
<rect x="18" y="22" width="12" height="4" rx="1" ry="1" fill="#fff"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 620 B