2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-11-11 01:15:22 +00:00
|
|
|
|
2013-11-20 16:29:04 +00:00
|
|
|
#ifndef nsXBLResourceLoader_h
|
|
|
|
#define nsXBLResourceLoader_h
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-11-11 01:15:22 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsICSSLoaderObserver.h"
|
2007-03-11 11:56:09 +00:00
|
|
|
#include "nsCOMArray.h"
|
2007-03-08 11:17:16 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2001-11-11 01:15:22 +00:00
|
|
|
|
|
|
|
class nsIContent;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsXBLPrototypeResources;
|
2003-03-06 23:59:18 +00:00
|
|
|
class nsXBLPrototypeBinding;
|
2013-02-01 10:56:02 +00:00
|
|
|
struct nsXBLResource;
|
2013-08-24 02:42:40 +00:00
|
|
|
class nsIObjectOutputStream;
|
2001-11-11 01:15:22 +00:00
|
|
|
|
|
|
|
// *********************************************************************/
|
|
|
|
// The XBLResourceLoader class
|
|
|
|
|
|
|
|
class nsXBLResourceLoader : public nsICSSLoaderObserver
|
|
|
|
{
|
|
|
|
public:
|
2007-03-08 11:17:16 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader)
|
2001-11-11 01:15:22 +00:00
|
|
|
|
|
|
|
// nsICSSLoaderObserver
|
2014-06-20 10:32:49 +00:00
|
|
|
NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
|
|
|
|
bool aWasAlternate,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsresult aStatus) override;
|
2001-11-11 01:15:22 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
void LoadResources(bool* aResult);
|
2002-03-23 22:46:13 +00:00
|
|
|
void AddResource(nsIAtom* aResourceType, const nsAString& aSrc);
|
2001-11-11 01:15:22 +00:00
|
|
|
void AddResourceListener(nsIContent* aElement);
|
|
|
|
|
2003-03-06 23:59:18 +00:00
|
|
|
nsXBLResourceLoader(nsXBLPrototypeBinding* aBinding,
|
|
|
|
nsXBLPrototypeResources* aResources);
|
2001-11-11 01:15:22 +00:00
|
|
|
|
|
|
|
void NotifyBoundElements();
|
|
|
|
|
2011-11-03 20:39:08 +00:00
|
|
|
nsresult Write(nsIObjectOutputStream* aStream);
|
|
|
|
|
2001-11-11 01:15:22 +00:00
|
|
|
// MEMBER VARIABLES
|
2003-03-06 23:59:18 +00:00
|
|
|
nsXBLPrototypeBinding* mBinding; // A pointer back to our binding.
|
2004-01-05 23:46:00 +00:00
|
|
|
nsXBLPrototypeResources* mResources; // A pointer back to our resources
|
|
|
|
// information. May be null if the
|
|
|
|
// resources have already been
|
|
|
|
// destroyed.
|
2001-11-11 01:15:22 +00:00
|
|
|
|
|
|
|
nsXBLResource* mResourceList; // The list of resources we need to load.
|
|
|
|
nsXBLResource* mLastResource;
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mLoadingResources;
|
2005-09-12 18:41:15 +00:00
|
|
|
// We need mInLoadResourcesFunc because we do a mixture of sync and
|
|
|
|
// async loads.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mInLoadResourcesFunc;
|
2012-08-22 15:56:38 +00:00
|
|
|
int16_t mPendingSheets; // The number of stylesheets that have yet to load.
|
2007-03-11 11:56:09 +00:00
|
|
|
|
|
|
|
// Bound elements that are waiting on the stylesheets and scripts.
|
|
|
|
nsCOMArray<nsIContent> mBoundElements;
|
2014-06-23 19:56:07 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsXBLResourceLoader();
|
2001-11-11 01:15:22 +00:00
|
|
|
};
|
|
|
|
|
2013-11-20 16:29:04 +00:00
|
|
|
#endif
|