mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Added a CanHandleContentType to identify if a given instantiated docShell can handle the requested document type.
This commit is contained in:
parent
2550bd6aa3
commit
01e6506fdf
@ -158,6 +158,17 @@ NS_IMETHODIMP nsDocShellBase::SetParent(nsIDocShell* parent)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::CanHandleContentType(const PRUnichar* contentType,
|
||||
PRBool* canHandle)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(canHandle);
|
||||
|
||||
NS_WARN_IF_FALSE(PR_FALSE, "Subclasses should override this method!!!!");
|
||||
|
||||
*canHandle = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellBase::GetPrefs(nsIPref** prefs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(prefs);
|
||||
|
@ -93,6 +93,11 @@ interface nsIDocShell : nsISupports
|
||||
*/
|
||||
attribute nsIDocShell parent;
|
||||
|
||||
/*
|
||||
Returns true if the given docshell can handle the requested content type.
|
||||
*/
|
||||
boolean canHandleContentType(in wstring contentType);
|
||||
|
||||
/*
|
||||
Prefs to use for the DocShell.
|
||||
*/
|
||||
|
@ -21,6 +21,7 @@
|
||||
*/
|
||||
|
||||
#include "nsHTMLDocShell.h"
|
||||
#include "nsString.h"
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsHTMLDocShell: Object Management
|
||||
@ -61,6 +62,20 @@ NS_IMPL_ISUPPORTS7(nsHTMLDocShell, nsIDocShell, nsIHTMLDocShell,
|
||||
// nsHTMLDocShell::nsIDocShell Overrides
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsHTMLDocShell::CanHandleContentType(const PRUnichar* contentType,
|
||||
PRBool* canHandle)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(canHandle);
|
||||
|
||||
nsAutoString aType(contentType);
|
||||
|
||||
if(aType.EqualsIgnoreCase("text/html"))
|
||||
*canHandle = PR_TRUE;
|
||||
else
|
||||
*canHandle = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsHTMLDocShell::nsIHTMLDocShell
|
||||
//*****************************************************************************
|
||||
|
@ -31,6 +31,9 @@ class nsHTMLDocShell : public nsDocShellBase, public nsIHTMLDocShell
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CanHandleContentType(const PRUnichar* contentType, PRBool* canHandle);
|
||||
|
||||
|
||||
NS_DECL_NSIHTMLDOCSHELL
|
||||
|
||||
static NS_METHOD Create(nsISupports* aOuter, const nsIID& aIID, void** ppv);
|
||||
|
Loading…
Reference in New Issue
Block a user