|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsXBLResourceLoader_h |
|
7 #define nsXBLResourceLoader_h |
|
8 |
|
9 #include "mozilla/Attributes.h" |
|
10 #include "nsCOMPtr.h" |
|
11 #include "nsICSSLoaderObserver.h" |
|
12 #include "nsCOMArray.h" |
|
13 #include "nsCycleCollectionParticipant.h" |
|
14 |
|
15 class nsIContent; |
|
16 class nsIAtom; |
|
17 class nsXBLPrototypeResources; |
|
18 class nsXBLPrototypeBinding; |
|
19 struct nsXBLResource; |
|
20 class nsIObjectOutputStream; |
|
21 |
|
22 // *********************************************************************/ |
|
23 // The XBLResourceLoader class |
|
24 |
|
25 class nsXBLResourceLoader : public nsICSSLoaderObserver |
|
26 { |
|
27 public: |
|
28 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
29 NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader) |
|
30 |
|
31 // nsICSSLoaderObserver |
|
32 NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet* aSheet, bool aWasAlternate, |
|
33 nsresult aStatus) MOZ_OVERRIDE; |
|
34 |
|
35 void LoadResources(bool* aResult); |
|
36 void AddResource(nsIAtom* aResourceType, const nsAString& aSrc); |
|
37 void AddResourceListener(nsIContent* aElement); |
|
38 |
|
39 nsXBLResourceLoader(nsXBLPrototypeBinding* aBinding, |
|
40 nsXBLPrototypeResources* aResources); |
|
41 virtual ~nsXBLResourceLoader(); |
|
42 |
|
43 void NotifyBoundElements(); |
|
44 |
|
45 nsresult Write(nsIObjectOutputStream* aStream); |
|
46 |
|
47 // MEMBER VARIABLES |
|
48 nsXBLPrototypeBinding* mBinding; // A pointer back to our binding. |
|
49 nsXBLPrototypeResources* mResources; // A pointer back to our resources |
|
50 // information. May be null if the |
|
51 // resources have already been |
|
52 // destroyed. |
|
53 |
|
54 nsXBLResource* mResourceList; // The list of resources we need to load. |
|
55 nsXBLResource* mLastResource; |
|
56 |
|
57 bool mLoadingResources; |
|
58 // We need mInLoadResourcesFunc because we do a mixture of sync and |
|
59 // async loads. |
|
60 bool mInLoadResourcesFunc; |
|
61 int16_t mPendingSheets; // The number of stylesheets that have yet to load. |
|
62 |
|
63 // Bound elements that are waiting on the stylesheets and scripts. |
|
64 nsCOMArray<nsIContent> mBoundElements; |
|
65 }; |
|
66 |
|
67 #endif |