Title: [220515] trunk
Revision
220515
Author
mcatanz...@igalia.com
Date
2017-08-09 22:58:26 -0700 (Wed, 09 Aug 2017)

Log Message

[GTK] Remove support for geoclue1
https://bugs.webkit.org/show_bug.cgi?id=164205

Reviewed by Carlos Garcia Campos.

.:

* Source/cmake/FindGeoClue.cmake: Removed.
* Source/cmake/OptionsGTK.cmake:

Source/WebCore:

* PlatformGTK.cmake:
* platform/geoclue/GeolocationProviderGeoclue.h:
* platform/geoclue/GeolocationProviderGeoclue1.cpp: Removed.
* platform/geoclue/GeolocationProviderGeoclue2.cpp: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/ChangeLog (220514 => 220515)


--- trunk/ChangeLog	2017-08-10 04:31:58 UTC (rev 220514)
+++ trunk/ChangeLog	2017-08-10 05:58:26 UTC (rev 220515)
@@ -1,5 +1,15 @@
 2017-08-09  Michael Catanzaro  <mcatanz...@igalia.com>
 
+        [GTK] Remove support for geoclue1
+        https://bugs.webkit.org/show_bug.cgi?id=164205
+
+        Reviewed by Carlos Garcia Campos.
+
+        * Source/cmake/FindGeoClue.cmake: Removed.
+        * Source/cmake/OptionsGTK.cmake:
+
+2017-08-09  Michael Catanzaro  <mcatanz...@igalia.com>
+
         [CMake] Remove unused find modules
         https://bugs.webkit.org/show_bug.cgi?id=175363
 

Modified: trunk/Source/WebCore/ChangeLog (220514 => 220515)


--- trunk/Source/WebCore/ChangeLog	2017-08-10 04:31:58 UTC (rev 220514)
+++ trunk/Source/WebCore/ChangeLog	2017-08-10 05:58:26 UTC (rev 220515)
@@ -1,3 +1,15 @@
+2017-08-09  Michael Catanzaro  <mcatanz...@igalia.com>
+
+        [GTK] Remove support for geoclue1
+        https://bugs.webkit.org/show_bug.cgi?id=164205
+
+        Reviewed by Carlos Garcia Campos.
+
+        * PlatformGTK.cmake:
+        * platform/geoclue/GeolocationProviderGeoclue.h:
+        * platform/geoclue/GeolocationProviderGeoclue1.cpp: Removed.
+        * platform/geoclue/GeolocationProviderGeoclue2.cpp: Removed.
+
 2017-08-09  Yoshiaki Jitsukawa  <yoshiaki.jitsuk...@sony.com>
 
         [PAL] Move spi/cocoa and spi/cg directories into PAL

Modified: trunk/Source/WebCore/PlatformGTK.cmake (220514 => 220515)


--- trunk/Source/WebCore/PlatformGTK.cmake	2017-08-10 04:31:58 UTC (rev 220514)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2017-08-10 05:58:26 UTC (rev 220515)
@@ -71,8 +71,7 @@
 
     platform/gamepad/glib/GamepadsGlib.cpp
 
-    platform/geoclue/GeolocationProviderGeoclue1.cpp
-    platform/geoclue/GeolocationProviderGeoclue2.cpp
+    platform/geoclue/GeolocationProviderGeoclue.cpp
 
     platform/glib/EventLoopGlib.cpp
     platform/glib/FileSystemGlib.cpp
@@ -181,7 +180,7 @@
     rendering/RenderThemeGtk.cpp
 )
 
-if (USE_GEOCLUE2)
+if (ENABLE_GEOLOCATION)
     list(APPEND WebCore_DERIVED_SOURCES
         ${DERIVED_SOURCES_WEBCORE_DIR}/Geoclue2Interface.c
     )

Copied: trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue.cpp (from rev 220507, trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue2.cpp) (0 => 220515)


--- trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue.cpp	2017-08-10 05:58:26 UTC (rev 220515)
@@ -0,0 +1,207 @@
+/*
+ * Copyright (C) 2014 Samsung Electronics. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GeolocationProviderGeoclue.h"
+
+#if ENABLE(GEOLOCATION)
+
+#include <wtf/glib/GLibUtilities.h>
+#include <wtf/glib/GUniquePtr.h>
+#include <wtf/text/CString.h>
+
+const char* gGeoclueBusName = "org.freedesktop.GeoClue2";
+const char* gGeoclueManagerPath = "/org/freedesktop/GeoClue2/Manager";
+
+using namespace WebCore;
+
+typedef enum {
+    GeoclueAccuracyLevelCountry = 1,
+    GeoclueAccuracyLevelCity = 4,
+    GeoclueAccuracyLevelStreet = 6,
+    GeoclueAccuracyLevelExact = 8,
+} GeoclueAccuracyLevel;
+
+GeolocationProviderGeoclue::GeolocationProviderGeoclue(GeolocationProviderGeoclueClient* client)
+    : m_client(client)
+    , m_latitude(0)
+    , m_longitude(0)
+    , m_altitude(0)
+    , m_accuracy(0)
+    , m_altitudeAccuracy(0)
+    , m_timestamp(0)
+    , m_enableHighAccuracy(false)
+    , m_isUpdating(false)
+{
+    ASSERT(m_client);
+}
+
+GeolocationProviderGeoclue::~GeolocationProviderGeoclue()
+{
+    stopUpdating();
+}
+
+void GeolocationProviderGeoclue::startUpdating()
+{
+    m_isUpdating = true;
+
+    if (!m_managerProxy) {
+        geoclue_manager_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, gGeoclueBusName, gGeoclueManagerPath, nullptr,
+            reinterpret_cast<GAsyncReadyCallback>(createGeoclueManagerProxyCallback), this);
+        return;
+    }
+
+    geoclue_manager_call_get_client(m_managerProxy.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(getGeoclueClientCallback), this);
+}
+
+void GeolocationProviderGeoclue::stopUpdating()
+{
+    if (m_clientProxy) {
+        geoclue_client_call_stop(m_clientProxy.get(), nullptr, nullptr, nullptr);
+        g_signal_handlers_disconnect_by_func(m_clientProxy.get(), reinterpret_cast<gpointer>(locationUpdatedCallback), this);
+        m_clientProxy = nullptr;
+    }
+    m_isUpdating = false;
+}
+
+void GeolocationProviderGeoclue::setEnableHighAccuracy(bool enable)
+{
+    if (m_enableHighAccuracy == enable)
+        return;
+
+    m_enableHighAccuracy = enable;
+
+    // If we're already updating we should report the new requirements in order
+    // to change to a more suitable provider if needed. If not, return.
+    if (!m_isUpdating)
+        return;
+
+    updateClientRequirements();
+}
+
+void GeolocationProviderGeoclue::createGeoclueManagerProxyCallback(GObject*, GAsyncResult* result, GeolocationProviderGeoclue* provider)
+{
+    GUniqueOutPtr<GError> error;
+    provider->m_managerProxy = adoptGRef(geoclue_manager_proxy_new_for_bus_finish(result, &error.outPtr()));
+    if (error) {
+        provider->errorOccurred(error->message);
+        return;
+    }
+
+    geoclue_manager_call_get_client(provider->m_managerProxy.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(getGeoclueClientCallback), provider);
+}
+
+void GeolocationProviderGeoclue::getGeoclueClientCallback(GObject* sourceObject, GAsyncResult* result, GeolocationProviderGeoclue* provider)
+{
+    GUniqueOutPtr<GError> error;
+    GUniqueOutPtr<gchar> path;
+    if (!geoclue_manager_call_get_client_finish(GEOCLUE_MANAGER(sourceObject), &path.outPtr(), result, &error.outPtr())) {
+        provider->errorOccurred(error->message);
+        return;
+    }
+
+    geoclue_client_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, gGeoclueBusName, path.get(), nullptr,
+        reinterpret_cast<GAsyncReadyCallback>(createGeoclueClientProxyCallback), provider);
+}
+
+void GeolocationProviderGeoclue::createGeoclueClientProxyCallback(GObject*, GAsyncResult* result, GeolocationProviderGeoclue* provider)
+{
+    GUniqueOutPtr<GError> error;
+    provider->m_clientProxy = adoptGRef(geoclue_client_proxy_new_for_bus_finish(result, &error.outPtr()));
+    if (error) {
+        provider->errorOccurred(error->message);
+        return;
+    }
+
+    // Geoclue2 requires the client to provide a desktop ID for security
+    // reasons, which should identify the application requesting the location.
+    // FIXME: We provide the program name as the desktop ID for now but, in an ideal world,
+    // we should provide a proper "application ID" (normally the name of a .desktop file).
+    // https://bugs.webkit.org/show_bug.cgi?id=129879
+    geoclue_client_set_desktop_id(provider->m_clientProxy.get(), g_get_prgname());
+
+    provider->startGeoclueClient();
+}
+
+void GeolocationProviderGeoclue::startClientCallback(GObject* sourceObject, GAsyncResult* result, GeolocationProviderGeoclue* provider)
+{
+    GUniqueOutPtr<GError> error;
+    if (!geoclue_client_call_start_finish(GEOCLUE_CLIENT(sourceObject), result, &error.outPtr()))
+        static_cast<GeolocationProviderGeoclue*>(provider)->errorOccurred(error->message);
+}
+
+void GeolocationProviderGeoclue::locationUpdatedCallback(GeoclueClient*, const gchar*, const gchar* newPath, GeolocationProviderGeoclue* provider)
+{
+    geoclue_location_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, gGeoclueBusName, newPath, nullptr,
+        reinterpret_cast<GAsyncReadyCallback>(createLocationProxyCallback), provider);
+}
+
+void GeolocationProviderGeoclue::createLocationProxyCallback(GObject*, GAsyncResult* result, GeolocationProviderGeoclue* provider)
+{
+    GUniqueOutPtr<GError> error;
+    GRefPtr<GeoclueLocation> locationProxy = adoptGRef(geoclue_location_proxy_new_for_bus_finish(result, &error.outPtr()));
+    if (error) {
+        provider->errorOccurred(error->message);
+        return;
+    }
+    provider->updateLocation(locationProxy.get());
+}
+
+void GeolocationProviderGeoclue::startGeoclueClient()
+{
+    // Set the requirement for the client.
+    updateClientRequirements();
+
+    g_signal_connect(m_clientProxy.get(), "location-updated", G_CALLBACK(locationUpdatedCallback), this);
+    geoclue_client_call_start(m_clientProxy.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(startClientCallback), this);
+}
+
+void GeolocationProviderGeoclue::updateLocation(GeoclueLocation* locationProxy)
+{
+    GTimeVal timeValue;
+    g_get_current_time(&timeValue);
+    m_timestamp = timeValue.tv_sec;
+    m_latitude = geoclue_location_get_latitude(locationProxy);
+    m_longitude = geoclue_location_get_longitude(locationProxy);
+    m_accuracy = geoclue_location_get_accuracy(locationProxy);
+    m_client->notifyPositionChanged(m_timestamp, m_latitude, m_longitude, m_altitude, m_accuracy, m_altitudeAccuracy);
+}
+
+void GeolocationProviderGeoclue::errorOccurred(const char* message)
+{
+    m_isUpdating = false;
+    m_client->notifyErrorOccurred(message);
+}
+
+void GeolocationProviderGeoclue::updateClientRequirements()
+{
+    if (!m_clientProxy)
+        return;
+
+    GeoclueAccuracyLevel accuracyLevel = m_enableHighAccuracy ? GeoclueAccuracyLevelExact : GeoclueAccuracyLevelCity;
+    geoclue_client_set_requested_accuracy_level(m_clientProxy.get(), accuracyLevel);
+}
+
+#endif // ENABLE(GEOLOCATION)

Modified: trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue.h (220514 => 220515)


--- trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue.h	2017-08-10 04:31:58 UTC (rev 220514)
+++ trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue.h	2017-08-10 05:58:26 UTC (rev 220515)
@@ -26,12 +26,7 @@
 #include "GeolocationProviderGeoclueClient.h"
 #include <wtf/glib/GRefPtr.h>
 
-#if USE(GEOCLUE2)
 #include "Geoclue2Interface.h"
-#else
-#include <geoclue/geoclue-master.h>
-#include <geoclue/geoclue-position.h>
-#endif
 
 namespace WebCore {
 
@@ -45,7 +40,6 @@
     void setEnableHighAccuracy(bool);
 
 private:
-#if USE(GEOCLUE2)
     static void createGeoclueManagerProxyCallback(GObject*, GAsyncResult*, GeolocationProviderGeoclue*);
     static void getGeoclueClientCallback(GObject*, GAsyncResult*, GeolocationProviderGeoclue*);
     static void createGeoclueClientProxyCallback(GObject*, GAsyncResult*, GeolocationProviderGeoclue*);
@@ -55,30 +49,14 @@
 
     void startGeoclueClient();
     void updateLocation(GeoclueLocation*);
-#else
-    static void getPositionCallback(GeocluePosition*, GeocluePositionFields, int, double, double, double, GeoclueAccuracy*, GError*, GeolocationProviderGeoclue*);
-    static void positionChangedCallback(GeocluePosition*, GeocluePositionFields, int, double, double, double, GeoclueAccuracy*, GeolocationProviderGeoclue*);
-    static void createGeocluePositionCallback(GeoclueMasterClient*, GeocluePosition*, GError*, GeolocationProviderGeoclue*);
-    static void geoclueClientSetRequirementsCallback(GeoclueMasterClient*, GError*, GeolocationProviderGeoclue*);
-    static void createGeoclueClientCallback(GeoclueMaster*, GeoclueMasterClient*, char*, GError*, GeolocationProviderGeoclue*);
 
-    void initializeGeoclueClient(GeoclueMasterClient*);
-    void initializeGeocluePosition(GeocluePosition*);
-    void positionChanged(GeocluePosition*, GeocluePositionFields, int, double, double, double, GeoclueAccuracy*);
-#endif
-
     void errorOccurred(const char*);
     void updateClientRequirements();
 
     GeolocationProviderGeoclueClient* m_client;
 
-#if USE(GEOCLUE2)
     GRefPtr<GeoclueManager> m_managerProxy;
     GRefPtr<GeoclueClient> m_clientProxy;
-#else
-    GRefPtr<GeoclueMasterClient> m_geoclueClient;
-    GRefPtr<GeocluePosition> m_geocluePosition;
-#endif
 
     double m_latitude;
     double m_longitude;

Deleted: trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue1.cpp (220514 => 220515)


--- trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue1.cpp	2017-08-10 04:31:58 UTC (rev 220514)
+++ trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue1.cpp	2017-08-10 05:58:26 UTC (rev 220515)
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2012 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GeolocationProviderGeoclue.h"
-
-#if ENABLE(GEOLOCATION) && !USE(GEOCLUE2)
-
-using namespace WebCore;
-
-void GeolocationProviderGeoclue::getPositionCallback(GeocluePosition* position, GeocluePositionFields fields, int timestamp, double latitude, double longitude, double altitude, GeoclueAccuracy* accuracy, GError* error, GeolocationProviderGeoclue* provider)
-{
-    if (error) {
-        provider->errorOccurred(error->message);
-        g_error_free(error);
-        return;
-    }
-    provider->positionChanged(position, fields, timestamp, latitude, longitude, altitude, accuracy);
-}
-
-void GeolocationProviderGeoclue::positionChangedCallback(GeocluePosition* position, GeocluePositionFields fields, int timestamp, double latitude, double longitude, double altitude, GeoclueAccuracy* accuracy, GeolocationProviderGeoclue* provider)
-{
-    provider->positionChanged(position, fields, timestamp, latitude, longitude, altitude, accuracy);
-}
-
-void GeolocationProviderGeoclue::createGeocluePositionCallback(GeoclueMasterClient*, GeocluePosition* position, GError *error, GeolocationProviderGeoclue* provider)
-{
-    if (error) {
-        provider->errorOccurred(error->message);
-        g_error_free(error);
-        return;
-    }
-    provider->initializeGeocluePosition(position);
-}
-
-void GeolocationProviderGeoclue::geoclueClientSetRequirementsCallback(GeoclueMasterClient*, GError* error, GeolocationProviderGeoclue* provider)
-{
-    if (error) {
-        provider->errorOccurred(error->message);
-        g_error_free(error);
-    }
-}
-
-void GeolocationProviderGeoclue::createGeoclueClientCallback(GeoclueMaster*, GeoclueMasterClient* client, char*, GError* error, GeolocationProviderGeoclue* provider)
-{
-    if (error) {
-        provider->errorOccurred(error->message);
-        g_error_free(error);
-        return;
-    }
-    provider->initializeGeoclueClient(client);
-}
-
-GeolocationProviderGeoclue::GeolocationProviderGeoclue(GeolocationProviderGeoclueClient* client)
-    : m_client(client)
-    , m_latitude(0)
-    , m_longitude(0)
-    , m_altitude(0)
-    , m_accuracy(0)
-    , m_altitudeAccuracy(0)
-    , m_timestamp(0)
-    , m_enableHighAccuracy(false)
-    , m_isUpdating(false)
-{
-    ASSERT(m_client);
-}
-
-GeolocationProviderGeoclue::~GeolocationProviderGeoclue()
-{
-}
-
-void GeolocationProviderGeoclue::startUpdating()
-{
-    ASSERT(!m_geoclueClient);
-
-    GRefPtr<GeoclueMaster> master = adoptGRef(geoclue_master_get_default());
-    geoclue_master_create_client_async(master.get(), reinterpret_cast<GeoclueCreateClientCallback>(createGeoclueClientCallback), this);
-    m_isUpdating = true;
-}
-
-void GeolocationProviderGeoclue::stopUpdating()
-{
-    m_geocluePosition.clear();
-    m_geoclueClient.clear();
-    m_isUpdating = false;
-}
-
-void GeolocationProviderGeoclue::setEnableHighAccuracy(bool enable)
-{
-    m_enableHighAccuracy = enable;
-
-    // If we're already updating we should report the new requirements in order
-    // to change to a more suitable provider if needed. If not, return.
-    if (!m_isUpdating)
-        return;
-
-    updateClientRequirements();
-}
-
-void GeolocationProviderGeoclue::initializeGeoclueClient(GeoclueMasterClient* geoclueClient)
-{
-    ASSERT(GEOCLUE_IS_MASTER_CLIENT(geoclueClient));
-
-    // Store the GeoclueMasterClient object as created by GeoClue.
-    m_geoclueClient = adoptGRef(geoclueClient);
-
-    // Set the requirement for the client and ask it to create a position associated to it.
-    updateClientRequirements();
-    geoclue_master_client_create_position_async(m_geoclueClient.get(), reinterpret_cast<CreatePositionCallback>(createGeocluePositionCallback), this);
-}
-
-void GeolocationProviderGeoclue::initializeGeocluePosition(GeocluePosition* geocluePosition)
-{
-    ASSERT(GEOCLUE_IS_POSITION(geocluePosition));
-
-    // Stores the GeocluePosition object associated with the GeoclueMasterClient.
-    m_geocluePosition = adoptGRef(geocluePosition);
-
-    // Get the initial position and keep updated of further changes.
-    geoclue_position_get_position_async(m_geocluePosition.get(), reinterpret_cast<GeocluePositionCallback>(getPositionCallback), this);
-    g_signal_connect(m_geocluePosition.get(), "position-changed", G_CALLBACK(positionChangedCallback), this);
-}
-
-void GeolocationProviderGeoclue::updateClientRequirements()
-{
-    if (!m_geoclueClient)
-        return;
-
-    GeoclueAccuracyLevel accuracyLevel = m_enableHighAccuracy ? GEOCLUE_ACCURACY_LEVEL_DETAILED : GEOCLUE_ACCURACY_LEVEL_LOCALITY;
-    geoclue_master_client_set_requirements_async(m_geoclueClient.get(), accuracyLevel, 0, false, GEOCLUE_RESOURCE_ALL, reinterpret_cast<GeoclueSetRequirementsCallback>(geoclueClientSetRequirementsCallback), this);
-}
-
-void GeolocationProviderGeoclue::positionChanged(GeocluePosition*, GeocluePositionFields fields, int timestamp, double latitude, double longitude, double altitude, GeoclueAccuracy* accuracy)
-{
-    if (!(fields & GEOCLUE_POSITION_FIELDS_LATITUDE && fields & GEOCLUE_POSITION_FIELDS_LONGITUDE)) {
-        errorOccurred("Position could not be determined.");
-        return;
-    }
-
-    m_timestamp = timestamp;
-    m_latitude = latitude;
-    m_longitude = longitude;
-    m_altitude = altitude;
-
-    geoclue_accuracy_get_details(accuracy, 0, &m_accuracy, &m_altitudeAccuracy);
-
-    m_client->notifyPositionChanged(m_timestamp, m_latitude, m_longitude, m_altitude, m_accuracy, m_altitudeAccuracy);
-}
-
-void GeolocationProviderGeoclue::errorOccurred(const char* message)
-{
-    m_client->notifyErrorOccurred(message);
-}
-
-#endif // ENABLE(GEOLOCATION) && !USE(GEOCLUE2)

Deleted: trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue2.cpp (220514 => 220515)


--- trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue2.cpp	2017-08-10 04:31:58 UTC (rev 220514)
+++ trunk/Source/WebCore/platform/geoclue/GeolocationProviderGeoclue2.cpp	2017-08-10 05:58:26 UTC (rev 220515)
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2014 Samsung Electronics. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GeolocationProviderGeoclue.h"
-
-#if ENABLE(GEOLOCATION) && USE(GEOCLUE2)
-
-#include <wtf/glib/GLibUtilities.h>
-#include <wtf/glib/GUniquePtr.h>
-#include <wtf/text/CString.h>
-
-const char* gGeoclueBusName = "org.freedesktop.GeoClue2";
-const char* gGeoclueManagerPath = "/org/freedesktop/GeoClue2/Manager";
-
-using namespace WebCore;
-
-typedef enum {
-    GeoclueAccuracyLevelCountry = 1,
-    GeoclueAccuracyLevelCity = 4,
-    GeoclueAccuracyLevelStreet = 6,
-    GeoclueAccuracyLevelExact = 8,
-} GeoclueAccuracyLevel;
-
-GeolocationProviderGeoclue::GeolocationProviderGeoclue(GeolocationProviderGeoclueClient* client)
-    : m_client(client)
-    , m_latitude(0)
-    , m_longitude(0)
-    , m_altitude(0)
-    , m_accuracy(0)
-    , m_altitudeAccuracy(0)
-    , m_timestamp(0)
-    , m_enableHighAccuracy(false)
-    , m_isUpdating(false)
-{
-    ASSERT(m_client);
-}
-
-GeolocationProviderGeoclue::~GeolocationProviderGeoclue()
-{
-    stopUpdating();
-}
-
-void GeolocationProviderGeoclue::startUpdating()
-{
-    m_isUpdating = true;
-
-    if (!m_managerProxy) {
-        geoclue_manager_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, gGeoclueBusName, gGeoclueManagerPath, nullptr,
-            reinterpret_cast<GAsyncReadyCallback>(createGeoclueManagerProxyCallback), this);
-        return;
-    }
-
-    geoclue_manager_call_get_client(m_managerProxy.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(getGeoclueClientCallback), this);
-}
-
-void GeolocationProviderGeoclue::stopUpdating()
-{
-    if (m_clientProxy) {
-        geoclue_client_call_stop(m_clientProxy.get(), nullptr, nullptr, nullptr);
-        g_signal_handlers_disconnect_by_func(m_clientProxy.get(), reinterpret_cast<gpointer>(locationUpdatedCallback), this);
-        m_clientProxy = nullptr;
-    }
-    m_isUpdating = false;
-}
-
-void GeolocationProviderGeoclue::setEnableHighAccuracy(bool enable)
-{
-    if (m_enableHighAccuracy == enable)
-        return;
-
-    m_enableHighAccuracy = enable;
-
-    // If we're already updating we should report the new requirements in order
-    // to change to a more suitable provider if needed. If not, return.
-    if (!m_isUpdating)
-        return;
-
-    updateClientRequirements();
-}
-
-void GeolocationProviderGeoclue::createGeoclueManagerProxyCallback(GObject*, GAsyncResult* result, GeolocationProviderGeoclue* provider)
-{
-    GUniqueOutPtr<GError> error;
-    provider->m_managerProxy = adoptGRef(geoclue_manager_proxy_new_for_bus_finish(result, &error.outPtr()));
-    if (error) {
-        provider->errorOccurred(error->message);
-        return;
-    }
-
-    geoclue_manager_call_get_client(provider->m_managerProxy.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(getGeoclueClientCallback), provider);
-}
-
-void GeolocationProviderGeoclue::getGeoclueClientCallback(GObject* sourceObject, GAsyncResult* result, GeolocationProviderGeoclue* provider)
-{
-    GUniqueOutPtr<GError> error;
-    GUniqueOutPtr<gchar> path;
-    if (!geoclue_manager_call_get_client_finish(GEOCLUE_MANAGER(sourceObject), &path.outPtr(), result, &error.outPtr())) {
-        provider->errorOccurred(error->message);
-        return;
-    }
-
-    geoclue_client_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, gGeoclueBusName, path.get(), nullptr,
-        reinterpret_cast<GAsyncReadyCallback>(createGeoclueClientProxyCallback), provider);
-}
-
-void GeolocationProviderGeoclue::createGeoclueClientProxyCallback(GObject*, GAsyncResult* result, GeolocationProviderGeoclue* provider)
-{
-    GUniqueOutPtr<GError> error;
-    provider->m_clientProxy = adoptGRef(geoclue_client_proxy_new_for_bus_finish(result, &error.outPtr()));
-    if (error) {
-        provider->errorOccurred(error->message);
-        return;
-    }
-
-    // Geoclue2 requires the client to provide a desktop ID for security
-    // reasons, which should identify the application requesting the location.
-    // FIXME: We provide the program name as the desktop ID for now but, in an ideal world,
-    // we should provide a proper "application ID" (normally the name of a .desktop file).
-    // https://bugs.webkit.org/show_bug.cgi?id=129879
-    geoclue_client_set_desktop_id(provider->m_clientProxy.get(), g_get_prgname());
-
-    provider->startGeoclueClient();
-}
-
-void GeolocationProviderGeoclue::startClientCallback(GObject* sourceObject, GAsyncResult* result, GeolocationProviderGeoclue* provider)
-{
-    GUniqueOutPtr<GError> error;
-    if (!geoclue_client_call_start_finish(GEOCLUE_CLIENT(sourceObject), result, &error.outPtr()))
-        static_cast<GeolocationProviderGeoclue*>(provider)->errorOccurred(error->message);
-}
-
-void GeolocationProviderGeoclue::locationUpdatedCallback(GeoclueClient*, const gchar*, const gchar* newPath, GeolocationProviderGeoclue* provider)
-{
-    geoclue_location_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, gGeoclueBusName, newPath, nullptr,
-        reinterpret_cast<GAsyncReadyCallback>(createLocationProxyCallback), provider);
-}
-
-void GeolocationProviderGeoclue::createLocationProxyCallback(GObject*, GAsyncResult* result, GeolocationProviderGeoclue* provider)
-{
-    GUniqueOutPtr<GError> error;
-    GRefPtr<GeoclueLocation> locationProxy = adoptGRef(geoclue_location_proxy_new_for_bus_finish(result, &error.outPtr()));
-    if (error) {
-        provider->errorOccurred(error->message);
-        return;
-    }
-    provider->updateLocation(locationProxy.get());
-}
-
-void GeolocationProviderGeoclue::startGeoclueClient()
-{
-    // Set the requirement for the client.
-    updateClientRequirements();
-
-    g_signal_connect(m_clientProxy.get(), "location-updated", G_CALLBACK(locationUpdatedCallback), this);
-    geoclue_client_call_start(m_clientProxy.get(), nullptr, reinterpret_cast<GAsyncReadyCallback>(startClientCallback), this);
-}
-
-void GeolocationProviderGeoclue::updateLocation(GeoclueLocation* locationProxy)
-{
-    GTimeVal timeValue;
-    g_get_current_time(&timeValue);
-    m_timestamp = timeValue.tv_sec;
-    m_latitude = geoclue_location_get_latitude(locationProxy);
-    m_longitude = geoclue_location_get_longitude(locationProxy);
-    m_accuracy = geoclue_location_get_accuracy(locationProxy);
-    m_client->notifyPositionChanged(m_timestamp, m_latitude, m_longitude, m_altitude, m_accuracy, m_altitudeAccuracy);
-}
-
-void GeolocationProviderGeoclue::errorOccurred(const char* message)
-{
-    m_isUpdating = false;
-    m_client->notifyErrorOccurred(message);
-}
-
-void GeolocationProviderGeoclue::updateClientRequirements()
-{
-    if (!m_clientProxy)
-        return;
-
-    GeoclueAccuracyLevel accuracyLevel = m_enableHighAccuracy ? GeoclueAccuracyLevelExact : GeoclueAccuracyLevelCity;
-    geoclue_client_set_requested_accuracy_level(m_clientProxy.get(), accuracyLevel);
-}
-
-#endif // ENABLE(GEOLOCATION) && USE(GEOCLUE2)

Deleted: trunk/Source/cmake/FindGeoClue.cmake (220514 => 220515)


--- trunk/Source/cmake/FindGeoClue.cmake	2017-08-10 04:31:58 UTC (rev 220514)
+++ trunk/Source/cmake/FindGeoClue.cmake	2017-08-10 05:58:26 UTC (rev 220515)
@@ -1,49 +0,0 @@
-# - Try to find GeoClue
-# Once done, this will define
-#
-#  GEOCLUE_FOUND - system has GeoClue
-#  GEOCLUE_INCLUDE_DIRS - the GeoClue include directories
-#  GEOCLUE_LIBRARIES - link these to use GeoClue
-#
-# Copyright (C) 2012 Raphael Kubo da Costa <rak...@webkit.org>
-# Copyright (C) 2013, 2014 Igalia S.L.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1.  Redistributions of source code must retain the above copyright
-#     notice, this list of conditions and the following disclaimer.
-# 2.  Redistributions in binary form must reproduce the above copyright
-#     notice, this list of conditions and the following disclaimer in the
-#     documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
-# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-find_package(PkgConfig)
-pkg_check_modules(GEOCLUE geoclue)
-
-set(VERSION_OK TRUE)
-if (GEOCLUE_VERSION)
-    if (GEOCLUE_FIND_VERSION_EXACT)
-        if (NOT("${GEOCLUE_FIND_VERSION}" VERSION_EQUAL "${GEOCLUE_VERSION}"))
-            set(VERSION_OK FALSE)
-        endif ()
-    else ()
-        if ("${GEOCLUE_VERSION}" VERSION_LESS "${GEOCLUE_FIND_VERSION}")
-            set(VERSION_OK FALSE)
-        endif ()
-    endif ()
-endif ()
-
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOCLUE DEFAULT_MSG GEOCLUE_INCLUDE_DIRS GEOCLUE_LIBRARIES VERSION_OK)

Modified: trunk/Source/cmake/OptionsGTK.cmake (220514 => 220515)


--- trunk/Source/cmake/OptionsGTK.cmake	2017-08-10 04:31:58 UTC (rev 220514)
+++ trunk/Source/cmake/OptionsGTK.cmake	2017-08-10 05:58:26 UTC (rev 220515)
@@ -243,13 +243,8 @@
 
 if (ENABLE_GEOLOCATION)
     find_package(GeoClue2 2.1.5)
-    if (GEOCLUE2_FOUND)
-        SET_AND_EXPOSE_TO_BUILD(USE_GEOCLUE2 ${GEOCLUE2_FOUND})
-    else ()
-        find_package(GeoClue)
-        if (NOT GEOCLUE_FOUND)
-            message(FATAL_ERROR "Geoclue is needed for ENABLE_GEOLOCATION.")
-        endif ()
+    if (NOT GEOCLUE2_FOUND)
+        message(FATAL_ERROR "Geoclue is needed for ENABLE_GEOLOCATION.")
     endif ()
 endif ()
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to