xpcom/io/nsIDirectoryService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/io/nsIDirectoryService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +interface nsIFile;
    1.12 +interface nsISimpleEnumerator;
    1.13 +
    1.14 +/**
    1.15 + * nsIDirectoryServiceProvider
    1.16 + *
    1.17 + * Used by Directory Service to get file locations.
    1.18 + */
    1.19 +
    1.20 +[scriptable, uuid(bbf8cab0-d43a-11d3-8cc2-00609792278c)]
    1.21 +interface nsIDirectoryServiceProvider: nsISupports
    1.22 +{
    1.23 + /**
    1.24 +  * getFile
    1.25 +  *
    1.26 +  * Directory Service calls this when it gets the first request for
    1.27 +  * a prop or on every request if the prop is not persistent.
    1.28 +  *
    1.29 +  * @param prop         The symbolic name of the file.
    1.30 +  * @param persistent   TRUE - The returned file will be cached by Directory
    1.31 +  *                     Service. Subsequent requests for this prop will
    1.32 +  *                     bypass the provider and use the cache.
    1.33 +  *                     FALSE - The provider will be asked for this prop
    1.34 +  *                     each time it is requested.
    1.35 +  *
    1.36 +  * @return             The file represented by the property.
    1.37 +  *
    1.38 +  */ 
    1.39 +  nsIFile getFile(in string prop, out boolean persistent);
    1.40 +};
    1.41 +
    1.42 +/**
    1.43 + * nsIDirectoryServiceProvider2
    1.44 + *
    1.45 + * An extension of nsIDirectoryServiceProvider which allows
    1.46 + * multiple files to be returned for the given key.
    1.47 + */
    1.48 +
    1.49 +[scriptable, uuid(2f977d4b-5485-11d4-87e2-0010a4e75ef2)]
    1.50 +interface nsIDirectoryServiceProvider2: nsIDirectoryServiceProvider
    1.51 +{
    1.52 + /**
    1.53 +  * getFiles
    1.54 +  *
    1.55 +  * Directory Service calls this when it gets a request for
    1.56 +  * a prop and the requested type is nsISimpleEnumerator.
    1.57 +  *
    1.58 +  * @param prop         The symbolic name of the file list.
    1.59 +  *
    1.60 +  * @return             An enumerator for a list of file locations.
    1.61 +  *                     The elements in the enumeration are nsIFile
    1.62 +  * @returnCode         NS_SUCCESS_AGGREGATE_RESULT if this result should be
    1.63 +  *                     aggregated with other "lower" providers.
    1.64 +  */
    1.65 +  nsISimpleEnumerator getFiles(in string prop);
    1.66 +};
    1.67 +
    1.68 +/**
    1.69 + * nsIDirectoryService
    1.70 + */
    1.71 +
    1.72 +[scriptable, uuid(57a66a60-d43a-11d3-8cc2-00609792278c)]
    1.73 +interface nsIDirectoryService: nsISupports
    1.74 +{
    1.75 + /**
    1.76 +  * init
    1.77 +  *
    1.78 +  * Must be called. Used internally by XPCOM initialization.
    1.79 +  *
    1.80 +  */
    1.81 +  void init();
    1.82 +
    1.83 + /**
    1.84 +  * registerProvider
    1.85 +  *
    1.86 +  * Register a provider with the service.
    1.87 +  *
    1.88 +  * @param prov            The service will keep a strong reference
    1.89 +  *                        to this object. It will be released when
    1.90 +  *                        the service is released.
    1.91 +  *
    1.92 +  */  
    1.93 +  void registerProvider(in nsIDirectoryServiceProvider prov);
    1.94 +  
    1.95 + /**
    1.96 +  * unregisterProvider
    1.97 +  *
    1.98 +  * Unregister a provider with the service.
    1.99 +  *
   1.100 +  * @param prov            
   1.101 +  *
   1.102 +  */  
   1.103 +  void unregisterProvider(in nsIDirectoryServiceProvider prov);
   1.104 +};
   1.105 +
   1.106 +

mercurial