Line data Source code
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___
8 :
9 : #include "nsISupports.h"
10 : #include "mozilla/EventForwards.h"
11 :
12 : class nsIContent;
13 : class nsIDocShell;
14 : class nsIInputStream;
15 : class nsIRequest;
16 :
17 : #define NS_ILINKHANDLER_IID \
18 : { 0xceb9aade, 0x43da, 0x4f1a, \
19 : { 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } }
20 :
21 : /**
22 : * Interface used for handling clicks on links
23 : */
24 5 : class nsILinkHandler : public nsISupports
25 : {
26 : public:
27 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINKHANDLER_IID)
28 :
29 : /**
30 : * Process a click on a link.
31 : *
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 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.
40 : * @param aTriggeringPrincipal, if not passed explicitly we fall back to
41 : * the document's principal.
42 : */
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 aIsTrusted,
50 : nsIPrincipal* aTriggeringPrincipal) = 0;
51 :
52 : /**
53 : * Process a click on a link.
54 : *
55 : * Works the same as OnLinkClick() except it happens immediately rather than
56 : * through an event.
57 : *
58 : * @param aContent the content for the frame that generated the trigger
59 : * @param aURI a URI obect that defines the destination for the link
60 : * @param aTargetSpec indicates where the link is targeted (may be an empty
61 : * string)
62 : * @param aFileName non-null when the link should be downloaded as the given file
63 : * @param aPostDataStream the POST data to send
64 : * @param aHeadersDataStream ???
65 : * @param aNoOpenerImplied if the link implies "noopener"
66 : * @param aDocShell (out-param) the DocShell that the request was opened on
67 : * @param aRequest the request that was opened
68 : * @param aTriggeringPrincipal, if not passed explicitly we fall back to
69 : * the document's principal.
70 : */
71 : NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
72 : nsIURI* aURI,
73 : const char16_t* aTargetSpec,
74 : const nsAString& aFileName,
75 : nsIInputStream* aPostDataStream = 0,
76 : nsIInputStream* aHeadersDataStream = 0,
77 : bool aNoOpenerImplied = false,
78 : nsIDocShell** aDocShell = 0,
79 : nsIRequest** aRequest = 0,
80 : nsIPrincipal* aTriggeringPrincipal = nullptr) = 0;
81 :
82 : /**
83 : * Process a mouse-over a link.
84 : *
85 : * @param aContent the linked content.
86 : * @param aURI an URI object that defines the destination for the link
87 : * @param aTargetSpec indicates where the link is targeted (it may be an empty
88 : * string)
89 : */
90 : NS_IMETHOD OnOverLink(nsIContent* aContent,
91 : nsIURI* aURLSpec,
92 : const char16_t* aTargetSpec) = 0;
93 :
94 : /**
95 : * Process the mouse leaving a link.
96 : */
97 : NS_IMETHOD OnLeaveLink() = 0;
98 : };
99 :
100 : NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler, NS_ILINKHANDLER_IID)
101 :
102 : #endif /* nsILinkHandler_h___ */
|