summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-18 22:04:26 +0000
committertbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-18 22:04:26 +0000
commitef1136572d460356ce88c0976b6104db700dc9d7 (patch)
treea355bc8e512a3bf90985788d41313f0d2f00f454
parentfac1fc07bbcdfc7c287850d37b0337ed01adb439 (diff)
downloadchromium_src-ef1136572d460356ce88c0976b6104db700dc9d7.zip
chromium_src-ef1136572d460356ce88c0976b6104db700dc9d7.tar.gz
chromium_src-ef1136572d460356ce88c0976b6104db700dc9d7.tar.bz2
Don't clear existing properties in SetProperties in WiFiService
If a property has previously been set for a network, and it's not set in new properties, networkingPrivate.setProperties should not clear it. Instead of new properties replacing existing ones, merge new properties into existing ones. (This matches ChromeOS behaviour). BUG=None TEST=None Review URL: https://codereview.chromium.org/241983002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264865 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--components/wifi/wifi_service_mac.mm12
-rw-r--r--components/wifi/wifi_service_win.cc94
2 files changed, 59 insertions, 47 deletions
diff --git a/components/wifi/wifi_service_mac.mm b/components/wifi/wifi_service_mac.mm
index fabc974..eb83e17 100644
--- a/components/wifi/wifi_service_mac.mm
+++ b/components/wifi/wifi_service_mac.mm
@@ -242,8 +242,16 @@ void WiFiServiceMac::SetProperties(
const std::string& network_guid,
scoped_ptr<base::DictionaryValue> properties,
std::string* error) {
- network_properties_.SetWithoutPathExpansion(network_guid,
- properties.release());
+ base::DictionaryValue* existing_properties;
+ // If the network properties already exist, don't override previously set
+ // properties, unless they are set in |properties|.
+ if (network_properties_.GetDictionaryWithoutPathExpansion(
+ network_guid, &existing_properties)) {
+ existing_properties->MergeDictionary(properties.get());
+ } else {
+ network_properties_.SetWithoutPathExpansion(network_guid,
+ properties.release());
+ }
}
void WiFiServiceMac::CreateNetwork(
diff --git a/components/wifi/wifi_service_win.cc b/components/wifi/wifi_service_win.cc
index 8b69e1a..5997071 100644
--- a/components/wifi/wifi_service_win.cc
+++ b/components/wifi/wifi_service_win.cc
@@ -57,9 +57,9 @@ const char kWlanScan[] = "WlanScan";
const char kWlanSetProfile[] = "WlanSetProfile";
// WlanApi function definitions
-typedef DWORD (WINAPI* WlanConnectFunction)(
+typedef DWORD(WINAPI* WlanConnectFunction)(
HANDLE hClientHandle,
- CONST GUID *pInterfaceGuid,
+ CONST GUID* pInterfaceGuid,
CONST PWLAN_CONNECTION_PARAMETERS pConnectionParameters,
PVOID pReserved);
@@ -67,31 +67,29 @@ typedef DWORD (WINAPI* WlanCloseHandleFunction)(
HANDLE hClientHandle,
PVOID pReserved);
-typedef DWORD (WINAPI* WlanDeleteProfileFunction)(
- HANDLE hClientHandle,
- const GUID *pInterfaceGuid,
- LPCWSTR strProfileName,
- PVOID pReserved);
+typedef DWORD(WINAPI* WlanDeleteProfileFunction)(HANDLE hClientHandle,
+ const GUID* pInterfaceGuid,
+ LPCWSTR strProfileName,
+ PVOID pReserved);
-typedef DWORD (WINAPI* WlanDisconnectFunction)(
- HANDLE hClientHandle,
- CONST GUID *pInterfaceGuid,
- PVOID pReserved);
+typedef DWORD(WINAPI* WlanDisconnectFunction)(HANDLE hClientHandle,
+ CONST GUID* pInterfaceGuid,
+ PVOID pReserved);
-typedef DWORD (WINAPI* WlanEnumInterfacesFunction)(
+typedef DWORD(WINAPI* WlanEnumInterfacesFunction)(
HANDLE hClientHandle,
PVOID pReserved,
- PWLAN_INTERFACE_INFO_LIST *ppInterfaceList);
+ PWLAN_INTERFACE_INFO_LIST* ppInterfaceList);
typedef VOID (WINAPI* WlanFreeMemoryFunction)(
_In_ PVOID pMemory);
-typedef DWORD (WINAPI* WlanGetAvailableNetworkListFunction)(
+typedef DWORD(WINAPI* WlanGetAvailableNetworkListFunction)(
HANDLE hClientHandle,
- CONST GUID *pInterfaceGuid,
+ CONST GUID* pInterfaceGuid,
DWORD dwFlags,
PVOID pReserved,
- PWLAN_AVAILABLE_NETWORK_LIST *ppAvailableNetworkList);
+ PWLAN_AVAILABLE_NETWORK_LIST* ppAvailableNetworkList);
typedef DWORD (WINAPI* WlanGetNetworkBssListFunction)(
HANDLE hClientHandle,
@@ -102,14 +100,13 @@ typedef DWORD (WINAPI* WlanGetNetworkBssListFunction)(
PVOID pReserved,
PWLAN_BSS_LIST* ppWlanBssList);
-typedef DWORD (WINAPI* WlanGetProfileFunction)(
- HANDLE hClientHandle,
- CONST GUID *pInterfaceGuid,
- LPCWSTR strProfileName,
- PVOID pReserved,
- LPWSTR *pstrProfileXml,
- DWORD *pdwFlags,
- DWORD *pdwGrantedAccess);
+typedef DWORD(WINAPI* WlanGetProfileFunction)(HANDLE hClientHandle,
+ CONST GUID* pInterfaceGuid,
+ LPCWSTR strProfileName,
+ PVOID pReserved,
+ LPWSTR* pstrProfileXml,
+ DWORD* pdwFlags,
+ DWORD* pdwGrantedAccess);
typedef DWORD (WINAPI* WlanOpenHandleFunction)(
DWORD dwClientVersion,
@@ -117,13 +114,13 @@ typedef DWORD (WINAPI* WlanOpenHandleFunction)(
PDWORD pdwNegotiatedVersion,
PHANDLE phClientHandle);
-typedef DWORD (WINAPI* WlanQueryInterfaceFunction)(
+typedef DWORD(WINAPI* WlanQueryInterfaceFunction)(
HANDLE hClientHandle,
- const GUID *pInterfaceGuid,
+ const GUID* pInterfaceGuid,
WLAN_INTF_OPCODE OpCode,
PVOID pReserved,
PDWORD pdwDataSize,
- PVOID *ppData,
+ PVOID* ppData,
PWLAN_OPCODE_VALUE_TYPE pWlanOpcodeValueType);
typedef DWORD (WINAPI* WlanRegisterNotificationFunction)(
@@ -144,22 +141,20 @@ typedef DWORD (WINAPI* WlanSaveTemporaryProfileFunction)(
BOOL bOverWrite,
PVOID pReserved);
-typedef DWORD (WINAPI* WlanScanFunction)(
- HANDLE hClientHandle,
- CONST GUID *pInterfaceGuid,
- CONST PDOT11_SSID pDot11Ssid,
- CONST PWLAN_RAW_DATA pIeData,
- PVOID pReserved);
-
-typedef DWORD (WINAPI* WlanSetProfileFunction)(
- HANDLE hClientHandle,
- const GUID *pInterfaceGuid,
- DWORD dwFlags,
- LPCWSTR strProfileXml,
- LPCWSTR strAllUserProfileSecurity,
- BOOL bOverwrite,
- PVOID pReserved,
- DWORD* pdwReasonCode);
+typedef DWORD(WINAPI* WlanScanFunction)(HANDLE hClientHandle,
+ CONST GUID* pInterfaceGuid,
+ CONST PDOT11_SSID pDot11Ssid,
+ CONST PWLAN_RAW_DATA pIeData,
+ PVOID pReserved);
+
+typedef DWORD(WINAPI* WlanSetProfileFunction)(HANDLE hClientHandle,
+ const GUID* pInterfaceGuid,
+ DWORD dwFlags,
+ LPCWSTR strProfileXml,
+ LPCWSTR strAllUserProfileSecurity,
+ BOOL bOverwrite,
+ PVOID pReserved,
+ DWORD* pdwReasonCode);
// Values for WLANProfile XML.
const char kAuthenticationOpen[] = "open";
@@ -555,8 +550,17 @@ void WiFiServiceImpl::SetProperties(
*error = kWiFiServiceError;
return;
}
- connect_properties_.SetWithoutPathExpansion(network_guid,
- properties.release());
+
+ base::DictionaryValue* existing_properties;
+ // If the network properties already exist, don't override previously set
+ // properties, unless they are set in |properties|.
+ if (connect_properties_.GetDictionaryWithoutPathExpansion(
+ network_guid, &existing_properties)) {
+ existing_properties->MergeDictionary(properties.get());
+ } else {
+ connect_properties_.SetWithoutPathExpansion(network_guid,
+ properties.release());
+ }
}
void WiFiServiceImpl::CreateNetwork(