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

Side by Side Diff: components/wifi/wifi_service_win.cc

Issue 88653002: Move GetVisibleNetworks network type filtering to WiFiService interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/wifi/wifi_service.h" 5 #include "components/wifi/wifi_service.h"
6 6
7 #include <iphlpapi.h> 7 #include <iphlpapi.h>
8 #include <objbase.h> 8 #include <objbase.h>
9 #include <wlanapi.h> 9 #include <wlanapi.h>
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 virtual void GetProperties(const std::string& network_guid, 147 virtual void GetProperties(const std::string& network_guid,
148 DictionaryValue* properties, 148 DictionaryValue* properties,
149 std::string* error) OVERRIDE; 149 std::string* error) OVERRIDE;
150 150
151 // Set Properties of network identified by |network_guid|. Populates |error| 151 // Set Properties of network identified by |network_guid|. Populates |error|
152 // on failure. 152 // on failure.
153 virtual void SetProperties(const std::string& network_guid, 153 virtual void SetProperties(const std::string& network_guid,
154 scoped_ptr<base::DictionaryValue> properties, 154 scoped_ptr<base::DictionaryValue> properties,
155 std::string* error) OVERRIDE; 155 std::string* error) OVERRIDE;
156 156
157 // Get list of visible networks. Populates |network_list| on success. 157 // Get list of visible networks of |network_type| (one of onc::network_type).
158 virtual void GetVisibleNetworks(ListValue* network_list) OVERRIDE; 158 // Populates |network_list| on success.
159 virtual void GetVisibleNetworks(const std::string& network_type,
160 ListValue* network_list) OVERRIDE;
159 161
160 // Request network scan. Send |NetworkListChanged| event on completion. 162 // Request network scan. Send |NetworkListChanged| event on completion.
161 virtual void RequestNetworkScan() OVERRIDE; 163 virtual void RequestNetworkScan() OVERRIDE;
162 164
163 // Start connect to network identified by |network_guid|. Populates |error| 165 // Start connect to network identified by |network_guid|. Populates |error|
164 // on failure. 166 // on failure.
165 virtual void StartConnect(const std::string& network_guid, 167 virtual void StartConnect(const std::string& network_guid,
166 std::string* error) OVERRIDE; 168 std::string* error) OVERRIDE;
167 169
168 // Start disconnect from network identified by |network_guid|. Populates 170 // Start disconnect from network identified by |network_guid|. Populates
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 419
418 void WiFiServiceImpl::SetProperties( 420 void WiFiServiceImpl::SetProperties(
419 const std::string& network_guid, 421 const std::string& network_guid,
420 scoped_ptr<base::DictionaryValue> properties, 422 scoped_ptr<base::DictionaryValue> properties,
421 std::string* error) { 423 std::string* error) {
422 // This method is not implemented in first version as it is not used by 424 // This method is not implemented in first version as it is not used by
423 // Google Cast extension. 425 // Google Cast extension.
424 CheckError(ERROR_CALL_NOT_IMPLEMENTED, kWiFiServiceError, error); 426 CheckError(ERROR_CALL_NOT_IMPLEMENTED, kWiFiServiceError, error);
425 } 427 }
426 428
427 void WiFiServiceImpl::GetVisibleNetworks(ListValue* network_list) { 429 void WiFiServiceImpl::GetVisibleNetworks(const std::string& network_type,
430 ListValue* network_list) {
431 DCHECK(network_type.empty() ||
432 network_type == onc::network_type::kAllTypes ||
433 network_type == onc::network_type::kWiFi);
stevenjb 2013/11/26 17:35:55 network_type comes more-or-less directly from the
mef 2013/11/26 18:30:39 Done.
434
428 DWORD error = EnsureInitialized(); 435 DWORD error = EnsureInitialized();
429
430 if (error == ERROR_SUCCESS) { 436 if (error == ERROR_SUCCESS) {
431 NetworkList networks; 437 NetworkList networks;
432 error = GetVisibleNetworkList(&networks); 438 error = GetVisibleNetworkList(&networks);
433 if (error == ERROR_SUCCESS && !networks.empty()) { 439 if (error == ERROR_SUCCESS && !networks.empty()) {
434 SortNetworks(&networks); 440 SortNetworks(&networks);
435 for (WiFiService::NetworkList::const_iterator it = networks.begin(); 441 for (WiFiService::NetworkList::const_iterator it = networks.begin();
436 it != networks.end(); 442 it != networks.end();
437 ++it) { 443 ++it) {
438 scoped_ptr<DictionaryValue> network(it->ToValue(true)); 444 scoped_ptr<DictionaryValue> network(it->ToValue(true));
439 network_list->Append(network.release()); 445 network_list->Append(network.release());
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 NetworkGuidList changed_networks(1, network_guid); 1271 NetworkGuidList changed_networks(1, network_guid);
1266 message_loop_proxy_->PostTask( 1272 message_loop_proxy_->PostTask(
1267 FROM_HERE, 1273 FROM_HERE,
1268 base::Bind(networks_changed_observer_, changed_networks)); 1274 base::Bind(networks_changed_observer_, changed_networks));
1269 } 1275 }
1270 } 1276 }
1271 1277
1272 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); } 1278 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); }
1273 1279
1274 } // namespace wifi 1280 } // namespace wifi
OLDNEW
« components/wifi/fake_wifi_service.cc ('K') | « components/wifi/wifi_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698