nsIChromeRegistry.idl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #include "nsISupports.idl"
  7. interface nsIURI;
  8. [scriptable, uuid(249fb5ad-ae29-4e2c-a728-ba5cf464d188)]
  9. interface nsIChromeRegistry : nsISupports
  10. {
  11. const int32_t NONE = 0;
  12. const int32_t PARTIAL = 1;
  13. const int32_t FULL = 2;
  14. /**
  15. * Resolve a chrome URL to an loadable URI using the information in the
  16. * registry. Does not modify aChromeURL.
  17. *
  18. * Chrome URLs are allowed to be specified in "shorthand", leaving the
  19. * "file" portion off. In that case, the URL is expanded to:
  20. *
  21. * chrome://package/provider/package.ext
  22. *
  23. * where "ext" is:
  24. *
  25. * "xul" for a "content" package,
  26. * "css" for a "skin" package, and
  27. * "dtd" for a "locale" package.
  28. *
  29. * @param aChromeURL the URL that is to be converted.
  30. */
  31. nsIURI convertChromeURL(in nsIURI aChromeURL);
  32. /**
  33. * refresh the chrome list at runtime, looking for new packages/etc
  34. */
  35. void checkForNewChrome();
  36. /**
  37. * returns whether XPCNativeWrappers are enabled for aURI.
  38. */
  39. [notxpcom] boolean wrappersEnabled(in nsIURI aURI);
  40. };
  41. [scriptable, uuid(93251ddf-5e85-4172-ac2a-31780562974f)]
  42. interface nsIXULChromeRegistry : nsIChromeRegistry
  43. {
  44. /* Should be called when locales change to reload all chrome (including XUL). */
  45. void reloadChrome();
  46. // If the optional asBCP47 parameter is true, the locale code will be
  47. // converted to a BCP47 language tag; in particular, this means that
  48. // "ja-JP-mac" will be returned as "ja-JP-x-lvariant-mac", which can be
  49. // passed to ECMA402 Intl API methods without throwing a RangeError.
  50. ACString getSelectedLocale(in ACString packageName,
  51. [optional] in boolean asBCP47);
  52. // Get the direction of the locale via the intl.uidirection.<locale> pref
  53. boolean isLocaleRTL(in ACString package);
  54. /* Should be called when skins change. Reloads only stylesheets. */
  55. void refreshSkins();
  56. /**
  57. * Installable skin XBL is not always granted the same privileges as other
  58. * chrome. This asks the chrome registry whether scripts are allowed to be
  59. * run for a particular chrome URI. Do not pass non-chrome URIs to this
  60. * method.
  61. */
  62. boolean allowScriptsForPackage(in nsIURI url);
  63. /**
  64. * Content should only be allowed to load chrome JS from certain packages.
  65. * This method reflects the contentaccessible flag on packages.
  66. * Do not pass non-chrome URIs to this method.
  67. */
  68. boolean allowContentToAccess(in nsIURI url);
  69. /**
  70. * Returns true if the passed chrome URL is allowed to be loaded in a remote
  71. * process. This reflects the remoteenabled flag on packages.
  72. * Do not pass non-chrome URIs to this method.
  73. */
  74. boolean canLoadURLRemotely(in nsIURI url);
  75. /**
  76. * Returns true if the passed chrome URL must be loaded in a remote process.
  77. * This reflects the remoterequired flag on packages.
  78. * Do not pass non-chrome URIs to this method.
  79. */
  80. boolean mustLoadURLRemotely(in nsIURI url);
  81. };
  82. %{ C++
  83. #define NS_CHROMEREGISTRY_CONTRACTID \
  84. "@mozilla.org/chrome/chrome-registry;1"
  85. /**
  86. * Chrome registry will notify various caches that all chrome files need
  87. * flushing.
  88. */
  89. #define NS_CHROME_FLUSH_TOPIC \
  90. "chrome-flush-caches"
  91. /**
  92. * Chrome registry will notify various caches that skin files need flushing.
  93. * If "chrome-flush-caches" is notified, this topic will *not* be notified.
  94. */
  95. #define NS_CHROME_FLUSH_SKINS_TOPIC \
  96. "chrome-flush-skin-caches"
  97. %}