Ability to force always asking before opening a helper app.
b = 84241 r = vishy sr = mscott a = asa git-svn-id: svn://10.0.0.236/trunk@96520 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
33eace628c
commit
49e70d2f2a
@ -80,6 +80,8 @@ pref("browser.toolbars.showbutton.net2phone", true);
|
||||
pref("browser.toolbars.showbutton.print", true);
|
||||
pref("browser.toolbars.showbutton.search", true);
|
||||
|
||||
pref("browser.helperApps.alwaysAsk.force", false);
|
||||
|
||||
pref("accessibility.browsewithcaret", false);
|
||||
pref("accessibility.usetexttospeech", "");
|
||||
pref("accessibility.usebrailledisplay", "");
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
||||
// used to manage our in memory data source of helper applications
|
||||
#include "nsRDFCID.h"
|
||||
@ -65,6 +67,8 @@
|
||||
#include "nsDecodeAppleFile.h"
|
||||
#endif // XP_MAC
|
||||
|
||||
const char *FORCE_ALWAYS_ASK_PREF = "browser.helperApps.alwaysAsk.force";
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID);
|
||||
|
||||
@ -838,12 +842,24 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest *request, nsISuppo
|
||||
httpChannel->SetApplyConversion( PR_FALSE );
|
||||
}
|
||||
|
||||
PRBool forceAlwaysAsk = PR_TRUE;
|
||||
nsCOMPtr<nsIPrefService> prefs =
|
||||
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(prefs, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = prefBranch->GetBoolPref(FORCE_ALWAYS_ASK_PREF, &forceAlwaysAsk);
|
||||
}
|
||||
|
||||
// now that the temp file is set up, find out if we need to invoke a dialog asking the user what
|
||||
// they want us to do with this content...
|
||||
|
||||
PRBool alwaysAsk = PR_FALSE;
|
||||
mMimeInfo->GetAlwaysAskBeforeHandling(&alwaysAsk);
|
||||
PRBool alwaysAsk = PR_TRUE;
|
||||
if (forceAlwaysAsk)
|
||||
alwaysAsk = PR_TRUE;
|
||||
else
|
||||
mMimeInfo->GetAlwaysAskBeforeHandling(&alwaysAsk);
|
||||
if (alwaysAsk)
|
||||
{
|
||||
// do this first! make sure we don't try to take an action until the user tells us what they want to do
|
||||
|
||||
@ -104,7 +104,21 @@
|
||||
var appPath = handlerInfo.appPath;
|
||||
if (appPath != undefined)
|
||||
gAppPath.value = appPath;
|
||||
gAskBeforeOpen.checked = handlerInfo.alwaysAsk == "true" ? true : false;
|
||||
|
||||
var prefs = Components.classes["@mozilla.org/preferences;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var forceAlwaysAsk = prefs.
|
||||
getBoolPref("browser.helperApps.alwaysAsk.force");
|
||||
|
||||
if (forceAlwaysAsk)
|
||||
{
|
||||
gAskBeforeOpen.checked = true;
|
||||
gAskBeforeOpen.disabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
gAskBeforeOpen.checked = handlerInfo.alwaysAsk == "true" ? true : false;
|
||||
}
|
||||
|
||||
gContentType.setAttribute("value", handlerInfo.description);
|
||||
gIcon.setAttribute("src", handlerInfo.largeIconURL);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user