| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ |
| 6 #define CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 8 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 9 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 10 #include "chromeos/dbus/dbus_method_call_status.h" | 13 #include "chromeos/dbus/dbus_method_call_status.h" |
| 11 #include "chromeos/dbus/shill_property_changed_observer.h" | 14 #include "chromeos/dbus/shill_property_changed_observer.h" |
| 12 #include "chromeos/network/network_handler.h" | 15 #include "chromeos/network/network_handler.h" |
| 13 #include "chromeos/network/network_util.h" | 16 #include "chromeos/network/network_util.h" |
| 14 | 17 |
| 15 namespace base { | 18 namespace base { |
| 16 class DictionaryValue; | 19 class DictionaryValue; |
| 17 } | 20 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 // GetWifiAccessPoints(); // returns true + same data, requests update | 33 // GetWifiAccessPoints(); // returns true + same data, requests update |
| 31 // (Delay some amount of time after data did not change, ~2 mins) | 34 // (Delay some amount of time after data did not change, ~2 mins) |
| 32 | 35 |
| 33 class CHROMEOS_EXPORT GeolocationHandler : public ShillPropertyChangedObserver { | 36 class CHROMEOS_EXPORT GeolocationHandler : public ShillPropertyChangedObserver { |
| 34 public: | 37 public: |
| 35 ~GeolocationHandler() override; | 38 ~GeolocationHandler() override; |
| 36 | 39 |
| 37 // This sends a request for wifi access point data. If data is already | 40 // This sends a request for wifi access point data. If data is already |
| 38 // available, returns |true|, fills |access_points| with the latest access | 41 // available, returns |true|, fills |access_points| with the latest access |
| 39 // point data, and sets |age_ms| to the time since the last update in MS. | 42 // point data, and sets |age_ms| to the time since the last update in MS. |
| 40 bool GetWifiAccessPoints(WifiAccessPointVector* access_points, int64* age_ms); | 43 bool GetWifiAccessPoints(WifiAccessPointVector* access_points, |
| 44 int64_t* age_ms); |
| 41 | 45 |
| 42 bool wifi_enabled() const { return wifi_enabled_; } | 46 bool wifi_enabled() const { return wifi_enabled_; } |
| 43 | 47 |
| 44 // ShillPropertyChangedObserver overrides | 48 // ShillPropertyChangedObserver overrides |
| 45 void OnPropertyChanged(const std::string& key, | 49 void OnPropertyChanged(const std::string& key, |
| 46 const base::Value& value) override; | 50 const base::Value& value) override; |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 friend class NetworkHandler; | 53 friend class NetworkHandler; |
| 50 friend class GeolocationHandlerTest; | 54 friend class GeolocationHandlerTest; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 75 | 79 |
| 76 // For Shill client callbacks | 80 // For Shill client callbacks |
| 77 base::WeakPtrFactory<GeolocationHandler> weak_ptr_factory_; | 81 base::WeakPtrFactory<GeolocationHandler> weak_ptr_factory_; |
| 78 | 82 |
| 79 DISALLOW_COPY_AND_ASSIGN(GeolocationHandler); | 83 DISALLOW_COPY_AND_ASSIGN(GeolocationHandler); |
| 80 }; | 84 }; |
| 81 | 85 |
| 82 } // namespace chromeos | 86 } // namespace chromeos |
| 83 | 87 |
| 84 #endif // CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ | 88 #endif // CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ |
| OLD | NEW |