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

Unified Diff: chrome/browser/local_discovery/wifi/bootstrapping_device_lister.h

Issue 288043004: Bootstrapping device lister plus tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wifi_lib1
Patch Set: Created 6 years, 7 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 | « no previous file | chrome/browser/local_discovery/wifi/bootstrapping_device_lister.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/local_discovery/wifi/bootstrapping_device_lister.h
diff --git a/chrome/browser/local_discovery/wifi/bootstrapping_device_lister.h b/chrome/browser/local_discovery/wifi/bootstrapping_device_lister.h
new file mode 100644
index 0000000000000000000000000000000000000000..dfcc9a91c60c969571dd67f462562a7371dfe295
--- /dev/null
+++ b/chrome/browser/local_discovery/wifi/bootstrapping_device_lister.h
@@ -0,0 +1,73 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_DEVICE_LISTER_H_
+#define CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_DEVICE_LISTER_H_
+
+#include <vector>
+
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/local_discovery/wifi/wifi_manager.h"
+
+namespace local_discovery {
+
+namespace wifi {
+
+struct BootstrappingDeviceDescription {
+ enum ConnectionStatus {
+ ONLINE,
+ OFFLINE,
+ CONNECTING,
+ NOT_CONFIGURED,
+ LOCAL_ONLY
+ };
+
+ BootstrappingDeviceDescription();
+ ~BootstrappingDeviceDescription();
+
+ std::string device_network_id;
+ std::string device_ssid;
+ std::string device_name;
+ std::string device_kind;
+ ConnectionStatus connection_status;
+};
+
+class BootstrappingDeviceLister : public NetworkListObserver {
+ public:
+ typedef base::Callback<
+ void(bool available, const BootstrappingDeviceDescription& description)>
+ UpdateCallback;
+
+ BootstrappingDeviceLister(WifiManager* wifi_manager,
+ const UpdateCallback& update_callback);
+ virtual ~BootstrappingDeviceLister();
+
+ void Start();
+
+ private:
+ typedef std::vector<
+ std::pair<std::string /*ssid*/, std::string /*internal_name*/> >
+ ActiveDeviceList;
+
+ virtual void OnNetworkListChanged(
+ const std::vector<NetworkProperties>& ssids) OVERRIDE;
+
+ void UpdateChangedSSIDs(bool available,
+ const ActiveDeviceList& changed,
+ const ActiveDeviceList& original);
+
+ WifiManager* wifi_manager_;
+ UpdateCallback update_callback_;
+
+ bool started_;
+ ActiveDeviceList active_devices_;
+ base::WeakPtrFactory<BootstrappingDeviceLister> weak_factory_;
+};
+
+} // namespace wifi
+
+} // namespace local_discovery
+
+#endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_DEVICE_LISTER_H_
« no previous file with comments | « no previous file | chrome/browser/local_discovery/wifi/bootstrapping_device_lister.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698