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 nsXBLDocumentInfo_h__ michael@0: #define nsXBLDocumentInfo_h__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsWeakReference.h" michael@0: #include "nsIDocument.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: michael@0: class nsXBLPrototypeBinding; michael@0: class nsXBLDocGlobalObject; michael@0: michael@0: class nsXBLDocumentInfo MOZ_FINAL : public nsSupportsWeakReference michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: michael@0: nsXBLDocumentInfo(nsIDocument* aDocument); michael@0: virtual ~nsXBLDocumentInfo(); michael@0: michael@0: already_AddRefed GetDocument() michael@0: { nsCOMPtr copy = mDocument; return copy.forget(); } michael@0: michael@0: bool GetScriptAccess() const { return mScriptAccess; } michael@0: michael@0: nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); } michael@0: michael@0: nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef); michael@0: nsresult SetPrototypeBinding(const nsACString& aRef, michael@0: nsXBLPrototypeBinding* aBinding); michael@0: michael@0: // This removes the binding without deleting it michael@0: void RemovePrototypeBinding(const nsACString& aRef); michael@0: michael@0: nsresult WritePrototypeBindings(); michael@0: michael@0: void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding); michael@0: michael@0: void FlushSkinStylesheets(); michael@0: michael@0: bool IsChrome() { return mIsChrome; } michael@0: michael@0: void MarkInCCGeneration(uint32_t aGeneration); michael@0: michael@0: static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo); michael@0: michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocumentInfo) michael@0: michael@0: private: michael@0: nsCOMPtr mDocument; michael@0: bool mScriptAccess; michael@0: bool mIsChrome; michael@0: // the binding table owns each nsXBLPrototypeBinding michael@0: nsAutoPtr> mBindingTable; michael@0: michael@0: // non-owning pointer to the first binding in the table michael@0: nsXBLPrototypeBinding* mFirstBinding; michael@0: }; michael@0: michael@0: #ifdef DEBUG michael@0: void AssertInCompilationScope(); michael@0: #else michael@0: inline void AssertInCompilationScope() {} michael@0: #endif michael@0: michael@0: #endif