OLD | NEW |
---|---|
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 17 matching lines...) Expand all Loading... | |
28 const char kWiFiServiceErrorNotImplemented[] = | 28 const char kWiFiServiceErrorNotImplemented[] = |
29 "Error.WiFiService.NotImplemented"; | 29 "Error.WiFiService.NotImplemented"; |
30 const wchar_t kNwCategoryWizardRegKey[] = | 30 const wchar_t kNwCategoryWizardRegKey[] = |
31 L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Network\\" | 31 L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Network\\" |
32 L"NwCategoryWizard"; | 32 L"NwCategoryWizard"; |
33 const wchar_t kNwCategoryWizardRegValue[] = L"Show"; | 33 const wchar_t kNwCategoryWizardRegValue[] = L"Show"; |
34 const wchar_t kNwCategoryWizardSavedRegValue[] = L"ShowSaved"; | 34 const wchar_t kNwCategoryWizardSavedRegValue[] = L"ShowSaved"; |
35 const wchar_t kNwCategoryWizardDeleteRegValue[] = L"ShowDelete"; | 35 const wchar_t kNwCategoryWizardDeleteRegValue[] = L"ShowDelete"; |
36 const wchar_t kWlanApiDll[] = L"wlanapi.dll"; | 36 const wchar_t kWlanApiDll[] = L"wlanapi.dll"; |
37 | 37 |
38 // Created Profile Dictionary keys | |
39 const char kProfileXmlKey[] = "xml"; | |
40 const char kProfileSharedKey[] = "shared"; | |
41 const char kProfileImplicitKey[] = "implicit"; | |
42 | |
38 // WlanApi function names | 43 // WlanApi function names |
39 const char kWlanConnect[] = "WlanConnect"; | 44 const char kWlanConnect[] = "WlanConnect"; |
40 const char kWlanCloseHandle[] = "WlanCloseHandle"; | 45 const char kWlanCloseHandle[] = "WlanCloseHandle"; |
46 const char kWlanDeleteProfile[] = "WlanDeleteProfile"; | |
41 const char kWlanDisconnect[] = "WlanDisconnect"; | 47 const char kWlanDisconnect[] = "WlanDisconnect"; |
42 const char kWlanEnumInterfaces[] = "WlanEnumInterfaces"; | 48 const char kWlanEnumInterfaces[] = "WlanEnumInterfaces"; |
43 const char kWlanFreeMemory[] = "WlanFreeMemory"; | 49 const char kWlanFreeMemory[] = "WlanFreeMemory"; |
44 const char kWlanGetAvailableNetworkList[] = "WlanGetAvailableNetworkList"; | 50 const char kWlanGetAvailableNetworkList[] = "WlanGetAvailableNetworkList"; |
45 const char kWlanGetNetworkBssList[] = "WlanGetNetworkBssList"; | 51 const char kWlanGetNetworkBssList[] = "WlanGetNetworkBssList"; |
46 const char kWlanGetProfile[] = "WlanGetProfile"; | 52 const char kWlanGetProfile[] = "WlanGetProfile"; |
47 const char kWlanOpenHandle[] = "WlanOpenHandle"; | 53 const char kWlanOpenHandle[] = "WlanOpenHandle"; |
48 const char kWlanQueryInterface[] = "WlanQueryInterface"; | 54 const char kWlanQueryInterface[] = "WlanQueryInterface"; |
49 const char kWlanRegisterNotification[] = "WlanRegisterNotification"; | 55 const char kWlanRegisterNotification[] = "WlanRegisterNotification"; |
50 const char kWlanSaveTemporaryProfile[] = "WlanSaveTemporaryProfile"; | 56 const char kWlanSaveTemporaryProfile[] = "WlanSaveTemporaryProfile"; |
51 const char kWlanScan[] = "WlanScan"; | 57 const char kWlanScan[] = "WlanScan"; |
52 const char kWlanSetProfile[] = "WlanSetProfile"; | 58 const char kWlanSetProfile[] = "WlanSetProfile"; |
53 | 59 |
54 // WlanApi function definitions | 60 // WlanApi function definitions |
55 typedef DWORD (WINAPI* WlanConnectFunction)( | 61 typedef DWORD (WINAPI* WlanConnectFunction)( |
56 HANDLE hClientHandle, | 62 HANDLE hClientHandle, |
57 CONST GUID *pInterfaceGuid, | 63 CONST GUID *pInterfaceGuid, |
58 CONST PWLAN_CONNECTION_PARAMETERS pConnectionParameters, | 64 CONST PWLAN_CONNECTION_PARAMETERS pConnectionParameters, |
59 PVOID pReserved); | 65 PVOID pReserved); |
60 | 66 |
61 typedef DWORD (WINAPI* WlanCloseHandleFunction)( | 67 typedef DWORD (WINAPI* WlanCloseHandleFunction)( |
62 HANDLE hClientHandle, | 68 HANDLE hClientHandle, |
63 PVOID pReserved); | 69 PVOID pReserved); |
64 | 70 |
71 typedef DWORD (WINAPI* WlanDeleteProfileFunction)( | |
72 HANDLE hClientHandle, | |
73 const GUID *pInterfaceGuid, | |
74 LPCWSTR strProfileName, | |
75 PVOID pReserved); | |
76 | |
65 typedef DWORD (WINAPI* WlanDisconnectFunction)( | 77 typedef DWORD (WINAPI* WlanDisconnectFunction)( |
66 HANDLE hClientHandle, | 78 HANDLE hClientHandle, |
67 CONST GUID *pInterfaceGuid, | 79 CONST GUID *pInterfaceGuid, |
68 PVOID pReserved); | 80 PVOID pReserved); |
69 | 81 |
70 typedef DWORD (WINAPI* WlanEnumInterfacesFunction)( | 82 typedef DWORD (WINAPI* WlanEnumInterfacesFunction)( |
71 HANDLE hClientHandle, | 83 HANDLE hClientHandle, |
72 PVOID pReserved, | 84 PVOID pReserved, |
73 PWLAN_INTERFACE_INFO_LIST *ppInterfaceList); | 85 PWLAN_INTERFACE_INFO_LIST *ppInterfaceList); |
74 | 86 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 std::string* error) OVERRIDE; | 227 std::string* error) OVERRIDE; |
216 | 228 |
217 virtual void SetEventObservers( | 229 virtual void SetEventObservers( |
218 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, | 230 scoped_refptr<base::MessageLoopProxy> message_loop_proxy, |
219 const NetworkGuidListCallback& networks_changed_observer, | 231 const NetworkGuidListCallback& networks_changed_observer, |
220 const NetworkGuidListCallback& network_list_changed_observer) OVERRIDE; | 232 const NetworkGuidListCallback& network_list_changed_observer) OVERRIDE; |
221 | 233 |
222 virtual void RequestConnectedNetworkUpdate() OVERRIDE {} | 234 virtual void RequestConnectedNetworkUpdate() OVERRIDE {} |
223 | 235 |
224 private: | 236 private: |
237 typedef int32 EncryptionType; | |
238 enum EncryptionTypeEnum { | |
239 kEncryptionTypeAny = 0, | |
240 kEncryptionTypeAES = 1, | |
241 kEncryptionTypeTKIP = 2 | |
242 }; | |
243 | |
225 // Static callback for Windows WLAN_NOTIFICATION. Calls OnWlanNotification | 244 // Static callback for Windows WLAN_NOTIFICATION. Calls OnWlanNotification |
226 // on WiFiServiceImpl passed back as |context|. | 245 // on WiFiServiceImpl passed back as |context|. |
227 static void __stdcall OnWlanNotificationCallback( | 246 static void __stdcall OnWlanNotificationCallback( |
228 PWLAN_NOTIFICATION_DATA wlan_notification_data, | 247 PWLAN_NOTIFICATION_DATA wlan_notification_data, |
229 PVOID context); | 248 PVOID context); |
230 | 249 |
231 // Callback for Windows WLAN_NOTIFICATION. Called on random thread from | 250 // Callback for Windows WLAN_NOTIFICATION. Called on random thread from |
232 // OnWlanNotificationCallback. Handles network connectivity and scan complete | 251 // OnWlanNotificationCallback. Handles network connectivity and scan complete |
233 // notification and posts tasks to main thread. | 252 // notification and posts tasks to main thread. |
234 void OnWlanNotification(PWLAN_NOTIFICATION_DATA wlan_notification_data); | 253 void OnWlanNotification(PWLAN_NOTIFICATION_DATA wlan_notification_data); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 // Get unique |network_guid| string based on |wlan|. | 327 // Get unique |network_guid| string based on |wlan|. |
309 std::string GUIDFromWLAN(const WLAN_AVAILABLE_NETWORK& wlan) const { | 328 std::string GUIDFromWLAN(const WLAN_AVAILABLE_NETWORK& wlan) const { |
310 return SSIDFromWLAN(wlan); | 329 return SSIDFromWLAN(wlan); |
311 } | 330 } |
312 | 331 |
313 // Deduce |onc::wifi| security from |alg|. | 332 // Deduce |onc::wifi| security from |alg|. |
314 std::string SecurityFromDot11AuthAlg(DOT11_AUTH_ALGORITHM alg) const; | 333 std::string SecurityFromDot11AuthAlg(DOT11_AUTH_ALGORITHM alg) const; |
315 | 334 |
316 // Deduce WLANProfile |authEncryption| values from |onc::wifi| security. | 335 // Deduce WLANProfile |authEncryption| values from |onc::wifi| security. |
317 bool AuthEncryptionFromSecurity(const std::string& security, | 336 bool AuthEncryptionFromSecurity(const std::string& security, |
337 EncryptionType encryption_type, | |
318 std::string* authentication, | 338 std::string* authentication, |
319 std::string* encryption, | 339 std::string* encryption, |
320 std::string* key_type) const; | 340 std::string* key_type) const; |
321 | 341 |
322 // Populate |properties| based on |wlan| and its corresponding bss info from | 342 // Populate |properties| based on |wlan| and its corresponding bss info from |
323 // |wlan_bss_list|. | 343 // |wlan_bss_list|. |
324 void NetworkPropertiesFromAvailableNetwork(const WLAN_AVAILABLE_NETWORK& wlan, | 344 void NetworkPropertiesFromAvailableNetwork(const WLAN_AVAILABLE_NETWORK& wlan, |
325 const WLAN_BSS_LIST& wlan_bss_list, | 345 const WLAN_BSS_LIST& wlan_bss_list, |
326 NetworkProperties* properties); | 346 NetworkProperties* properties); |
327 | 347 |
(...skipping 23 matching lines...) Expand all Loading... | |
351 | 371 |
352 // Get DOT11_BSSID_LIST of desired BSSIDs to connect to |ssid| network on | 372 // Get DOT11_BSSID_LIST of desired BSSIDs to connect to |ssid| network on |
353 // given |frequency|. | 373 // given |frequency|. |
354 DWORD GetDesiredBssList(DOT11_SSID& ssid, | 374 DWORD GetDesiredBssList(DOT11_SSID& ssid, |
355 Frequency frequency, | 375 Frequency frequency, |
356 scoped_ptr<DOT11_BSSID_LIST>* desired_list); | 376 scoped_ptr<DOT11_BSSID_LIST>* desired_list); |
357 | 377 |
358 // Normalizes |frequency_in_mhz| into one of |Frequency| values. | 378 // Normalizes |frequency_in_mhz| into one of |Frequency| values. |
359 Frequency GetNormalizedFrequency(int frequency_in_mhz) const; | 379 Frequency GetNormalizedFrequency(int frequency_in_mhz) const; |
360 | 380 |
361 // Create |profile_xml| based on |network_properties|. | 381 // Create |profile_xml| based on |network_properties|. If |encryption_type| |
382 // is |kEncryptionTypeAny| applies the type most suitable for parameters in | |
383 // |network_properties|. | |
362 bool CreateProfile(const NetworkProperties& network_properties, | 384 bool CreateProfile(const NetworkProperties& network_properties, |
385 EncryptionType encryption_type, | |
363 std::string* profile_xml); | 386 std::string* profile_xml); |
364 | 387 |
365 // Save temporary wireless profile for |network_guid|. | 388 // Save temporary wireless profile for |network_guid|. |
366 DWORD SaveTempProfile(const std::string& network_guid); | 389 DWORD SaveTempProfile(const std::string& network_guid); |
367 | 390 |
368 // Get previously stored |profile_xml| for |network_guid|. | 391 // Get previously stored |profile_xml| for |network_guid|. |
369 // If |get_plaintext_key| is true, and process has sufficient privileges, then | 392 // If |get_plaintext_key| is true, and process has sufficient privileges, then |
370 // <sharedKey> data in |profile_xml| will be unprotected. | 393 // <sharedKey> data in |profile_xml| will be unprotected. |
371 DWORD GetProfile(const std::string& network_guid, | 394 DWORD GetProfile(const std::string& network_guid, |
372 bool get_plaintext_key, | 395 bool get_plaintext_key, |
373 std::string* profile_xml); | 396 std::string* profile_xml); |
374 | 397 |
398 // Set |profile_xml| to current user or all users depending on |shared| flag. | |
399 // If |overwrite| is false, then returns an error if profile exists. | |
400 DWORD SetProfile(bool shared, const std::string& profile_xml, bool overwrite); | |
401 | |
375 // Return true if there is previously stored profile xml for |network_guid|. | 402 // Return true if there is previously stored profile xml for |network_guid|. |
376 bool HaveProfile(const std::string& network_guid); | 403 bool HaveProfile(const std::string& network_guid); |
377 | 404 |
405 // Remove profile that was created implicitly or failed to connect. | |
406 DWORD RemoveCreatedProfile(const std::string& network_guid, | |
407 bool connection_failed); | |
408 | |
378 // Notify |network_list_changed_observer_| that list of visible networks has | 409 // Notify |network_list_changed_observer_| that list of visible networks has |
379 // changed to |networks|. | 410 // changed to |networks|. |
380 void NotifyNetworkListChanged(const NetworkList& networks); | 411 void NotifyNetworkListChanged(const NetworkList& networks); |
381 | 412 |
382 // Notify |networks_changed_observer_| that network |network_guid| status has | 413 // Notify |networks_changed_observer_| that network |network_guid| status has |
383 // changed. | 414 // changed. |
384 void NotifyNetworkChanged(const std::string& network_guid); | 415 void NotifyNetworkChanged(const std::string& network_guid); |
385 | 416 |
386 // Load WlanApi.dll from SystemDirectory and get Api function pointers. | 417 // Load WlanApi.dll from SystemDirectory and get Api function pointers. |
387 DWORD LoadWlanLibrary(); | 418 DWORD LoadWlanLibrary(); |
388 // Instance of WlanApi.dll. | 419 // Instance of WlanApi.dll. |
389 HINSTANCE wlan_api_library_; | 420 HINSTANCE wlan_api_library_; |
390 // WlanApi function pointers | 421 // WlanApi function pointers |
391 WlanConnectFunction WlanConnect_function_; | 422 WlanConnectFunction WlanConnect_function_; |
392 WlanCloseHandleFunction WlanCloseHandle_function_; | 423 WlanCloseHandleFunction WlanCloseHandle_function_; |
424 WlanDeleteProfileFunction WlanDeleteProfile_function_; | |
393 WlanDisconnectFunction WlanDisconnect_function_; | 425 WlanDisconnectFunction WlanDisconnect_function_; |
394 WlanEnumInterfacesFunction WlanEnumInterfaces_function_; | 426 WlanEnumInterfacesFunction WlanEnumInterfaces_function_; |
395 WlanFreeMemoryFunction WlanFreeMemory_function_; | 427 WlanFreeMemoryFunction WlanFreeMemory_function_; |
396 WlanGetAvailableNetworkListFunction WlanGetAvailableNetworkList_function_; | 428 WlanGetAvailableNetworkListFunction WlanGetAvailableNetworkList_function_; |
397 // WlanGetNetworkBssList function may not be avaiable on Windows XP. | 429 // WlanGetNetworkBssList function may not be avaiable on Windows XP. |
398 WlanGetNetworkBssListFunction WlanGetNetworkBssList_function_; | 430 WlanGetNetworkBssListFunction WlanGetNetworkBssList_function_; |
399 WlanGetProfileFunction WlanGetProfile_function_; | 431 WlanGetProfileFunction WlanGetProfile_function_; |
400 WlanOpenHandleFunction WlanOpenHandle_function_; | 432 WlanOpenHandleFunction WlanOpenHandle_function_; |
401 WlanQueryInterfaceFunction WlanQueryInterface_function_; | 433 WlanQueryInterfaceFunction WlanQueryInterface_function_; |
402 WlanRegisterNotificationFunction WlanRegisterNotification_function_; | 434 WlanRegisterNotificationFunction WlanRegisterNotification_function_; |
403 WlanScanFunction WlanScan_function_; | 435 WlanScanFunction WlanScan_function_; |
404 WlanSetProfileFunction WlanSetProfile_function_; | 436 WlanSetProfileFunction WlanSetProfile_function_; |
405 // WlanSaveTemporaryProfile function may not be avaiable on Windows XP. | 437 // WlanSaveTemporaryProfile function may not be avaiable on Windows XP. |
406 WlanSaveTemporaryProfileFunction WlanSaveTemporaryProfile_function_; | 438 WlanSaveTemporaryProfileFunction WlanSaveTemporaryProfile_function_; |
407 | 439 |
408 // WLAN service handle. | 440 // WLAN service handle. |
409 HANDLE client_; | 441 HANDLE client_; |
410 // GUID of the currently connected interface, if any, otherwise the GUID of | 442 // GUID of the currently connected interface, if any, otherwise the GUID of |
411 // one of the WLAN interfaces. | 443 // one of the WLAN interfaces. |
412 GUID interface_guid_; | 444 GUID interface_guid_; |
413 // Temporary storage of network properties indexed by |network_guid|. Persist | 445 // Temporary storage of network properties indexed by |network_guid|. Persist |
414 // only in memory. | 446 // only in memory. |
415 base::DictionaryValue connect_properties_; | 447 base::DictionaryValue connect_properties_; |
416 // Preserved WLAN profile xml. | 448 // Preserved WLAN profile xml. |
417 std::map<std::string, std::string> saved_profiles_xml_; | 449 std::map<std::string, std::string> saved_profiles_xml_; |
450 // Created WLAN Profiles, indexed by |network_guid|. Contains xml with TKIP | |
451 // encryption type saved by |CreateNetwork| if applicable. Profile has to be | |
452 // deleted if connection fails. Implicitly created profiles have to be deleted | |
453 // if connection succeeds. Persist only in memory. | |
454 base::DictionaryValue created_profiles_; | |
418 // Observer to get notified when network(s) have changed (e.g. connect). | 455 // Observer to get notified when network(s) have changed (e.g. connect). |
419 NetworkGuidListCallback networks_changed_observer_; | 456 NetworkGuidListCallback networks_changed_observer_; |
420 // Observer to get notified when network list has changed (scan complete). | 457 // Observer to get notified when network list has changed (scan complete). |
421 NetworkGuidListCallback network_list_changed_observer_; | 458 NetworkGuidListCallback network_list_changed_observer_; |
422 // Saved value of network location wizard show value. | 459 // Saved value of network location wizard show value. |
423 scoped_ptr<DWORD> saved_nw_category_wizard_; | 460 scoped_ptr<DWORD> saved_nw_category_wizard_; |
424 // MessageLoopProxy to post events on UI thread. | 461 // MessageLoopProxy to post events on UI thread. |
425 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 462 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
426 // Task runner for worker tasks. | 463 // Task runner for worker tasks. |
427 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 464 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
428 // If |false|, then |networks_changed_observer_| is not notified. | 465 // If |false|, then |networks_changed_observer_| is not notified. |
429 bool enable_notify_network_changed_; | 466 bool enable_notify_network_changed_; |
430 // Number of attempts to check that network has connected successfully. | 467 // Number of attempts to check that network has connected successfully. |
431 static const int kMaxAttempts = 100; | 468 static const int kMaxAttempts = 100; |
432 // Delay between attempts to check that network has connected successfully. | 469 // Delay between attempts to check that network has connected successfully. |
433 static const int kAttemptDelayMs = 100; | 470 static const int kAttemptDelayMs = 100; |
434 DISALLOW_COPY_AND_ASSIGN(WiFiServiceImpl); | 471 DISALLOW_COPY_AND_ASSIGN(WiFiServiceImpl); |
435 }; | 472 }; |
436 | 473 |
437 WiFiServiceImpl::WiFiServiceImpl() | 474 WiFiServiceImpl::WiFiServiceImpl() |
438 : wlan_api_library_(NULL), | 475 : wlan_api_library_(NULL), |
439 WlanConnect_function_(NULL), | 476 WlanConnect_function_(NULL), |
440 WlanCloseHandle_function_(NULL), | 477 WlanCloseHandle_function_(NULL), |
478 WlanDeleteProfile_function_(NULL), | |
441 WlanDisconnect_function_(NULL), | 479 WlanDisconnect_function_(NULL), |
442 WlanEnumInterfaces_function_(NULL), | 480 WlanEnumInterfaces_function_(NULL), |
443 WlanFreeMemory_function_(NULL), | 481 WlanFreeMemory_function_(NULL), |
444 WlanGetAvailableNetworkList_function_(NULL), | 482 WlanGetAvailableNetworkList_function_(NULL), |
445 WlanGetNetworkBssList_function_(NULL), | 483 WlanGetNetworkBssList_function_(NULL), |
446 WlanGetProfile_function_(NULL), | 484 WlanGetProfile_function_(NULL), |
447 WlanOpenHandle_function_(NULL), | 485 WlanOpenHandle_function_(NULL), |
448 WlanRegisterNotification_function_(NULL), | 486 WlanRegisterNotification_function_(NULL), |
449 WlanSaveTemporaryProfile_function_(NULL), | 487 WlanSaveTemporaryProfile_function_(NULL), |
450 WlanScan_function_(NULL), | 488 WlanScan_function_(NULL), |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 return; | 567 return; |
530 | 568 |
531 WiFiService::NetworkProperties network_properties; | 569 WiFiService::NetworkProperties network_properties; |
532 if (!network_properties.UpdateFromValue(*properties)) { | 570 if (!network_properties.UpdateFromValue(*properties)) { |
533 CheckError(ERROR_INVALID_DATA, kWiFiServiceError, error); | 571 CheckError(ERROR_INVALID_DATA, kWiFiServiceError, error); |
534 return; | 572 return; |
535 } | 573 } |
536 | 574 |
537 network_properties.guid = network_properties.ssid; | 575 network_properties.guid = network_properties.ssid; |
538 std::string profile_xml; | 576 std::string profile_xml; |
539 if (!CreateProfile(network_properties, &profile_xml)) { | 577 if (!CreateProfile(network_properties, kEncryptionTypeAny, &profile_xml)) { |
540 CheckError(ERROR_INVALID_DATA, kWiFiServiceError, error); | 578 CheckError(ERROR_INVALID_DATA, kWiFiServiceError, error); |
541 return; | 579 return; |
542 } | 580 } |
543 | 581 |
544 base::string16 profile_xml16(base::UTF8ToUTF16(profile_xml)); | 582 error_code = SetProfile(shared, profile_xml, false); |
545 DWORD reason_code = 0u; | |
546 | |
547 error_code = WlanSetProfile_function_(client_, | |
548 &interface_guid_, | |
549 shared ? 0 : WLAN_PROFILE_USER, | |
550 profile_xml16.c_str(), | |
551 NULL, | |
552 FALSE, | |
553 NULL, | |
554 &reason_code); | |
555 if (CheckError(error_code, kWiFiServiceError, error)) { | 583 if (CheckError(error_code, kWiFiServiceError, error)) { |
556 DVLOG(0) << profile_xml; | 584 DVLOG(0) << profile_xml; |
557 DVLOG(0) << "SetProfile Reason Code:" << reason_code; | |
558 return; | 585 return; |
559 } | 586 } |
560 | 587 |
588 // WAP and WAP2 networks could use either AES or TKIP encryption type. | |
589 // Preserve alternative profile to use in case if connection with default | |
590 // encryption type fails. | |
591 std::string tkip_profile_xml; | |
592 if (!CreateProfile(network_properties, | |
593 kEncryptionTypeTKIP, | |
594 &tkip_profile_xml)) { | |
595 CheckError(ERROR_INVALID_DATA, kWiFiServiceError, error); | |
596 return; | |
597 } | |
598 | |
599 if (tkip_profile_xml != profile_xml) { | |
600 scoped_ptr<base::DictionaryValue> tkip_profile(new base::DictionaryValue()); | |
601 tkip_profile->SetString(kProfileXmlKey, tkip_profile_xml); | |
602 tkip_profile->SetBoolean(kProfileSharedKey, shared); | |
603 created_profiles_.SetWithoutPathExpansion(network_properties.guid, | |
604 tkip_profile.release()); | |
605 } | |
606 | |
561 *network_guid = network_properties.guid; | 607 *network_guid = network_properties.guid; |
562 } | 608 } |
563 | 609 |
564 void WiFiServiceImpl::GetVisibleNetworks(const std::string& network_type, | 610 void WiFiServiceImpl::GetVisibleNetworks(const std::string& network_type, |
565 base::ListValue* network_list) { | 611 base::ListValue* network_list) { |
566 if (!network_type.empty() && | 612 if (!network_type.empty() && |
567 network_type != onc::network_type::kAllTypes && | 613 network_type != onc::network_type::kAllTypes && |
568 network_type != onc::network_type::kWiFi) { | 614 network_type != onc::network_type::kWiFi) { |
569 return; | 615 return; |
570 } | 616 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 // changed. | 819 // changed. |
774 DWORD error = GetVisibleNetworkList(&networks); | 820 DWORD error = GetVisibleNetworkList(&networks); |
775 DCHECK(error == ERROR_SUCCESS); | 821 DCHECK(error == ERROR_SUCCESS); |
776 if (error == ERROR_SUCCESS) | 822 if (error == ERROR_SUCCESS) |
777 NotifyNetworkListChanged(networks); | 823 NotifyNetworkListChanged(networks); |
778 } | 824 } |
779 | 825 |
780 void WiFiServiceImpl::WaitForNetworkConnect(const std::string& network_guid, | 826 void WiFiServiceImpl::WaitForNetworkConnect(const std::string& network_guid, |
781 int attempt) { | 827 int attempt) { |
782 // If network didn't get connected in |kMaxAttempts|, then restore automatic | 828 // If network didn't get connected in |kMaxAttempts|, then restore automatic |
783 // network change notifications and stop waiting. | 829 // network change notifications and stop waiting. |
afontan
2014/03/26 17:33:23
The comment should be updated to reflect the TKIP
mef
2014/03/26 20:42:30
Done.
| |
784 if (attempt > kMaxAttempts) { | 830 if (attempt > kMaxAttempts) { |
785 DLOG(ERROR) << kMaxAttempts << " attempts exceeded waiting for connect to " | 831 DLOG(ERROR) << kMaxAttempts << " attempts exceeded waiting for connect to " |
786 << network_guid; | 832 << network_guid; |
833 | |
834 base::DictionaryValue* created_profile = NULL; | |
835 // Check, whether this connection is using newly created profile. | |
836 if (created_profiles_.GetDictionaryWithoutPathExpansion( | |
837 network_guid, &created_profile)) { | |
838 std::string tkip_profile_xml; | |
839 bool shared = false; | |
840 // Check, if this connection there is alternative TKIP profile xml that | |
841 // should be tried. If there is, then set it up and try to connect again. | |
842 if (created_profile->GetString(kProfileXmlKey, &tkip_profile_xml) && | |
843 created_profile->GetBoolean(kProfileSharedKey, &shared)) { | |
844 // Remove TKIP profile xml, so it will not be tried again. | |
845 created_profile->Remove(kProfileXmlKey, NULL); | |
846 created_profile->Remove(kProfileSharedKey, NULL); | |
847 DWORD error_code = SetProfile(shared, tkip_profile_xml, true); | |
848 if (error_code == ERROR_SUCCESS) { | |
849 // Try to connect with new profile. | |
850 error_code = Connect(network_guid, | |
851 GetFrequencyToConnect(network_guid)); | |
852 if (error_code == ERROR_SUCCESS) { | |
853 // Start waiting again. | |
854 WaitForNetworkConnect(network_guid, 0); | |
855 return; | |
856 } | |
857 } | |
afontan
2014/03/26 17:33:23
We should probably log the case where error_code !
mef
2014/03/26 20:42:30
Done.
| |
858 } else { | |
859 // Connection has failed, so delete bad created profile. | |
860 RemoveCreatedProfile(network_guid, true); | |
afontan
2014/03/26 17:33:23
Should we check the return value and log if we cou
mef
2014/03/26 20:42:30
Done.
| |
861 } | |
862 } | |
787 enable_notify_network_changed_ = true; | 863 enable_notify_network_changed_ = true; |
788 RestoreNwCategoryWizard(); | 864 RestoreNwCategoryWizard(); |
789 return; | 865 return; |
790 } | 866 } |
791 std::string connected_network_guid; | 867 std::string connected_network_guid; |
792 DWORD error = FindConnectedNetwork(&connected_network_guid); | 868 DWORD error = FindConnectedNetwork(&connected_network_guid); |
793 if (network_guid == connected_network_guid) { | 869 if (network_guid == connected_network_guid) { |
794 DVLOG(1) << "WiFi Connected, Reset DHCP: " << network_guid; | 870 DVLOG(1) << "WiFi Connected, Reset DHCP: " << network_guid; |
795 // Even though wireless network is now connected, it may still be unusable, | 871 // Even though wireless network is now connected, it may still be unusable, |
796 // e.g. after Chromecast device reset. Reset DHCP on wireless network to | 872 // e.g. after Chromecast device reset. Reset DHCP on wireless network to |
797 // work around this issue. | 873 // work around this issue. |
798 error = ResetDHCP(); | 874 error = ResetDHCP(); |
875 // There is no need to keep created profile as network is connected. | |
afontan
2014/03/26 17:33:23
In this case we are not deleting the profile creat
mef
2014/03/26 20:42:30
Done.
| |
876 RemoveCreatedProfile(network_guid, false); | |
afontan
2014/03/26 17:33:23
We should check the return value and log.
mef
2014/03/26 20:42:30
Done. I've changed it to explicitly remove it from
| |
799 // Restore previously suppressed notifications. | 877 // Restore previously suppressed notifications. |
800 enable_notify_network_changed_ = true; | 878 enable_notify_network_changed_ = true; |
801 RestoreNwCategoryWizard(); | 879 RestoreNwCategoryWizard(); |
802 NotifyNetworkChanged(network_guid); | 880 NotifyNetworkChanged(network_guid); |
803 } else { | 881 } else { |
804 // Continue waiting for network connection state change. | 882 // Continue waiting for network connection state change. |
805 task_runner_->PostDelayedTask( | 883 task_runner_->PostDelayedTask( |
806 FROM_HERE, | 884 FROM_HERE, |
807 base::Bind(&WiFiServiceImpl::WaitForNetworkConnect, | 885 base::Bind(&WiFiServiceImpl::WaitForNetworkConnect, |
808 base::Unretained(this), | 886 base::Unretained(this), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
870 return ERROR_NOT_FOUND; | 948 return ERROR_NOT_FOUND; |
871 } | 949 } |
872 | 950 |
873 // Initialize WlanApi function pointers | 951 // Initialize WlanApi function pointers |
874 WlanConnect_function_ = | 952 WlanConnect_function_ = |
875 reinterpret_cast<WlanConnectFunction>( | 953 reinterpret_cast<WlanConnectFunction>( |
876 ::GetProcAddress(wlan_api_library_, kWlanConnect)); | 954 ::GetProcAddress(wlan_api_library_, kWlanConnect)); |
877 WlanCloseHandle_function_ = | 955 WlanCloseHandle_function_ = |
878 reinterpret_cast<WlanCloseHandleFunction>( | 956 reinterpret_cast<WlanCloseHandleFunction>( |
879 ::GetProcAddress(wlan_api_library_, kWlanCloseHandle)); | 957 ::GetProcAddress(wlan_api_library_, kWlanCloseHandle)); |
958 WlanDeleteProfile_function_ = | |
959 reinterpret_cast<WlanDeleteProfileFunction>( | |
960 ::GetProcAddress(wlan_api_library_, kWlanDeleteProfile)); | |
880 WlanDisconnect_function_ = | 961 WlanDisconnect_function_ = |
881 reinterpret_cast<WlanDisconnectFunction>( | 962 reinterpret_cast<WlanDisconnectFunction>( |
882 ::GetProcAddress(wlan_api_library_, kWlanDisconnect)); | 963 ::GetProcAddress(wlan_api_library_, kWlanDisconnect)); |
883 WlanEnumInterfaces_function_ = | 964 WlanEnumInterfaces_function_ = |
884 reinterpret_cast<WlanEnumInterfacesFunction>( | 965 reinterpret_cast<WlanEnumInterfacesFunction>( |
885 ::GetProcAddress(wlan_api_library_, kWlanEnumInterfaces)); | 966 ::GetProcAddress(wlan_api_library_, kWlanEnumInterfaces)); |
886 WlanFreeMemory_function_ = | 967 WlanFreeMemory_function_ = |
887 reinterpret_cast<WlanFreeMemoryFunction>( | 968 reinterpret_cast<WlanFreeMemoryFunction>( |
888 ::GetProcAddress(wlan_api_library_, kWlanFreeMemory)); | 969 ::GetProcAddress(wlan_api_library_, kWlanFreeMemory)); |
889 WlanGetAvailableNetworkList_function_ = | 970 WlanGetAvailableNetworkList_function_ = |
(...skipping 19 matching lines...) Expand all Loading... | |
909 ::GetProcAddress(wlan_api_library_, kWlanSaveTemporaryProfile)); | 990 ::GetProcAddress(wlan_api_library_, kWlanSaveTemporaryProfile)); |
910 WlanScan_function_ = | 991 WlanScan_function_ = |
911 reinterpret_cast<WlanScanFunction>( | 992 reinterpret_cast<WlanScanFunction>( |
912 ::GetProcAddress(wlan_api_library_, kWlanScan)); | 993 ::GetProcAddress(wlan_api_library_, kWlanScan)); |
913 WlanSetProfile_function_ = | 994 WlanSetProfile_function_ = |
914 reinterpret_cast<WlanSetProfileFunction>( | 995 reinterpret_cast<WlanSetProfileFunction>( |
915 ::GetProcAddress(wlan_api_library_, kWlanSetProfile)); | 996 ::GetProcAddress(wlan_api_library_, kWlanSetProfile)); |
916 | 997 |
917 if (!WlanConnect_function_ || | 998 if (!WlanConnect_function_ || |
918 !WlanCloseHandle_function_ || | 999 !WlanCloseHandle_function_ || |
1000 !WlanDeleteProfile_function_ || | |
919 !WlanDisconnect_function_ || | 1001 !WlanDisconnect_function_ || |
920 !WlanEnumInterfaces_function_ || | 1002 !WlanEnumInterfaces_function_ || |
921 !WlanFreeMemory_function_ || | 1003 !WlanFreeMemory_function_ || |
922 !WlanGetAvailableNetworkList_function_ || | 1004 !WlanGetAvailableNetworkList_function_ || |
923 !WlanGetProfile_function_ || | 1005 !WlanGetProfile_function_ || |
924 !WlanOpenHandle_function_ || | 1006 !WlanOpenHandle_function_ || |
925 !WlanQueryInterface_function_ || | 1007 !WlanQueryInterface_function_ || |
926 !WlanRegisterNotification_function_ || | 1008 !WlanRegisterNotification_function_ || |
927 !WlanScan_function_ || | 1009 !WlanScan_function_ || |
928 !WlanSetProfile_function_) { | 1010 !WlanSetProfile_function_) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1081 | 1163 |
1082 DWORD WiFiServiceImpl::CloseClientHandle() { | 1164 DWORD WiFiServiceImpl::CloseClientHandle() { |
1083 DWORD error = ERROR_SUCCESS; | 1165 DWORD error = ERROR_SUCCESS; |
1084 if (client_ != NULL) { | 1166 if (client_ != NULL) { |
1085 error = WlanCloseHandle_function_(client_, NULL); | 1167 error = WlanCloseHandle_function_(client_, NULL); |
1086 client_ = NULL; | 1168 client_ = NULL; |
1087 } | 1169 } |
1088 if (wlan_api_library_ != NULL) { | 1170 if (wlan_api_library_ != NULL) { |
1089 WlanConnect_function_ = NULL; | 1171 WlanConnect_function_ = NULL; |
1090 WlanCloseHandle_function_ = NULL; | 1172 WlanCloseHandle_function_ = NULL; |
1173 WlanDeleteProfile_function_ = NULL; | |
1091 WlanDisconnect_function_ = NULL; | 1174 WlanDisconnect_function_ = NULL; |
1092 WlanEnumInterfaces_function_ = NULL; | 1175 WlanEnumInterfaces_function_ = NULL; |
1093 WlanFreeMemory_function_ = NULL; | 1176 WlanFreeMemory_function_ = NULL; |
1094 WlanGetAvailableNetworkList_function_ = NULL; | 1177 WlanGetAvailableNetworkList_function_ = NULL; |
1095 WlanGetNetworkBssList_function_ = NULL; | 1178 WlanGetNetworkBssList_function_ = NULL; |
1096 WlanGetProfile_function_ = NULL; | 1179 WlanGetProfile_function_ = NULL; |
1097 WlanOpenHandle_function_ = NULL; | 1180 WlanOpenHandle_function_ = NULL; |
1098 WlanRegisterNotification_function_ = NULL; | 1181 WlanRegisterNotification_function_ = NULL; |
1099 WlanSaveTemporaryProfile_function_ = NULL; | 1182 WlanSaveTemporaryProfile_function_ = NULL; |
1100 WlanScan_function_ = NULL; | 1183 WlanScan_function_ = NULL; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1460 WLAN_CONNECTION_PARAMETERS wlan_params = { | 1543 WLAN_CONNECTION_PARAMETERS wlan_params = { |
1461 wlan_connection_mode_profile, | 1544 wlan_connection_mode_profile, |
1462 profile_name.c_str(), | 1545 profile_name.c_str(), |
1463 NULL, | 1546 NULL, |
1464 desired_bss_list.get(), | 1547 desired_bss_list.get(), |
1465 dot11_BSS_type_any, | 1548 dot11_BSS_type_any, |
1466 0}; | 1549 0}; |
1467 error = WlanConnect_function_( | 1550 error = WlanConnect_function_( |
1468 client_, &interface_guid_, &wlan_params, NULL); | 1551 client_, &interface_guid_, &wlan_params, NULL); |
1469 } else { | 1552 } else { |
1470 // TODO(mef): wlan_connection_mode_discovery_unsecure is not available on | |
1471 // XP. If XP support is needed, then temporary profile will have to be | |
1472 // created. | |
1473 WLAN_CONNECTION_PARAMETERS wlan_params = { | 1553 WLAN_CONNECTION_PARAMETERS wlan_params = { |
1474 wlan_connection_mode_discovery_unsecure, | 1554 wlan_connection_mode_discovery_unsecure, |
1475 NULL, | 1555 NULL, |
1476 &ssid, | 1556 &ssid, |
1477 desired_bss_list.get(), | 1557 desired_bss_list.get(), |
1478 dot11_BSS_type_infrastructure, | 1558 dot11_BSS_type_infrastructure, |
1479 0}; | 1559 0}; |
1480 error = WlanConnect_function_( | 1560 error = WlanConnect_function_( |
1481 client_, &interface_guid_, &wlan_params, NULL); | 1561 client_, &interface_guid_, &wlan_params, NULL); |
1562 if (error == ERROR_SUCCESS) { | |
1563 // Connection in |wlan_connection_mode_discovery_unsecure| mode causes | |
1564 // system to implicitly create a profile. Mark it as such, and delete in | |
1565 // |WaitForNetworkConnect| when connection is completed. | |
1566 scoped_ptr<base::DictionaryValue> implicit_profile( | |
1567 new base::DictionaryValue()); | |
1568 implicit_profile->SetBoolean(kProfileImplicitKey, true); | |
1569 created_profiles_.SetWithoutPathExpansion(network_guid, | |
1570 implicit_profile.release()); | |
1571 } | |
1482 } | 1572 } |
1483 } | 1573 } |
1484 | 1574 |
1485 return error; | 1575 return error; |
1486 } | 1576 } |
1487 | 1577 |
1488 DWORD WiFiServiceImpl::Disconnect() { | 1578 DWORD WiFiServiceImpl::Disconnect() { |
1489 if (client_ == NULL) { | 1579 if (client_ == NULL) { |
1490 NOTREACHED(); | 1580 NOTREACHED(); |
1491 return ERROR_NOINTERFACE; | 1581 return ERROR_NOINTERFACE; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1545 *profile_xml = base::UTF16ToUTF8(str_profile_xml); | 1635 *profile_xml = base::UTF16ToUTF8(str_profile_xml); |
1546 } | 1636 } |
1547 // Clean up. | 1637 // Clean up. |
1548 if (str_profile_xml != NULL) { | 1638 if (str_profile_xml != NULL) { |
1549 WlanFreeMemory_function_(str_profile_xml); | 1639 WlanFreeMemory_function_(str_profile_xml); |
1550 } | 1640 } |
1551 | 1641 |
1552 return error; | 1642 return error; |
1553 } | 1643 } |
1554 | 1644 |
1645 DWORD WiFiServiceImpl::SetProfile(bool shared, | |
1646 const std::string& profile_xml, | |
1647 bool overwrite) { | |
1648 DWORD error_code = ERROR_SUCCESS; | |
1649 | |
1650 base::string16 profile_xml16(base::UTF8ToUTF16(profile_xml)); | |
1651 DWORD reason_code = 0u; | |
1652 | |
1653 error_code = WlanSetProfile_function_(client_, | |
1654 &interface_guid_, | |
1655 shared ? 0 : WLAN_PROFILE_USER, | |
1656 profile_xml16.c_str(), | |
1657 NULL, | |
1658 overwrite, | |
1659 NULL, | |
1660 &reason_code); | |
1661 return error_code; | |
1662 } | |
1663 | |
1555 bool WiFiServiceImpl::HaveProfile(const std::string& network_guid) { | 1664 bool WiFiServiceImpl::HaveProfile(const std::string& network_guid) { |
1556 DWORD error = ERROR_SUCCESS; | 1665 DWORD error = ERROR_SUCCESS; |
1557 std::string profile_xml; | 1666 std::string profile_xml; |
1558 return GetProfile(network_guid, false, &profile_xml) == ERROR_SUCCESS; | 1667 return GetProfile(network_guid, false, &profile_xml) == ERROR_SUCCESS; |
1559 } | 1668 } |
1560 | 1669 |
1670 | |
1671 DWORD WiFiServiceImpl::RemoveCreatedProfile(const std::string& network_guid, | |
1672 bool connection_failed) { | |
1673 base::DictionaryValue* created_profile = NULL; | |
1674 bool implicitly_created = false; | |
1675 DWORD error_code = ERROR_SUCCESS; | |
1676 // Check, whether this connection is using new created profile, and remove it. | |
1677 if (created_profiles_.GetDictionaryWithoutPathExpansion( | |
1678 network_guid, &created_profile)) { | |
1679 if (connection_failed || | |
1680 created_profile->GetBoolean(kProfileImplicitKey, &implicitly_created) && | |
1681 implicitly_created) { | |
1682 // Connection has failed, or profile was created implicitly, so delete it. | |
1683 base::string16 profile_name = ProfileNameFromGUID(network_guid); | |
1684 error_code = WlanDeleteProfile_function_(client_, | |
1685 &interface_guid_, | |
1686 profile_name.c_str(), | |
1687 NULL); | |
1688 } | |
1689 created_profiles_.RemoveWithoutPathExpansion(network_guid, NULL); | |
1690 } | |
1691 return error_code; | |
1692 } | |
1693 | |
1561 bool WiFiServiceImpl::AuthEncryptionFromSecurity( | 1694 bool WiFiServiceImpl::AuthEncryptionFromSecurity( |
1562 const std::string& security, | 1695 const std::string& security, |
1696 EncryptionType encryption_type, | |
1563 std::string* authentication, | 1697 std::string* authentication, |
1564 std::string* encryption, | 1698 std::string* encryption, |
1565 std::string* key_type) const { | 1699 std::string* key_type) const { |
1566 if (security == onc::wifi::kNone) { | 1700 if (security == onc::wifi::kNone) { |
1567 *authentication = kAuthenticationOpen; | 1701 *authentication = kAuthenticationOpen; |
1568 *encryption = kEncryptionNone; | 1702 *encryption = kEncryptionNone; |
1569 } else if (security == onc::wifi::kWEP_PSK) { | 1703 } else if (security == onc::wifi::kWEP_PSK) { |
1570 *authentication = kAuthenticationOpen; | 1704 *authentication = kAuthenticationOpen; |
1571 *encryption = kEncryptionWEP; | 1705 *encryption = kEncryptionWEP; |
1572 *key_type = kKeyTypeNetwork; | 1706 *key_type = kKeyTypeNetwork; |
1573 } else if (security == onc::wifi::kWPA_PSK) { | 1707 } else if (security == onc::wifi::kWPA_PSK) { |
1574 *authentication = kAuthenticationWpaPsk; | 1708 *authentication = kAuthenticationWpaPsk; |
1575 // TODO(mef): WAP |encryption| could be either |AES| or |TKIP|. It has to be | 1709 if (encryption_type == kEncryptionTypeTKIP) { |
1576 // determined and adjusted properly during |Connect|. | 1710 *encryption = kEncryptionTKIP; |
1577 *encryption = kEncryptionAES; | 1711 } else { |
1712 *encryption = kEncryptionAES; | |
1713 } | |
1578 *key_type = kKeyTypePassphrase; | 1714 *key_type = kKeyTypePassphrase; |
1579 } else if (security == onc::wifi::kWPA2_PSK) { | 1715 } else if (security == onc::wifi::kWPA2_PSK) { |
1580 *authentication = kAuthenticationWpa2Psk; | 1716 *authentication = kAuthenticationWpa2Psk; |
1581 // TODO(mef): WAP |encryption| could be either |AES| or |TKIP|. It has to be | 1717 if (encryption_type == kEncryptionTypeTKIP) { |
1582 // determined and adjusted properly during |Connect|. | 1718 *encryption = kEncryptionTKIP; |
1583 *encryption = kEncryptionAES; | 1719 } else { |
1720 *encryption = kEncryptionAES; | |
1721 } | |
1584 *key_type = kKeyTypePassphrase; | 1722 *key_type = kKeyTypePassphrase; |
afontan
2014/03/26 17:33:23
This if/else is getting a bit long so is harder to
mef
2014/03/26 20:42:30
I've added a helper method. A switch doesn't work
| |
1585 } else { | 1723 } else { |
1586 return false; | 1724 return false; |
1587 } | 1725 } |
1588 return true; | 1726 return true; |
1589 } | 1727 } |
1590 | 1728 |
1591 bool WiFiServiceImpl::CreateProfile( | 1729 bool WiFiServiceImpl::CreateProfile( |
1592 const NetworkProperties& network_properties, | 1730 const NetworkProperties& network_properties, |
1731 EncryptionType encryption_type, | |
1593 std::string* profile_xml) { | 1732 std::string* profile_xml) { |
1594 // Get authentication and encryption values from security. | 1733 // Get authentication and encryption values from security. |
1595 std::string authentication; | 1734 std::string authentication; |
1596 std::string encryption; | 1735 std::string encryption; |
1597 std::string key_type; | 1736 std::string key_type; |
1598 bool valid = AuthEncryptionFromSecurity(network_properties.security, | 1737 bool valid = AuthEncryptionFromSecurity(network_properties.security, |
1738 encryption_type, | |
1599 &authentication, | 1739 &authentication, |
1600 &encryption, | 1740 &encryption, |
1601 &key_type); | 1741 &key_type); |
1602 if (!valid) | 1742 if (!valid) |
1603 return valid; | 1743 return valid; |
1604 | 1744 |
1605 // Generate profile XML. | 1745 // Generate profile XML. |
1606 XmlWriter xml_writer; | 1746 XmlWriter xml_writer; |
1607 xml_writer.StartWriting(); | 1747 xml_writer.StartWriting(); |
1608 xml_writer.StartElement("WLANProfile"); | 1748 xml_writer.StartElement("WLANProfile"); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1662 NetworkGuidList changed_networks(1, network_guid); | 1802 NetworkGuidList changed_networks(1, network_guid); |
1663 message_loop_proxy_->PostTask( | 1803 message_loop_proxy_->PostTask( |
1664 FROM_HERE, | 1804 FROM_HERE, |
1665 base::Bind(networks_changed_observer_, changed_networks)); | 1805 base::Bind(networks_changed_observer_, changed_networks)); |
1666 } | 1806 } |
1667 } | 1807 } |
1668 | 1808 |
1669 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); } | 1809 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); } |
1670 | 1810 |
1671 } // namespace wifi | 1811 } // namespace wifi |
OLD | NEW |