summaryrefslogtreecommitdiffstats
path: root/src/core/location_provider_qt.h
blob: bd13915860e5d83debb78dd4a24b2987817823e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef LOCATION_PROVIDER_QT_H
#define LOCATION_PROVIDER_QT_H

#include <QtCore/qcompilerdetection.h>

#include "services/device/public/cpp/geolocation/geoposition.h"
#include "services/device/public/cpp/geolocation/location_provider.h"

QT_FORWARD_DECLARE_CLASS(QThread)

namespace QtWebEngineCore {
class QtPositioningHelper;

class LocationProviderQt : public device::LocationProvider
{
public:
    LocationProviderQt();
    virtual ~LocationProviderQt();

    // LocationProvider
    void StartProvider(bool high_accuracy) override;
    void StopProvider() override;
    const device::mojom::Geoposition& GetPosition() override { return m_lastKnownPosition; }
    void OnPermissionGranted() override;
    void SetUpdateCallback(const LocationProviderUpdateCallback& callback) override;

private:
    friend class QtPositioningHelper;

    void updatePosition(const device::mojom::Geoposition &);

    device::mojom::Geoposition m_lastKnownPosition;
    LocationProviderUpdateCallback m_callback;
    QtPositioningHelper *m_positioningHelper;
};
} // namespace QtWebEngineCore

#endif // LOCATION_PROVIDER_QT_H