зеркало из https://github.com/mozilla/pjs.git
Convert nsIDocumentCharsetInfo to IDL so we can get rid of more bits of nsBrowse
rInstance. bug=46200, r=erik@netscape.com, r=smfr, a=alecf.
This commit is contained in:
Родитель
53c89d5ecc
Коммит
34dc58df87
|
@ -46,6 +46,7 @@
|
|||
#include "nsIHTTPEventSink.h"
|
||||
#include "nsISecurityEventSink.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsDocumentCharsetInfoCID.h"
|
||||
|
||||
// Local Includes
|
||||
#include "nsDocShell.h"
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
nsCharsetDetectionAdaptorCID.h
|
||||
nsDetectionConfident.h
|
||||
nsICharsetDetectionAdaptor.h
|
||||
nsICharsetDetectionObserver.h
|
||||
nsICharsetDetector.h
|
||||
nsIMetaCharsetService.h
|
||||
nsIStringCharsetDetector.h
|
||||
nsIXMLEncodingService.h
|
||||
nsMetaCharsetCID.h
|
||||
nsXMLEncodingCID.h
|
||||
nsIDocumentCharsetInfo.h
|
|
@ -0,0 +1 @@
|
|||
nsIDocumentCharsetInfo.idl
|
|
@ -28,9 +28,14 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MODULE = chardet
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIDocumentCharsetInfo.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsCharsetDetectionAdaptorCID.h \
|
||||
nsDetectionConfident.h \
|
||||
nsDocumentCharsetInfoCID.h \
|
||||
nsICharsetDetectionAdaptor.h \
|
||||
nsICharsetDetectionObserver.h \
|
||||
nsICharsetDetector.h \
|
||||
|
@ -39,7 +44,6 @@ EXPORTS = \
|
|||
nsIXMLEncodingService.h \
|
||||
nsMetaCharsetCID.h \
|
||||
nsXMLEncodingCID.h \
|
||||
nsIDocumentCharsetInfo.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
|
|
@ -21,10 +21,14 @@
|
|||
|
||||
DEPTH=..\..\..
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIDocumentCharsetInfo.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsCharsetDetectionAdaptorCID.h \
|
||||
nsDetectionConfident.h \
|
||||
nsDocumentCharsetInfoCID.h \
|
||||
nsICharsetDetectionAdaptor.h \
|
||||
nsICharsetDetectionObserver.h \
|
||||
nsICharsetDetector.h \
|
||||
|
@ -33,7 +37,6 @@ EXPORTS = \
|
|||
nsIXMLEncodingService.h \
|
||||
nsMetaCharsetCID.h \
|
||||
nsXMLEncodingCID.h \
|
||||
nsIDocumentCharsetInfo.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE=chardet
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef nsDocumentCharsetInfoCID_h__
|
||||
#define nsDocumentCharsetInfoCID_h__
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#define NS_DOCUMENTCHARSETINFO_CONTRACTID "@mozilla.org/document-charset-info;1"
|
||||
|
||||
// {D25E0511-2BAE-11d4-9D10-0050040007B2}
|
||||
#define NS_DOCUMENTCHARSETINFO_CID \
|
||||
{0xd25e0511, 0x2bae, 0x11d4, {0x9d, 0x10, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}}
|
||||
|
||||
#endif // nsDocumentCharsetInfoCID_h__
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "nsIAtom.idl"
|
||||
|
||||
// XXX doc me
|
||||
// XXX mark the right params "const"
|
||||
|
||||
[scriptable, uuid(2d40b291-01e1-11d4-9d0e-0050040007b2)]
|
||||
interface nsIDocumentCharsetInfo : nsISupports
|
||||
{
|
||||
attribute nsIAtom forcedCharset;
|
||||
|
||||
attribute boolean forcedDetector;
|
||||
|
||||
attribute nsIAtom parentCharset;
|
||||
};
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsXMLEncodingCID.h"
|
||||
#include "nsCharsetDetectionAdaptorCID.h"
|
||||
#include "nsDocumentCharsetInfo.h"
|
||||
#include "nsDocumentCharsetInfoCID.h"
|
||||
|
||||
#include "nsPSMDetectors.h"
|
||||
|
||||
|
@ -239,7 +240,7 @@ static Components gComponents[] = {
|
|||
{ "Meta Charset", &kMetaCharsetCID,
|
||||
NS_META_CHARSET_CONTRACTID, },
|
||||
{ "Document Charset Info", &kDocumentCharsetInfoCID,
|
||||
NS_DOCUMENTCHARSETINFO_PID, },
|
||||
NS_DOCUMENTCHARSETINFO_CONTRACTID, },
|
||||
{ "XML Encoding", &kXMLEncodingCID,
|
||||
NS_XML_ENCODING_CONTRACTID, },
|
||||
{ "Charset Detection Adaptor", &kCharsetDetectionAdaptorCID,
|
||||
|
|
|
@ -48,7 +48,6 @@ public:
|
|||
|
||||
NS_IMETHOD SetParentCharset(nsIAtom * aCharset);
|
||||
NS_IMETHOD GetParentCharset(nsIAtom ** aResult);
|
||||
NS_IMETHOD SetParentCharset(nsString * aCharset);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIAtom> mForcedCharset;
|
||||
|
@ -125,19 +124,6 @@ NS_IMETHODIMP nsDocumentCharsetInfo::GetParentCharset(nsIAtom ** aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocumentCharsetInfo::SetParentCharset(nsString * aCharset)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_WITH_SERVICE(nsICharsetConverterManager2, ccMan, kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIAtom> csAtom;
|
||||
res = ccMan->GetCharsetAtom(aCharset->GetUnicode(), getter_AddRefs(csAtom));
|
||||
if (NS_FAILED(res)) return NS_ERROR_FAILURE;
|
||||
|
||||
return SetParentCharset(csAtom);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsDocumentCharsetInfoFactory, NS_GET_IID(nsIFactory));
|
||||
|
||||
NS_IMETHODIMP nsDocumentCharsetInfoFactory::CreateInstance(
|
||||
|
|
|
@ -105,6 +105,7 @@
|
|||
|
||||
#include "nsIWindowMediator.h"
|
||||
|
||||
#include "nsDocumentCharsetInfoCID.h"
|
||||
#include "nsIDocumentCharsetInfo.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsICharsetConverterManager2.h"
|
||||
|
|
Загрузка…
Ссылка в новой задаче