/src/mozilla-central/chrome/nsChromeRegistryContent.h
Line | Count | Source (jump to first uncovered line) |
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 | | 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 | | |
39 | | void RegisterPackage(const ChromePackage& aPackage); |
40 | | void RegisterOverride(const OverrideMapping& aOverride); |
41 | | void RegisterSubstitution(const SubstitutionMapping& aResource); |
42 | | |
43 | | private: |
44 | | struct PackageEntry |
45 | | { |
46 | 0 | PackageEntry() : flags(0) { } |
47 | 0 | ~PackageEntry() { } |
48 | | |
49 | | nsCOMPtr<nsIURI> contentBaseURI; |
50 | | nsCOMPtr<nsIURI> localeBaseURI; |
51 | | nsCOMPtr<nsIURI> skinBaseURI; |
52 | | uint32_t flags; |
53 | | }; |
54 | | |
55 | | nsIURI* GetBaseURIFromPackage(const nsCString& aPackage, |
56 | | const nsCString& aProvider, |
57 | | const nsCString& aPath) override; |
58 | | nsresult GetFlagsFromPackage(const nsCString& aPackage, uint32_t* aFlags) override; |
59 | | |
60 | | nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash; |
61 | | nsCString mLocale; |
62 | | |
63 | | virtual void ManifestContent(ManifestProcessingContext& cx, int lineno, |
64 | | char *const * argv, int flags) override; |
65 | | virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno, |
66 | | char *const * argv, int flags) override; |
67 | | virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno, |
68 | | char *const * argv, int flags) override; |
69 | | virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno, |
70 | | char *const * argv, int flags) override; |
71 | | virtual void ManifestResource(ManifestProcessingContext& cx, int lineno, |
72 | | char *const * argv, int flags) override; |
73 | | }; |
74 | | |
75 | | #endif // nsChromeRegistryContent_h |