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
4 : *
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/
9 : *
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
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code.
16 : *
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.
21 : *
22 : * Contributor(s):
23 : *
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.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 : #ifndef nsILinkHandler_h___
38 : #define nsILinkHandler_h___
39 :
40 : #include "nsISupports.h"
41 : #include "nsIContent.h"
42 :
43 : class nsIInputStream;
44 : class nsIDocShell;
45 : class nsIRequest;
46 : class nsString;
47 : class nsGUIEvent;
48 :
49 : // Interface ID for nsILinkHandler
50 : #define NS_ILINKHANDLER_IID \
51 : { 0xd85670a1, 0x224a, 0x4562, \
52 : { 0x87, 0xa9, 0x43, 0xa5, 0x24, 0xe7, 0xd0, 0x1b } }
53 :
54 : /**
55 : * Interface used for handling clicks on links
56 : */
57 0 : class nsILinkHandler : public nsISupports {
58 : public:
59 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINKHANDLER_IID)
60 :
61 : /**
62 : * Process a click on a link.
63 : *
64 : * @param aContent the content for the frame that generated the trigger
65 : * @param aURI a URI object that defines the destination for the link
66 : * @param aTargetSpec indicates where the link is targeted (may be an empty
67 : * string)
68 : * @param aPostDataStream the POST data to send
69 : * @param aHeadersDataStream ???
70 : * @param aIsTrusted false if the triggerer is an untrusted DOM event.
71 : */
72 : NS_IMETHOD OnLinkClick(nsIContent* aContent,
73 : nsIURI* aURI,
74 : const PRUnichar* aTargetSpec,
75 : nsIInputStream* aPostDataStream,
76 : nsIInputStream* aHeadersDataStream,
77 : bool aIsTrusted) = 0;
78 :
79 : /**
80 : * Process a click on a link.
81 : *
82 : * Works the same as OnLinkClick() except it happens immediately rather than
83 : * through an event.
84 : *
85 : * @param aContent the content for the frame that generated the trigger
86 : * @param aURI a URI obect that defines the destination for the link
87 : * @param aTargetSpec indicates where the link is targeted (may be an empty
88 : * string)
89 : * @param aPostDataStream the POST data to send
90 : * @param aHeadersDataStream ???
91 : * @param aDocShell (out-param) the DocShell that the request was opened on
92 : * @param aRequest the request that was opened
93 : */
94 : NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
95 : nsIURI* aURI,
96 : const PRUnichar* aTargetSpec,
97 : nsIInputStream* aPostDataStream = 0,
98 : nsIInputStream* aHeadersDataStream = 0,
99 : nsIDocShell** aDocShell = 0,
100 : nsIRequest** aRequest = 0) = 0;
101 :
102 : /**
103 : * Process a mouse-over a link.
104 : *
105 : * @param aContent the linked content.
106 : * @param aURI an URI object that defines the destination for the link
107 : * @param aTargetSpec indicates where the link is targeted (it may be an empty
108 : * string)
109 : */
110 : NS_IMETHOD OnOverLink(nsIContent* aContent,
111 : nsIURI* aURLSpec,
112 : const PRUnichar* aTargetSpec) = 0;
113 :
114 : /**
115 : * Process the mouse leaving a link.
116 : */
117 : NS_IMETHOD OnLeaveLink() = 0;
118 : };
119 :
120 : NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler, NS_ILINKHANDLER_IID)
121 :
122 : #endif /* nsILinkHandler_h___ */
|