|
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(03b41c3d-0816-4134-8b2e-4f5afbdb1f06)] |
|
19 interface nsIApplicationCacheService : nsISupports |
|
20 { |
|
21 /** |
|
22 * Create group string identifying cache group according the manifest |
|
23 * URL and the given load context. |
|
24 */ |
|
25 ACString buildGroupID(in nsIURI aManifestURL, |
|
26 in nsILoadContextInfo aLoadContextInfo); |
|
27 |
|
28 /** |
|
29 * Same as buildGroupID method, just doesn't require load context. |
|
30 */ |
|
31 ACString buildGroupIDForApp(in nsIURI aManifestURL, |
|
32 in unsigned long aAppID, |
|
33 in boolean aInBrowser); |
|
34 |
|
35 /** |
|
36 * Create a new, empty application cache for the given cache |
|
37 * group. |
|
38 */ |
|
39 nsIApplicationCache createApplicationCache(in ACString group); |
|
40 |
|
41 /** |
|
42 * Create a new, empty application cache for the given cache |
|
43 * group residing in a custom directory with a custom quota. |
|
44 * |
|
45 * @param group |
|
46 * URL of the manifest |
|
47 * @param directory |
|
48 * Actually a reference to a profile directory where to |
|
49 * create the OfflineCache sub-dir. |
|
50 * @param quota |
|
51 * Optional override of the default quota. |
|
52 */ |
|
53 nsIApplicationCache createCustomApplicationCache(in ACString group, |
|
54 in nsIFile profileDir, |
|
55 in int32_t quota); |
|
56 |
|
57 /** |
|
58 * Get an application cache object for the given client ID. |
|
59 */ |
|
60 nsIApplicationCache getApplicationCache(in ACString clientID); |
|
61 |
|
62 /** |
|
63 * Get the currently active cache object for a cache group. |
|
64 */ |
|
65 nsIApplicationCache getActiveCache(in ACString group); |
|
66 |
|
67 /** |
|
68 * Deactivate the currently-active cache object for a cache group. |
|
69 */ |
|
70 void deactivateGroup(in ACString group); |
|
71 |
|
72 /** |
|
73 * Deletes some or all of an application's cache entries. |
|
74 * |
|
75 * @param appId |
|
76 * The mozIApplication.localId of the application. |
|
77 * |
|
78 * @param discardOnlyBrowserEntries |
|
79 * If true, only entries marked as 'inBrowserElement' are deleted |
|
80 * (this is used by browser applications to delete user browsing |
|
81 * data/history.). If false, *all* entries for the given appId are |
|
82 * deleted (this is used for application uninstallation). |
|
83 */ |
|
84 void discardByAppId(in int32_t appID, in boolean discardOnlyBrowserEntries); |
|
85 |
|
86 /** |
|
87 * Try to find the best application cache to serve a resource. |
|
88 */ |
|
89 nsIApplicationCache chooseApplicationCache(in ACString key, |
|
90 [optional] in nsILoadContextInfo aLoadContextInfo); |
|
91 |
|
92 /** |
|
93 * Flags the key as being opportunistically cached. |
|
94 * |
|
95 * This method should also propagate the entry to other |
|
96 * application caches with the same opportunistic namespace, but |
|
97 * this is not currently implemented. |
|
98 * |
|
99 * @param cache |
|
100 * The cache in which the entry is cached now. |
|
101 * @param key |
|
102 * The cache entry key. |
|
103 */ |
|
104 void cacheOpportunistically(in nsIApplicationCache cache, in ACString key); |
|
105 |
|
106 /** |
|
107 * Get the list of application cache groups. |
|
108 */ |
|
109 void getGroups([optional] out unsigned long count, |
|
110 [array, size_is(count), retval] out string groupIDs); |
|
111 |
|
112 /** |
|
113 * Get the list of application cache groups in the order of |
|
114 * activating time. |
|
115 */ |
|
116 void getGroupsTimeOrdered([optional] out unsigned long count, |
|
117 [array, size_is(count), retval] out string groupIDs); |
|
118 }; |