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

Side by Side Diff: chrome/utility/wifi/wifi_service.h

Issue 22295002: Base infrastructure for Networking Private API on Windows and Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compilation error. Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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 // This file defiles the WiFiService interface used by chrome.networkingPrivate
6 // JavaScript extension API.
7
8 #ifndef CHROME_UTILITY_WIFI_WIFI_SERVICE_H_
9 #define CHROME_UTILITY_WIFI_WIFI_SERVICE_H_
10
11 #include <list>
12 #include <string>
13
14 #include "base/callback.h"
15 #include "base/memory/ref_counted.h"
16 #include "base/values.h"
17
18 class WiFiService {
19 public:
20 enum ConnectionState {
21 kConnectionStateConnected,
22 kConnectionStateNotConnected
23 };
24
25 enum NetworkType {
26 kNetworkTypeAll,
27 kNetworkTypeNone,
28 kNetworkTypeEthernet,
29 kNetworkTypeWiFi,
30 kNetworkTypeVPN,
31 kNetworkTypeCellular
32 };
33
34 typedef int32 Frequency;
35 enum FrequencyEnum {
36 kFrequencyUnknown = 0,
37 kFrequency2400 = 2400,
38 kFrequency5000 = 5000
39 };
40
41 typedef std::list<Frequency> FrequencyList;
42
43 enum Security {
44 kSecurityNone,
45 kSecurityUnknown,
46 kSecurityWPA,
47 kSecurityWPA_PSK,
48 kSecurityWEP_PSK
49 };
stevenjb 2013/08/13 23:39:04 FWIW, the original ChromeOS networking code used a
mef 2013/08/21 17:25:34 Thanks a lot for valuable insight! My initial inte
mef 2013/10/08 21:46:25 Done.
50
51 struct NetworkProperties {
52 ConnectionState connection_state;
53 std::string guid;
54 std::string name;
55 std::string ssid;
56 std::string bssid;
57 NetworkType type;
58 Frequency frequency;
59 Security security;
60 // WiFi Signal Strength. 0..100
61 int32 signal_strength;
62 bool auto_connect;
63 FrequencyList frequency_list;
64
65 std::string json_extra; // Extra JSON properties for unit tests
66
67 NetworkProperties();
68 ~NetworkProperties();
stevenjb 2013/08/13 23:39:04 Move to top
mef 2013/08/21 17:25:34 Will do.
mef 2013/09/11 20:55:08 Done.
69 scoped_ptr<base::DictionaryValue> ToValue(bool network_list) const;
70 bool UpdateFromValue(const base::DictionaryValue& value);
stevenjb 2013/08/13 23:39:04 WS
mef 2013/09/11 20:55:08 Done.
71 static std::string MacAddressAsString(const uint8 mac_as_int[6]);
72 static bool OrderByType(const NetworkProperties& l,
73 const NetworkProperties& r);
74 };
75
76 typedef std::list<NetworkProperties> NetworkList;
77
78 // An error callback used by both the configuration handler and the state
79 // handler to receive error results from the API.
80 typedef base::Callback<void(const std::string& error_name,
81 scoped_ptr<base::DictionaryValue> error_data)>
82 ErrorCallback;
83
84 typedef base::Callback<void(const std::string& network_guid,
85 const base::DictionaryValue& dictionary)>
86 DictionaryResultCallback;
87
88 typedef base::Callback<void(const std::string& network_guid,
89 const NetworkProperties& properties)>
90 NetworkPropertiesCallback;
91
92 typedef base::Callback<void(const NetworkList& network_list)>
93 NetworkListCallback;
94
95 typedef base::Callback<void(const std::string& service_path)>
96 StringResultCallback;
97
98 virtual ~WiFiService() {}
99
100 virtual void GetProperties(const std::string& network_guid,
101 const NetworkPropertiesCallback& callback,
102 const ErrorCallback& error_callback) = 0;
103
104 virtual void GetState(const std::string& network_guid,
105 const NetworkPropertiesCallback& callback,
106 const ErrorCallback& error_callback) = 0;
107
108 virtual void GetManagedProperties(const std::string& network_guid,
109 const DictionaryResultCallback& callback,
110 const ErrorCallback& error_callback) = 0;
111
112 virtual void SetProperties(const std::string& network_guid,
113 const base::DictionaryValue& properties,
114 const StringResultCallback& callback,
115 const ErrorCallback& error_callback) = 0;
116
117 virtual void GetVisibleNetworks(const NetworkListCallback& callback,
118 const ErrorCallback& error_callback) = 0;
119
120 virtual void RequestNetworkScan() = 0;
121
122 virtual void StartConnect(const std::string& network_guid,
123 const StringResultCallback& callback,
124 const ErrorCallback& error_callback) = 0;
125
126 virtual void StartDisconnect(const std::string& network_guid,
127 const StringResultCallback& callback,
128 const ErrorCallback& error_callback) = 0;
129
130 static WiFiService* CreateService();
131 static WiFiService* CreateServiceMock();
stevenjb 2013/08/13 23:39:04 private: DISALLOW_COPY...
mef 2013/08/21 17:25:34 Will do.
mef 2013/09/11 20:55:08 Done.
132 };
133
134 #endif // CHROME_UTILITY_WIFI_WIFI_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698