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/. */
7 #ifndef mozilla_dom_PlacesVisit_h
8 #define mozilla_dom_PlacesVisit_h
10 #include "mozilla/dom/PlacesEvent.h"
15 class PlacesVisit final
: public PlacesEvent
{
17 explicit PlacesVisit() : PlacesEvent(PlacesEventType::Page_visited
) {}
19 static already_AddRefed
<PlacesVisit
> Constructor(const GlobalObject
& aGlobal
,
21 RefPtr
<PlacesVisit
> event
= new PlacesVisit();
22 return event
.forget();
25 JSObject
* WrapObject(JSContext
* aCx
,
26 JS::Handle
<JSObject
*> aGivenProto
) override
{
27 return PlacesVisit_Binding::Wrap(aCx
, this, aGivenProto
);
30 const PlacesVisit
* AsPlacesVisit() const override
{ return this; }
32 void GetUrl(nsString
& aUrl
) { aUrl
= mUrl
; }
33 uint64_t VisitId() { return mVisitId
; }
34 uint64_t VisitTime() { return mVisitTime
; }
35 uint64_t ReferringVisitId() { return mReferringVisitId
; }
36 uint64_t TransitionType() { return mTransitionType
; }
37 void GetPageGuid(nsTString
<char>& aPageGuid
) { aPageGuid
= mPageGuid
; }
38 uint64_t Frecency() { return mFrecency
; }
39 bool Hidden() { return mHidden
; }
40 uint32_t VisitCount() { return mVisitCount
; }
41 uint32_t TypedCount() { return mTypedCount
; }
42 void GetLastKnownTitle(nsString
& aLastKnownTitle
) {
43 aLastKnownTitle
= mLastKnownTitle
;
46 // It's convenient for these to be directly available in C++, so just expose
47 // them. These are generally passed around with const qualifiers anyway, so
48 // it shouldn't be a problem.
52 uint64_t mReferringVisitId
;
53 uint32_t mTransitionType
;
59 nsString mLastKnownTitle
;
62 ~PlacesVisit() = default;
66 } // namespace mozilla
68 #endif // mozilla_dom_PlacesVisit_h