Bug 1473362 [wpt PR 11778] - Update wpt metadata, a=testonly
[gecko.git] / docshell / base / nsILinkHandler.h
blob608b6cdecce37529b6144788624906b6b824f2ca
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsILinkHandler_h___
7 #define nsILinkHandler_h___
9 #include "nsISupports.h"
10 #include "mozilla/EventForwards.h"
12 class nsIContent;
13 class nsIDocShell;
14 class nsIInputStream;
15 class nsIRequest;
17 #define NS_ILINKHANDLER_IID \
18 { 0xceb9aade, 0x43da, 0x4f1a, \
19 { 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } }
21 /**
22 * Interface used for handling clicks on links
24 class nsILinkHandler : public nsISupports
26 public:
27 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINKHANDLER_IID)
29 /**
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
35 * string)
36 * @param aFileName non-null when the link should be downloaded as the given file
37 * @param aPostDataStream the POST data to send
38 * @param aHeadersDataStream ???
39 * @param aIsTrusted false if the triggerer is an untrusted DOM event.
40 * @param aTriggeringPrincipal, if not passed explicitly we fall back to
41 * the document's principal.
43 NS_IMETHOD OnLinkClick(nsIContent* aContent,
44 nsIURI* aURI,
45 const char16_t* aTargetSpec,
46 const nsAString& aFileName,
47 nsIInputStream* aPostDataStream,
48 nsIInputStream* aHeadersDataStream,
49 bool aIsUserTriggered,
50 bool aIsTrusted,
51 nsIPrincipal* aTriggeringPrincipal) = 0;
53 /**
54 * Process a click on a link.
56 * Works the same as OnLinkClick() except it happens immediately rather than
57 * through an event.
59 * @param aContent the content for the frame that generated the trigger
60 * @param aURI a URI obect that defines the destination for the link
61 * @param aTargetSpec indicates where the link is targeted (may be an empty
62 * string)
63 * @param aFileName non-null when the link should be downloaded as the given file
64 * @param aPostDataStream the POST data to send
65 * @param aHeadersDataStream ???
66 * @param aNoOpenerImplied if the link implies "noopener"
67 * @param aDocShell (out-param) the DocShell that the request was opened on
68 * @param aRequest the request that was opened
69 * @param aTriggeringPrincipal, if not passed explicitly we fall back to
70 * the document's principal.
72 NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
73 nsIURI* aURI,
74 const char16_t* aTargetSpec,
75 const nsAString& aFileName,
76 nsIInputStream* aPostDataStream = 0,
77 nsIInputStream* aHeadersDataStream = 0,
78 bool aNoOpenerImplied = false,
79 nsIDocShell** aDocShell = 0,
80 nsIRequest** aRequest = 0,
81 bool aIsUserTriggered = false,
82 nsIPrincipal* aTriggeringPrincipal = nullptr) = 0;
84 /**
85 * Process a mouse-over a link.
87 * @param aContent the linked content.
88 * @param aURI an URI object that defines the destination for the link
89 * @param aTargetSpec indicates where the link is targeted (it may be an empty
90 * string)
92 NS_IMETHOD OnOverLink(nsIContent* aContent,
93 nsIURI* aURLSpec,
94 const char16_t* aTargetSpec) = 0;
96 /**
97 * Process the mouse leaving a link.
99 NS_IMETHOD OnLeaveLink() = 0;
102 NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler, NS_ILINKHANDLER_IID)
104 #endif /* nsILinkHandler_h___ */