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

Unified Diff: components/wifi/wifi_service_win.cc

Issue 86123003: Use WiFi.Frequency property to set desired band for networkingPrivateApi.StartConnect() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Separated move of GetVisibleNetworks filtering into https://codereview.chromium.org/88653002 Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/wifi/wifi_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/wifi/wifi_service_win.cc
diff --git a/components/wifi/wifi_service_win.cc b/components/wifi/wifi_service_win.cc
index 052062db1a757f5f4bfa617b74cf9e96bc186876..16b67fd1b1d129da3525a7cfec4d08ec643810f3 100644
--- a/components/wifi/wifi_service_win.cc
+++ b/components/wifi/wifi_service_win.cc
@@ -291,6 +291,10 @@ class WiFiServiceImpl : public WiFiService, base::NonThreadSafe {
// Disconnect from currently connected network if any.
DWORD Disconnect();
+ // Get desired connection freqency if it was set using |SetProperties|.
+ // Default to |kFrequencyAny|.
+ Frequency GetDesiredFrequency(const std::string& network_guid);
+
// Get DOT11_BSSID_LIST of desired BSSIDs to connect to |ssid| network on
// given |frequency|.
DWORD GetDesiredBssList(DOT11_SSID& ssid,
@@ -339,6 +343,8 @@ class WiFiServiceImpl : public WiFiService, base::NonThreadSafe {
// GUID of the currently connected interface, if any, otherwise the GUID of
// one of the WLAN interfaces.
GUID interface_guid_;
+ // Temporary storage of network properties indexed by |network_guid|.
+ DictionaryValue temporary_network_properties_;
stevenjb 2013/11/26 18:00:34 How about 'connect_properties_' to better describe
mef 2013/11/26 19:00:13 Done.
// Preserved WLAN profile xml.
std::map<std::string, std::string> saved_profiles_xml_;
// Observer to get notified when network(s) have changed (e.g. connect).
@@ -419,9 +425,11 @@ void WiFiServiceImpl::SetProperties(
const std::string& network_guid,
scoped_ptr<base::DictionaryValue> properties,
std::string* error) {
- // This method is not implemented in first version as it is not used by
- // Google Cast extension.
- CheckError(ERROR_CALL_NOT_IMPLEMENTED, kWiFiServiceError, error);
+ // Temporary preserve WiFi properties (desired frequency, wifi password to use
+ // in StartConnect.
+ DCHECK(properties->HasKey(onc::network_type::kWiFi));
stevenjb 2013/11/26 18:00:34 This should set |error| instead of CHECK
mef 2013/11/26 19:00:13 Done.
+ temporary_network_properties_.SetWithoutPathExpansion(network_guid,
+ properties.release());
}
void WiFiServiceImpl::GetVisibleNetworks(ListValue* network_list) {
@@ -457,7 +465,7 @@ void WiFiServiceImpl::StartConnect(const std::string& network_guid,
std::string connected_network_guid;
error_code = SaveCurrentConnectedNetwork(&connected_network_guid);
if (error_code == ERROR_SUCCESS) {
- Frequency frequency = kFrequencyAny;
+ Frequency frequency = GetDesiredFrequency(network_guid);
// Connect only if network |network_guid| is not connected already.
tbarzic 2013/11/26 19:02:21 is |network_guid| unique for (ssid, frequency) pai
mef 2013/11/27 18:00:03 Good point, done. Currently connected band is not
if (network_guid != connected_network_guid)
error_code = Connect(network_guid, frequency);
@@ -1045,6 +1053,22 @@ DWORD WiFiServiceImpl::FindConnectedNetwork(
return error;
}
+WiFiService::Frequency WiFiServiceImpl::GetDesiredFrequency(
stevenjb 2013/11/26 18:00:34 GetConnectFrequency or GetFrequencyForConnect?
mef 2013/11/26 19:00:13 Done.
+ const std::string& network_guid) {
+ // Check whether desired frequency is set in |temporary_network_properties_|.
+ DictionaryValue* properties;
+ DictionaryValue* wifi;
+ int frequency;
+ if (temporary_network_properties_.GetDictionaryWithoutPathExpansion(
+ network_guid,
+ &properties) &&
stevenjb 2013/11/26 18:00:34 nit: OK (and a little clearer imho) to combine the
mef 2013/11/26 19:00:13 Done.
+ properties->GetDictionary(onc::network_type::kWiFi, &wifi) &&
+ wifi->GetInteger(onc::wifi::kFrequency, &frequency)) {
tbarzic 2013/11/26 19:02:21 should frequency be normalized (here or in SetProp
mef 2013/11/27 18:00:03 Done.
+ return static_cast<Frequency>(frequency);
+ }
+ return kFrequencyAny;
+}
+
DWORD WiFiServiceImpl::GetDesiredBssList(
DOT11_SSID& ssid,
Frequency frequency,
@@ -1129,7 +1153,6 @@ DWORD WiFiServiceImpl::GetDesiredBssList(
return error;
}
-
DWORD WiFiServiceImpl::Connect(const std::string& network_guid,
Frequency frequency) {
if (client_ == NULL) {
« no previous file with comments | « no previous file | components/wifi/wifi_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698