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