Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | interface nsIApplicationCache; |
michael@0 | 10 | interface nsIFile; |
michael@0 | 11 | interface nsIURI; |
michael@0 | 12 | interface nsILoadContextInfo; |
michael@0 | 13 | |
michael@0 | 14 | /** |
michael@0 | 15 | * The application cache service manages the set of application cache |
michael@0 | 16 | * groups. |
michael@0 | 17 | */ |
michael@0 | 18 | [scriptable, uuid(03b41c3d-0816-4134-8b2e-4f5afbdb1f06)] |
michael@0 | 19 | interface nsIApplicationCacheService : nsISupports |
michael@0 | 20 | { |
michael@0 | 21 | /** |
michael@0 | 22 | * Create group string identifying cache group according the manifest |
michael@0 | 23 | * URL and the given load context. |
michael@0 | 24 | */ |
michael@0 | 25 | ACString buildGroupID(in nsIURI aManifestURL, |
michael@0 | 26 | in nsILoadContextInfo aLoadContextInfo); |
michael@0 | 27 | |
michael@0 | 28 | /** |
michael@0 | 29 | * Same as buildGroupID method, just doesn't require load context. |
michael@0 | 30 | */ |
michael@0 | 31 | ACString buildGroupIDForApp(in nsIURI aManifestURL, |
michael@0 | 32 | in unsigned long aAppID, |
michael@0 | 33 | in boolean aInBrowser); |
michael@0 | 34 | |
michael@0 | 35 | /** |
michael@0 | 36 | * Create a new, empty application cache for the given cache |
michael@0 | 37 | * group. |
michael@0 | 38 | */ |
michael@0 | 39 | nsIApplicationCache createApplicationCache(in ACString group); |
michael@0 | 40 | |
michael@0 | 41 | /** |
michael@0 | 42 | * Create a new, empty application cache for the given cache |
michael@0 | 43 | * group residing in a custom directory with a custom quota. |
michael@0 | 44 | * |
michael@0 | 45 | * @param group |
michael@0 | 46 | * URL of the manifest |
michael@0 | 47 | * @param directory |
michael@0 | 48 | * Actually a reference to a profile directory where to |
michael@0 | 49 | * create the OfflineCache sub-dir. |
michael@0 | 50 | * @param quota |
michael@0 | 51 | * Optional override of the default quota. |
michael@0 | 52 | */ |
michael@0 | 53 | nsIApplicationCache createCustomApplicationCache(in ACString group, |
michael@0 | 54 | in nsIFile profileDir, |
michael@0 | 55 | in int32_t quota); |
michael@0 | 56 | |
michael@0 | 57 | /** |
michael@0 | 58 | * Get an application cache object for the given client ID. |
michael@0 | 59 | */ |
michael@0 | 60 | nsIApplicationCache getApplicationCache(in ACString clientID); |
michael@0 | 61 | |
michael@0 | 62 | /** |
michael@0 | 63 | * Get the currently active cache object for a cache group. |
michael@0 | 64 | */ |
michael@0 | 65 | nsIApplicationCache getActiveCache(in ACString group); |
michael@0 | 66 | |
michael@0 | 67 | /** |
michael@0 | 68 | * Deactivate the currently-active cache object for a cache group. |
michael@0 | 69 | */ |
michael@0 | 70 | void deactivateGroup(in ACString group); |
michael@0 | 71 | |
michael@0 | 72 | /** |
michael@0 | 73 | * Deletes some or all of an application's cache entries. |
michael@0 | 74 | * |
michael@0 | 75 | * @param appId |
michael@0 | 76 | * The mozIApplication.localId of the application. |
michael@0 | 77 | * |
michael@0 | 78 | * @param discardOnlyBrowserEntries |
michael@0 | 79 | * If true, only entries marked as 'inBrowserElement' are deleted |
michael@0 | 80 | * (this is used by browser applications to delete user browsing |
michael@0 | 81 | * data/history.). If false, *all* entries for the given appId are |
michael@0 | 82 | * deleted (this is used for application uninstallation). |
michael@0 | 83 | */ |
michael@0 | 84 | void discardByAppId(in int32_t appID, in boolean discardOnlyBrowserEntries); |
michael@0 | 85 | |
michael@0 | 86 | /** |
michael@0 | 87 | * Try to find the best application cache to serve a resource. |
michael@0 | 88 | */ |
michael@0 | 89 | nsIApplicationCache chooseApplicationCache(in ACString key, |
michael@0 | 90 | [optional] in nsILoadContextInfo aLoadContextInfo); |
michael@0 | 91 | |
michael@0 | 92 | /** |
michael@0 | 93 | * Flags the key as being opportunistically cached. |
michael@0 | 94 | * |
michael@0 | 95 | * This method should also propagate the entry to other |
michael@0 | 96 | * application caches with the same opportunistic namespace, but |
michael@0 | 97 | * this is not currently implemented. |
michael@0 | 98 | * |
michael@0 | 99 | * @param cache |
michael@0 | 100 | * The cache in which the entry is cached now. |
michael@0 | 101 | * @param key |
michael@0 | 102 | * The cache entry key. |
michael@0 | 103 | */ |
michael@0 | 104 | void cacheOpportunistically(in nsIApplicationCache cache, in ACString key); |
michael@0 | 105 | |
michael@0 | 106 | /** |
michael@0 | 107 | * Get the list of application cache groups. |
michael@0 | 108 | */ |
michael@0 | 109 | void getGroups([optional] out unsigned long count, |
michael@0 | 110 | [array, size_is(count), retval] out string groupIDs); |
michael@0 | 111 | |
michael@0 | 112 | /** |
michael@0 | 113 | * Get the list of application cache groups in the order of |
michael@0 | 114 | * activating time. |
michael@0 | 115 | */ |
michael@0 | 116 | void getGroupsTimeOrdered([optional] out unsigned long count, |
michael@0 | 117 | [array, size_is(count), retval] out string groupIDs); |
michael@0 | 118 | }; |