2008-08-27 03:09:02 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-08-27 03:09:02 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsIApplicationCache;
|
2012-06-06 06:08:30 +04:00
|
|
|
interface nsIFile;
|
2012-07-31 10:36:00 +04:00
|
|
|
interface nsIURI;
|
|
|
|
interface nsILoadContext;
|
2008-08-27 03:09:02 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The application cache service manages the set of application cache
|
|
|
|
* groups.
|
|
|
|
*/
|
2012-10-02 17:55:00 +04:00
|
|
|
[scriptable, uuid(9b5b2cde-d5dd-48d3-87f8-8e8b776952a8)]
|
2008-08-27 03:09:02 +04:00
|
|
|
interface nsIApplicationCacheService : nsISupports
|
|
|
|
{
|
2012-07-31 10:36:00 +04:00
|
|
|
/**
|
|
|
|
* Create group string identifying cache group according the manifest
|
|
|
|
* URL and the given load context.
|
|
|
|
*/
|
|
|
|
ACString buildGroupID(in nsIURI aManifestURL,
|
|
|
|
in nsILoadContext aLoadContext);
|
|
|
|
|
2012-10-02 17:55:00 +04:00
|
|
|
/**
|
|
|
|
* Same as buildGroupID method, just doesn't require load context.
|
|
|
|
*/
|
|
|
|
ACString buildGroupIDForApp(in nsIURI aManifestURL,
|
|
|
|
in unsigned long aAppID,
|
|
|
|
in boolean aInBrowser);
|
|
|
|
|
2008-08-27 03:09:02 +04:00
|
|
|
/**
|
|
|
|
* Create a new, empty application cache for the given cache
|
|
|
|
* group.
|
|
|
|
*/
|
|
|
|
nsIApplicationCache createApplicationCache(in ACString group);
|
|
|
|
|
2012-06-04 18:12:24 +04:00
|
|
|
/**
|
|
|
|
* Create a new, empty application cache for the given cache
|
|
|
|
* group residing in a custom directory with a custom quota.
|
|
|
|
*
|
|
|
|
* @param group
|
|
|
|
* URL of the manifest
|
|
|
|
* @param directory
|
|
|
|
* Actually a reference to a profile directory where to
|
|
|
|
* create the OfflineCache sub-dir.
|
|
|
|
* @param quota
|
|
|
|
* Optional override of the default quota.
|
|
|
|
*/
|
|
|
|
nsIApplicationCache createCustomApplicationCache(in ACString group,
|
2012-06-06 06:08:30 +04:00
|
|
|
in nsIFile profileDir,
|
2012-08-22 19:56:38 +04:00
|
|
|
in int32_t quota);
|
2012-06-04 18:12:24 +04:00
|
|
|
|
2008-08-27 03:09:02 +04:00
|
|
|
/**
|
|
|
|
* Get an application cache object for the given client ID.
|
|
|
|
*/
|
|
|
|
nsIApplicationCache getApplicationCache(in ACString clientID);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the currently active cache object for a cache group.
|
|
|
|
*/
|
|
|
|
nsIApplicationCache getActiveCache(in ACString group);
|
|
|
|
|
2008-11-04 21:59:12 +03:00
|
|
|
/**
|
|
|
|
* Deactivate the currently-active cache object for a cache group.
|
|
|
|
*/
|
|
|
|
void deactivateGroup(in ACString group);
|
|
|
|
|
2012-10-03 04:39:09 +04:00
|
|
|
/**
|
|
|
|
* Deletes some or all of an application's cache entries.
|
|
|
|
*
|
|
|
|
* @param appId
|
|
|
|
* The mozIApplication.localId of the application.
|
|
|
|
*
|
|
|
|
* @param discardOnlyBrowserEntries
|
|
|
|
* If true, only entries marked as 'inBrowserElement' are deleted
|
|
|
|
* (this is used by browser applications to delete user browsing
|
|
|
|
* data/history.). If false, *all* entries for the given appId are
|
|
|
|
* deleted (this is used for application uninstallation).
|
|
|
|
*/
|
|
|
|
void discardByAppId(in int32_t appID, in boolean discardOnlyBrowserEntries);
|
|
|
|
|
2008-08-27 03:09:02 +04:00
|
|
|
/**
|
|
|
|
* Try to find the best application cache to serve a resource.
|
|
|
|
*/
|
2012-07-31 10:36:00 +04:00
|
|
|
nsIApplicationCache chooseApplicationCache(in ACString key,
|
|
|
|
[optional] in nsILoadContext loadContext);
|
2008-09-30 22:34:23 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Flags the key as being opportunistically cached.
|
|
|
|
*
|
|
|
|
* This method should also propagate the entry to other
|
|
|
|
* application caches with the same opportunistic namespace, but
|
|
|
|
* this is not currently implemented.
|
|
|
|
*
|
|
|
|
* @param cache
|
|
|
|
* The cache in which the entry is cached now.
|
|
|
|
* @param key
|
|
|
|
* The cache entry key.
|
|
|
|
*/
|
|
|
|
void cacheOpportunistically(in nsIApplicationCache cache, in ACString key);
|
2009-02-22 22:09:10 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the list of application cache groups.
|
|
|
|
*/
|
2009-11-04 22:23:20 +03:00
|
|
|
void getGroups([optional] out unsigned long count,
|
2009-02-22 22:09:10 +03:00
|
|
|
[array, size_is(count), retval] out string groupIDs);
|
2012-03-31 04:52:06 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the list of application cache groups in the order of
|
|
|
|
* activating time.
|
|
|
|
*/
|
|
|
|
void getGroupsTimeOrdered([optional] out unsigned long count,
|
|
|
|
[array, size_is(count), retval] out string groupIDs);
|
2008-08-27 03:09:02 +04:00
|
|
|
};
|