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