1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is the Mozilla browser.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * Adam Lock <adamlock@netscape.com>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsISupports.idl"
41
42 interface nsIURI;
43
44 /**
45 * Interface implemented by objects capable of fixing up strings into URIs
46 */
47 [scriptable, uuid(773081ac-9f81-4bdb-9e7a-5e87b4361f09)]
48 interface nsIURIFixup : nsISupports
49 {
50 /** No fixup flags. */
51 const unsigned long FIXUP_FLAG_NONE = 0;
52
53 /**
54 * Allow the fixup to use a keyword lookup service to complete the URI.
55 * The fixup object implementer should honour this flag and only perform
56 * any lengthy keyword (or search) operation if it is set.
57 */
58 const unsigned long FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP = 1;
59
60 /**
61 * Tell the fixup to make an alternate URI from the input URI, for example
62 * to turn foo into www.foo.com.
63 */
64 const unsigned long FIXUP_FLAGS_MAKE_ALTERNATE_URI = 2;
65
66 /**
67 * Converts an internal URI (e.g. a wyciwyg URI) into one which we can
68 * expose to the user, for example on the URL bar.
69 *
70 * @param aURI The URI to be converted
71 * @return nsIURI The converted, exposable URI
72 * @throws NS_ERROR_MALFORMED_URI when the exposable portion of aURI is malformed
73 * @throws NS_ERROR_UNKNOWN_PROTOCOL when we can't get a protocol handler service
74 * for the URI scheme.
75 */
76 nsIURI createExposableURI(in nsIURI aURI);
77
78 /**
79 * Converts the specified string into a URI, first attempting
80 * to correct any errors in the syntax or other vagaries. Returns
81 * a wellformed URI or nsnull if it can't.
82 *
83 * @param aURIText Candidate URI.
84 * @param aFixupFlags Flags that govern ways the URI may be fixed up.
85 */
86 nsIURI createFixupURI(in AUTF8String aURIText, in unsigned long aFixupFlags);
87
88 /**
89 * Converts the specified keyword string into a URI. Note that it's the
90 * caller's responsibility to check whether keywords are enabled and
91 * whether aKeyword is a sensible keyword.
92 */
93 nsIURI keywordToURI(in AUTF8String aKeyword);
94 };