michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIURI; michael@0: interface nsIInputStream; michael@0: michael@0: /** michael@0: * Interface implemented by objects capable of fixing up strings into URIs michael@0: */ michael@0: [scriptable, uuid(731877f8-973b-414c-b772-9ca1f3fffb7e)] michael@0: interface nsIURIFixup : nsISupports michael@0: { michael@0: /** No fixup flags. */ michael@0: const unsigned long FIXUP_FLAG_NONE = 0; michael@0: michael@0: /** michael@0: * Allow the fixup to use a keyword lookup service to complete the URI. michael@0: * The fixup object implementer should honour this flag and only perform michael@0: * any lengthy keyword (or search) operation if it is set. michael@0: */ michael@0: const unsigned long FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP = 1; michael@0: michael@0: /** michael@0: * Tell the fixup to make an alternate URI from the input URI, for example michael@0: * to turn foo into www.foo.com. michael@0: */ michael@0: const unsigned long FIXUP_FLAGS_MAKE_ALTERNATE_URI = 2; michael@0: michael@0: /** michael@0: * Fix common scheme typos. michael@0: */ michael@0: const unsigned long FIXUP_FLAG_FIX_SCHEME_TYPOS = 8; michael@0: michael@0: /* Note that flag 4 is available. */ michael@0: michael@0: /** michael@0: * Converts an internal URI (e.g. a wyciwyg URI) into one which we can michael@0: * expose to the user, for example on the URL bar. michael@0: * michael@0: * @param aURI The URI to be converted michael@0: * @return nsIURI The converted, exposable URI michael@0: * @throws NS_ERROR_MALFORMED_URI when the exposable portion of aURI is malformed michael@0: * @throws NS_ERROR_UNKNOWN_PROTOCOL when we can't get a protocol handler service michael@0: * for the URI scheme. michael@0: */ michael@0: nsIURI createExposableURI(in nsIURI aURI); michael@0: michael@0: /** michael@0: * Converts the specified string into a URI, first attempting michael@0: * to correct any errors in the syntax or other vagaries. Returns michael@0: * a wellformed URI or nullptr if it can't. michael@0: * michael@0: * @param aURIText Candidate URI. michael@0: * @param aFixupFlags Flags that govern ways the URI may be fixed up. michael@0: * @param aPostData The POST data to submit with the returned michael@0: * URI (see nsISearchSubmission). michael@0: */ michael@0: nsIURI createFixupURI(in AUTF8String aURIText, in unsigned long aFixupFlags, michael@0: [optional] out nsIInputStream aPostData); michael@0: michael@0: /** michael@0: * Converts the specified keyword string into a URI. Note that it's the michael@0: * caller's responsibility to check whether keywords are enabled and michael@0: * whether aKeyword is a sensible keyword. michael@0: * michael@0: * @param aKeyword The keyword string to convert into a URI michael@0: * @param aPostData The POST data to submit to the returned URI michael@0: * (see nsISearchSubmission). michael@0: * michael@0: * @throws NS_ERROR_FAILURE if the resulting URI requires submission of POST michael@0: * data and aPostData is null. michael@0: */ michael@0: nsIURI keywordToURI(in AUTF8String aKeyword, michael@0: [optional] out nsIInputStream aPostData); michael@0: }; michael@0: