nsContextMenuInfo.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 nsContextMenuInfo_h__
  6. #define nsContextMenuInfo_h__
  7. #include "nsCOMPtr.h"
  8. #include "nsIContextMenuListener2.h"
  9. #include "nsIDOMNode.h"
  10. #include "nsIDOMEvent.h"
  11. #include "imgIContainer.h"
  12. #include "imgIRequest.h"
  13. class ChromeContextMenuListener;
  14. class imgRequestProxy;
  15. // Helper class for implementors of nsIContextMenuListener2
  16. class nsContextMenuInfo : public nsIContextMenuInfo
  17. {
  18. friend class ChromeContextMenuListener;
  19. public:
  20. nsContextMenuInfo();
  21. NS_DECL_ISUPPORTS
  22. NS_DECL_NSICONTEXTMENUINFO
  23. private:
  24. virtual ~nsContextMenuInfo();
  25. void SetMouseEvent(nsIDOMEvent* aEvent) { mMouseEvent = aEvent; }
  26. void SetDOMNode(nsIDOMNode* aNode) { mDOMNode = aNode; }
  27. void SetAssociatedLink(nsIDOMNode* aLink) { mAssociatedLink = aLink; }
  28. nsresult GetImageRequest(nsIDOMNode* aDOMNode, imgIRequest** aRequest);
  29. bool HasBackgroundImage(nsIDOMNode* aDOMNode);
  30. nsresult GetBackgroundImageRequest(nsIDOMNode* aDOMNode,
  31. imgRequestProxy** aRequest);
  32. nsresult GetBackgroundImageRequestInternal(nsIDOMNode* aDOMNode,
  33. imgRequestProxy** aRequest);
  34. private:
  35. nsCOMPtr<nsIDOMEvent> mMouseEvent;
  36. nsCOMPtr<nsIDOMNode> mDOMNode;
  37. nsCOMPtr<nsIDOMNode> mAssociatedLink;
  38. };
  39. #endif // nsContextMenuInfo_h__