michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 nsXBLResourceLoader_h michael@0: #define nsXBLResourceLoader_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsICSSLoaderObserver.h" michael@0: #include "nsCOMArray.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: michael@0: class nsIContent; michael@0: class nsIAtom; michael@0: class nsXBLPrototypeResources; michael@0: class nsXBLPrototypeBinding; michael@0: struct nsXBLResource; michael@0: class nsIObjectOutputStream; michael@0: michael@0: // *********************************************************************/ michael@0: // The XBLResourceLoader class michael@0: michael@0: class nsXBLResourceLoader : public nsICSSLoaderObserver michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader) michael@0: michael@0: // nsICSSLoaderObserver michael@0: NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate, michael@0: nsresult aStatus) MOZ_OVERRIDE; michael@0: michael@0: void LoadResources(bool* aResult); michael@0: void AddResource(nsIAtom* aResourceType, const nsAString& aSrc); michael@0: void AddResourceListener(nsIContent* aElement); michael@0: michael@0: nsXBLResourceLoader(nsXBLPrototypeBinding* aBinding, michael@0: nsXBLPrototypeResources* aResources); michael@0: virtual ~nsXBLResourceLoader(); michael@0: michael@0: void NotifyBoundElements(); michael@0: michael@0: nsresult Write(nsIObjectOutputStream* aStream); michael@0: michael@0: // MEMBER VARIABLES michael@0: nsXBLPrototypeBinding* mBinding; // A pointer back to our binding. michael@0: nsXBLPrototypeResources* mResources; // A pointer back to our resources michael@0: // information. May be null if the michael@0: // resources have already been michael@0: // destroyed. michael@0: michael@0: nsXBLResource* mResourceList; // The list of resources we need to load. michael@0: nsXBLResource* mLastResource; michael@0: michael@0: bool mLoadingResources; michael@0: // We need mInLoadResourcesFunc because we do a mixture of sync and michael@0: // async loads. michael@0: bool mInLoadResourcesFunc; michael@0: int16_t mPendingSheets; // The number of stylesheets that have yet to load. michael@0: michael@0: // Bound elements that are waiting on the stylesheets and scripts. michael@0: nsCOMArray mBoundElements; michael@0: }; michael@0: michael@0: #endif