docshell/base/nsIURIFixup.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docshell/base/nsIURIFixup.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,81 @@
     1.4 +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +
    1.12 +interface nsIURI;
    1.13 +interface nsIInputStream;
    1.14 +
    1.15 +/**
    1.16 + * Interface implemented by objects capable of fixing up strings into URIs
    1.17 + */
    1.18 +[scriptable, uuid(731877f8-973b-414c-b772-9ca1f3fffb7e)]
    1.19 +interface nsIURIFixup : nsISupports
    1.20 +{
    1.21 +    /** No fixup flags. */
    1.22 +    const unsigned long FIXUP_FLAG_NONE = 0;
    1.23 +
    1.24 +    /**
    1.25 +     * Allow the fixup to use a keyword lookup service to complete the URI.
    1.26 +     * The fixup object implementer should honour this flag and only perform
    1.27 +     * any lengthy keyword (or search) operation if it is set.
    1.28 +     */
    1.29 +    const unsigned long FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP = 1;
    1.30 +
    1.31 +    /**
    1.32 +     * Tell the fixup to make an alternate URI from the input URI, for example
    1.33 +     * to turn foo into www.foo.com.
    1.34 +     */
    1.35 +    const unsigned long FIXUP_FLAGS_MAKE_ALTERNATE_URI = 2;
    1.36 +
    1.37 +    /**
    1.38 +     * Fix common scheme typos.
    1.39 +     */
    1.40 +    const unsigned long FIXUP_FLAG_FIX_SCHEME_TYPOS = 8;
    1.41 +
    1.42 +    /* Note that flag 4 is available. */
    1.43 +
    1.44 +    /**
    1.45 +     * Converts an internal URI (e.g. a wyciwyg URI) into one which we can
    1.46 +     * expose to the user, for example on the URL bar.
    1.47 +     *
    1.48 +     * @param  aURI       The URI to be converted
    1.49 +     * @return nsIURI     The converted, exposable URI
    1.50 +     * @throws NS_ERROR_MALFORMED_URI when the exposable portion of aURI is malformed
    1.51 +     * @throws NS_ERROR_UNKNOWN_PROTOCOL when we can't get a protocol handler service
    1.52 +     *         for the URI scheme.
    1.53 +     */
    1.54 +    nsIURI createExposableURI(in nsIURI aURI);
    1.55 +
    1.56 +    /**
    1.57 +     * Converts the specified string into a URI, first attempting
    1.58 +     * to correct any errors in the syntax or other vagaries. Returns
    1.59 +     * a wellformed URI or nullptr if it can't.
    1.60 +     *
    1.61 +     * @param aURIText    Candidate URI.
    1.62 +     * @param aFixupFlags Flags that govern ways the URI may be fixed up.
    1.63 +     * @param aPostData   The POST data to submit with the returned
    1.64 +     *                    URI (see nsISearchSubmission).
    1.65 +     */
    1.66 +    nsIURI createFixupURI(in AUTF8String aURIText, in unsigned long aFixupFlags,
    1.67 +                          [optional] out nsIInputStream aPostData);
    1.68 +
    1.69 +    /**
    1.70 +     * Converts the specified keyword string into a URI.  Note that it's the
    1.71 +     * caller's responsibility to check whether keywords are enabled and
    1.72 +     * whether aKeyword is a sensible keyword.
    1.73 +     *
    1.74 +     * @param aKeyword  The keyword string to convert into a URI
    1.75 +     * @param aPostData The POST data to submit to the returned URI
    1.76 +     *                  (see nsISearchSubmission).
    1.77 +     *
    1.78 +     * @throws NS_ERROR_FAILURE if the resulting URI requires submission of POST
    1.79 +     *         data and aPostData is null.
    1.80 +     */
    1.81 +    nsIURI keywordToURI(in AUTF8String aKeyword,
    1.82 +                        [optional] out nsIInputStream aPostData);
    1.83 +};
    1.84 +

mercurial