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

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 {
19 std::string internal_id;
20 std::string ssid;
21 bool connected;
22 };
23
24 class NetworkListObserver {
25 public:
26 virtual ~NetworkListObserver() {}
27
28 virtual void Start() = 0;
stevenjb 2014/05/15 18:16:26 Please comment.
Noam Samuel 2014/05/20 21:19:53 Done.
29 };
30
31 // Credentials for WiFi networks. Currently only supports PSK-based networks.
32 // TODO(noamsml): Support for 802.11X and other authentication methods.
33 struct WifiCredentials {
34 static WifiCredentials FromPSK(const std::string& psk);
35
36 std::string psk;
37 };
38
39 class WifiManager {
stevenjb 2014/05/15 18:16:26 Please add a comment describing the purpose of thi
Noam Samuel 2014/05/20 21:19:53 Done.
40 public:
41 typedef base::Callback<void(const std::vector<NetworkProperties>& ssids)>
42 SSIDListCallback;
43 typedef base::Callback<void(bool success)> SuccessCallback;
44 typedef base::Callback<
45 void(bool success, const std::string& ssid, const std::string& password)>
46 CredentialsCallback;
47
48 virtual ~WifiManager() {}
49
50 static scoped_ptr<WifiManager> Create();
51
52 virtual void Start() = 0;
stevenjb 2014/05/15 18:16:26 Please comment.
Noam Samuel 2014/05/20 21:19:53 Done.
53
54 // Get the list of visible SSIDs in the vicinity. This does not initiate a
55 // scan, but merely gets the list of networks from the system.
56 virtual void GetSSIDList(const SSIDListCallback& callback) = 0;
57
58 // Request a scan for networks nearby. |callback| will be called once the scan
59 // is initiated and may be null.
stevenjb 2014/05/15 18:16:26 Since this is just requesting a scan, does it real
Noam Samuel 2014/05/20 21:19:53 Done.
60 virtual void RequestScan(const base::Closure& callback) = 0;
61
62 // Connect to a network with a given SSID and password. |callback| will be
stevenjb 2014/05/15 18:16:26 This should probably say "Configure and connect to
Noam Samuel 2014/05/20 21:19:53 Done.
63 // called once the network is connected or after it has failed to connect.
64 virtual void ConnectToNetwork(const std::string& ssid,
65 const WifiCredentials& credentials,
66 const SuccessCallback& callback) = 0;
67
68 // Connect to a network with a given network ID. |callback| will be called
69 // once the network is connected or after it has failed to connect.
70 virtual void ConnectToNetworkByID(const std::string& internal_id,
71 const SuccessCallback& callback) = 0;
72
73 // Get the credentials for a network with a given network ID. |callback| will
74 // be called with credentials if they can be retrieved.
75 virtual void GetNetworkCredentials(const std::string& internal_id,
76 const CredentialsCallback& callback) = 0;
stevenjb 2014/05/15 18:16:26 My first assumption was that this was caching the
Noam Samuel 2014/05/20 21:19:53 Done.
77
78 // Create an observer for changes in the visible network list. As long as the
79 // observer is live, |callback| will be called with the new SSID list whenever
80 // it changes.
stevenjb 2014/05/15 18:16:26 It's not clear to me how this is intended to be us
Noam Samuel 2014/05/16 17:56:02 This is an RAII observer tied to a callback. An ob
stevenjb 2014/05/19 16:29:52 Hmm. I'm not convinced that this would be a better
Noam Samuel 2014/05/20 21:19:53 Named to watcher because it's in line with Service
81 virtual scoped_ptr<NetworkListObserver> CreateNetworkListObserver(
82 const SSIDListCallback& callback) = 0;
stevenjb 2014/05/15 18:16:26 DISALLOW_COPY_AND_ASSIGN
Noam Samuel 2014/05/20 21:19:53 Causes compile errors. Also, unnecessary for abstr
83 };
84
85 } // namespace wifi
86
87 } // namespace local_discovery
88
89 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_WIFI_WIFI_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698