| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ | 5 #ifndef DEVICE_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ | 6 #define DEVICE_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
| 19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 20 #include "content/browser/geolocation/location_provider_base.h" | 20 #include "device/geolocation/geolocation_export.h" |
| 21 #include "content/browser/geolocation/network_location_request.h" | 21 #include "device/geolocation/geoposition.h" |
| 22 #include "content/browser/geolocation/wifi_data_provider_manager.h" | 22 #include "device/geolocation/location_provider_base.h" |
| 23 #include "content/common/content_export.h" | 23 #include "device/geolocation/network_location_request.h" |
| 24 #include "content/public/common/geoposition.h" | 24 #include "device/geolocation/wifi_data_provider_manager.h" |
| 25 | 25 |
| 26 namespace content { | 26 namespace device { |
| 27 class AccessTokenStore; | 27 class AccessTokenStore; |
| 28 | 28 |
| 29 class NetworkLocationProvider : public base::NonThreadSafe, | 29 class NetworkLocationProvider : public base::NonThreadSafe, |
| 30 public LocationProviderBase { | 30 public LocationProviderBase { |
| 31 public: | 31 public: |
| 32 // Cache of recently resolved locations. Public for tests. | 32 // Cache of recently resolved locations. Public for tests. |
| 33 class CONTENT_EXPORT PositionCache { | 33 class DEVICE_GEOLOCATION_EXPORT PositionCache { |
| 34 public: | 34 public: |
| 35 // The maximum size of the cache of positions. | 35 // The maximum size of the cache of positions. |
| 36 static const size_t kMaximumSize; | 36 static const size_t kMaximumSize; |
| 37 | 37 |
| 38 PositionCache(); | 38 PositionCache(); |
| 39 ~PositionCache(); | 39 ~PositionCache(); |
| 40 | 40 |
| 41 // Caches the current position response for the current set of cell ID and | 41 // Caches the current position response for the current set of cell ID and |
| 42 // WiFi data. In the case of the cache exceeding kMaximumSize this will | 42 // WiFi data. In the case of the cache exceeding kMaximumSize this will |
| 43 // evict old entries in FIFO orderer of being added. | 43 // evict old entries in FIFO orderer of being added. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // The cache of positions. | 128 // The cache of positions. |
| 129 const std::unique_ptr<PositionCache> position_cache_; | 129 const std::unique_ptr<PositionCache> position_cache_; |
| 130 | 130 |
| 131 base::WeakPtrFactory<NetworkLocationProvider> weak_factory_; | 131 base::WeakPtrFactory<NetworkLocationProvider> weak_factory_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(NetworkLocationProvider); | 133 DISALLOW_COPY_AND_ASSIGN(NetworkLocationProvider); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 // Factory functions for the various types of location provider to abstract | 136 // Factory functions for the various types of location provider to abstract |
| 137 // over the platform-dependent implementations. | 137 // over the platform-dependent implementations. |
| 138 CONTENT_EXPORT LocationProviderBase* NewNetworkLocationProvider( | 138 DEVICE_GEOLOCATION_EXPORT LocationProviderBase* NewNetworkLocationProvider( |
| 139 const scoped_refptr<AccessTokenStore>& access_token_store, | 139 const scoped_refptr<AccessTokenStore>& access_token_store, |
| 140 const scoped_refptr<net::URLRequestContextGetter>& context, | 140 const scoped_refptr<net::URLRequestContextGetter>& context, |
| 141 const GURL& url, | 141 const GURL& url, |
| 142 const base::string16& access_token); | 142 const base::string16& access_token); |
| 143 | 143 |
| 144 } // namespace content | 144 } // namespace device |
| 145 | 145 |
| 146 #endif // CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ | 146 #endif // DEVICE_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
| OLD | NEW |