|
1 /* -*- Mode: C++; tab-width: 8; 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 nsChromeRegistryContent_h |
|
7 #define nsChromeRegistryContent_h |
|
8 |
|
9 #include "nsChromeRegistry.h" |
|
10 #include "nsClassHashtable.h" |
|
11 |
|
12 struct ChromePackage; |
|
13 struct ResourceMapping; |
|
14 struct OverrideMapping; |
|
15 |
|
16 class nsChromeRegistryContent : public nsChromeRegistry |
|
17 { |
|
18 public: |
|
19 nsChromeRegistryContent(); |
|
20 |
|
21 void RegisterRemoteChrome(const InfallibleTArray<ChromePackage>& aPackages, |
|
22 const InfallibleTArray<ResourceMapping>& aResources, |
|
23 const InfallibleTArray<OverrideMapping>& aOverrides, |
|
24 const nsACString& aLocale); |
|
25 |
|
26 NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage, |
|
27 nsIUTF8StringEnumerator* *aResult) MOZ_OVERRIDE; |
|
28 NS_IMETHOD CheckForNewChrome() MOZ_OVERRIDE; |
|
29 NS_IMETHOD CheckForOSAccessibility() MOZ_OVERRIDE; |
|
30 NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, |
|
31 const char16_t* aData) MOZ_OVERRIDE; |
|
32 NS_IMETHOD IsLocaleRTL(const nsACString& package, |
|
33 bool *aResult) MOZ_OVERRIDE; |
|
34 NS_IMETHOD GetSelectedLocale(const nsACString& aPackage, |
|
35 nsACString& aLocale) MOZ_OVERRIDE; |
|
36 NS_IMETHOD GetStyleOverlays(nsIURI *aChromeURL, |
|
37 nsISimpleEnumerator **aResult) MOZ_OVERRIDE; |
|
38 NS_IMETHOD GetXULOverlays(nsIURI *aChromeURL, |
|
39 nsISimpleEnumerator **aResult) MOZ_OVERRIDE; |
|
40 |
|
41 private: |
|
42 struct PackageEntry |
|
43 { |
|
44 PackageEntry() : flags(0) { } |
|
45 ~PackageEntry() { } |
|
46 |
|
47 nsCOMPtr<nsIURI> contentBaseURI; |
|
48 nsCOMPtr<nsIURI> localeBaseURI; |
|
49 nsCOMPtr<nsIURI> skinBaseURI; |
|
50 uint32_t flags; |
|
51 }; |
|
52 |
|
53 void RegisterPackage(const ChromePackage& aPackage); |
|
54 void RegisterResource(const ResourceMapping& aResource); |
|
55 void RegisterOverride(const OverrideMapping& aOverride); |
|
56 |
|
57 nsresult UpdateSelectedLocale() MOZ_OVERRIDE; |
|
58 nsIURI* GetBaseURIFromPackage(const nsCString& aPackage, |
|
59 const nsCString& aProvider, |
|
60 const nsCString& aPath) MOZ_OVERRIDE; |
|
61 nsresult GetFlagsFromPackage(const nsCString& aPackage, uint32_t* aFlags) MOZ_OVERRIDE; |
|
62 |
|
63 nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash; |
|
64 nsCString mLocale; |
|
65 |
|
66 virtual void ManifestContent(ManifestProcessingContext& cx, int lineno, |
|
67 char *const * argv, bool platform, |
|
68 bool contentaccessible); |
|
69 virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno, |
|
70 char *const * argv, bool platform, |
|
71 bool contentaccessible); |
|
72 virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno, |
|
73 char *const * argv, bool platform, |
|
74 bool contentaccessible); |
|
75 virtual void ManifestOverlay(ManifestProcessingContext& cx, int lineno, |
|
76 char *const * argv, bool platform, |
|
77 bool contentaccessible); |
|
78 virtual void ManifestStyle(ManifestProcessingContext& cx, int lineno, |
|
79 char *const * argv, bool platform, |
|
80 bool contentaccessible); |
|
81 virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno, |
|
82 char *const * argv, bool platform, |
|
83 bool contentaccessible); |
|
84 virtual void ManifestResource(ManifestProcessingContext& cx, int lineno, |
|
85 char *const * argv, bool platform, |
|
86 bool contentaccessible); |
|
87 }; |
|
88 |
|
89 #endif // nsChromeRegistryContent_h |