1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * the Mozilla Foundation.
19 * Portions created by the Initial Developer are Copyright (C) 2010
20 * the Initial Developer. All Rights Reserved.
23 * Josh Matthews <josh@joshmatthews.net> (Initial Developer)
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #ifndef nsChromeRegistryContent_h
40 #define nsChromeRegistryContent_h
42 #include "nsChromeRegistry.h"
44 #include "nsClassHashtable.h"
48 struct ResourceMapping
;
49 struct OverrideMapping
;
51 class nsChromeRegistryContent
: public nsChromeRegistry
54 nsChromeRegistryContent();
56 void RegisterRemoteChrome(const nsTArray
<ChromePackage
>& aPackages
,
57 const nsTArray
<ResourceMapping
>& aResources
,
58 const nsTArray
<OverrideMapping
>& aOverrides
,
59 const nsACString
& aLocale
);
61 NS_OVERRIDE NS_IMETHOD
GetLocalesForPackage(const nsACString
& aPackage
,
62 nsIUTF8StringEnumerator
* *aResult
);
63 NS_OVERRIDE NS_IMETHOD
CheckForNewChrome();
64 NS_OVERRIDE NS_IMETHOD
CheckForOSAccessibility();
65 NS_OVERRIDE NS_IMETHOD
Observe(nsISupports
* aSubject
, const char* aTopic
,
66 const PRUnichar
* aData
);
67 NS_OVERRIDE NS_IMETHOD
IsLocaleRTL(const nsACString
& package
,
69 NS_OVERRIDE NS_IMETHOD
GetSelectedLocale(const nsACString
& aPackage
,
71 NS_OVERRIDE NS_IMETHOD
GetStyleOverlays(nsIURI
*aChromeURL
,
72 nsISimpleEnumerator
**aResult
);
73 NS_OVERRIDE NS_IMETHOD
GetXULOverlays(nsIURI
*aChromeURL
,
74 nsISimpleEnumerator
**aResult
);
79 PackageEntry() : flags(0) { }
82 nsCOMPtr
<nsIURI
> contentBaseURI
;
83 nsCOMPtr
<nsIURI
> localeBaseURI
;
84 nsCOMPtr
<nsIURI
> skinBaseURI
;
88 void RegisterPackage(const ChromePackage
& aPackage
);
89 void RegisterResource(const ResourceMapping
& aResource
);
90 void RegisterOverride(const OverrideMapping
& aOverride
);
92 NS_OVERRIDE
void UpdateSelectedLocale();
93 NS_OVERRIDE nsIURI
* GetBaseURIFromPackage(const nsCString
& aPackage
,
94 const nsCString
& aProvider
,
95 const nsCString
& aPath
);
96 NS_OVERRIDE nsresult
GetFlagsFromPackage(const nsCString
& aPackage
, PRUint32
* aFlags
);
98 nsClassHashtable
<nsCStringHashKey
, PackageEntry
> mPackagesHash
;
101 virtual void ManifestContent(ManifestProcessingContext
& cx
, int lineno
,
102 char *const * argv
, bool platform
,
103 bool contentaccessible
);
104 virtual void ManifestLocale(ManifestProcessingContext
& cx
, int lineno
,
105 char *const * argv
, bool platform
,
106 bool contentaccessible
);
107 virtual void ManifestSkin(ManifestProcessingContext
& cx
, int lineno
,
108 char *const * argv
, bool platform
,
109 bool contentaccessible
);
110 virtual void ManifestOverlay(ManifestProcessingContext
& cx
, int lineno
,
111 char *const * argv
, bool platform
,
112 bool contentaccessible
);
113 virtual void ManifestStyle(ManifestProcessingContext
& cx
, int lineno
,
114 char *const * argv
, bool platform
,
115 bool contentaccessible
);
116 virtual void ManifestOverride(ManifestProcessingContext
& cx
, int lineno
,
117 char *const * argv
, bool platform
,
118 bool contentaccessible
);
119 virtual void ManifestResource(ManifestProcessingContext
& cx
, int lineno
,
120 char *const * argv
, bool platform
,
121 bool contentaccessible
);
124 #endif // nsChromeRegistryContent_h