1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is the Mozilla browser.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * pav
25 * Blake Ross (blaker@netscape.com)
26 * Benjamin Smedberg <bsmedberg@covad.net>
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * either of the GNU General Public License Version 2 or later (the "GPL"),
30 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31 * in which case the provisions of the GPL or the LGPL are applicable instead
32 * of those above. If you wish to allow use of your version of this file only
33 * under the terms of either the GPL or the LGPL, and not to allow others to
34 * use your version of this file under the terms of the MPL, indicate your
35 * decision by deleting the provisions above and replace them with the notice
36 * and other provisions required by the GPL or the LGPL. If you do not delete
37 * the provisions above, a recipient may use your version of this file under
38 * the terms of any one of the MPL, the GPL or the LGPL.
39 *
40 * ***** END LICENSE BLOCK ***** */
41
42 #include "nsISupports.idl"
43
44 interface nsIURI;
45
46 [scriptable, uuid(68389281-f6d0-4533-841d-344a2018140c)]
47 interface nsIChromeRegistry : nsISupports
48 {
49 const PRInt32 NONE = 0;
50 const PRInt32 PARTIAL = 1;
51 const PRInt32 FULL = 2;
52
53 /**
54 * Resolve a chrome URL to an loadable URI using the information in the
55 * registry. Does not modify aChromeURL.
56 *
57 * Chrome URLs are allowed to be specified in "shorthand", leaving the
58 * "file" portion off. In that case, the URL is expanded to:
59 *
60 * chrome://package/provider/package.ext
61 *
62 * where "ext" is:
63 *
64 * "xul" for a "content" package,
65 * "css" for a "skin" package, and
66 * "dtd" for a "locale" package.
67 *
68 * @param aChromeURL the URL that is to be converted.
69 */
70 nsIURI convertChromeURL(in nsIURI aChromeURL);
71
72 /**
73 * refresh the chrome list at runtime, looking for new packages/etc
74 */
75 void checkForNewChrome();
76 };
77
78 [scriptable, uuid(2860e205-490e-4b06-90b6-87160d35a5a7)]
79 interface nsIXULChromeRegistry : nsIChromeRegistry
80 {
81 /* Should be called when locales change to reload all chrome (including XUL). */
82 void reloadChrome();
83
84 ACString getSelectedLocale(in ACString packageName);
85
86 /* Should be called when skins change. Reloads only stylesheets. */
87 void refreshSkins();
88
89 /**
90 * Installable skin XBL is not always granted the same privileges as other
91 * chrome. This asks the chrome registry whether scripts are allowed to be
92 * run for a particular chrome URI. Do not pass non-chrome URIs to this
93 * method.
94 */
95 boolean allowScriptsForPackage(in nsIURI url);
96
97 /**
98 * Content should only be allowed to load chrome JS from certain packages.
99 * This method reflects the contentaccessible flag on packages.
100 * Do not pass non-chrome URIs to this method.
101 */
102 boolean allowContentToAccess(in nsIURI url);
103 };
104
105 %{ C++
106
107 #define NS_CHROMEREGISTRY_CONTRACTID \
108 "@mozilla.org/chrome/chrome-registry;1"
109
110 /**
111 * Chrome registry will notify various caches that all chrome files need
112 * flushing.
113 */
114 #define NS_CHROME_FLUSH_TOPIC \
115 "chrome-flush-caches"
116
117 /**
118 * Chrome registry will notify various caches that skin files need flushing.
119 * If "chrome-flush-caches" is notified, this topic will *not* be notified.
120 */
121 #define NS_CHROME_FLUSH_SKINS_TOPIC \
122 "chrome-flush-skin-caches"
123
124 %}