1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Mozilla Communicator client code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
37 #ifndef nsILinkHandler_h___
38 #define nsILinkHandler_h___
40 #include "nsISupports.h"
49 // Interface ID for nsILinkHandler
50 #define NS_ILINKHANDLER_IID \
51 { 0x514bc565, 0x8d38, 0x4dde,{0xb4, 0xeb, 0xe7, 0xb5, 0x01, 0x2b, 0xf4, 0x64}}
54 eLinkState_Unknown
= 0,
55 eLinkState_Unvisited
= 1,
56 eLinkState_Visited
= 2,
57 eLinkState_NotLink
= 3
61 * Interface used for handling clicks on links
63 class nsILinkHandler
: public nsISupports
{
65 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINKHANDLER_IID
)
68 * Process a click on a link.
70 * @param aContent the content for the frame that generated the trigger
71 * @param aURI a URI object that defines the destination for the link
72 * @param aTargetSpec indicates where the link is targeted (may be an empty
74 * @param aPostDataStream the POST data to send
75 * @param aHeadersDataStream ???
77 NS_IMETHOD
OnLinkClick(nsIContent
* aContent
,
79 const PRUnichar
* aTargetSpec
,
80 nsIInputStream
* aPostDataStream
= 0,
81 nsIInputStream
* aHeadersDataStream
= 0) = 0;
84 * Process a click on a link.
86 * Works the same as OnLinkClick() except it happens immediately rather than
89 * @param aContent the content for the frame that generated the trigger
90 * @param aURI a URI obect that defines the destination for the link
91 * @param aTargetSpec indicates where the link is targeted (may be an empty
93 * @param aPostDataStream the POST data to send
94 * @param aHeadersDataStream ???
95 * @param aDocShell (out-param) the DocShell that the request was opened on
96 * @param aRequest the request that was opened
98 NS_IMETHOD
OnLinkClickSync(nsIContent
* aContent
,
100 const PRUnichar
* aTargetSpec
,
101 nsIInputStream
* aPostDataStream
= 0,
102 nsIInputStream
* aHeadersDataStream
= 0,
103 nsIDocShell
** aDocShell
= 0,
104 nsIRequest
** aRequest
= 0) = 0;
107 * Process a mouse-over a link.
109 * @param aContent the linked content.
110 * @param aURI an URI object that defines the destination for the link
111 * @param aTargetSpec indicates where the link is targeted (it may be an empty
114 NS_IMETHOD
OnOverLink(nsIContent
* aContent
,
116 const PRUnichar
* aTargetSpec
) = 0;
119 * Process the mouse leaving a link.
121 NS_IMETHOD
OnLeaveLink() = 0;
125 * Get the state of a link to a given absolute URL
127 NS_IMETHOD
GetLinkState(nsIURI
* aLinkURI
, nsLinkState
& aState
) = 0;
130 NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler
, NS_ILINKHANDLER_IID
)
132 #endif /* nsILinkHandler_h___ */