1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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
9interface imgIRequest;
10interface nsIDocument;
11interface nsIDOMDocument;
12interface nsIProperties;
13interface nsIURI;
14
15/**
16 * imgICache interface
17 *
18 * @author Stuart Parmenter <pavlov@netscape.com>
19 * @version 0.1
20 * @see imagelib2
21 */
22[scriptable, builtinclass, uuid(bfdf23ff-378e-402e-8a6c-840f0c82b6c3)]
23interface imgICache : nsISupports
24{
25  /**
26   * Evict images from the cache.
27   *
28   * @param chrome If TRUE,  evict only chrome images.
29   *               If FALSE, evict everything except chrome images.
30   */
31  void clearCache(in boolean chrome);
32
33  /**
34   * Evict images from the cache.
35   *
36   * @param uri The URI to remove.
37   * @param doc The document to remove the cache entry for.
38   * @throws NS_ERROR_NOT_AVAILABLE if \a uri was unable to be removed from
39   * the cache.
40   */
41  [noscript] void removeEntry(in nsIURI uri, [optional] in nsIDOMDocument doc);
42
43  /**
44   * Find Properties
45   * Used to get properties such as 'type' and 'content-disposition'
46   * 'type' is a nsISupportsCString containing the images' mime type such as
47   * 'image/png'
48   * 'content-disposition' will be a nsISupportsCString containing the header
49   * If you call this before any data has been loaded from a URI, it will
50   * succeed, but come back empty.
51   *
52   * Hopefully this will be removed with bug 805119
53   *
54   * @param uri The URI to look up.
55   * @param doc Optional pointer to the document that the cache entry belongs to.
56   * @returns NULL if the URL was not found in the cache
57   */
58  [must_use]
59  nsIProperties findEntryProperties(in nsIURI uri,
60                                    [optional] in nsIDOMDocument doc);
61
62  /**
63   * Make this cache instance respect private browsing notifications. This
64   * entails clearing the chrome and content caches whenever the
65   * last-pb-context-exited notification is observed.
66   */
67  void respectPrivacyNotifications();
68
69  /**
70   * Clear the image cache for a document.  Controlled documents are responsible
71   * for doing this manually when they get destroyed.
72   */
73  [noscript, notxpcom]
74  void clearCacheForControlledDocument(in nsIDocument doc);
75};
76