tor-browser

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

PlacesObservers.h (2835B)


      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
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_PlacesObservers__
      8 #define mozilla_dom_PlacesObservers__
      9 
     10 #include "mozilla/AlreadyAddRefed.h"
     11 #include "mozilla/dom/BindingDeclarations.h"
     12 #include "mozilla/dom/PlacesEvent.h"
     13 #include "mozilla/dom/PlacesEventCounts.h"
     14 #include "mozilla/dom/PlacesObserversBinding.h"
     15 #include "mozilla/places/INativePlacesEventCallback.h"
     16 #include "nsIWeakReferenceUtils.h"
     17 
     18 namespace mozilla {
     19 class ErrorResult;
     20 
     21 namespace dom {
     22 
     23 class PlacesObservers {
     24 public:
     25  static void AddListener(GlobalObject& aGlobal,
     26                          const nsTArray<PlacesEventType>& aEventTypes,
     27                          PlacesEventCallback& aCallback, ErrorResult& rv);
     28  static void AddListener(GlobalObject& aGlobal,
     29                          const nsTArray<PlacesEventType>& aEventTypes,
     30                          PlacesWeakCallbackWrapper& aCallback,
     31                          ErrorResult& rv);
     32  static void AddListener(const nsTArray<PlacesEventType>& aEventTypes,
     33                          places::INativePlacesEventCallback* aCallback);
     34  static void RemoveListener(GlobalObject& aGlobal,
     35                             const nsTArray<PlacesEventType>& aEventTypes,
     36                             PlacesEventCallback& aCallback, ErrorResult& rv);
     37  static void RemoveListener(GlobalObject& aGlobal,
     38                             const nsTArray<PlacesEventType>& aEventTypes,
     39                             PlacesWeakCallbackWrapper& aCallback,
     40                             ErrorResult& rv);
     41  static void RemoveListener(const nsTArray<PlacesEventType>& aEventTypes,
     42                             places::INativePlacesEventCallback* aCallback);
     43 
     44  MOZ_CAN_RUN_SCRIPT
     45  static void NotifyListeners(
     46      GlobalObject& aGlobal,
     47      const Sequence<OwningNonNull<PlacesEvent>>& aEvents, ErrorResult& rv);
     48 
     49  MOZ_CAN_RUN_SCRIPT
     50  static void NotifyListeners(
     51      const Sequence<OwningNonNull<PlacesEvent>>& aEvents);
     52 
     53  static StaticRefPtr<PlacesEventCounts> sCounts;
     54  static already_AddRefed<PlacesEventCounts> Counts(const GlobalObject& global);
     55 
     56 private:
     57  static void RemoveListener(uint32_t aFlags, PlacesEventCallback& aCallback);
     58  static void RemoveListener(uint32_t aFlags,
     59                             PlacesWeakCallbackWrapper& aCallback);
     60  static void RemoveListener(uint32_t aFlags,
     61                             places::INativePlacesEventCallback* aCallback);
     62 
     63  MOZ_CAN_RUN_SCRIPT static void NotifyNext();
     64 };
     65 
     66 }  // namespace dom
     67 }  // namespace mozilla
     68 
     69 #endif  // mozilla_dom_PlacesObservers__