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/. */
6 #ifndef nsChromeRegistryContent_h
7 #define nsChromeRegistryContent_h
9 #include "nsChromeRegistry.h"
10 #include "nsClassHashtable.h"
13 struct SubstitutionMapping
;
14 struct OverrideMapping
;
16 class nsChromeRegistryContent
: public nsChromeRegistry
19 nsChromeRegistryContent();
21 void RegisterRemoteChrome(const InfallibleTArray
<ChromePackage
>& aPackages
,
22 const InfallibleTArray
<SubstitutionMapping
>& aResources
,
23 const InfallibleTArray
<OverrideMapping
>& aOverrides
,
24 const nsACString
& aLocale
,
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
,
37 nsACString
& aLocale
) override
;
39 void RegisterPackage(const ChromePackage
& aPackage
);
40 void RegisterOverride(const OverrideMapping
& aOverride
);
41 void RegisterSubstitution(const SubstitutionMapping
& aResource
);
46 PackageEntry() : flags(0) { }
49 nsCOMPtr
<nsIURI
> contentBaseURI
;
50 nsCOMPtr
<nsIURI
> localeBaseURI
;
51 nsCOMPtr
<nsIURI
> skinBaseURI
;
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
;
60 nsClassHashtable
<nsCStringHashKey
, PackageEntry
> mPackagesHash
;
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
;
75 #endif // nsChromeRegistryContent_h