1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/base/nsILinkHandler.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,94 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 +#ifndef nsILinkHandler_h___ 1.9 +#define nsILinkHandler_h___ 1.10 + 1.11 +#include "nsISupports.h" 1.12 +#include "mozilla/EventForwards.h" 1.13 + 1.14 +class nsIContent; 1.15 +class nsIDocShell; 1.16 +class nsIInputStream; 1.17 +class nsIRequest; 1.18 +class nsString; 1.19 + 1.20 +// Interface ID for nsILinkHandler 1.21 +#define NS_ILINKHANDLER_IID \ 1.22 + { 0xceb9aade, 0x43da, 0x4f1a, \ 1.23 + { 0xac, 0x8a, 0xc7, 0x09, 0xfb, 0x22, 0x46, 0x64 } } 1.24 + 1.25 +/** 1.26 + * Interface used for handling clicks on links 1.27 + */ 1.28 +class nsILinkHandler : public nsISupports { 1.29 +public: 1.30 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINKHANDLER_IID) 1.31 + 1.32 + /** 1.33 + * Process a click on a link. 1.34 + * 1.35 + * @param aContent the content for the frame that generated the trigger 1.36 + * @param aURI a URI object that defines the destination for the link 1.37 + * @param aTargetSpec indicates where the link is targeted (may be an empty 1.38 + * string) 1.39 + * @param aPostDataStream the POST data to send 1.40 + * @param aFileName non-null when the link should be downloaded as the given file 1.41 + * @param aHeadersDataStream ??? 1.42 + * @param aIsTrusted false if the triggerer is an untrusted DOM event. 1.43 + */ 1.44 + NS_IMETHOD OnLinkClick(nsIContent* aContent, 1.45 + nsIURI* aURI, 1.46 + const char16_t* aTargetSpec, 1.47 + const nsAString& aFileName, 1.48 + nsIInputStream* aPostDataStream, 1.49 + nsIInputStream* aHeadersDataStream, 1.50 + bool aIsTrusted) = 0; 1.51 + 1.52 + /** 1.53 + * Process a click on a link. 1.54 + * 1.55 + * Works the same as OnLinkClick() except it happens immediately rather than 1.56 + * through an event. 1.57 + * 1.58 + * @param aContent the content for the frame that generated the trigger 1.59 + * @param aURI a URI obect that defines the destination for the link 1.60 + * @param aTargetSpec indicates where the link is targeted (may be an empty 1.61 + * string) 1.62 + * @param aFileName non-null when the link should be downloaded as the given file 1.63 + * @param aPostDataStream the POST data to send 1.64 + * @param aHeadersDataStream ??? 1.65 + * @param aDocShell (out-param) the DocShell that the request was opened on 1.66 + * @param aRequest the request that was opened 1.67 + */ 1.68 + NS_IMETHOD OnLinkClickSync(nsIContent* aContent, 1.69 + nsIURI* aURI, 1.70 + const char16_t* aTargetSpec, 1.71 + const nsAString& aFileName, 1.72 + nsIInputStream* aPostDataStream = 0, 1.73 + nsIInputStream* aHeadersDataStream = 0, 1.74 + nsIDocShell** aDocShell = 0, 1.75 + nsIRequest** aRequest = 0) = 0; 1.76 + 1.77 + /** 1.78 + * Process a mouse-over a link. 1.79 + * 1.80 + * @param aContent the linked content. 1.81 + * @param aURI an URI object that defines the destination for the link 1.82 + * @param aTargetSpec indicates where the link is targeted (it may be an empty 1.83 + * string) 1.84 + */ 1.85 + NS_IMETHOD OnOverLink(nsIContent* aContent, 1.86 + nsIURI* aURLSpec, 1.87 + const char16_t* aTargetSpec) = 0; 1.88 + 1.89 + /** 1.90 + * Process the mouse leaving a link. 1.91 + */ 1.92 + NS_IMETHOD OnLeaveLink() = 0; 1.93 +}; 1.94 + 1.95 +NS_DEFINE_STATIC_IID_ACCESSOR(nsILinkHandler, NS_ILINKHANDLER_IID) 1.96 + 1.97 +#endif /* nsILinkHandler_h___ */