]> khamidou — GitHub mirrors - electron.git/commitdiff
Add network provider for google geolocation api.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 13 Aug 2014 05:28:05 +0000 (13:28 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 13 Aug 2014 05:28:05 +0000 (13:28 +0800)
atom/browser/atom_access_token_store.cc
atom/browser/atom_access_token_store.h

index 0018f77b9430996f411249c9189b801946e5e313..6555ac76aea122dcd5377cde365d9ff09ecd6389 100644 (file)
@@ -7,8 +7,23 @@
 #include "atom/browser/atom_browser_context.h"
 #include "atom/browser/net/atom_url_request_context_getter.h"
 
+#ifndef GOOGLEAPIS_API_KEY
+#define GOOGLEAPIS_API_KEY "AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q"
+#endif
+
 namespace atom {
 
+namespace {
+
+// Notice that we just combined the api key with the url together here, because
+// if we use the standard {url: key} format Chromium would override our key with
+// the predefined one in common.gypi of libchromiumcontent, which is empty.
+const char* kGeolocationProviderUrl =
+    "https://www.googleapis.com/geolocation/v1/geolocate?key="
+    GOOGLEAPIS_API_KEY;
+
+}  // namespace
+
 AtomAccessTokenStore::AtomAccessTokenStore() {
 }
 
@@ -18,6 +33,7 @@ AtomAccessTokenStore::~AtomAccessTokenStore() {
 void AtomAccessTokenStore::LoadAccessTokens(
     const LoadAccessTokensCallbackType& callback) {
   AccessTokenSet access_token_set;
+  access_token_set[GURL(kGeolocationProviderUrl)];
   callback.Run(access_token_set,
                AtomBrowserContext::Get()->url_request_context_getter());
 }
index 4f4f95fb4b3670094cbf5174c632a14ca61a00fe..d1d080ac33a084b035a395e08d857d6f52d54ef7 100644 (file)
@@ -28,4 +28,4 @@ class AtomAccessTokenStore : public content::AccessTokenStore {
 
 }  // namespace atom
 
-#endif  // ATOM_BROWSER_ATOWSER_ATOM_ACCESS_TOKEN_STORE_H_
+#endif  // ATOM_BROWSER_ATOM_ACCESS_TOKEN_STORE_H_