1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_DEVICE_LISTER_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_DEVICE_LISTER_H_
10 #include "base/callback.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/local_discovery/wifi/wifi_manager.h"
14 namespace local_discovery {
18 struct BootstrappingDeviceDescription {
19 enum ConnectionStatus {
27 BootstrappingDeviceDescription();
28 ~BootstrappingDeviceDescription();
30 std::string device_network_id;
31 std::string device_ssid;
32 std::string device_name;
33 std::string device_kind;
34 ConnectionStatus connection_status;
37 class BootstrappingDeviceLister : public NetworkListObserver {
39 typedef base::Callback<
40 void(bool available, const BootstrappingDeviceDescription& description)>
43 BootstrappingDeviceLister(WifiManager* wifi_manager,
44 const UpdateCallback& update_callback);
45 ~BootstrappingDeviceLister() override;
51 std::pair<std::string /*ssid*/, std::string /*internal_name*/> >
54 void OnNetworkListChanged(
55 const std::vector<NetworkProperties>& ssids) override;
57 void UpdateChangedSSIDs(bool available,
58 const ActiveDeviceList& changed,
59 const ActiveDeviceList& original);
61 WifiManager* wifi_manager_;
62 UpdateCallback update_callback_;
65 ActiveDeviceList active_devices_;
66 base::WeakPtrFactory<BootstrappingDeviceLister> weak_factory_;
71 } // namespace local_discovery
73 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_BOOTSTRAPPING_DEVICE_LISTER_H_