michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIApplicationCache; michael@0: interface nsIFile; michael@0: interface nsIURI; michael@0: interface nsILoadContextInfo; michael@0: michael@0: /** michael@0: * The application cache service manages the set of application cache michael@0: * groups. michael@0: */ michael@0: [scriptable, uuid(03b41c3d-0816-4134-8b2e-4f5afbdb1f06)] michael@0: interface nsIApplicationCacheService : nsISupports michael@0: { michael@0: /** michael@0: * Create group string identifying cache group according the manifest michael@0: * URL and the given load context. michael@0: */ michael@0: ACString buildGroupID(in nsIURI aManifestURL, michael@0: in nsILoadContextInfo aLoadContextInfo); michael@0: michael@0: /** michael@0: * Same as buildGroupID method, just doesn't require load context. michael@0: */ michael@0: ACString buildGroupIDForApp(in nsIURI aManifestURL, michael@0: in unsigned long aAppID, michael@0: in boolean aInBrowser); michael@0: michael@0: /** michael@0: * Create a new, empty application cache for the given cache michael@0: * group. michael@0: */ michael@0: nsIApplicationCache createApplicationCache(in ACString group); michael@0: michael@0: /** michael@0: * Create a new, empty application cache for the given cache michael@0: * group residing in a custom directory with a custom quota. michael@0: * michael@0: * @param group michael@0: * URL of the manifest michael@0: * @param directory michael@0: * Actually a reference to a profile directory where to michael@0: * create the OfflineCache sub-dir. michael@0: * @param quota michael@0: * Optional override of the default quota. michael@0: */ michael@0: nsIApplicationCache createCustomApplicationCache(in ACString group, michael@0: in nsIFile profileDir, michael@0: in int32_t quota); michael@0: michael@0: /** michael@0: * Get an application cache object for the given client ID. michael@0: */ michael@0: nsIApplicationCache getApplicationCache(in ACString clientID); michael@0: michael@0: /** michael@0: * Get the currently active cache object for a cache group. michael@0: */ michael@0: nsIApplicationCache getActiveCache(in ACString group); michael@0: michael@0: /** michael@0: * Deactivate the currently-active cache object for a cache group. michael@0: */ michael@0: void deactivateGroup(in ACString group); michael@0: michael@0: /** michael@0: * Deletes some or all of an application's cache entries. michael@0: * michael@0: * @param appId michael@0: * The mozIApplication.localId of the application. michael@0: * michael@0: * @param discardOnlyBrowserEntries michael@0: * If true, only entries marked as 'inBrowserElement' are deleted michael@0: * (this is used by browser applications to delete user browsing michael@0: * data/history.). If false, *all* entries for the given appId are michael@0: * deleted (this is used for application uninstallation). michael@0: */ michael@0: void discardByAppId(in int32_t appID, in boolean discardOnlyBrowserEntries); michael@0: michael@0: /** michael@0: * Try to find the best application cache to serve a resource. michael@0: */ michael@0: nsIApplicationCache chooseApplicationCache(in ACString key, michael@0: [optional] in nsILoadContextInfo aLoadContextInfo); michael@0: michael@0: /** michael@0: * Flags the key as being opportunistically cached. michael@0: * michael@0: * This method should also propagate the entry to other michael@0: * application caches with the same opportunistic namespace, but michael@0: * this is not currently implemented. michael@0: * michael@0: * @param cache michael@0: * The cache in which the entry is cached now. michael@0: * @param key michael@0: * The cache entry key. michael@0: */ michael@0: void cacheOpportunistically(in nsIApplicationCache cache, in ACString key); michael@0: michael@0: /** michael@0: * Get the list of application cache groups. michael@0: */ michael@0: void getGroups([optional] out unsigned long count, michael@0: [array, size_is(count), retval] out string groupIDs); michael@0: michael@0: /** michael@0: * Get the list of application cache groups in the order of michael@0: * activating time. michael@0: */ michael@0: void getGroupsTimeOrdered([optional] out unsigned long count, michael@0: [array, size_is(count), retval] out string groupIDs); michael@0: };