Bug 1857841 - pt 3. Add a new page kind named "fresh" r=glandium
[gecko.git] / dom / system / mac / CoreLocationLocationProvider.h
blob27b990cf9a58abcd5e8c1525b57171805801359f
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 #include "nsCOMPtr.h"
8 #include "nsIGeolocationProvider.h"
9 #include "mozilla/Attributes.h"
12 * The CoreLocationObjects class contains the CoreLocation objects
13 * we'll need.
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++
18 * as well.
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;
26 class MLSFallback;
28 class CoreLocationLocationProvider : public nsIGeolocationProvider {
29 public:
30 NS_DECL_ISUPPORTS
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
36 // Objective-C.
37 MOZ_CAN_RUN_SCRIPT_BOUNDARY
38 void NotifyError(uint16_t aErrorCode);
39 void Update(nsIDOMGeoPosition* aSomewhere);
40 void CreateMLSFallbackProvider();
41 void CancelMLSFallbackProvider();
43 private:
44 virtual ~CoreLocationLocationProvider() = default;
46 CoreLocationObjects* mCLObjects;
47 nsCOMPtr<nsIGeolocationUpdate> mCallback;
48 RefPtr<MLSFallback> mMLSFallbackProvider;
50 class MLSUpdate : public nsIGeolocationUpdate {
51 public:
52 NS_DECL_ISUPPORTS
53 NS_DECL_NSIGEOLOCATIONUPDATE
55 explicit MLSUpdate(CoreLocationLocationProvider& parentProvider);
57 private:
58 CoreLocationLocationProvider& mParentLocationProvider;
59 virtual ~MLSUpdate() = default;