|
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___ |
|
7 |
|
8 #include "nsISupports.h" |
|
9 #include "mozilla/EventForwards.h" |
|
10 |
|
11 class nsIContent; |
|
12 class nsIDocShell; |
|
13 class nsIInputStream; |
|
14 class nsIRequest; |
|
15 class nsString; |
|
16 |
|
17 // Interface ID for nsILinkHandler |
|
18 #define NS_ILINKHANDLER_IID \ |
|
19 { 0xceb9aade, 0x43da, 0x4f1a, \ |
|
20 { 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } } |
|
21 |
|
22 /** |
|
23 * Interface used for handling clicks on links |
|
24 */ |
|
25 class nsILinkHandler : public nsISupports { |
|
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 */ |
|
41 NS_IMETHOD OnLinkClick(nsIContent* aContent, |
|
42 nsIURI* aURI, |
|
43 const char16_t* aTargetSpec, |
|
44 const nsAString& aFileName, |
|
45 nsIInputStream* aPostDataStream, |
|
46 nsIInputStream* aHeadersDataStream, |
|
47 bool aIsTrusted) = 0; |
|
48 |
|
49 /** |
|
50 * Process a click on a link. |
|
51 * |
|
52 * Works the same as OnLinkClick() except it happens immediately rather than |
|
53 * through an event. |
|
54 * |
|
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 |
|
58 * string) |
|
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 |
|
64 */ |
|
65 NS_IMETHOD OnLinkClickSync(nsIContent* aContent, |
|
66 nsIURI* aURI, |
|
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; |
|
73 |
|
74 /** |
|
75 * Process a mouse-over a link. |
|
76 * |
|
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 |
|
80 * string) |
|
81 */ |
|
82 NS_IMETHOD OnOverLink(nsIContent* aContent, |
|
83 nsIURI* aURLSpec, |
|
84 const char16_t* aTargetSpec) = 0; |
|
85 |
|
86 /** |
|
87 * Process the mouse leaving a link. |
|
88 */ |
|
89 NS_IMETHOD OnLeaveLink() = 0; |
|
90 }; |
|
91 |
|
92 NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler, NS_ILINKHANDLER_IID) |
|
93 |
|
94 #endif /* nsILinkHandler_h___ */ |