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/. */
8 #include "nsIGeolocationProvider.h"
9 #include "mozilla/Attributes.h"
12 * The CoreLocationObjects class contains the CoreLocation objects
15 * Declaring them directly in CoreLocationLocationProvider
16 * would require Objective-C++ syntax, which would contaminate all
17 * files that include this header and require them to be Objective-C++
20 * The solution then is to forward-declare CoreLocationObjects here and
21 * hold a pointer to it in CoreLocationLocationProvider, and only actually
22 * define it in CoreLocationLocationProvider.mm, thus making it safe
23 * for Geolocation.cpp, which is C++-only, to include this header.
25 class CoreLocationObjects
;
28 class CoreLocationLocationProvider
: public nsIGeolocationProvider
{
31 NS_DECL_NSIGEOLOCATIONPROVIDER
33 CoreLocationLocationProvider();
34 // MOZ_CAN_RUN_SCRIPT_BOUNDARY because we can't mark Objective-C methods as
35 // MOZ_CAN_RUN_SCRIPT as far as I can tell, and this method is called from
37 MOZ_CAN_RUN_SCRIPT_BOUNDARY
38 void NotifyError(uint16_t aErrorCode
);
39 void Update(nsIDOMGeoPosition
* aSomewhere
);
40 void CreateMLSFallbackProvider();
41 void CancelMLSFallbackProvider();
44 virtual ~CoreLocationLocationProvider() = default;
46 CoreLocationObjects
* mCLObjects
;
47 nsCOMPtr
<nsIGeolocationUpdate
> mCallback
;
48 RefPtr
<MLSFallback
> mMLSFallbackProvider
;
50 class MLSUpdate
: public nsIGeolocationUpdate
{
53 NS_DECL_NSIGEOLOCATIONUPDATE
55 explicit MLSUpdate(CoreLocationLocationProvider
& parentProvider
);
58 CoreLocationLocationProvider
& mParentLocationProvider
;
59 virtual ~MLSUpdate() = default;