tor-browser

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

PlacesFavicon.h (1605B)


      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_PlacesFavicon_h
      8 #define mozilla_dom_PlacesFavicon_h
      9 
     10 #include "mozilla/dom/PlacesEvent.h"
     11 
     12 namespace mozilla {
     13 namespace dom {
     14 
     15 class PlacesFavicon final : public PlacesEvent {
     16 public:
     17  explicit PlacesFavicon() : PlacesEvent(PlacesEventType::Favicon_changed) {}
     18 
     19  static already_AddRefed<PlacesFavicon> Constructor(
     20      const GlobalObject& aGlobal, const PlacesFaviconInit& aInitDict) {
     21    RefPtr<PlacesFavicon> event = new PlacesFavicon();
     22    event->mUrl = aInitDict.mUrl;
     23    event->mPageGuid = aInitDict.mPageGuid;
     24    event->mFaviconUrl = aInitDict.mFaviconUrl;
     25    return event.forget();
     26  }
     27 
     28  JSObject* WrapObject(JSContext* aCx,
     29                       JS::Handle<JSObject*> aGivenProto) override {
     30    return PlacesFavicon_Binding::Wrap(aCx, this, aGivenProto);
     31  }
     32 
     33  const PlacesFavicon* AsPlacesFavicon() const override { return this; }
     34 
     35  void GetUrl(nsString& aUrl) const { aUrl = mUrl; }
     36  void GetPageGuid(nsCString& aPageGuid) const { aPageGuid = mPageGuid; }
     37  void GetFaviconUrl(nsString& aFaviconUrl) const { aFaviconUrl = mFaviconUrl; }
     38 
     39  nsString mUrl;
     40  nsCString mPageGuid;
     41  nsString mFaviconUrl;
     42 
     43 private:
     44  ~PlacesFavicon() = default;
     45 };
     46 
     47 }  // namespace dom
     48 }  // namespace mozilla
     49 
     50 #endif  // mozilla_dom_PlacesFavicon_h