tor-browser

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

PlacesBookmarkMoved.h (2856B)


      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_PlacesBookmarkMoved_h
      8 #define mozilla_dom_PlacesBookmarkMoved_h
      9 
     10 #include "mozilla/dom/PlacesBookmark.h"
     11 
     12 namespace mozilla {
     13 namespace dom {
     14 class PlacesBookmarkMoved final : public PlacesBookmark {
     15 public:
     16  explicit PlacesBookmarkMoved()
     17      : PlacesBookmark(PlacesEventType::Bookmark_moved) {}
     18 
     19  static already_AddRefed<PlacesBookmarkMoved> Constructor(
     20      const GlobalObject& aGlobal, const PlacesBookmarkMovedInit& aInitDict) {
     21    RefPtr<PlacesBookmarkMoved> event = new PlacesBookmarkMoved();
     22    event->mId = aInitDict.mId;
     23    event->mItemType = aInitDict.mItemType;
     24    event->mUrl = aInitDict.mUrl;
     25    event->mGuid = aInitDict.mGuid;
     26    event->mParentGuid = aInitDict.mParentGuid;
     27    event->mIndex = aInitDict.mIndex;
     28    event->mOldParentGuid = aInitDict.mOldParentGuid;
     29    event->mOldIndex = aInitDict.mOldIndex;
     30    event->mSource = aInitDict.mSource;
     31    event->mIsTagging = aInitDict.mIsTagging;
     32    event->mTitle = aInitDict.mTitle;
     33    event->mTags = aInitDict.mTags;
     34    event->mFrecency = aInitDict.mFrecency;
     35    event->mHidden = aInitDict.mHidden;
     36    event->mVisitCount = aInitDict.mVisitCount;
     37    event->mDateAdded = aInitDict.mDateAdded;
     38    if (!aInitDict.mLastVisitDate.IsNull()) {
     39      event->mLastVisitDate.SetValue(aInitDict.mLastVisitDate.Value());
     40    } else {
     41      event->mLastVisitDate.SetNull();
     42    }
     43    return event.forget();
     44  }
     45 
     46  JSObject* WrapObject(JSContext* aCx,
     47                       JS::Handle<JSObject*> aGivenProto) override {
     48    return PlacesBookmarkMoved_Binding::Wrap(aCx, this, aGivenProto);
     49  }
     50 
     51  const PlacesBookmarkMoved* AsPlacesBookmarkMoved() const override {
     52    return this;
     53  }
     54 
     55  int32_t Index() { return mIndex; }
     56  int32_t OldIndex() { return mOldIndex; }
     57  void GetOldParentGuid(nsCString& aOldParentGuid) {
     58    aOldParentGuid = mOldParentGuid;
     59  }
     60  void GetTitle(nsString& aTitle) { aTitle = mTitle; }
     61  void GetTags(nsString& aTags) { aTags = mTags; }
     62  uint64_t Frecency() { return mFrecency; }
     63  bool Hidden() { return mHidden; }
     64  uint32_t VisitCount() { return mVisitCount; }
     65  uint64_t DateAdded() { return mDateAdded; }
     66  Nullable<uint64_t> GetLastVisitDate() { return mLastVisitDate; }
     67 
     68  int32_t mIndex;
     69  int32_t mOldIndex;
     70  nsCString mOldParentGuid;
     71  nsString mTitle;
     72  nsString mTags;
     73  int64_t mFrecency;
     74  bool mHidden;
     75  uint32_t mVisitCount;
     76  uint64_t mDateAdded;
     77  Nullable<uint64_t> mLastVisitDate;
     78 
     79 private:
     80  ~PlacesBookmarkMoved() = default;
     81 };
     82 
     83 }  // namespace dom
     84 }  // namespace mozilla
     85 
     86 #endif