2010-03-11 08:33:00 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-03-11 08:33:00 +03:00
|
|
|
|
|
|
|
#ifndef nsChromeRegistryContent_h
|
|
|
|
#define nsChromeRegistryContent_h
|
|
|
|
|
|
|
|
#include "nsChromeRegistry.h"
|
|
|
|
#include "nsClassHashtable.h"
|
|
|
|
|
|
|
|
struct ChromePackage;
|
2015-07-17 01:50:07 +03:00
|
|
|
struct SubstitutionMapping;
|
2010-03-11 08:33:00 +03:00
|
|
|
struct OverrideMapping;
|
|
|
|
|
|
|
|
class nsChromeRegistryContent : public nsChromeRegistry {
|
|
|
|
public:
|
|
|
|
nsChromeRegistryContent();
|
2014-07-26 00:17:36 +04:00
|
|
|
|
2019-07-10 06:58:10 +03:00
|
|
|
void RegisterRemoteChrome(const nsTArray<ChromePackage>& aPackages,
|
|
|
|
const nsTArray<SubstitutionMapping>& aResources,
|
|
|
|
const nsTArray<OverrideMapping>& aOverrides,
|
|
|
|
const nsACString& aLocale, bool aReset);
|
2010-03-11 08:33:00 +03:00
|
|
|
|
2012-07-06 22:15:45 +04:00
|
|
|
NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIUTF8StringEnumerator** aResult) override;
|
|
|
|
NS_IMETHOD CheckForNewChrome() override;
|
2012-07-06 22:15:45 +04:00
|
|
|
NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
|
2015-03-21 19:28:04 +03:00
|
|
|
const char16_t* aData) override;
|
2012-07-06 22:15:45 +04:00
|
|
|
NS_IMETHOD IsLocaleRTL(const nsACString& package, bool* aResult) override;
|
|
|
|
NS_IMETHOD GetSelectedLocale(const nsACString& aPackage, bool aAsBCP47,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsACString& aLocale) override;
|
2010-03-11 08:33:00 +03:00
|
|
|
|
2014-07-26 00:17:36 +04:00
|
|
|
void RegisterPackage(const ChromePackage& aPackage);
|
|
|
|
void RegisterOverride(const OverrideMapping& aOverride);
|
2015-07-17 01:50:07 +03:00
|
|
|
void RegisterSubstitution(const SubstitutionMapping& aResource);
|
2014-07-26 00:17:36 +04:00
|
|
|
|
2010-03-11 08:33:00 +03:00
|
|
|
private:
|
|
|
|
struct PackageEntry {
|
|
|
|
PackageEntry() : flags(0) {}
|
|
|
|
~PackageEntry() {}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> contentBaseURI;
|
|
|
|
nsCOMPtr<nsIURI> localeBaseURI;
|
|
|
|
nsCOMPtr<nsIURI> skinBaseURI;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t flags;
|
2010-03-11 08:33:00 +03:00
|
|
|
};
|
|
|
|
|
2012-07-06 22:15:45 +04:00
|
|
|
nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
|
|
|
|
const nsCString& aProvider,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsCString& aPath) override;
|
|
|
|
nsresult GetFlagsFromPackage(const nsCString& aPackage,
|
|
|
|
uint32_t* aFlags) override;
|
2010-03-11 08:33:00 +03:00
|
|
|
|
|
|
|
nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
|
2011-01-12 00:34:31 +03:00
|
|
|
nsCString mLocale;
|
2010-07-01 19:55:57 +04:00
|
|
|
|
|
|
|
virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
|
2015-03-21 19:28:04 +03:00
|
|
|
char* const* argv, int flags) override;
|
2010-07-01 19:55:57 +04:00
|
|
|
virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
|
2015-03-21 19:28:04 +03:00
|
|
|
char* const* argv, int flags) override;
|
2010-07-01 19:55:57 +04:00
|
|
|
virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno,
|
2015-03-21 19:28:04 +03:00
|
|
|
char* const* argv, int flags) override;
|
2010-07-01 19:55:57 +04:00
|
|
|
virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno,
|
2015-03-21 19:28:04 +03:00
|
|
|
char* const* argv, int flags) override;
|
2010-07-01 19:55:57 +04:00
|
|
|
virtual void ManifestResource(ManifestProcessingContext& cx, int lineno,
|
2015-03-21 19:28:04 +03:00
|
|
|
char* const* argv, int flags) override;
|
2010-03-11 08:33:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsChromeRegistryContent_h
|