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

Side by Side Diff: chrome/browser/chromeos/cros/network_library_impl_base.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_impl_base.h" 5 #include "chrome/browser/chromeos/cros/network_library_impl_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/chromeos/cros/native_network_parser.h" 8 #include "chrome/browser/chromeos/cros/native_network_parser.h"
9 #include "chrome/browser/chromeos/cros/onc_network_parser.h" 9 #include "chrome/browser/chromeos/cros/onc_network_parser.h"
10 #include "chrome/browser/chromeos/network_login_observer.h" 10 #include "chrome/browser/chromeos/network_login_observer.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return wimax_networks_; 314 return wimax_networks_;
315 } 315 }
316 const VirtualNetworkVector& NetworkLibraryImplBase::virtual_networks() const { 316 const VirtualNetworkVector& NetworkLibraryImplBase::virtual_networks() const {
317 return virtual_networks_; 317 return virtual_networks_;
318 } 318 }
319 const VirtualNetworkVector& 319 const VirtualNetworkVector&
320 NetworkLibraryImplBase::remembered_virtual_networks() const { 320 NetworkLibraryImplBase::remembered_virtual_networks() const {
321 return remembered_virtual_networks_; 321 return remembered_virtual_networks_;
322 } 322 }
323 323
324 // Use flimflam's ordering of the services to determine which type of 324 // Use shill's ordering of the services to determine which type of
325 // network to return (i.e. don't assume priority of network types). 325 // network to return (i.e. don't assume priority of network types).
326 // Note: This does not include any virtual networks. 326 // Note: This does not include any virtual networks.
327 namespace { 327 namespace {
328 Network* highest_priority(Network* a, Network*b) { 328 Network* highest_priority(Network* a, Network*b) {
329 if (!a) 329 if (!a)
330 return b; 330 return b;
331 if (!b) 331 if (!b)
332 return a; 332 return a;
333 if (b->priority_order() < a->priority_order()) 333 if (b->priority_order() < a->priority_order())
334 return b; 334 return b;
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 821
822 // 2. Start the connection. 822 // 2. Start the connection.
823 void NetworkLibraryImplBase::NetworkConnectStartWifi( 823 void NetworkLibraryImplBase::NetworkConnectStartWifi(
824 WifiNetwork* wifi, NetworkProfileType profile_type) { 824 WifiNetwork* wifi, NetworkProfileType profile_type) {
825 DCHECK(!wifi->connection_started()); 825 DCHECK(!wifi->connection_started());
826 // This will happen if a network resets, gets out of range or is forgotten. 826 // This will happen if a network resets, gets out of range or is forgotten.
827 if (wifi->user_passphrase_ != wifi->passphrase_ || 827 if (wifi->user_passphrase_ != wifi->passphrase_ ||
828 wifi->passphrase_required()) 828 wifi->passphrase_required())
829 wifi->SetPassphrase(wifi->user_passphrase_); 829 wifi->SetPassphrase(wifi->user_passphrase_);
830 // For enterprise 802.1X networks, always provide TPM PIN when available. 830 // For enterprise 802.1X networks, always provide TPM PIN when available.
831 // flimflam uses the PIN if it needs to access certificates in the TPM and 831 // shill uses the PIN if it needs to access certificates in the TPM and
832 // ignores it otherwise. 832 // ignores it otherwise.
833 if (wifi->encryption() == SECURITY_8021X) { 833 if (wifi->encryption() == SECURITY_8021X) {
834 // If the TPM initialization has not completed, GetTpmPin() will return 834 // If the TPM initialization has not completed, GetTpmPin() will return
835 // an empty value, in which case we do not want to clear the PIN since 835 // an empty value, in which case we do not want to clear the PIN since
836 // that will cause flimflam to flag the network as unconfigured. 836 // that will cause shill to flag the network as unconfigured.
837 // TODO(stevenjb): We may want to delay attempting to connect, or fail 837 // TODO(stevenjb): We may want to delay attempting to connect, or fail
838 // immediately, rather than let the network layer attempt a connection. 838 // immediately, rather than let the network layer attempt a connection.
839 std::string tpm_pin = GetTpmPin(); 839 std::string tpm_pin = GetTpmPin();
840 if (!tpm_pin.empty()) 840 if (!tpm_pin.empty())
841 wifi->SetCertificatePin(tpm_pin); 841 wifi->SetCertificatePin(tpm_pin);
842 } 842 }
843 NetworkConnectStart(wifi, profile_type); 843 NetworkConnectStart(wifi, profile_type);
844 } 844 }
845 845
846 void NetworkLibraryImplBase::NetworkConnectStartVPN(VirtualNetwork* vpn) { 846 void NetworkLibraryImplBase::NetworkConnectStartVPN(VirtualNetwork* vpn) {
847 // flimflam needs the TPM PIN for some VPN networks to access client 847 // shill needs the TPM PIN for some VPN networks to access client
848 // certificates, and ignores the PIN if it doesn't need them. Only set this 848 // certificates, and ignores the PIN if it doesn't need them. Only set this
849 // if the TPM is ready (see comment in NetworkConnectStartWifi). 849 // if the TPM is ready (see comment in NetworkConnectStartWifi).
850 std::string tpm_pin = GetTpmPin(); 850 std::string tpm_pin = GetTpmPin();
851 if (!tpm_pin.empty()) { 851 if (!tpm_pin.empty()) {
852 std::string tpm_slot = GetTpmSlot(); 852 std::string tpm_slot = GetTpmSlot();
853 vpn->SetCertificateSlotAndPin(tpm_slot, tpm_pin); 853 vpn->SetCertificateSlotAndPin(tpm_slot, tpm_pin);
854 } 854 }
855 NetworkConnectStart(vpn, PROFILE_NONE); 855 NetworkConnectStart(vpn, PROFILE_NONE);
856 } 856 }
857 857
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 NotifyNetworkChanged(network); 913 NotifyNetworkChanged(network);
914 VLOG(1) << "Error connecting to network: " << network->name() 914 VLOG(1) << "Error connecting to network: " << network->name()
915 << " Status: " << status; 915 << " Status: " << status;
916 return; 916 return;
917 } 917 }
918 918
919 VLOG(1) << "Connected to network: " << network->name() 919 VLOG(1) << "Connected to network: " << network->name()
920 << " State: " << network->state() 920 << " State: " << network->state()
921 << " Status: " << status; 921 << " Status: " << status;
922 922
923 // If the user asked not to save credentials, flimflam will have 923 // If the user asked not to save credentials, shill will have
924 // forgotten them. Wipe our cache as well. 924 // forgotten them. Wipe our cache as well.
925 if (!network->save_credentials()) 925 if (!network->save_credentials())
926 network->EraseCredentials(); 926 network->EraseCredentials();
927 927
928 ClearActiveNetwork(network->type()); 928 ClearActiveNetwork(network->type());
929 UpdateActiveNetwork(network); 929 UpdateActiveNetwork(network);
930 930
931 // Notify observers. 931 // Notify observers.
932 NotifyNetworkManagerChanged(true); // Forced update. 932 NotifyNetworkManagerChanged(true); // Forced update.
933 NotifyUserConnectionInitiated(network); 933 NotifyUserConnectionInitiated(network);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 return true; 1314 return true;
1315 1315
1316 // Set |network| to active. 1316 // Set |network| to active.
1317 UpdateActiveNetwork(network); 1317 UpdateActiveNetwork(network);
1318 return true; 1318 return true;
1319 } 1319 }
1320 1320
1321 //////////////////////////////////////////////////////////////////////////// 1321 ////////////////////////////////////////////////////////////////////////////
1322 // Network list management functions. 1322 // Network list management functions.
1323 1323
1324 // Note: sometimes flimflam still returns networks when the device type is 1324 // Note: sometimes shill still returns networks when the device type is
1325 // disabled. Always check the appropriate enabled() state before adding 1325 // disabled. Always check the appropriate enabled() state before adding
1326 // networks to a list or setting an active network so that we do not show them 1326 // networks to a list or setting an active network so that we do not show them
1327 // in the UI. 1327 // in the UI.
1328 1328
1329 // This relies on services being requested from flimflam in priority order, 1329 // This relies on services being requested from shill in priority order,
1330 // and the updates getting processed and received in order. 1330 // and the updates getting processed and received in order.
1331 void NetworkLibraryImplBase::UpdateActiveNetwork(Network* network) { 1331 void NetworkLibraryImplBase::UpdateActiveNetwork(Network* network) {
1332 network->set_is_active(true); 1332 network->set_is_active(true);
1333 ConnectionType type(network->type()); 1333 ConnectionType type(network->type());
1334 if (type == TYPE_ETHERNET) { 1334 if (type == TYPE_ETHERNET) {
1335 if (ethernet_enabled()) { 1335 if (ethernet_enabled()) {
1336 // Set ethernet_ to the first connected ethernet service, or the first 1336 // Set ethernet_ to the first connected ethernet service, or the first
1337 // disconnected ethernet service if none are connected. 1337 // disconnected ethernet service if none are connected.
1338 if (ethernet_ == NULL || !ethernet_->connected()) { 1338 if (ethernet_ == NULL || !ethernet_->connected()) {
1339 ethernet_ = static_cast<EthernetNetwork*>(network); 1339 ethernet_ = static_cast<EthernetNetwork*>(network);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 1469
1470 bool NetworkLibraryImplBase::ValidateRememberedNetwork(Network* network) { 1470 bool NetworkLibraryImplBase::ValidateRememberedNetwork(Network* network) {
1471 std::pair<NetworkMap::iterator, bool> result = 1471 std::pair<NetworkMap::iterator, bool> result =
1472 remembered_network_map_.insert( 1472 remembered_network_map_.insert(
1473 std::make_pair(network->service_path(), network)); 1473 std::make_pair(network->service_path(), network));
1474 DCHECK(result.second); // Should only get called with new network. 1474 DCHECK(result.second); // Should only get called with new network.
1475 1475
1476 // See if this is a policy-configured network that has meanwhile been removed. 1476 // See if this is a policy-configured network that has meanwhile been removed.
1477 // This situation may arise when the full list of remembered networks is not 1477 // This situation may arise when the full list of remembered networks is not
1478 // available to LoadOncNetworks(), which can happen due to the asynchronous 1478 // available to LoadOncNetworks(), which can happen due to the asynchronous
1479 // communication between flimflam and NetworkLibrary. Just tell flimflam to 1479 // communication between shill and NetworkLibrary. Just tell shill to
1480 // delete the network now. 1480 // delete the network now.
1481 const NetworkUIData::ONCSource source = network->ui_data().onc_source(); 1481 const NetworkUIData::ONCSource source = network->ui_data().onc_source();
1482 if (source == NetworkUIData::ONC_SOURCE_USER_POLICY || 1482 if (source == NetworkUIData::ONC_SOURCE_USER_POLICY ||
1483 source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY) { 1483 source == NetworkUIData::ONC_SOURCE_DEVICE_POLICY) {
1484 NetworkSourceMap::const_iterator network_id_set( 1484 NetworkSourceMap::const_iterator network_id_set(
1485 network_source_map_.find(source)); 1485 network_source_map_.find(source));
1486 if (network_id_set != network_source_map_.end() && 1486 if (network_id_set != network_source_map_.end() &&
1487 network_id_set->second.find(network->unique_id()) == 1487 network_id_set->second.find(network->unique_id()) ==
1488 network_id_set->second.end()) { 1488 network_id_set->second.end()) {
1489 DeleteRememberedNetwork(network->service_path()); 1489 DeleteRememberedNetwork(network->service_path());
(...skipping 10 matching lines...) Expand all
1500 1500
1501 if (network->type() == TYPE_WIFI) { 1501 if (network->type() == TYPE_WIFI) {
1502 remembered_wifi_networks_.push_back( 1502 remembered_wifi_networks_.push_back(
1503 static_cast<WifiNetwork*>(network)); 1503 static_cast<WifiNetwork*>(network));
1504 } else if (network->type() == TYPE_VPN) { 1504 } else if (network->type() == TYPE_VPN) {
1505 remembered_virtual_networks_.push_back( 1505 remembered_virtual_networks_.push_back(
1506 static_cast<VirtualNetwork*>(network)); 1506 static_cast<VirtualNetwork*>(network));
1507 } else { 1507 } else {
1508 NOTREACHED(); 1508 NOTREACHED();
1509 } 1509 }
1510 // Find service path in profiles. Flimflam does not set the Profile 1510 // Find service path in profiles. Shill does not set the Profile
1511 // property for remembered networks, only active networks. 1511 // property for remembered networks, only active networks.
1512 for (NetworkProfileList::iterator iter = profile_list_.begin(); 1512 for (NetworkProfileList::iterator iter = profile_list_.begin();
1513 iter != profile_list_.end(); ++iter) { 1513 iter != profile_list_.end(); ++iter) {
1514 NetworkProfile& profile = *iter; 1514 NetworkProfile& profile = *iter;
1515 if (profile.services.find(network->service_path()) != 1515 if (profile.services.find(network->service_path()) !=
1516 profile.services.end()) { 1516 profile.services.end()) {
1517 network->set_profile_path(profile.path); 1517 network->set_profile_path(profile.path);
1518 network->set_profile_type(profile.type); 1518 network->set_profile_type(profile.type);
1519 VLOG(1) << "ValidateAndAddRememberedNetwork: " << network->service_path() 1519 VLOG(1) << "ValidateAndAddRememberedNetwork: " << network->service_path()
1520 << " profile: " << profile.path; 1520 << " profile: " << profile.path;
1521 break; 1521 break;
1522 } 1522 }
1523 } 1523 }
1524 DCHECK(!network->profile_path().empty()) 1524 DCHECK(!network->profile_path().empty())
1525 << "Service path not in any profile: " << network->service_path(); 1525 << "Service path not in any profile: " << network->service_path();
1526 return true; 1526 return true;
1527 } 1527 }
1528 1528
1529 void NetworkLibraryImplBase::DeleteRememberedNetwork( 1529 void NetworkLibraryImplBase::DeleteRememberedNetwork(
1530 const std::string& service_path) { 1530 const std::string& service_path) {
1531 NetworkMap::iterator found = remembered_network_map_.find(service_path); 1531 NetworkMap::iterator found = remembered_network_map_.find(service_path);
1532 if (found == remembered_network_map_.end()) { 1532 if (found == remembered_network_map_.end()) {
1533 LOG(WARNING) << "Attempt to delete non-existent remembered network: " 1533 LOG(WARNING) << "Attempt to delete non-existent remembered network: "
1534 << service_path; 1534 << service_path;
1535 return; 1535 return;
1536 } 1536 }
1537 Network* remembered_network = found->second; 1537 Network* remembered_network = found->second;
1538 1538
1539 // Update any associated network service before removing from profile 1539 // Update any associated network service before removing from profile
1540 // so that flimflam doesn't recreate the service (e.g. when we disconenct it). 1540 // so that shill doesn't recreate the service (e.g. when we disconenct it).
1541 Network* network = FindNetworkByUniqueId(remembered_network->unique_id()); 1541 Network* network = FindNetworkByUniqueId(remembered_network->unique_id());
1542 if (network) { 1542 if (network) {
1543 // Clear the stored credentials for any forgotten networks. 1543 // Clear the stored credentials for any forgotten networks.
1544 network->EraseCredentials(); 1544 network->EraseCredentials();
1545 network->ClearUIData(); 1545 network->ClearUIData();
1546 SetProfileType(network, PROFILE_NONE); 1546 SetProfileType(network, PROFILE_NONE);
1547 // Remove VPN from list of networks. 1547 // Remove VPN from list of networks.
1548 if (network->type() == TYPE_VPN) 1548 if (network->type() == TYPE_VPN)
1549 CallRemoveNetwork(network); 1549 CallRemoveNetwork(network);
1550 } else { 1550 } else {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 GetTpmInfo(); 1840 GetTpmInfo();
1841 return tpm_slot_; 1841 return tpm_slot_;
1842 } 1842 }
1843 1843
1844 const std::string& NetworkLibraryImplBase::GetTpmPin() { 1844 const std::string& NetworkLibraryImplBase::GetTpmPin() {
1845 GetTpmInfo(); 1845 GetTpmInfo();
1846 return tpm_pin_; 1846 return tpm_pin_;
1847 } 1847 }
1848 1848
1849 } // namespace chromeos 1849 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library_impl_base.h ('k') | chrome/browser/chromeos/cros/network_library_impl_cros.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698