tor-browser

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

PlacesBookmarkTags.h (1751B)


      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_PlacesBookmarkTags_h
      8 #define mozilla_dom_PlacesBookmarkTags_h
      9 
     10 #include "mozilla/dom/PlacesBookmarkChanged.h"
     11 
     12 namespace mozilla {
     13 namespace dom {
     14 class PlacesBookmarkTags final : public PlacesBookmarkChanged {
     15 public:
     16  explicit PlacesBookmarkTags()
     17      : PlacesBookmarkChanged(PlacesEventType::Bookmark_tags_changed) {}
     18 
     19  static already_AddRefed<PlacesBookmarkTags> Constructor(
     20      const GlobalObject& aGlobal, const PlacesBookmarkTagsInit& aInitDict) {
     21    RefPtr<PlacesBookmarkTags> event = new PlacesBookmarkTags();
     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->mTags = aInitDict.mTags;
     28    event->mLastModified = aInitDict.mLastModified;
     29    event->mSource = aInitDict.mSource;
     30    event->mIsTagging = aInitDict.mIsTagging;
     31    return event.forget();
     32  }
     33 
     34  JSObject* WrapObject(JSContext* aCx,
     35                       JS::Handle<JSObject*> aGivenProto) override {
     36    return PlacesBookmarkTags_Binding::Wrap(aCx, this, aGivenProto);
     37  }
     38 
     39  const PlacesBookmarkTags* AsPlacesBookmarkTags() const override {
     40    return this;
     41  }
     42 
     43  void GetTags(nsTArray<nsString>& aTags) const { aTags.Assign(mTags); }
     44 
     45  nsTArray<nsString> mTags;
     46 
     47 private:
     48  ~PlacesBookmarkTags() = default;
     49 };
     50 
     51 }  // namespace dom
     52 }  // namespace mozilla
     53 
     54 #endif