/* boolean canHandleContent (in string aContentType, in PRBool aIsContentPreferred, out string aDesiredContentType); */ NS_IMETHODIMP CWebBrowserContainer::CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval) { *_retval = PR_FALSE; *aDesiredContentType = nsnull; if (aContentType) { nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mOwner->mWebBrowser)); nsCOMPtr<nsIWebNavigationInfo> webNavInfo( do_GetService("@mozilla.org/webnavigation-info;1")); if (webNavInfo) { PRUint32 canHandle; nsresult rv = webNavInfo->IsTypeSupported(nsDependentCString(aContentType), webNav, &canHandle); NS_ENSURE_SUCCESS(rv, rv); *_retval = (canHandle != nsIWebNavigationInfo::UNSUPPORTED); } } return NS_OK; }
NS_IMETHODIMP EmbedContentListener::CanHandleContent(const char *aContentType, PRBool aIsContentPreferred, char **aDesiredContentType, PRBool *_retval) { *_retval = PR_FALSE; *aDesiredContentType = nsnull; if (aContentType) { nsCOMPtr<nsIWebNavigationInfo> webNavInfo( do_GetService(NS_WEBNAVIGATION_INFO_CONTRACTID)); if (webNavInfo) { PRUint32 canHandle; nsresult rv = webNavInfo->IsTypeSupported(nsDependentCString(aContentType), mOwner ? mOwner->mNavigation.get() : nsnull, &canHandle); NS_ENSURE_SUCCESS(rv, rv); *_retval = (canHandle != nsIWebNavigationInfo::UNSUPPORTED); } } return NS_OK; }