PlacesBookmarkRemoved.h (1978B)
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_PlacesBookmarkRemoved_h 8 #define mozilla_dom_PlacesBookmarkRemoved_h 9 10 #include "mozilla/dom/PlacesBookmark.h" 11 12 namespace mozilla { 13 namespace dom { 14 class PlacesBookmarkRemoved final : public PlacesBookmark { 15 public: 16 explicit PlacesBookmarkRemoved() 17 : PlacesBookmark(PlacesEventType::Bookmark_removed) {} 18 19 static already_AddRefed<PlacesBookmarkRemoved> Constructor( 20 const GlobalObject& aGlobal, const PlacesBookmarkRemovedInit& aInitDict) { 21 RefPtr<PlacesBookmarkRemoved> event = new PlacesBookmarkRemoved(); 22 event->mItemType = aInitDict.mItemType; 23 event->mId = aInitDict.mId; 24 event->mParentId = aInitDict.mParentId; 25 event->mIndex = aInitDict.mIndex; 26 event->mUrl = aInitDict.mUrl; 27 event->mTitle = aInitDict.mTitle; 28 event->mGuid = aInitDict.mGuid; 29 event->mParentGuid = aInitDict.mParentGuid; 30 event->mSource = aInitDict.mSource; 31 event->mIsTagging = aInitDict.mIsTagging; 32 event->mIsDescendantRemoval = aInitDict.mIsDescendantRemoval; 33 return event.forget(); 34 } 35 36 JSObject* WrapObject(JSContext* aCx, 37 JS::Handle<JSObject*> aGivenProto) override { 38 return PlacesBookmarkRemoved_Binding::Wrap(aCx, this, aGivenProto); 39 } 40 41 const PlacesBookmarkRemoved* AsPlacesBookmarkRemoved() const override { 42 return this; 43 } 44 45 int32_t Index() { return mIndex; } 46 void GetTitle(nsString& aTitle) { aTitle = mTitle; } 47 bool IsDescendantRemoval() { return mIsDescendantRemoval; } 48 49 int32_t mIndex; 50 nsString mTitle; 51 bool mIsDescendantRemoval; 52 53 private: 54 ~PlacesBookmarkRemoved() = default; 55 }; 56 57 } // namespace dom 58 } // namespace mozilla 59 60 #endif