layout/printing/nsPrintPreviewListener.h
author Boris Chiou <boris.chiou@gmail.com>
Mon, 23 May 2016 16:11:28 +0800
changeset 371290 d7fabed9c1b6fc0e8af52b68c7b8f5edb32bc95a
parent 278243 91d6e262b662a0b4e47358665e222d3927337af9
child 489668 cbb8fdf1daf98a15f7d57f6b08d273bdf96aa1a0
child 687734 c86887bc83f32797af69c6610c8e08f9531482b3
permissions -rw-r--r--
Bug 1244590 - Part 11: Test for different targets. MozReview-Commit-ID: B0hrEKRdKEG

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef nsPrintPreviewListener_h__
#define nsPrintPreviewListener_h__

// Interfaces needed to be included
#include "nsIDOMEventListener.h"
// Helper Classes
#include "nsCOMPtr.h"
#include "mozilla/Attributes.h"

namespace mozilla {
namespace dom {
class EventTarget;
} // namespace dom
} // namespace mozilla

//
// class nsPrintPreviewListener
//
// The class that listens to the chrome events and tells the embedding
// chrome to show context menus, as appropriate. Handles registering itself
// with the DOM with AddChromeListeners() and removing itself with
// RemoveChromeListeners().
//
class nsPrintPreviewListener final : public nsIDOMEventListener

{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIDOMEVENTLISTENER

  explicit nsPrintPreviewListener(mozilla::dom::EventTarget* aTarget);

  // Add/remove the relevant listeners, based on what interfaces
  // the embedding chrome implements.
  nsresult AddListeners();
  nsresult RemoveListeners();

private:
  ~nsPrintPreviewListener();

  nsCOMPtr<mozilla::dom::EventTarget> mEventTarget;

}; // class nsPrintPreviewListener



#endif /* nsPrintPreviewListener_h__ */