| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ |
| 6 #define CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/time.h" |
| 10 #include "chromeos/dbus/dbus_method_call_status.h" |
| 11 #include "chromeos/network/network_util.h" |
| 12 |
| 13 namespace base { |
| 14 class DictionaryValue; |
| 15 } |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 class CHROMEOS_EXPORT GeolocationHandler { |
| 20 public: |
| 21 ~GeolocationHandler(); |
| 22 |
| 23 // Manage the global instance. Must be initialized before any calls to Get(). |
| 24 static void Initialize(); |
| 25 static void Shutdown(); |
| 26 static GeolocationHandler* Get(); |
| 27 |
| 28 // This sends a request for wifi access point data. If data is already |
| 29 // available, returns |true| and sets |access_points|. |
| 30 bool GetWifiAccessPoints(WifiAccessPointVector* access_points); |
| 31 |
| 32 private: |
| 33 friend class GeolocationHandlerTest; |
| 34 |
| 35 GeolocationHandler(); |
| 36 |
| 37 // Callback for receiving Geolocation data. |
| 38 void GeolocationCallback(DBusMethodCallStatus call_status, |
| 39 const base::DictionaryValue& properties); |
| 40 |
| 41 // Cached wifi access points and update time |
| 42 WifiAccessPointVector wifi_access_points_; |
| 43 base::Time geolocation_received_time_; |
| 44 |
| 45 // For Shill client callbacks |
| 46 base::WeakPtrFactory<GeolocationHandler> weak_ptr_factory_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(GeolocationHandler); |
| 49 }; |
| 50 |
| 51 } // namespace chromeos |
| 52 |
| 53 #endif // CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_ |
| OLD | NEW |