OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
6 #define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 CacheAgeList cache_age_list_; // Oldest first. | 64 CacheAgeList cache_age_list_; // Oldest first. |
65 }; | 65 }; |
66 | 66 |
67 NetworkLocationProvider(AccessTokenStore* access_token_store, | 67 NetworkLocationProvider(AccessTokenStore* access_token_store, |
68 net::URLRequestContextGetter* context, | 68 net::URLRequestContextGetter* context, |
69 const GURL& url, | 69 const GURL& url, |
70 const string16& access_token); | 70 const string16& access_token); |
71 virtual ~NetworkLocationProvider(); | 71 virtual ~NetworkLocationProvider(); |
72 | 72 |
73 // LocationProviderBase implementation | 73 // LocationProviderBase implementation |
74 virtual bool StartProvider(bool high_accuracy); | 74 virtual bool StartProvider(bool high_accuracy) OVERRIDE; |
75 virtual void StopProvider(); | 75 virtual void StopProvider() OVERRIDE; |
76 virtual void GetPosition(Geoposition *position); | 76 virtual void GetPosition(Geoposition *position) OVERRIDE; |
77 virtual void UpdatePosition(); | 77 virtual void UpdatePosition() OVERRIDE; |
78 virtual void OnPermissionGranted(const GURL& requesting_frame); | 78 virtual void OnPermissionGranted(const GURL& requesting_frame) OVERRIDE; |
79 | 79 |
80 private: | 80 private: |
81 // Satisfies a position request from cache or network. | 81 // Satisfies a position request from cache or network. |
82 void RequestPosition(); | 82 void RequestPosition(); |
83 | 83 |
84 // Internal helper used by DeviceDataUpdateAvailable | 84 // Internal helper used by DeviceDataUpdateAvailable |
85 void OnDeviceDataUpdated(); | 85 void OnDeviceDataUpdated(); |
86 | 86 |
87 bool IsStarted() const; | 87 bool IsStarted() const; |
88 | 88 |
89 // DeviceDataProvider::ListenerInterface implementation. | 89 // DeviceDataProvider::ListenerInterface implementation. |
90 virtual void DeviceDataUpdateAvailable(RadioDataProvider* provider); | 90 virtual void DeviceDataUpdateAvailable(RadioDataProvider* provider) OVERRIDE; |
91 virtual void DeviceDataUpdateAvailable(WifiDataProvider* provider); | 91 virtual void DeviceDataUpdateAvailable(WifiDataProvider* provider) OVERRIDE; |
92 | 92 |
93 // NetworkLocationRequest::ListenerInterface implementation. | 93 // NetworkLocationRequest::ListenerInterface implementation. |
94 virtual void LocationResponseAvailable(const Geoposition& position, | 94 virtual void LocationResponseAvailable(const Geoposition& position, |
95 bool server_error, | 95 bool server_error, |
96 const string16& access_token, | 96 const string16& access_token, |
97 const RadioData& radio_data, | 97 const RadioData& radio_data, |
98 const WifiData& wifi_data); | 98 const WifiData& wifi_data) OVERRIDE; |
99 | 99 |
100 scoped_refptr<AccessTokenStore> access_token_store_; | 100 scoped_refptr<AccessTokenStore> access_token_store_; |
101 | 101 |
102 // The device data providers, acquired via global factories. | 102 // The device data providers, acquired via global factories. |
103 RadioDataProvider* radio_data_provider_; | 103 RadioDataProvider* radio_data_provider_; |
104 WifiDataProvider* wifi_data_provider_; | 104 WifiDataProvider* wifi_data_provider_; |
105 | 105 |
106 // The radio and wifi data, flags to indicate if each data set is complete. | 106 // The radio and wifi data, flags to indicate if each data set is complete. |
107 RadioData radio_data_; | 107 RadioData radio_data_; |
108 WifiData wifi_data_; | 108 WifiData wifi_data_; |
(...skipping 18 matching lines...) Expand all Loading... |
127 scoped_ptr<NetworkLocationRequest> request_; | 127 scoped_ptr<NetworkLocationRequest> request_; |
128 | 128 |
129 base::WeakPtrFactory<NetworkLocationProvider> weak_factory_; | 129 base::WeakPtrFactory<NetworkLocationProvider> weak_factory_; |
130 // The cache of positions. | 130 // The cache of positions. |
131 scoped_ptr<PositionCache> position_cache_; | 131 scoped_ptr<PositionCache> position_cache_; |
132 | 132 |
133 DISALLOW_COPY_AND_ASSIGN(NetworkLocationProvider); | 133 DISALLOW_COPY_AND_ASSIGN(NetworkLocationProvider); |
134 }; | 134 }; |
135 | 135 |
136 #endif // CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ | 136 #endif // CONTENT_BROWSER_GEOLOCATION_NETWORK_LOCATION_PROVIDER_H_ |
OLD | NEW |