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:
PlacesBookmarkMoved()16   explicit PlacesBookmarkMoved()
17       : PlacesBookmark(PlacesEventType::Bookmark_moved) {}
18 
Constructor(const GlobalObject & aGlobal,const PlacesBookmarkMovedInit & aInitDict)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     return event.forget();
33   }
34 
WrapObject(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)35   JSObject* WrapObject(JSContext* aCx,
36                        JS::Handle<JSObject*> aGivenProto) override {
37     return PlacesBookmarkMoved_Binding::Wrap(aCx, this, aGivenProto);
38   }
39 
AsPlacesBookmarkMoved()40   const PlacesBookmarkMoved* AsPlacesBookmarkMoved() const override {
41     return this;
42   }
43 
Index()44   int32_t Index() { return mIndex; }
OldIndex()45   int32_t OldIndex() { return mOldIndex; }
GetOldParentGuid(nsCString & aOldParentGuid)46   void GetOldParentGuid(nsCString& aOldParentGuid) {
47     aOldParentGuid = mOldParentGuid;
48   }
49 
50   int32_t mIndex;
51   int32_t mOldIndex;
52   nsCString mOldParentGuid;
53 
54  private:
55   ~PlacesBookmarkMoved() = default;
56 };
57 
58 }  // namespace dom
59 }  // namespace mozilla
60 
61 #endif
62