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_PlacesBookmarkMoved_h
8 #define mozilla_dom_PlacesBookmarkMoved_h
10 #include "mozilla/dom/PlacesBookmark.h"
14 class PlacesBookmarkMoved final
: public PlacesBookmark
{
16 explicit PlacesBookmarkMoved()
17 : PlacesBookmark(PlacesEventType::Bookmark_moved
) {}
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());
41 event
->mLastVisitDate
.SetNull();
43 return event
.forget();
46 JSObject
* WrapObject(JSContext
* aCx
,
47 JS::Handle
<JSObject
*> aGivenProto
) override
{
48 return PlacesBookmarkMoved_Binding::Wrap(aCx
, this, aGivenProto
);
51 const PlacesBookmarkMoved
* AsPlacesBookmarkMoved() const override
{
55 int32_t Index() { return mIndex
; }
56 int32_t OldIndex() { return mOldIndex
; }
57 void GetOldParentGuid(nsCString
& aOldParentGuid
) {
58 aOldParentGuid
= mOldParentGuid
;
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
; }
70 nsCString mOldParentGuid
;
77 Nullable
<uint64_t> mLastVisitDate
;
80 ~PlacesBookmarkMoved() = default;
84 } // namespace mozilla