nsILinkHandler.h 3.7 KB

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