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

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

Issue 102993002: Implement Networking Private API VerifyAndEncryptCredentials method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address codereview comments. Created 6 years, 10 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
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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 697
698 // Did not find passphrase in the profile. 698 // Did not find passphrase in the profile.
699 *error = kWiFiServiceError; 699 *error = kWiFiServiceError;
700 } 700 }
701 701
702 void WiFiServiceImpl::SetEventObservers( 702 void WiFiServiceImpl::SetEventObservers(
703 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, 703 scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
704 const NetworkGuidListCallback& networks_changed_observer, 704 const NetworkGuidListCallback& networks_changed_observer,
705 const NetworkGuidListCallback& network_list_changed_observer) { 705 const NetworkGuidListCallback& network_list_changed_observer) {
706 message_loop_proxy_.swap(message_loop_proxy); 706 message_loop_proxy_.swap(message_loop_proxy);
707 if (!networks_changed_observer_.is_null() ||
708 !network_list_changed_observer_.is_null()) {
709 // Stop listening to WLAN notifications.
710 WlanRegisterNotification_function_(client_,
711 WLAN_NOTIFICATION_SOURCE_NONE,
tbarzic 2014/02/25 23:07:25 nit: indent
mef 2014/02/26 17:43:36 Done.
712 FALSE,
713 OnWlanNotificationCallback,
714 this,
715 NULL,
716 NULL);
717 }
707 networks_changed_observer_ = networks_changed_observer; 718 networks_changed_observer_ = networks_changed_observer;
708 network_list_changed_observer_ = network_list_changed_observer; 719 network_list_changed_observer_ = network_list_changed_observer;
720 if (!networks_changed_observer_.is_null() ||
721 !network_list_changed_observer_.is_null()) {
722 // Start listening to WLAN notifications.
723 WlanRegisterNotification_function_(client_,
724 WLAN_NOTIFICATION_SOURCE_ALL,
725 FALSE,
726 OnWlanNotificationCallback,
727 this,
728 NULL,
729 NULL);
730 }
709 } 731 }
710 732
711 void WiFiServiceImpl::OnWlanNotificationCallback( 733 void WiFiServiceImpl::OnWlanNotificationCallback(
712 PWLAN_NOTIFICATION_DATA wlan_notification_data, 734 PWLAN_NOTIFICATION_DATA wlan_notification_data,
713 PVOID context) { 735 PVOID context) {
714 WiFiServiceImpl* service = reinterpret_cast<WiFiServiceImpl*>(context); 736 WiFiServiceImpl* service = reinterpret_cast<WiFiServiceImpl*>(context);
715 service->OnWlanNotification(wlan_notification_data); 737 service->OnWlanNotification(wlan_notification_data);
716 } 738 }
717 739
718 void WiFiServiceImpl::OnWlanNotification( 740 void WiFiServiceImpl::OnWlanNotification(
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 interface_guid_ = interface_list->InterfaceInfo[0].InterfaceGuid; 958 interface_guid_ = interface_list->InterfaceInfo[0].InterfaceGuid;
937 // Try to find a connected interface. 959 // Try to find a connected interface.
938 for (DWORD itf = 0; itf < interface_list->dwNumberOfItems; ++itf) { 960 for (DWORD itf = 0; itf < interface_list->dwNumberOfItems; ++itf) {
939 if (interface_list->InterfaceInfo[itf].isState == 961 if (interface_list->InterfaceInfo[itf].isState ==
940 wlan_interface_state_connected) { 962 wlan_interface_state_connected) {
941 // Found connected interface, remember it! 963 // Found connected interface, remember it!
942 interface_guid_ = interface_list->InterfaceInfo[itf].InterfaceGuid; 964 interface_guid_ = interface_list->InterfaceInfo[itf].InterfaceGuid;
943 break; 965 break;
944 } 966 }
945 } 967 }
946 WlanRegisterNotification_function_(client_,
947 WLAN_NOTIFICATION_SOURCE_ALL,
948 FALSE,
949 OnWlanNotificationCallback,
950 this,
951 NULL,
952 NULL);
953 } else { 968 } else {
954 error = ERROR_NOINTERFACE; 969 error = ERROR_NOINTERFACE;
955 } 970 }
956 } 971 }
957 // Clean up.. 972 // Clean up..
958 if (interface_list != NULL) 973 if (interface_list != NULL)
959 WlanFreeMemory_function_(interface_list); 974 WlanFreeMemory_function_(interface_list);
960 } 975 }
961 return error; 976 return error;
962 } 977 }
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 NetworkGuidList changed_networks(1, network_guid); 1659 NetworkGuidList changed_networks(1, network_guid);
1645 message_loop_proxy_->PostTask( 1660 message_loop_proxy_->PostTask(
1646 FROM_HERE, 1661 FROM_HERE,
1647 base::Bind(networks_changed_observer_, changed_networks)); 1662 base::Bind(networks_changed_observer_, changed_networks));
1648 } 1663 }
1649 } 1664 }
1650 1665
1651 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); } 1666 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); }
1652 1667
1653 } // namespace wifi 1668 } // namespace wifi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698