1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsILinkHandler_h___
6 #define nsILinkHandler_h___
8 #include "nsISupports.h"
9 #include "mozilla/EventForwards.h"
17 // Interface ID for nsILinkHandler
18 #define NS_ILINKHANDLER_IID \
19 { 0xceb9aade, 0x43da, 0x4f1a, \
20 { 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } }
23 * Interface used for handling clicks on links
25 class nsILinkHandler
: public nsISupports
{
27 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINKHANDLER_IID
)
30 * Process a click on a link.
32 * @param aContent the content for the frame that generated the trigger
33 * @param aURI a URI object that defines the destination for the link
34 * @param aTargetSpec indicates where the link is targeted (may be an empty
36 * @param aPostDataStream the POST data to send
37 * @param aFileName non-null when the link should be downloaded as the given file
38 * @param aHeadersDataStream ???
39 * @param aIsTrusted false if the triggerer is an untrusted DOM event.
41 NS_IMETHOD
OnLinkClick(nsIContent
* aContent
,
43 const char16_t
* aTargetSpec
,
44 const nsAString
& aFileName
,
45 nsIInputStream
* aPostDataStream
,
46 nsIInputStream
* aHeadersDataStream
,
50 * Process a click on a link.
52 * Works the same as OnLinkClick() except it happens immediately rather than
55 * @param aContent the content for the frame that generated the trigger
56 * @param aURI a URI obect that defines the destination for the link
57 * @param aTargetSpec indicates where the link is targeted (may be an empty
59 * @param aFileName non-null when the link should be downloaded as the given file
60 * @param aPostDataStream the POST data to send
61 * @param aHeadersDataStream ???
62 * @param aDocShell (out-param) the DocShell that the request was opened on
63 * @param aRequest the request that was opened
65 NS_IMETHOD
OnLinkClickSync(nsIContent
* aContent
,
67 const char16_t
* aTargetSpec
,
68 const nsAString
& aFileName
,
69 nsIInputStream
* aPostDataStream
= 0,
70 nsIInputStream
* aHeadersDataStream
= 0,
71 nsIDocShell
** aDocShell
= 0,
72 nsIRequest
** aRequest
= 0) = 0;
75 * Process a mouse-over a link.
77 * @param aContent the linked content.
78 * @param aURI an URI object that defines the destination for the link
79 * @param aTargetSpec indicates where the link is targeted (it may be an empty
82 NS_IMETHOD
OnOverLink(nsIContent
* aContent
,
84 const char16_t
* aTargetSpec
) = 0;
87 * Process the mouse leaving a link.
89 NS_IMETHOD
OnLeaveLink() = 0;
92 NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler
, NS_ILINKHANDLER_IID
)
94 #endif /* nsILinkHandler_h___ */