Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Unified Diff: chromeos/network/geolocation_handler.h

Issue 2624843003: Add support for cellular geolocation (Closed)
Patch Set: Update device tests to use correct dict key Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/geolocation/simple_geolocation_unittest.cc ('k') | chromeos/network/geolocation_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/geolocation_handler.h
diff --git a/chromeos/network/geolocation_handler.h b/chromeos/network/geolocation_handler.h
index f962328511ff802fd717a44abd5ad385493c08f8..c0e61527dfc203559553b36a42a0dfdbb3f08f54 100644
--- a/chromeos/network/geolocation_handler.h
+++ b/chromeos/network/geolocation_handler.h
@@ -21,10 +21,11 @@ class DictionaryValue;
namespace chromeos {
-// This class provices Shill Wifi Access Point data. It currently relies on
-// polling because that is the usage model in content::WifiDataProvider. This
-// class requests data asynchronously, returning the most recent available data.
-// A typical usage pattern, assuming a wifi device is enabled, is:
+// This class provices Shill Wifi Access Point and Cell Tower data. It
+// currently relies on polling because that is the usage model in
+// content::WifiDataProvider. This class requests data asynchronously,
+// returning the most recent available data. A typical usage pattern,
+// assuming a wifi device is enabled, is:
// Initialize(); // Makes an initial request
// GetWifiAccessPoints(); // returns true + inital data, requests update
// (Delay some amount of time, ~10s)
@@ -37,9 +38,17 @@ class CHROMEOS_EXPORT GeolocationHandler : public ShillPropertyChangedObserver {
public:
~GeolocationHandler() override;
- // This sends a request for wifi access point data. If data is already
- // available, returns |true|, fills |access_points| with the latest access
- // point data, and sets |age_ms| to the time since the last update in MS.
+ // This sends a request for geolocation (both wifi AP and cell tower) data.
+ // If AP data is already available, fills |access_points| with the latest
+ // access point data, and similarly for cell tower data and |cell_towers|.
+ // Returns |true| if either type of data is already available upon call.
+ bool GetNetworkInformation(WifiAccessPointVector* access_points,
+ CellTowerVector* cell_towers);
+
+ // This sends a request for geolocation (both wifi AP and cell tower) data.
+ // If wifi data is already available, returns |true|, fills |access_points|
+ // with the latest access point data, and sets |age_ms| to the time
+ // since the last update in MS.
bool GetWifiAccessPoints(WifiAccessPointVector* access_points,
int64_t* age_ms);
@@ -52,7 +61,7 @@ class CHROMEOS_EXPORT GeolocationHandler : public ShillPropertyChangedObserver {
private:
friend class NetworkHandler;
friend class GeolocationHandlerTest;
- friend class SimpleGeolocationWiFiTest;
+ friend class SimpleGeolocationWirelessTest;
GeolocationHandler();
@@ -65,18 +74,23 @@ class CHROMEOS_EXPORT GeolocationHandler : public ShillPropertyChangedObserver {
// Called from OnPropertyChanged or ManagerPropertiesCallback.
void HandlePropertyChanged(const std::string& key, const base::Value& value);
- // Asynchronously request wifi access points from Shill.Manager.
- void RequestWifiAccessPoints();
+ // Asynchronously request geolocation objects (wifi access points and
+ // cell towers) from Shill.Manager.
+ void RequestGeolocationObjects();
// Callback for receiving Geolocation data.
void GeolocationCallback(DBusMethodCallStatus call_status,
const base::DictionaryValue& properties);
- // Wifi enabled state
+ bool cellular_enabled_;
bool wifi_enabled_;
- // Cached wifi access points and update time
+ void AddCellTowerFromDict(const base::DictionaryValue* entry);
+ void AddAccessPointFromDict(const base::DictionaryValue* entry);
+
+ // Cached netork information and update time
WifiAccessPointVector wifi_access_points_;
+ CellTowerVector cell_towers_;
base::Time geolocation_received_time_;
// For Shill client callbacks
« no previous file with comments | « chromeos/geolocation/simple_geolocation_unittest.cc ('k') | chromeos/network/geolocation_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698