1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef ZoomConstraintsClient_h_ 8 #define ZoomConstraintsClient_h_ 9 10 #include "FrameMetrics.h" 11 #include "mozilla/Maybe.h" 12 #include "nsIDOMEventListener.h" 13 #include "nsIObserver.h" 14 #include "nsWeakPtr.h" 15 16 class nsIDOMEventTarget; 17 class nsIDocument; 18 class nsIPresShell; 19 20 class ZoomConstraintsClient final : public nsIDOMEventListener, 21 public nsIObserver { 22 public: 23 NS_DECL_ISUPPORTS 24 NS_DECL_NSIDOMEVENTLISTENER 25 NS_DECL_NSIOBSERVER 26 27 ZoomConstraintsClient(); 28 29 private: 30 ~ZoomConstraintsClient(); 31 32 public: 33 void Init(nsIPresShell* aPresShell, nsIDocument* aDocument); 34 void Destroy(); 35 void ScreenSizeChanged(); 36 37 private: 38 void RefreshZoomConstraints(); 39 40 nsCOMPtr<nsIDocument> mDocument; 41 nsIPresShell* MOZ_NON_OWNING_REF 42 mPresShell; // raw ref since the presShell owns this 43 nsCOMPtr<nsIDOMEventTarget> mEventTarget; 44 mozilla::Maybe<mozilla::layers::ScrollableLayerGuid> mGuid; 45 }; 46 47 #endif 48