tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PlacesVisit.h (2248B)


      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_PlacesVisit_h
      8 #define mozilla_dom_PlacesVisit_h
      9 
     10 #include "mozilla/dom/PlacesEvent.h"
     11 
     12 namespace mozilla {
     13 namespace dom {
     14 
     15 class PlacesVisit final : public PlacesEvent {
     16 public:
     17  explicit PlacesVisit() : PlacesEvent(PlacesEventType::Page_visited) {}
     18 
     19  static already_AddRefed<PlacesVisit> Constructor(const GlobalObject& aGlobal,
     20                                                   ErrorResult& aRv) {
     21    RefPtr<PlacesVisit> event = new PlacesVisit();
     22    return event.forget();
     23  }
     24 
     25  JSObject* WrapObject(JSContext* aCx,
     26                       JS::Handle<JSObject*> aGivenProto) override {
     27    return PlacesVisit_Binding::Wrap(aCx, this, aGivenProto);
     28  }
     29 
     30  const PlacesVisit* AsPlacesVisit() const override { return this; }
     31 
     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;
     44  }
     45 
     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.
     49  nsString mUrl;
     50  uint64_t mVisitId;
     51  uint64_t mVisitTime;
     52  uint64_t mReferringVisitId;
     53  uint32_t mTransitionType;
     54  nsCString mPageGuid;
     55  int64_t mFrecency;
     56  bool mHidden;
     57  uint32_t mVisitCount;
     58  uint32_t mTypedCount;
     59  nsString mLastKnownTitle;
     60 
     61 private:
     62  ~PlacesVisit() = default;
     63 };
     64 
     65 }  // namespace dom
     66 }  // namespace mozilla
     67 
     68 #endif  // mozilla_dom_PlacesVisit_h