[haiku-commits] haiku: hrev47946 - in src/kits: shared network/libnetapi

  • From: zooey@xxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 2 Oct 2014 00:32:53 +0200 (CEST)

hrev47946 adds 2 changesets to branch 'master'
old head: d02e38fb131904b2049355705fe50c8fd2b93d83
new head: d0fe638dbdfdfdf36990ff15cd9b14b5875498aa
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=d0fe638+%5Ed02e38f

----------------------------------------------------------------------------

3006031: Move Geolocation to kits/shared and make it private.

d0fe638: Look for private key of default geolocation service.
  
  * Let the jamfile set HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY if the
    header that is supposed to contain it is found in src/kits/shared
    (which isn't the case for normal builds).
  * In case HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY is set, include the
    corresponding header and activate Mozilla's geolocation service with
    the key defined in that header.
    
  This procedure should enable buildbot to create nightly images without
  exposing the private service key.

                                    [ Oliver Tappe <zooey@xxxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 31 insertions(+), 6 deletions(-)
headers/private/shared/Geolocation.h             |  6 ++++++
src/kits/network/libnetapi/Jamfile               |  4 +---
.../libnetapi => shared}/Geolocation.cpp         | 22 +++++++++++++++++---
src/kits/shared/Jamfile                          |  5 +++++

############################################################################

Commit:      3006031ac284d9a27b3f5df09ed5974cc31492c4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3006031
Author:      Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
Date:        Wed Oct  1 21:13:12 2014 UTC

Move Geolocation to kits/shared and make it private.

----------------------------------------------------------------------------

diff --git a/headers/private/shared/Geolocation.h 
b/headers/private/shared/Geolocation.h
index b458f9e..cad1e17 100644
--- a/headers/private/shared/Geolocation.h
+++ b/headers/private/shared/Geolocation.h
@@ -9,6 +9,9 @@
 #include <Url.h>
 
 
+namespace BPrivate {
+
+
 class BGeolocation {
 public:
                                BGeolocation();
@@ -26,4 +29,7 @@ private:
 };
 
 
+}      // namespace BPrivate
+
+
 #endif
diff --git a/src/kits/network/libnetapi/Jamfile 
b/src/kits/network/libnetapi/Jamfile
index 2f8fc3c..285858c 100644
--- a/src/kits/network/libnetapi/Jamfile
+++ b/src/kits/network/libnetapi/Jamfile
@@ -50,7 +50,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
                        NetworkInterface.cpp
                        NetworkRoster.cpp
                        RouteSupport.cpp
-                       
+
                        AbstractSocket.cpp
                        DatagramSocket.cpp
                        Socket.cpp
@@ -59,8 +59,6 @@ for architectureObject in [ MultiArchSubDirSetup ] {
                        # TODO: another add-on for file:// (a much simpler one)
                        FileRequest.cpp
 
-                       Geolocation.cpp
-
                        # TODO: another add-on for gopher://
                        GopherRequest.cpp
 
diff --git a/src/kits/network/libnetapi/Geolocation.cpp 
b/src/kits/shared/Geolocation.cpp
similarity index 98%
rename from src/kits/network/libnetapi/Geolocation.cpp
rename to src/kits/shared/Geolocation.cpp
index c804111..af6099b 100644
--- a/src/kits/network/libnetapi/Geolocation.cpp
+++ b/src/kits/shared/Geolocation.cpp
@@ -16,6 +16,9 @@
 #include <UrlRequest.h>
 
 
+namespace BPrivate {
+
+
 BGeolocation::BGeolocation()
        : fService(kDefaultService)
 {
@@ -141,3 +144,6 @@ BGeolocation::LocateSelf(float& latitude, float& longitude)
 // FIXME switch to an openly available service that will actually work with the
 // "standard" geolocation API. Openbmap has a few variations.
 const char* BGeolocation::kDefaultService = 
"http://openbmap.org/api/json.php5";;
+
+
+}      // namespace BPrivate
diff --git a/src/kits/shared/Jamfile b/src/kits/shared/Jamfile
index 6867447..20cd490 100644
--- a/src/kits/shared/Jamfile
+++ b/src/kits/shared/Jamfile
@@ -30,6 +30,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
                        CommandPipe.cpp
                        DragTrackingFilter.cpp
                        DriverSettingsMessageAdapter.cpp
+                       Geolocation.cpp
                        HashString.cpp
                        IconButton.cpp
                        IconView.cpp

############################################################################

Revision:    hrev47946
Commit:      d0fe638dbdfdfdf36990ff15cd9b14b5875498aa
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d0fe638
Author:      Oliver Tappe <zooey@xxxxxxxxxxxxxxx>
Date:        Wed Oct  1 22:12:46 2014 UTC

Look for private key of default geolocation service.

* Let the jamfile set HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY if the
  header that is supposed to contain it is found in src/kits/shared
  (which isn't the case for normal builds).
* In case HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY is set, include the
  corresponding header and activate Mozilla's geolocation service with
  the key defined in that header.
  
This procedure should enable buildbot to create nightly images without
exposing the private service key.

----------------------------------------------------------------------------

diff --git a/src/kits/shared/Geolocation.cpp b/src/kits/shared/Geolocation.cpp
index af6099b..7d2f4e8 100644
--- a/src/kits/shared/Geolocation.cpp
+++ b/src/kits/shared/Geolocation.cpp
@@ -141,9 +141,19 @@ BGeolocation::LocateSelf(float& latitude, float& longitude)
 }
 
 
-// FIXME switch to an openly available service that will actually work with the
-// "standard" geolocation API. Openbmap has a few variations.
-const char* BGeolocation::kDefaultService = 
"http://openbmap.org/api/json.php5";;
+#ifdef HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY
+
+#include "DefaultGeolocationServiceKey.h"
+
+const char* BGeolocation::kDefaultService
+       = "https://location.services.mozilla.com/v1/geolocate?key=";
+               DEFAULT_GEOLOCATION_SERVICE_KEY;
+
+#else
+
+const char* BGeolocation::kDefaultService = "";
+
+#endif
 
 
 }      // namespace BPrivate
diff --git a/src/kits/shared/Jamfile b/src/kits/shared/Jamfile
index 20cd490..3185802 100644
--- a/src/kits/shared/Jamfile
+++ b/src/kits/shared/Jamfile
@@ -6,6 +6,10 @@ AddSubDirSupportedPlatforms libbe_test ;
 UseLibraryHeaders agg ;
 UsePrivateHeaders shared locale ;
 
+if [ Glob $(SUBDIR) : DefaultGeolocationServiceKey.h ] {
+       SubDirC++Flags [ FDefines HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY ] ;
+}
+
 local architectureObject ;
 for architectureObject in [ MultiArchSubDirSetup ] {
        on $(architectureObject) {


Other related posts:

  • » [haiku-commits] haiku: hrev47946 - in src/kits: shared network/libnetapi - zooey