Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/chromeos/cros/network_library.cc

Issue 10915106: Renaming instances of "flimflam" with "shill", now that we're only (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Upload after merge Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.h" 5 #include "chrome/browser/chromeos/cros/network_library.h"
6 6
7 #include <dbus/dbus-glib.h> 7 #include <dbus/dbus-glib.h>
8 8
9 #include "base/i18n/icu_encoding_detection.h" 9 #include "base/i18n/icu_encoding_detection.h"
10 #include "base/i18n/icu_string_conversions.h" 10 #include "base/i18n/icu_string_conversions.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 281
282 // static 282 // static
283 Network* Network::CreateForTesting(ConnectionType type) { 283 Network* Network::CreateForTesting(ConnectionType type) {
284 return new Network("fake_service_path", type); 284 return new Network("fake_service_path", type);
285 } 285 }
286 286
287 void Network::SetState(ConnectionState new_state) { 287 void Network::SetState(ConnectionState new_state) {
288 if (new_state == state_) 288 if (new_state == state_)
289 return; 289 return;
290 if (state_ == STATE_CONNECT_REQUESTED && new_state == STATE_IDLE) { 290 if (state_ == STATE_CONNECT_REQUESTED && new_state == STATE_IDLE) {
291 // CONNECT_REQUESTED is set internally. Shill/flimflam do not update the 291 // CONNECT_REQUESTED is set internally. Shill does not update the
292 // state immediately, so ignore any Idle state updates sent while a 292 // state immediately, so ignore any Idle state updates sent while a
293 // connection attempt is in progress. 293 // connection attempt is in progress.
294 VLOG(2) << "Ignoring idle state change after connection request."; 294 VLOG(2) << "Ignoring idle state change after connection request.";
295 return; 295 return;
296 } 296 }
297 ConnectionState old_state = state_; 297 ConnectionState old_state = state_;
298 VLOG(2) << "Entering new state: " << ConnectionStateString(new_state); 298 VLOG(2) << "Entering new state: " << ConnectionStateString(new_state);
299 state_ = new_state; 299 state_ = new_state;
300 if (!IsConnectingState(new_state)) 300 if (!IsConnectingState(new_state))
301 set_connection_started(false); 301 set_connection_started(false);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 break; 605 break;
606 case PROVIDER_TYPE_L2TP_IPSEC_USER_CERT: 606 case PROVIDER_TYPE_L2TP_IPSEC_USER_CERT:
607 if (client_cert_id_.empty() && 607 if (client_cert_id_.empty() &&
608 client_cert_type() != CLIENT_CERT_TYPE_PATTERN) 608 client_cert_type() != CLIENT_CERT_TYPE_PATTERN)
609 return true; 609 return true;
610 break; 610 break;
611 case PROVIDER_TYPE_OPEN_VPN: 611 case PROVIDER_TYPE_OPEN_VPN:
612 if (client_cert_id_.empty()) 612 if (client_cert_id_.empty())
613 return true; 613 return true;
614 // For now we always need additional info for OpenVPN. 614 // For now we always need additional info for OpenVPN.
615 // TODO(stevenjb): Check connectable() once flimflam sets that state 615 // TODO(stevenjb): Check connectable() once shill sets that state
616 // properly, or define another mechanism to determine when additional 616 // properly, or define another mechanism to determine when additional
617 // credentials are required. 617 // credentials are required.
618 return true; 618 return true;
619 break; 619 break;
620 case PROVIDER_TYPE_MAX: 620 case PROVIDER_TYPE_MAX:
621 NOTREACHED(); 621 NOTREACHED();
622 break; 622 break;
623 } 623 }
624 return false; 624 return false;
625 } 625 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 } 828 }
829 829
830 CellularNetwork::~CellularNetwork() { 830 CellularNetwork::~CellularNetwork() {
831 } 831 }
832 832
833 bool CellularNetwork::StartActivation() { 833 bool CellularNetwork::StartActivation() {
834 if (!EnsureCrosLoaded()) 834 if (!EnsureCrosLoaded())
835 return false; 835 return false;
836 if (!CrosActivateCellularModem(service_path(), "")) 836 if (!CrosActivateCellularModem(service_path(), ""))
837 return false; 837 return false;
838 // Don't wait for flimflam to tell us that we are really activating since 838 // Don't wait for shill to tell us that we are really activating since
839 // other notifications in the message loop might cause us to think that 839 // other notifications in the message loop might cause us to think that
840 // the process hasn't started yet. 840 // the process hasn't started yet.
841 activation_state_ = ACTIVATION_STATE_ACTIVATING; 841 activation_state_ = ACTIVATION_STATE_ACTIVATING;
842 return true; 842 return true;
843 } 843 }
844 844
845 void CellularNetwork::RefreshDataPlansIfNeeded() const { 845 void CellularNetwork::RefreshDataPlansIfNeeded() const {
846 if (!EnsureCrosLoaded()) 846 if (!EnsureCrosLoaded())
847 return; 847 return;
848 if (connected() && activated()) 848 if (connected() && activated())
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 eap_phase_2_auth_(EAP_PHASE_2_AUTH_AUTO), 993 eap_phase_2_auth_(EAP_PHASE_2_AUTH_AUTO),
994 eap_use_system_cas_(true), 994 eap_use_system_cas_(true),
995 eap_save_credentials_(false), 995 eap_save_credentials_(false),
996 ALLOW_THIS_IN_INITIALIZER_LIST(weak_pointer_factory_(this)) { 996 ALLOW_THIS_IN_INITIALIZER_LIST(weak_pointer_factory_(this)) {
997 } 997 }
998 998
999 WifiNetwork::~WifiNetwork() {} 999 WifiNetwork::~WifiNetwork() {}
1000 1000
1001 void WifiNetwork::CalculateUniqueId() { 1001 void WifiNetwork::CalculateUniqueId() {
1002 ConnectionSecurity encryption = encryption_; 1002 ConnectionSecurity encryption = encryption_;
1003 // Flimflam treats wpa and rsn as psk internally, so convert those types 1003 // Shill treats wpa and rsn as psk internally, so convert those types
1004 // to psk for unique naming. 1004 // to psk for unique naming.
1005 if (encryption == SECURITY_WPA || encryption == SECURITY_RSN) 1005 if (encryption == SECURITY_WPA || encryption == SECURITY_RSN)
1006 encryption = SECURITY_PSK; 1006 encryption = SECURITY_PSK;
1007 std::string security = std::string(SecurityToString(encryption)); 1007 std::string security = std::string(SecurityToString(encryption));
1008 set_unique_id(security + "|" + name()); 1008 set_unique_id(security + "|" + name());
1009 } 1009 }
1010 1010
1011 bool WifiNetwork::SetSsid(const std::string& ssid) { 1011 bool WifiNetwork::SetSsid(const std::string& ssid) {
1012 // Detects encoding and convert to UTF-8. 1012 // Detects encoding and convert to UTF-8.
1013 std::string ssid_utf8; 1013 std::string ssid_utf8;
(...skipping 26 matching lines...) Expand all
1040 return SetSsid(std::string(ssid_raw.begin(), ssid_raw.end())); 1040 return SetSsid(std::string(ssid_raw.begin(), ssid_raw.end()));
1041 } 1041 }
1042 1042
1043 const std::string& WifiNetwork::GetPassphrase() const { 1043 const std::string& WifiNetwork::GetPassphrase() const {
1044 if (!user_passphrase_.empty()) 1044 if (!user_passphrase_.empty())
1045 return user_passphrase_; 1045 return user_passphrase_;
1046 return passphrase_; 1046 return passphrase_;
1047 } 1047 }
1048 1048
1049 void WifiNetwork::SetPassphrase(const std::string& passphrase) { 1049 void WifiNetwork::SetPassphrase(const std::string& passphrase) {
1050 // Set the user_passphrase_ only; passphrase_ stores the flimflam value. 1050 // Set the user_passphrase_ only; passphrase_ stores the shill value.
1051 // If the user sets an empty passphrase, restore it to the passphrase 1051 // If the user sets an empty passphrase, restore it to the passphrase
1052 // remembered by flimflam. 1052 // remembered by shill.
1053 if (!passphrase.empty()) { 1053 if (!passphrase.empty()) {
1054 user_passphrase_ = passphrase; 1054 user_passphrase_ = passphrase;
1055 passphrase_ = passphrase; 1055 passphrase_ = passphrase;
1056 } else { 1056 } else {
1057 user_passphrase_ = passphrase_; 1057 user_passphrase_ = passphrase_;
1058 } 1058 }
1059 // Send the change to flimflam. If the format is valid, it will propagate to 1059 // Send the change to shill. If the format is valid, it will propagate to
1060 // passphrase_ with a service update. 1060 // passphrase_ with a service update.
1061 SetOrClearStringProperty(flimflam::kPassphraseProperty, passphrase, NULL); 1061 SetOrClearStringProperty(flimflam::kPassphraseProperty, passphrase, NULL);
1062 } 1062 }
1063 1063
1064 // See src/third_party/flimflam/doc/service-api.txt for properties that 1064 // See src/third_party/shill/doc/service-api.txt for properties that
1065 // flimflam will forget when SaveCredentials is false. 1065 // shill will forget when SaveCredentials is false.
1066 void WifiNetwork::EraseCredentials() { 1066 void WifiNetwork::EraseCredentials() {
1067 WipeString(&passphrase_); 1067 WipeString(&passphrase_);
1068 WipeString(&user_passphrase_); 1068 WipeString(&user_passphrase_);
1069 WipeString(&eap_client_cert_pkcs11_id_); 1069 WipeString(&eap_client_cert_pkcs11_id_);
1070 WipeString(&eap_identity_); 1070 WipeString(&eap_identity_);
1071 WipeString(&eap_anonymous_identity_); 1071 WipeString(&eap_anonymous_identity_);
1072 WipeString(&eap_passphrase_); 1072 WipeString(&eap_passphrase_);
1073 } 1073 }
1074 1074
1075 void WifiNetwork::SetIdentity(const std::string& identity) { 1075 void WifiNetwork::SetIdentity(const std::string& identity) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 const std::string& nss_nickname) { 1143 const std::string& nss_nickname) {
1144 VLOG(1) << "SetEAPServerCaCertNssNickname " << nss_nickname; 1144 VLOG(1) << "SetEAPServerCaCertNssNickname " << nss_nickname;
1145 SetOrClearStringProperty(flimflam::kEapCaCertNssProperty, 1145 SetOrClearStringProperty(flimflam::kEapCaCertNssProperty,
1146 nss_nickname, &eap_server_ca_cert_nss_nickname_); 1146 nss_nickname, &eap_server_ca_cert_nss_nickname_);
1147 } 1147 }
1148 1148
1149 void WifiNetwork::SetEAPClientCertPkcs11Id(const std::string& pkcs11_id) { 1149 void WifiNetwork::SetEAPClientCertPkcs11Id(const std::string& pkcs11_id) {
1150 VLOG(1) << "SetEAPClientCertPkcs11Id " << pkcs11_id; 1150 VLOG(1) << "SetEAPClientCertPkcs11Id " << pkcs11_id;
1151 SetOrClearStringProperty( 1151 SetOrClearStringProperty(
1152 flimflam::kEapCertIdProperty, pkcs11_id, &eap_client_cert_pkcs11_id_); 1152 flimflam::kEapCertIdProperty, pkcs11_id, &eap_client_cert_pkcs11_id_);
1153 // flimflam requires both CertID and KeyID for TLS connections, despite 1153 // shill requires both CertID and KeyID for TLS connections, despite
1154 // the fact that by convention they are the same ID. 1154 // the fact that by convention they are the same ID.
1155 SetOrClearStringProperty(flimflam::kEapKeyIdProperty, pkcs11_id, NULL); 1155 SetOrClearStringProperty(flimflam::kEapKeyIdProperty, pkcs11_id, NULL);
1156 } 1156 }
1157 1157
1158 void WifiNetwork::SetEAPUseSystemCAs(bool use_system_cas) { 1158 void WifiNetwork::SetEAPUseSystemCAs(bool use_system_cas) {
1159 SetBooleanProperty(flimflam::kEapUseSystemCasProperty, use_system_cas, 1159 SetBooleanProperty(flimflam::kEapUseSystemCasProperty, use_system_cas,
1160 &eap_use_system_cas_); 1160 &eap_use_system_cas_);
1161 } 1161 }
1162 1162
1163 void WifiNetwork::SetEAPIdentity(const std::string& identity) { 1163 void WifiNetwork::SetEAPIdentity(const std::string& identity) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1207 }
1208 return result; 1208 return result;
1209 } 1209 }
1210 case SECURITY_PSK: 1210 case SECURITY_PSK:
1211 return "PSK"; 1211 return "PSK";
1212 } 1212 }
1213 return "Unknown"; 1213 return "Unknown";
1214 } 1214 }
1215 1215
1216 bool WifiNetwork::IsPassphraseRequired() const { 1216 bool WifiNetwork::IsPassphraseRequired() const {
1217 // TODO(stevenjb): Remove error_ tests when fixed in flimflam 1217 // TODO(stevenjb): Remove error_ tests when fixed.
1218 // (http://crosbug.com/10135). 1218 // (http://crosbug.com/10135).
1219 if (error() == ERROR_BAD_PASSPHRASE || error() == ERROR_BAD_WEPKEY) 1219 if (error() == ERROR_BAD_PASSPHRASE || error() == ERROR_BAD_WEPKEY)
1220 return true; 1220 return true;
1221 // For 802.1x networks, configuration is required if connectable is false 1221 // For 802.1x networks, configuration is required if connectable is false
1222 // unless we're using a certificate pattern. 1222 // unless we're using a certificate pattern.
1223 if (encryption_ == SECURITY_8021X) { 1223 if (encryption_ == SECURITY_8021X) {
1224 if (eap_method_ != EAP_METHOD_TLS || 1224 if (eap_method_ != EAP_METHOD_TLS ||
1225 client_cert_type() != CLIENT_CERT_TYPE_PATTERN) 1225 client_cert_type() != CLIENT_CERT_TYPE_PATTERN)
1226 return !connectable(); 1226 return !connectable();
1227 return false; 1227 return false;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 NetworkLibrary* impl; 1338 NetworkLibrary* impl;
1339 if (stub) 1339 if (stub)
1340 impl = new NetworkLibraryImplStub(); 1340 impl = new NetworkLibraryImplStub();
1341 else 1341 else
1342 impl = new NetworkLibraryImplCros(); 1342 impl = new NetworkLibraryImplCros();
1343 impl->Init(); 1343 impl->Init();
1344 return impl; 1344 return impl;
1345 } 1345 }
1346 1346
1347 } // namespace chromeos 1347 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library.h ('k') | chrome/browser/chromeos/cros/network_library_impl_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698