diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index c86128e6037..ed9f43268e6 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -46,6 +46,7 @@ #include "nsIHTTPEventSink.h" #include "nsISecurityEventSink.h" #include "nsScriptSecurityManager.h" +#include "nsDocumentCharsetInfoCID.h" // Local Includes #include "nsDocShell.h" diff --git a/mozilla/intl/chardet/public/MANIFEST b/mozilla/intl/chardet/public/MANIFEST index 97d4734daa6..573d468d611 100644 --- a/mozilla/intl/chardet/public/MANIFEST +++ b/mozilla/intl/chardet/public/MANIFEST @@ -1,5 +1,6 @@ nsCharsetDetectionAdaptorCID.h nsDetectionConfident.h +nsDocumentCharsetInfoCID.h nsICharsetDetectionAdaptor.h nsICharsetDetectionObserver.h nsICharsetDetector.h @@ -8,4 +9,3 @@ nsIStringCharsetDetector.h nsIXMLEncodingService.h nsMetaCharsetCID.h nsXMLEncodingCID.h -nsIDocumentCharsetInfo.h diff --git a/mozilla/intl/chardet/public/MANIFEST_IDL b/mozilla/intl/chardet/public/MANIFEST_IDL new file mode 100644 index 00000000000..2b0fd8d5b4d --- /dev/null +++ b/mozilla/intl/chardet/public/MANIFEST_IDL @@ -0,0 +1 @@ +nsIDocumentCharsetInfo.idl diff --git a/mozilla/intl/chardet/public/Makefile.in b/mozilla/intl/chardet/public/Makefile.in index 574de49aad4..c2ebc18c63c 100644 --- a/mozilla/intl/chardet/public/Makefile.in +++ b/mozilla/intl/chardet/public/Makefile.in @@ -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)) diff --git a/mozilla/intl/chardet/public/makefile.win b/mozilla/intl/chardet/public/makefile.win index 2ad5cabc18a..1b6e38ae197 100644 --- a/mozilla/intl/chardet/public/makefile.win +++ b/mozilla/intl/chardet/public/makefile.win @@ -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 diff --git a/mozilla/intl/chardet/public/nsDocumentCharsetInfoCID.h b/mozilla/intl/chardet/public/nsDocumentCharsetInfoCID.h new file mode 100644 index 00000000000..e49cfa291e1 --- /dev/null +++ b/mozilla/intl/chardet/public/nsDocumentCharsetInfoCID.h @@ -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__ + diff --git a/mozilla/intl/chardet/public/nsIDocumentCharsetInfo.h b/mozilla/intl/chardet/public/nsIDocumentCharsetInfo.h deleted file mode 100644 index ce49293cd83..00000000000 --- a/mozilla/intl/chardet/public/nsIDocumentCharsetInfo.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#ifndef nsIDocumentCharsetInfo_h__ -#define nsIDocumentCharsetInfo_h__ - -#include "nsISupports.h" -#include "nsIAtom.h" - -// {2D40B291-01E1-11d4-9D0E-0050040007B2} -#define NS_IDOCUMENTCHARSETINFO_IID \ - {0x2d40b291, 0x1e1, 0x11d4, {0x9d, 0xe, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}} - -// {D25E0511-2BAE-11d4-9D10-0050040007B2} -#define NS_DOCUMENTCHARSETINFO_CID \ - {0xd25e0511, 0x2bae, 0x11d4, {0x9d, 0x10, 0x0, 0x50, 0x4, 0x0, 0x7, 0xb2}} - -#define NS_DOCUMENTCHARSETINFO_PID \ - "@mozilla.org/document-charset-info;1" - -// XXX doc me -// XXX make this interface IDL -// XXX mark the right params "const" - -class nsIDocumentCharsetInfo : public nsISupports -{ -public: - NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENTCHARSETINFO_IID) - - NS_IMETHOD SetForcedCharset(nsIAtom * aCharset) = 0; - NS_IMETHOD GetForcedCharset(nsIAtom ** aResult) = 0; - - NS_IMETHOD SetForcedDetector(PRBool aForced) = 0; - NS_IMETHOD GetForcedDetector(PRBool * aResult) = 0; - - NS_IMETHOD SetParentCharset(nsIAtom * aCharset) = 0; - NS_IMETHOD GetParentCharset(nsIAtom ** aResult) = 0; - - /** - * You should NOT use this method!!! It will very soon be deprecated. I only - * added it here for convenience in the ongoing transition to Atoms. Use - * SetParentCharset(nsIAtom *) instead. - */ - NS_IMETHOD SetParentCharset(nsString * aCharset) = 0; -}; - -#endif // nsIDocumentCharsetInfo_h__ diff --git a/mozilla/intl/chardet/public/nsIDocumentCharsetInfo.idl b/mozilla/intl/chardet/public/nsIDocumentCharsetInfo.idl new file mode 100644 index 00000000000..76499ac3db6 --- /dev/null +++ b/mozilla/intl/chardet/public/nsIDocumentCharsetInfo.idl @@ -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; +}; diff --git a/mozilla/intl/chardet/src/nsCharDetModule.cpp b/mozilla/intl/chardet/src/nsCharDetModule.cpp index 8e6dd609ce2..0eedd95ee22 100644 --- a/mozilla/intl/chardet/src/nsCharDetModule.cpp +++ b/mozilla/intl/chardet/src/nsCharDetModule.cpp @@ -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, diff --git a/mozilla/intl/chardet/src/nsDocumentCharsetInfo.cpp b/mozilla/intl/chardet/src/nsDocumentCharsetInfo.cpp index 64d364a0bbe..f2274d4dcfe 100644 --- a/mozilla/intl/chardet/src/nsDocumentCharsetInfo.cpp +++ b/mozilla/intl/chardet/src/nsDocumentCharsetInfo.cpp @@ -48,7 +48,6 @@ public: NS_IMETHOD SetParentCharset(nsIAtom * aCharset); NS_IMETHOD GetParentCharset(nsIAtom ** aResult); - NS_IMETHOD SetParentCharset(nsString * aCharset); private: nsCOMPtr 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 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( diff --git a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp index 0350bda7c27..a24bc51199e 100644 --- a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp +++ b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp @@ -105,6 +105,7 @@ #include "nsIWindowMediator.h" +#include "nsDocumentCharsetInfoCID.h" #include "nsIDocumentCharsetInfo.h" #include "nsICharsetConverterManager.h" #include "nsICharsetConverterManager2.h"