Source code

Revision control

Other Tools

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