author Dave Townsend <>
Fri, 11 Jan 2019 17:23:11 +0000
changeset 513494 eace4709948cdf060a36a60c00eeb286cb7acb17
parent 508163 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1518799: Show a custom page on startup on Nightly on a specific date. r=Gijs We want to show an informative message about dedicated profiles per channel to users of Nightly on a specific date. We currently only have the ability to do this when the version changes. This adds the ability to show a page once on startup on a specific date. This will probably be backed out past that date. Differential Revision:

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 */

#ifndef nsChromeRegistryContent_h
#define nsChromeRegistryContent_h

#include "nsChromeRegistry.h"
#include "nsClassHashtable.h"

struct ChromePackage;
struct SubstitutionMapping;
struct OverrideMapping;

class nsChromeRegistryContent : public nsChromeRegistry {

  void RegisterRemoteChrome(
      const InfallibleTArray<ChromePackage>& aPackages,
      const InfallibleTArray<SubstitutionMapping>& aResources,
      const InfallibleTArray<OverrideMapping>& aOverrides,
      const nsACString& aLocale, bool aReset);

  NS_IMETHOD GetLocalesForPackage(const nsACString& aPackage,
                                  nsIUTF8StringEnumerator** aResult) override;
  NS_IMETHOD CheckForNewChrome() override;
  NS_IMETHOD CheckForOSAccessibility() override;
  NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
                     const char16_t* aData) override;
  NS_IMETHOD IsLocaleRTL(const nsACString& package, bool* aResult) override;
  NS_IMETHOD GetSelectedLocale(const nsACString& aPackage, bool aAsBCP47,
                               nsACString& aLocale) override;

  void RegisterPackage(const ChromePackage& aPackage);
  void RegisterOverride(const OverrideMapping& aOverride);
  void RegisterSubstitution(const SubstitutionMapping& aResource);

  struct PackageEntry {
    PackageEntry() : flags(0) {}
    ~PackageEntry() {}

    nsCOMPtr<nsIURI> contentBaseURI;
    nsCOMPtr<nsIURI> localeBaseURI;
    nsCOMPtr<nsIURI> skinBaseURI;
    uint32_t flags;

  nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
                                const nsCString& aProvider,
                                const nsCString& aPath) override;
  nsresult GetFlagsFromPackage(const nsCString& aPackage,
                               uint32_t* aFlags) override;

  nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
  nsCString mLocale;

  virtual void ManifestContent(ManifestProcessingContext& cx, int lineno,
                               char* const* argv, int flags) override;
  virtual void ManifestLocale(ManifestProcessingContext& cx, int lineno,
                              char* const* argv, int flags) override;
  virtual void ManifestSkin(ManifestProcessingContext& cx, int lineno,
                            char* const* argv, int flags) override;
  virtual void ManifestOverride(ManifestProcessingContext& cx, int lineno,
                                char* const* argv, int flags) override;
  virtual void ManifestResource(ManifestProcessingContext& cx, int lineno,
                                char* const* argv, int flags) override;

#endif  // nsChromeRegistryContent_h