Line data Source code
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 file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_dom_TelemetryScrollProbe_h
8 : #define mozilla_dom_TelemetryScrollProbe_h
9 :
10 : #include "nsIDOMEventListener.h"
11 :
12 : class nsIDocument;
13 : class nsIDOMEvent;
14 : class nsIPresShell;
15 : class nsIWebNavigation;
16 :
17 : namespace mozilla {
18 : namespace dom {
19 :
20 : class TabChildGlobal;
21 :
22 : /*
23 : * A class for implementing a telemetry scroll probe, listens to
24 : * pagehide events in a frame script context and records the
25 : * max scroll y, and amount of vertical scrolling that ocurred.
26 : * for more information see bug 1340904
27 : */
28 : class TelemetryScrollProbe final : public nsIDOMEventListener
29 : {
30 : public:
31 : static void Create(TabChildGlobal* aWebFrame);
32 :
33 : NS_DECL_ISUPPORTS
34 : NS_DECL_NSIDOMEVENTLISTENER
35 :
36 : private:
37 1 : explicit TelemetryScrollProbe(nsWeakPtr aWebNav)
38 1 : : mWebNav(aWebNav)
39 1 : { }
40 0 : ~TelemetryScrollProbe() {}
41 :
42 : already_AddRefed<nsIWebNavigation> GetWebNavigation() const;
43 : already_AddRefed<nsIDocument> GetDocument() const;
44 : already_AddRefed<nsIPresShell> GetPresShell() const;
45 :
46 : bool ShouldIgnore(nsIDOMEvent* aEvent) const;
47 :
48 : nsWeakPtr mWebNav;
49 : };
50 :
51 : } // namespace dom
52 : } // namespace mozilla
53 :
54 : #endif // mozilla_dom_TelemetryScrollProbe_h
|