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

Unified Diff: chromeos/network/geolocation_handler.h

Issue 11887008: Deprecate ShillNetworkClient and add GeolocationHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
Index: chromeos/network/geolocation_handler.h
diff --git a/chromeos/network/geolocation_handler.h b/chromeos/network/geolocation_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..1c06f9d3983ef8431b34dbe8114784c6af08756b
--- /dev/null
+++ b/chromeos/network/geolocation_handler.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
Greg Spencer (Chromium) 2013/01/12 00:52:37 It's 2013...
stevenjb 2013/01/12 01:55:59 Meh. Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_
+#define CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/time.h"
+#include "chromeos/dbus/dbus_method_call_status.h"
+#include "chromeos/network/network_util.h"
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace chromeos {
+
+class CHROMEOS_EXPORT GeolocationHandler {
+ public:
+ ~GeolocationHandler();
+
+ // Manage the global instance. Must be initialized before any calls to Get().
+ static void Initialize();
+ static void Shutdown();
+ static GeolocationHandler* Get();
+
+ // This sends a request for wifi access point data. If data is already
+ // available, returns |true| and sets |access_points|.
+ bool GetWifiAccessPoints(WifiAccessPointVector* access_points);
+
+ private:
+ friend class GeolocationHandlerTest;
+
+ GeolocationHandler();
+
+ // Callback for receiving Geolocation data.
+ void GeolocationCallback(DBusMethodCallStatus call_status,
+ const base::DictionaryValue& properties);
+
+ // Cached wifi access points and update time
+ WifiAccessPointVector wifi_access_points_;
+ base::Time geolocation_received_time_;
+
+ // For Shill client callbacks
+ base::WeakPtrFactory<GeolocationHandler> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(GeolocationHandler);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_NETWORK_GEOLOCATION_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698