| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 return ""; | 381 return ""; |
| 382 case SECURITY_WEP: | 382 case SECURITY_WEP: |
| 383 return "WEP"; | 383 return "WEP"; |
| 384 case SECURITY_WPA: | 384 case SECURITY_WPA: |
| 385 return "WPA"; | 385 return "WPA"; |
| 386 case SECURITY_RSN: | 386 case SECURITY_RSN: |
| 387 return "RSN"; | 387 return "RSN"; |
| 388 case SECURITY_8021X: | 388 case SECURITY_8021X: |
| 389 return "8021X"; | 389 return "8021X"; |
| 390 } | 390 } |
| 391 return "Unknown";} | 391 return "Unknown"; |
| 392 } |
| 393 |
| 394 // Parse 'path' to determine if the certificate is stored in a pkcs#11 device. |
| 395 // flimflam recognizes the string "SETTINGS:" to specify authentication |
| 396 // parameters. 'key_id=' indicates that the certificate is stored in a pkcs#11 |
| 397 // device. See src/third_party/flimflam/files/doc/service-api.txt. |
| 398 bool WifiNetwork::IsCertificateLoaded() const { |
| 399 static const std::string settings_string("SETTINGS:"); |
| 400 static const std::string pkcs11_key("key_id"); |
| 401 if (cert_path_.find(settings_string) == 0) { |
| 402 std::string::size_type idx = cert_path_.find(pkcs11_key); |
| 403 if (idx != std::string::npos) |
| 404 idx = cert_path_.find_first_not_of(kWhitespaceASCII, |
| 405 idx + pkcs11_key.length()); |
| 406 if (idx != std::string::npos && cert_path_[idx] == '=') |
| 407 return true; |
| 408 } |
| 409 return false; |
| 410 } |
| 392 | 411 |
| 393 //////////////////////////////////////////////////////////////////////////////// | 412 //////////////////////////////////////////////////////////////////////////////// |
| 394 // NetworkLibrary | 413 // NetworkLibrary |
| 395 | 414 |
| 396 class NetworkLibraryImpl : public NetworkLibrary { | 415 class NetworkLibraryImpl : public NetworkLibrary { |
| 397 public: | 416 public: |
| 398 NetworkLibraryImpl() | 417 NetworkLibraryImpl() |
| 399 : network_status_connection_(NULL), | 418 : network_status_connection_(NULL), |
| 400 data_plan_monitor_(NULL), | 419 data_plan_monitor_(NULL), |
| 401 available_devices_(0), | 420 available_devices_(0), |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 return new NetworkLibraryStubImpl(); | 1241 return new NetworkLibraryStubImpl(); |
| 1223 else | 1242 else |
| 1224 return new NetworkLibraryImpl(); | 1243 return new NetworkLibraryImpl(); |
| 1225 } | 1244 } |
| 1226 | 1245 |
| 1227 } // namespace chromeos | 1246 } // namespace chromeos |
| 1228 | 1247 |
| 1229 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 1248 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 1230 // won't be deleted until it's last InvokeLater is run. | 1249 // won't be deleted until it's last InvokeLater is run. |
| 1231 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); | 1250 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); |
| OLD | NEW |