Bug 1812499 [wpt PR 38184] - Simplify handling of name-to-subdir mapping in canvas...
[gecko.git] / dom / base / PlacesObservers.h
blobe7aca305d8c50a66456b5867e96d930082eb9308
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/. */
7 #ifndef mozilla_dom_PlacesObservers__
8 #define mozilla_dom_PlacesObservers__
10 #include "mozilla/AlreadyAddRefed.h"
11 #include "mozilla/dom/BindingDeclarations.h"
12 #include "mozilla/dom/PlacesObserversBinding.h"
13 #include "mozilla/dom/PlacesEvent.h"
14 #include "mozilla/places/INativePlacesEventCallback.h"
15 #include "nsIWeakReferenceUtils.h"
17 namespace mozilla {
18 class ErrorResult;
20 namespace dom {
22 class PlacesObservers {
23 public:
24 static void AddListener(GlobalObject& aGlobal,
25 const nsTArray<PlacesEventType>& aEventTypes,
26 PlacesEventCallback& aCallback, ErrorResult& rv);
27 static void AddListener(GlobalObject& aGlobal,
28 const nsTArray<PlacesEventType>& aEventTypes,
29 PlacesWeakCallbackWrapper& aCallback,
30 ErrorResult& rv);
31 static void AddListener(const nsTArray<PlacesEventType>& aEventTypes,
32 places::INativePlacesEventCallback* aCallback);
33 static void RemoveListener(GlobalObject& aGlobal,
34 const nsTArray<PlacesEventType>& aEventTypes,
35 PlacesEventCallback& aCallback, ErrorResult& rv);
36 static void RemoveListener(GlobalObject& aGlobal,
37 const nsTArray<PlacesEventType>& aEventTypes,
38 PlacesWeakCallbackWrapper& aCallback,
39 ErrorResult& rv);
40 static void RemoveListener(const nsTArray<PlacesEventType>& aEventTypes,
41 places::INativePlacesEventCallback* aCallback);
43 MOZ_CAN_RUN_SCRIPT
44 static void NotifyListeners(
45 GlobalObject& aGlobal,
46 const Sequence<OwningNonNull<PlacesEvent>>& aEvents, ErrorResult& rv);
48 MOZ_CAN_RUN_SCRIPT
49 static void NotifyListeners(
50 const Sequence<OwningNonNull<PlacesEvent>>& aEvents);
52 private:
53 static void RemoveListener(uint32_t aFlags, PlacesEventCallback& aCallback);
54 static void RemoveListener(uint32_t aFlags,
55 PlacesWeakCallbackWrapper& aCallback);
56 static void RemoveListener(uint32_t aFlags,
57 places::INativePlacesEventCallback* aCallback);
59 MOZ_CAN_RUN_SCRIPT static void NotifyNext();
62 } // namespace dom
63 } // namespace mozilla
65 #endif // mozilla_dom_PlacesObservers__