michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_DOMImplementation_h michael@0: #define mozilla_dom_DOMImplementation_h michael@0: michael@0: #include "nsIDOMDOMImplementation.h" michael@0: #include "nsWrapperCache.h" michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/ErrorResult.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsIDocument.h" michael@0: #include "nsIScriptGlobalObject.h" michael@0: #include "nsIURI.h" michael@0: #include "nsIWeakReferenceUtils.h" michael@0: #include "nsString.h" michael@0: michael@0: class nsIDOMDocument; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class DocumentType; michael@0: michael@0: class DOMImplementation MOZ_FINAL : public nsIDOMDOMImplementation michael@0: , public nsWrapperCache michael@0: { michael@0: public: michael@0: DOMImplementation(nsIDocument* aOwner, michael@0: nsIGlobalObject* aScriptObject, michael@0: nsIURI* aDocumentURI, michael@0: nsIURI* aBaseURI) michael@0: : mOwner(aOwner) michael@0: , mScriptObject(do_GetWeakReference(aScriptObject)) michael@0: , mDocumentURI(aDocumentURI) michael@0: , mBaseURI(aBaseURI) michael@0: { michael@0: MOZ_ASSERT(aOwner); michael@0: SetIsDOMBinding(); michael@0: } michael@0: michael@0: ~DOMImplementation() michael@0: { michael@0: } michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation) michael@0: michael@0: nsIDocument* GetParentObject() const michael@0: { michael@0: return mOwner; michael@0: } michael@0: michael@0: virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE; michael@0: michael@0: // nsIDOMDOMImplementation michael@0: NS_DECL_NSIDOMDOMIMPLEMENTATION michael@0: michael@0: bool HasFeature(const nsAString& aFeature, const nsAString& aVersion); michael@0: michael@0: already_AddRefed michael@0: CreateDocumentType(const nsAString& aQualifiedName, michael@0: const nsAString& aPublicId, michael@0: const nsAString& aSystemId, michael@0: ErrorResult& aRv); michael@0: michael@0: already_AddRefed michael@0: CreateDocument(const nsAString& aNamespaceURI, michael@0: const nsAString& aQualifiedName, michael@0: nsIDOMDocumentType* aDoctype, michael@0: ErrorResult& aRv); michael@0: michael@0: already_AddRefed michael@0: CreateHTMLDocument(const Optional& aTitle, ErrorResult& aRv); michael@0: michael@0: private: michael@0: nsresult CreateDocument(const nsAString& aNamespaceURI, michael@0: const nsAString& aQualifiedName, michael@0: nsIDOMDocumentType* aDoctype, michael@0: nsIDocument** aDocument, michael@0: nsIDOMDocument** aDOMDocument); michael@0: nsresult CreateHTMLDocument(const nsAString& aTitle, michael@0: nsIDocument** aDocument, michael@0: nsIDOMDocument** aDOMDocument); michael@0: michael@0: nsCOMPtr mOwner; michael@0: nsWeakPtr mScriptObject; michael@0: nsCOMPtr mDocumentURI; michael@0: nsCOMPtr mBaseURI; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_DOMImplementation_h