OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/cros/network_library_impl_stub.h" | 5 #include "chrome/browser/chromeos/cros/network_library_impl_stub.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 | 9 |
10 using content::BrowserThread; | 10 using content::BrowserThread; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 remembered->set_name(network->name()); | 378 remembered->set_name(network->name()); |
379 remembered->set_unique_id(network->unique_id()); | 379 remembered->set_unique_id(network->unique_id()); |
380 // ValidateAndAddRememberedNetwork will insert the network into the matching | 380 // ValidateAndAddRememberedNetwork will insert the network into the matching |
381 // profile and set the profile type + path. | 381 // profile and set the profile type + path. |
382 if (!ValidateAndAddRememberedNetwork(remembered)) | 382 if (!ValidateAndAddRememberedNetwork(remembered)) |
383 NOTREACHED(); | 383 NOTREACHED(); |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 void NetworkLibraryImplStub::ConnectToNetwork(Network* network) { | 387 void NetworkLibraryImplStub::ConnectToNetwork(Network* network) { |
| 388 std::string passphrase; |
388 if (network->type() == TYPE_WIFI) { | 389 if (network->type() == TYPE_WIFI) { |
389 WifiNetwork* wifi = static_cast<WifiNetwork*>(network); | 390 WifiNetwork* wifi = static_cast<WifiNetwork*>(network); |
390 if (wifi->encryption() != SECURITY_NONE) { | 391 if (wifi->passphrase_required()) |
391 if (wifi->passphrase().find("bad") == 0) { | 392 passphrase = wifi->passphrase(); |
392 NetworkConnectCompleted(network, CONNECT_BAD_PASSPHRASE); | 393 } else if (network->type() == TYPE_WIMAX) { |
393 return; | 394 WimaxNetwork* wimax = static_cast<WimaxNetwork*>(network); |
394 } else if (wifi->passphrase().find("error") == 0) { | 395 if (wimax->passphrase_required()) |
395 NetworkConnectCompleted(network, CONNECT_FAILED); | 396 passphrase = wimax->eap_passphrase(); |
396 return; | 397 } |
397 } | 398 if (!passphrase.empty()) { |
| 399 if (passphrase.find("bad") == 0) { |
| 400 NetworkConnectCompleted(network, CONNECT_BAD_PASSPHRASE); |
| 401 return; |
| 402 } else if (passphrase.find("error") == 0) { |
| 403 NetworkConnectCompleted(network, CONNECT_FAILED); |
| 404 return; |
398 } | 405 } |
399 } | 406 } |
400 | 407 |
401 // Set connected state. | 408 // Set connected state. |
402 network->set_connected(true); | 409 network->set_connected(true); |
403 network->set_connection_started(false); | 410 network->set_connection_started(false); |
404 | 411 |
405 // Make the connected network the highest priority network. | 412 // Make the connected network the highest priority network. |
406 // Set all other networks of the same type to disconnected + inactive; | 413 // Set all other networks of the same type to disconnected + inactive; |
407 int old_priority_order = network->priority_order_; | 414 int old_priority_order = network->priority_order_; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 HardwareAddressFormat format) { | 663 HardwareAddressFormat format) { |
657 *hardware_address = hardware_address_; | 664 *hardware_address = hardware_address_; |
658 return ip_configs_; | 665 return ip_configs_; |
659 } | 666 } |
660 | 667 |
661 void NetworkLibraryImplStub::SetIPConfig(const NetworkIPConfig& ipconfig) { | 668 void NetworkLibraryImplStub::SetIPConfig(const NetworkIPConfig& ipconfig) { |
662 ip_configs_.push_back(ipconfig); | 669 ip_configs_.push_back(ipconfig); |
663 } | 670 } |
664 | 671 |
665 } // namespace chromeos | 672 } // namespace chromeos |
OLD | NEW |