Bug 1133000 - Expose the protected-mode toggle in the Addons-manager UI options pane for Flash. r=Unfocused/MattN

--HG--
extra : rebase_source : 6917fdbc19c7b2a03d3a65c1f2d7eff01afc61fd
extra : histedit_source : bcb328b11de86da2e7d84b8b1d730a43e5d515db
This commit is contained in:
Benjamin Smedberg 2015-02-13 14:55:37 -05:00
Родитель f5675dad59
Коммит d4201803b0
6 изменённых файлов: 45 добавлений и 1 удалений

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

@ -229,3 +229,5 @@
<!ENTITY experiment.info.learnmore.accesskey "L">
<!ENTITY experiment.info.changetelemetry "Telemetry Settings">
<!ENTITY experiment.info.changetelemetry.accesskey "T">
<!ENTITY setting.learnmore "Learn More…">

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

@ -39,3 +39,4 @@
<!ENTITY plugin.file "File">
<!ENTITY plugin.mimeTypes "MIME Types">
<!ENTITY plugin.flashProtectedMode.label "Enable Adobe Flash protected mode">

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

@ -74,6 +74,10 @@ setting[type="bool"][localized="true"] {
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-localized-bool");
}
setting[type="bool"]:not([learnmore]) .preferences-learnmore {
visibility: collapse;
}
setting[type="boolint"] {
display: -moz-grid-line;
-moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-boolint");

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

@ -13,4 +13,8 @@
<setting type="control" title="&plugin.mimeTypes;">
<label class="text-list" id="pluginMimeTypes"/>
</setting>
<setting type="bool" pref="dom.ipc.plugins.flash.disable-protected-mode"
inverted="true" title="&plugin.flashProtectedMode.label;"
id="pluginEnableProtectedMode"
learnmore="https://support.mozilla.org/kb/flash-protected-mode-settings" />
</vbox>

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

@ -144,6 +144,8 @@
<xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
</xul:hbox>
<xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
<xul:label class="preferences-learnmore text-link"
onclick="document.getBindingParent(this).openLearnMore()">&setting.learnmore;</xul:label>
</xul:vbox>
<xul:hbox class="preferences-alignment">
<xul:checkbox anonid="input" xbl:inherits="disabled,onlabel,offlabel,label=checkboxlabel" oncommand="inputChanged();"/>
@ -171,6 +173,14 @@
<property name="value" onget="return this.input.checked;" onset="return this.input.setChecked(val);"/>
<property name="inverted" readonly="true" onget="return this.getAttribute('inverted');"/>
<method name="openLearnMore">
<body>
<![CDATA[
window.open(this.getAttribute("learnmore"), "_blank");
]]>
</body>
</method>
</implementation>
</binding>

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

@ -16,6 +16,7 @@ Cu.import("resource://gre/modules/Services.jsm");
const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties";
const STRING_TYPE_NAME = "type.%ID%.name";
const LIST_UPDATED_TOPIC = "plugins-list-updated";
const FLASH_MIME_TYPE = "application/x-shockwave-flash";
Cu.import("resource://gre/modules/Log.jsm");
const LOGGER_ID = "addons.plugins";
@ -85,6 +86,9 @@ var PluginProvider = {
types.push(type.type + (extras ? " (" + extras + ")" : ""));
}
typeLabel.textContent = types.join(",\n");
let showProtectedModePref = canDisableFlashProtectedMode(plugin);
aSubject.getElementById("pluginEnableProtectedMode")
.setAttribute("collapsed", showProtectedModePref ? "" : "true");
});
break;
case LIST_UPDATED_TOPIC:
@ -276,6 +280,19 @@ var PluginProvider = {
}
};
function isFlashPlugin(aPlugin) {
for (let type of aPlugin.pluginMimeTypes) {
if (type.type == FLASH_MIME_TYPE) {
return true;
}
}
return false;
}
// Protected mode is win32-only, not win64
function canDisableFlashProtectedMode(aPlugin) {
return isFlashPlugin(aPlugin) && Services.appinfo.XPCOMABI == "x86-msvc";
}
/**
* The PluginWrapper wraps a set of nsIPluginTags to provide the data visible to
* public callers through the API.
@ -488,10 +505,16 @@ function PluginWrapper(aId, aName, aDescription, aTags) {
}
return permissions;
});
this.__defineGetter__("optionsType", function() {
if (canDisableFlashProtectedMode(this)) {
return AddonManager.OPTIONS_TYPE_INLINE;
}
return AddonManager.OPTIONS_TYPE_INLINE_INFO;
});
}
PluginWrapper.prototype = {
optionsType: AddonManager.OPTIONS_TYPE_INLINE_INFO,
optionsURL: "chrome://mozapps/content/extensions/pluginPrefs.xul",
get updateDate() {