1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6#include "nsISupports.idl"
7
8interface nsIFile;
9interface nsISimpleEnumerator;
10
11/**
12 * nsIDirectoryServiceProvider
13 *
14 * Used by Directory Service to get file locations.
15 */
16
17[scriptable, uuid(bbf8cab0-d43a-11d3-8cc2-00609792278c)]
18interface nsIDirectoryServiceProvider: nsISupports
19{
20 /**
21  * getFile
22  *
23  * Directory Service calls this when it gets the first request for
24  * a prop or on every request if the prop is not persistent.
25  *
26  * @param prop         The symbolic name of the file.
27  * @param persistent   TRUE - The returned file will be cached by Directory
28  *                     Service. Subsequent requests for this prop will
29  *                     bypass the provider and use the cache.
30  *                     FALSE - The provider will be asked for this prop
31  *                     each time it is requested.
32  *
33  * @return             The file represented by the property.
34  *
35  */
36  nsIFile getFile(in string prop, out boolean persistent);
37};
38
39/**
40 * nsIDirectoryServiceProvider2
41 *
42 * An extension of nsIDirectoryServiceProvider which allows
43 * multiple files to be returned for the given key.
44 */
45
46[scriptable, uuid(2f977d4b-5485-11d4-87e2-0010a4e75ef2)]
47interface nsIDirectoryServiceProvider2: nsIDirectoryServiceProvider
48{
49 /**
50  * getFiles
51  *
52  * Directory Service calls this when it gets a request for
53  * a prop and the requested type is nsISimpleEnumerator.
54  *
55  * @param prop         The symbolic name of the file list.
56  *
57  * @return             An enumerator for a list of file locations.
58  *                     The elements in the enumeration are nsIFile
59  * @returnCode         NS_SUCCESS_AGGREGATE_RESULT if this result should be
60  *                     aggregated with other "lower" providers.
61  */
62  nsISimpleEnumerator getFiles(in string prop);
63};
64
65/**
66 * nsIDirectoryService
67 */
68
69[scriptable, uuid(57a66a60-d43a-11d3-8cc2-00609792278c)]
70interface nsIDirectoryService: nsISupports
71{
72 /**
73  * init
74  *
75  * Must be called. Used internally by XPCOM initialization.
76  *
77  */
78  void init();
79
80 /**
81  * registerProvider
82  *
83  * Register a provider with the service.
84  *
85  * @param prov            The service will keep a strong reference
86  *                        to this object. It will be released when
87  *                        the service is released.
88  *
89  */
90  void registerProvider(in nsIDirectoryServiceProvider prov);
91
92 /**
93  * unregisterProvider
94  *
95  * Unregister a provider with the service.
96  *
97  * @param prov
98  *
99  */
100  void unregisterProvider(in nsIDirectoryServiceProvider prov);
101};
102
103
104