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

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, 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 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
14 namespace local_discovery {
15
16 namespace wifi {
17
18 struct NetworkProperties {
mef 2014/05/28 16:28:30 would it make sense to make WiFiService::NetworkPr
Noam Samuel 2014/05/28 23:04:36 Done.
19 std::string internal_id;
20 std::string ssid;
21 bool connected;
22 };
23
24 typedef std::vector<NetworkProperties> NetworkPropertiesList;
25
26 // Credentials for WiFi networks. Currently only supports PSK-based networks.
27 // TODO(noamsml): Support for 802.11X and other authentication methods.
28 struct WifiCredentials {
29 static WifiCredentials FromPSK(const std::string& psk);
30
31 std::string psk;
32 };
33
34 // Observer for the network list. Classes may implement this interface and call
35 // |AddNetworkListObserver| to be notified of changes to the visible network
36 // list.
37 class NetworkListObserver {
38 public:
39 virtual ~NetworkListObserver() {}
40
41 virtual void OnNetworkListChanged(const NetworkPropertiesList& ssid) = 0;
42 };
43
44 // A class to manage listing, connecting to, and getting the credentials of WiFi
45 // networks.
46 class WifiManager {
47 public:
48 typedef base::Callback<void(const NetworkPropertiesList& ssids)>
49 SSIDListCallback;
50 typedef base::Callback<void(bool success)> SuccessCallback;
51 typedef base::Callback<
52 void(bool success, const std::string& ssid, const std::string& password)>
53 CredentialsCallback;
54
55 virtual ~WifiManager() {}
56
57 static scoped_ptr<WifiManager> Create();
58
59 // Start the wifi manager. This must be called before any other method calls.
60 virtual void Start() = 0;
61
62 // Get the list of visible SSIDs in the vicinity. This does not initiate a
63 // scan, but merely gets the list of networks from the system.
64 virtual void GetSSIDList(const SSIDListCallback& callback) = 0;
65
66 // Request a scan for networks nearby.
67 virtual void RequestScan() = 0;
68
69 // Configure and connect to a network with a given SSID and
70 // credentials. |callback| will be called once the network is connected or
71 // after it has failed to connect.
72 virtual void ConfigureAndConnectNetwork(const std::string& ssid,
73 const WifiCredentials& credentials,
74 const SuccessCallback& callback) = 0;
75
76 // Connect to a configured network with a given network ID. |callback| will be
77 // called once the network is connected or after it has failed to connect.
78 virtual void ConnectToNetworkByID(const std::string& internal_id,
79 const SuccessCallback& callback) = 0;
80
81 // Reequest the credentials for a network with a given network ID from the
82 // system. |callback| will be called with credentials if they can be
83 // retrieved.
84 virtual void RequestNetworkCredentials(
85 const std::string& internal_id,
86 const CredentialsCallback& callback) = 0;
87
88 // Add a network list observer. This observer will be notified every time the
89 // network list changes.
90 virtual void AddNetworkListObserver(NetworkListObserver* observer) = 0;
91
92 // Remove a network list observer.
93 virtual void RemoveNetworkListObserver(NetworkListObserver* observer) = 0;
94 };
95
96 } // namespace wifi
97
98 } // namespace local_discovery
99
100 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_WIFI_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698