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; | |
389 if (network->type() == TYPE_WIFI) { | 388 if (network->type() == TYPE_WIFI) { |
390 WifiNetwork* wifi = static_cast<WifiNetwork*>(network); | 389 WifiNetwork* wifi = static_cast<WifiNetwork*>(network); |
391 if (wifi->passphrase_required()) | 390 if (wifi->encryption() != SECURITY_NONE) { |
392 passphrase = wifi->passphrase(); | 391 if (wifi->passphrase().find("bad") == 0) { |
393 } else if (network->type() == TYPE_WIMAX) { | 392 NetworkConnectCompleted(network, CONNECT_BAD_PASSPHRASE); |
394 WimaxNetwork* wimax = static_cast<WimaxNetwork*>(network); | 393 return; |
395 if (wimax->passphrase_required()) | 394 } else if (wifi->passphrase().find("error") == 0) { |
396 passphrase = wimax->eap_passphrase(); | 395 NetworkConnectCompleted(network, CONNECT_FAILED); |
397 } | 396 return; |
398 if (!passphrase.empty()) { | 397 } |
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; | |
405 } | 398 } |
406 } | 399 } |
407 | 400 |
408 // Set connected state. | 401 // Set connected state. |
409 network->set_connected(true); | 402 network->set_connected(true); |
410 network->set_connection_started(false); | 403 network->set_connection_started(false); |
411 | 404 |
412 // Make the connected network the highest priority network. | 405 // Make the connected network the highest priority network. |
413 // Set all other networks of the same type to disconnected + inactive; | 406 // Set all other networks of the same type to disconnected + inactive; |
414 int old_priority_order = network->priority_order_; | 407 int old_priority_order = network->priority_order_; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 HardwareAddressFormat format) { | 656 HardwareAddressFormat format) { |
664 *hardware_address = hardware_address_; | 657 *hardware_address = hardware_address_; |
665 return ip_configs_; | 658 return ip_configs_; |
666 } | 659 } |
667 | 660 |
668 void NetworkLibraryImplStub::SetIPConfig(const NetworkIPConfig& ipconfig) { | 661 void NetworkLibraryImplStub::SetIPConfig(const NetworkIPConfig& ipconfig) { |
669 ip_configs_.push_back(ipconfig); | 662 ip_configs_.push_back(ipconfig); |
670 } | 663 } |
671 | 664 |
672 } // namespace chromeos | 665 } // namespace chromeos |
OLD | NEW |