nsIApplicationCacheService.idl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  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 nsIApplicationCache;
  8. interface nsIFile;
  9. interface nsIURI;
  10. interface nsILoadContextInfo;
  11. /**
  12. * The application cache service manages the set of application cache
  13. * groups.
  14. */
  15. [scriptable, uuid(b8b6546c-6cec-4bda-82df-08e006a97b56)]
  16. interface nsIApplicationCacheService : nsISupports
  17. {
  18. /**
  19. * Create group string identifying cache group according the manifest
  20. * URL and the given principal.
  21. */
  22. ACString buildGroupIDForInfo(in nsIURI aManifestURL,
  23. in nsILoadContextInfo aLoadContextInfo);
  24. ACString buildGroupIDForSuffix(in nsIURI aManifestURL,
  25. in ACString aOriginSuffix);
  26. /**
  27. * Create a new, empty application cache for the given cache
  28. * group.
  29. */
  30. nsIApplicationCache createApplicationCache(in ACString group);
  31. /**
  32. * Create a new, empty application cache for the given cache
  33. * group residing in a custom directory with a custom quota.
  34. *
  35. * @param group
  36. * URL of the manifest
  37. * @param directory
  38. * Actually a reference to a profile directory where to
  39. * create the OfflineCache sub-dir.
  40. * @param quota
  41. * Optional override of the default quota.
  42. */
  43. nsIApplicationCache createCustomApplicationCache(in ACString group,
  44. in nsIFile profileDir,
  45. in int32_t quota);
  46. /**
  47. * Get an application cache object for the given client ID.
  48. */
  49. nsIApplicationCache getApplicationCache(in ACString clientID);
  50. /**
  51. * Get the currently active cache object for a cache group.
  52. */
  53. nsIApplicationCache getActiveCache(in ACString group);
  54. /**
  55. * Deactivate the currently-active cache object for a cache group.
  56. */
  57. void deactivateGroup(in ACString group);
  58. /**
  59. * Evict offline cache entries, either all of them or those belonging
  60. * to the given origin.
  61. */
  62. void evict(in nsILoadContextInfo aLoadContextInfo);
  63. /**
  64. * Delete caches whom origin attributes matches the given pattern.
  65. */
  66. void evictMatchingOriginAttributes(in AString aPattern);
  67. /**
  68. * Try to find the best application cache to serve a resource.
  69. */
  70. nsIApplicationCache chooseApplicationCache(in ACString key,
  71. [optional] in nsILoadContextInfo aLoadContextInfo);
  72. /**
  73. * Flags the key as being opportunistically cached.
  74. *
  75. * This method should also propagate the entry to other
  76. * application caches with the same opportunistic namespace, but
  77. * this is not currently implemented.
  78. *
  79. * @param cache
  80. * The cache in which the entry is cached now.
  81. * @param key
  82. * The cache entry key.
  83. */
  84. void cacheOpportunistically(in nsIApplicationCache cache, in ACString key);
  85. /**
  86. * Get the list of application cache groups.
  87. */
  88. void getGroups([optional] out unsigned long count,
  89. [array, size_is(count), retval] out string groupIDs);
  90. /**
  91. * Get the list of application cache groups in the order of
  92. * activating time.
  93. */
  94. void getGroupsTimeOrdered([optional] out unsigned long count,
  95. [array, size_is(count), retval] out string groupIDs);
  96. };