Bug 1034679 - Add isEnabledStateLocked property to visually disable plug-ins with locked states in Add-ons Manager. r=bsmedberg

This commit is contained in:
Alex Bardas 2014-08-14 10:57:00 -04:00
parent 11805f92cb
commit ca6a5202d0
2 changed files with 23 additions and 1 deletions

View File

@ -5,7 +5,7 @@
#include "nsISupports.idl"
[scriptable, uuid(0e56f04d-cda4-4a55-ab83-e5e29ddd370e)]
[scriptable, uuid(231df043-3a32-43c4-aaac-7ad2da81e84f)]
interface nsIPluginTag : nsISupports
{
// enabledState is stored as one of the following as an integer in prefs,
@ -25,6 +25,11 @@ interface nsIPluginTag : nsISupports
*/
readonly attribute boolean blocklisted;
/**
* true if the state is non-default and locked, false otherwise.
*/
readonly attribute boolean isEnabledStateLocked;
readonly attribute boolean disabled;
readonly attribute boolean clicktoplay;
attribute unsigned long enabledState;

View File

@ -16,6 +16,7 @@
#include "nsPluginLogging.h"
#include "nsNPAPIPlugin.h"
#include "mozilla/Preferences.h"
#include "mozilla/unused.h"
#include <cctype>
#include "mozilla/dom/EncodingUtils.h"
@ -340,6 +341,22 @@ nsPluginTag::GetBlocklisted(bool* aBlocklisted)
return NS_OK;
}
NS_IMETHODIMP
nsPluginTag::GetIsEnabledStateLocked(bool* aIsEnabledStateLocked)
{
*aIsEnabledStateLocked = false;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (NS_WARN_IF(!prefs)) {
return NS_ERROR_FAILURE;
}
unused << prefs->PrefIsLocked(GetStatePrefNameForPlugin(this).get(),
aIsEnabledStateLocked);
return NS_OK;
}
bool
nsPluginTag::IsClicktoplay()
{