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

Side by Side Diff: chrome/browser/local_discovery/wifi/wifi_manager.h

Issue 226883002: WiFi client for GCD bootstrapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_WIFI_MANAGER_H_
6 #define CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_WIFI_MANAGER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "components/wifi/network_properties.h"
14
15 namespace local_discovery {
16
17 namespace wifi {
18
19 // Convenience definition for users of this header, since ::wifi and
20 // local_discovery::wifi may conflict.
21 using ::wifi::NetworkProperties;
22
23 typedef std::vector<NetworkProperties> NetworkPropertiesList;
24
25 // Credentials for WiFi networks. Currently only supports PSK-based networks.
26 // TODO(noamsml): Support for 802.11X and other authentication methods.
27 struct WifiCredentials {
28 static WifiCredentials FromPSK(const std::string& psk);
29
30 std::string psk;
31 };
32
33 // Observer for the network list. Classes may implement this interface and call
34 // |AddNetworkListObserver| to be notified of changes to the visible network
35 // list.
36 class NetworkListObserver {
37 public:
38 virtual ~NetworkListObserver() {}
39
40 virtual void OnNetworkListChanged(const NetworkPropertiesList& ssid) = 0;
41 };
42
43 // A class to manage listing, connecting to, and getting the credentials of WiFi
44 // networks.
45 class WifiManager {
46 public:
47 typedef base::Callback<void(const NetworkPropertiesList& ssids)>
48 SSIDListCallback;
49 typedef base::Callback<void(bool success)> SuccessCallback;
50 typedef base::Callback<
51 void(bool success, const std::string& ssid, const std::string& password)>
52 CredentialsCallback;
53
54 virtual ~WifiManager() {}
55
56 static scoped_ptr<WifiManager> Create();
57
58 // Start the wifi manager. This must be called before any other method calls.
59 virtual void Start() = 0;
60
61 // Get the list of visible SSIDs in the vicinity. This does not initiate a
62 // scan, but merely gets the list of networks from the system.
63 virtual void GetSSIDList(const SSIDListCallback& callback) = 0;
64
65 // Request a scan for networks nearby.
66 virtual void RequestScan() = 0;
67
68 // Configure and connect to a network with a given SSID and
69 // credentials. |callback| will be called once the network is connected or
70 // after it has failed to connect.
71 virtual void ConfigureAndConnectNetwork(const std::string& ssid,
72 const WifiCredentials& credentials,
73 const SuccessCallback& callback) = 0;
74
75 // Connect to a configured network with a given network ID. |callback| will be
76 // called once the network is connected or after it has failed to connect.
77 virtual void ConnectToNetworkByID(const std::string& internal_id,
78 const SuccessCallback& callback) = 0;
79
80 // Reequest the credentials for a network with a given network ID from the
81 // system. |callback| will be called with credentials if they can be
82 // retrieved.
83 virtual void RequestNetworkCredentials(
84 const std::string& internal_id,
85 const CredentialsCallback& callback) = 0;
86
87 // Add a network list observer. This observer will be notified every time the
88 // network list changes.
89 virtual void AddNetworkListObserver(NetworkListObserver* observer) = 0;
90
91 // Remove a network list observer.
92 virtual void RemoveNetworkListObserver(NetworkListObserver* observer) = 0;
93 };
94
95 } // namespace wifi
96
97 } // namespace local_discovery
98
99 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_WIFI_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698