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"
22 class PlacesObservers
{
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
,
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
,
40 static void RemoveListener(const nsTArray
<PlacesEventType
>& aEventTypes
,
41 places::INativePlacesEventCallback
* aCallback
);
44 static void NotifyListeners(
45 GlobalObject
& aGlobal
,
46 const Sequence
<OwningNonNull
<PlacesEvent
>>& aEvents
, ErrorResult
& rv
);
49 static void NotifyListeners(
50 const Sequence
<OwningNonNull
<PlacesEvent
>>& aEvents
);
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();
63 } // namespace mozilla
65 #endif // mozilla_dom_PlacesObservers__