1/* -*- Mode: IDL; tab-width: 4; 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 nsIChannel;
10interface nsIContentViewer;
11interface nsIStreamListener;
12interface nsIDocShell;
13interface nsIDocument;
14interface nsILoadGroup;
15interface nsIPrincipal;
16
17/**
18 * To get a component that implements nsIDocumentLoaderFactory
19 * for a given mimetype, use nsICategoryManager to find an entry
20 * with the mimetype as its name in the category "Gecko-Content-Viewers".
21 * The value of the entry is the contractid of the component.
22 * The component is a service, so use GetService, not CreateInstance to get it.
23 */
24
25[scriptable, uuid(e795239e-9d3c-47c4-b063-9e600fb3b287)]
26interface nsIDocumentLoaderFactory : nsISupports {
27    nsIContentViewer createInstance(in string aCommand,
28                              in nsIChannel aChannel,
29                              in nsILoadGroup aLoadGroup,
30                              in ACString aContentType,
31                              in nsIDocShell aContainer,
32                              in nsISupports aExtraInfo,
33                              out nsIStreamListener aDocListenerResult);
34
35    nsIContentViewer createInstanceForDocument(in nsISupports aContainer,
36                                         in nsIDocument aDocument,
37                                         in string aCommand);
38
39    /**
40     * Create a blank document using the given loadgroup and given
41     * principal.  aPrincipal is allowed to be null, in which case the
42     * new document will get the about:blank codebase principal.
43     */
44    nsIDocument createBlankDocument(in nsILoadGroup aLoadGroup,
45                                    in nsIPrincipal aPrincipal);
46};
47