| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/i18n/icu_encoding_detection.h" | 10 #include "base/i18n/icu_encoding_detection.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // wifi_networks_: ordered vector of WifiNetwork* entries in network_map_, | 48 // wifi_networks_: ordered vector of WifiNetwork* entries in network_map_, |
| 49 // in descending order of importance. | 49 // in descending order of importance. |
| 50 // CellularNetwork | 50 // CellularNetwork |
| 51 // active_cellular_: Cellular version of wifi_. | 51 // active_cellular_: Cellular version of wifi_. |
| 52 // cellular_networks_: Cellular version of wifi_. | 52 // cellular_networks_: Cellular version of wifi_. |
| 53 // network_unique_id_map_: map<unique_id,Network*> for visible networks. | 53 // network_unique_id_map_: map<unique_id,Network*> for visible networks. |
| 54 // remembered_network_map_: a canonical map<path,Network*> for all networks | 54 // remembered_network_map_: a canonical map<path,Network*> for all networks |
| 55 // remembered in the active Profile ("favorites"). | 55 // remembered in the active Profile ("favorites"). |
| 56 // remembered_wifi_networks_: ordered vector of WifiNetwork* entries in | 56 // remembered_wifi_networks_: ordered vector of WifiNetwork* entries in |
| 57 // remembered_network_map_, in descending order of preference. | 57 // remembered_network_map_, in descending order of preference. |
| 58 // remembered_virtual_networks_: ordered vector of VirtualNetwork* entries in |
| 59 // remembered_network_map_, in descending order of preference. |
| 58 // | 60 // |
| 59 // network_manager_monitor_: a handle to the libcros network Manager handler. | 61 // network_manager_monitor_: a handle to the libcros network Manager handler. |
| 60 // NetworkManagerStatusChanged: This handles all messages from the Manager. | 62 // NetworkManagerStatusChanged: This handles all messages from the Manager. |
| 61 // Messages are parsed here and the appropriate updates are then requested. | 63 // Messages are parsed here and the appropriate updates are then requested. |
| 62 // | 64 // |
| 63 // UpdateNetworkServiceList: This is the primary Manager handler. It handles | 65 // UpdateNetworkServiceList: This is the primary Manager handler. It handles |
| 64 // the "Services" message which list all visible networks. The handler | 66 // the "Services" message which list all visible networks. The handler |
| 65 // rebuilds the network lists without destroying existing Network structures, | 67 // rebuilds the network lists without destroying existing Network structures, |
| 66 // then requests neccessary updates to be fetched asynchronously from | 68 // then requests neccessary updates to be fetched asynchronously from |
| 67 // libcros (RequestNetworkServiceInfo). | 69 // libcros (RequestNetworkServiceInfo). |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 bool res = info->GetWithoutPathExpansion(key, &value); | 1160 bool res = info->GetWithoutPathExpansion(key, &value); |
| 1159 DCHECK(res); | 1161 DCHECK(res); |
| 1160 if (res) { | 1162 if (res) { |
| 1161 int index = property_index_parser().Get(key); | 1163 int index = property_index_parser().Get(key); |
| 1162 if (!ParseValue(index, value)) // virtual. | 1164 if (!ParseValue(index, value)) // virtual. |
| 1163 VLOG(1) << "Network: " << name() | 1165 VLOG(1) << "Network: " << name() |
| 1164 << " Type: " << ConnectionTypeToString(type()) | 1166 << " Type: " << ConnectionTypeToString(type()) |
| 1165 << " Unhandled key: " << key; | 1167 << " Unhandled key: " << key; |
| 1166 } | 1168 } |
| 1167 } | 1169 } |
| 1170 CalculateUniqueId(); |
| 1168 } | 1171 } |
| 1169 | 1172 |
| 1170 void Network::EraseCredentials() { | 1173 void Network::EraseCredentials() { |
| 1171 } | 1174 } |
| 1172 | 1175 |
| 1176 void Network::CalculateUniqueId() { |
| 1177 unique_id_ = name_; |
| 1178 } |
| 1179 |
| 1173 bool Network::RequiresUserProfile() const { | 1180 bool Network::RequiresUserProfile() const { |
| 1174 return false; | 1181 return false; |
| 1175 } | 1182 } |
| 1176 | 1183 |
| 1184 void Network::CopyCredentialsFromRemembered(Network* remembered) { |
| 1185 } |
| 1186 |
| 1177 void Network::SetValueProperty(const char* prop, Value* val) { | 1187 void Network::SetValueProperty(const char* prop, Value* val) { |
| 1178 DCHECK(prop); | 1188 DCHECK(prop); |
| 1179 DCHECK(val); | 1189 DCHECK(val); |
| 1180 if (!EnsureCrosLoaded()) | 1190 if (!EnsureCrosLoaded()) |
| 1181 return; | 1191 return; |
| 1182 chromeos::SetNetworkServiceProperty(service_path_.c_str(), prop, val); | 1192 chromeos::SetNetworkServiceProperty(service_path_.c_str(), prop, val); |
| 1183 } | 1193 } |
| 1184 | 1194 |
| 1185 void Network::ClearProperty(const char* prop) { | 1195 void Network::ClearProperty(const char* prop) { |
| 1186 DCHECK(prop); | 1196 DCHECK(prop); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 default: | 1407 default: |
| 1398 return Network::ParseValue(index, value); | 1408 return Network::ParseValue(index, value); |
| 1399 break; | 1409 break; |
| 1400 } | 1410 } |
| 1401 return false; | 1411 return false; |
| 1402 } | 1412 } |
| 1403 | 1413 |
| 1404 void VirtualNetwork::ParseInfo(const DictionaryValue* info) { | 1414 void VirtualNetwork::ParseInfo(const DictionaryValue* info) { |
| 1405 Network::ParseInfo(info); | 1415 Network::ParseInfo(info); |
| 1406 VLOG(1) << "VPN: " << name() | 1416 VLOG(1) << "VPN: " << name() |
| 1417 << " Server: " << server_hostname() |
| 1407 << " Type: " << ProviderTypeToString(provider_type()); | 1418 << " Type: " << ProviderTypeToString(provider_type()); |
| 1408 if (provider_type_ == PROVIDER_TYPE_L2TP_IPSEC_PSK) { | 1419 if (provider_type_ == PROVIDER_TYPE_L2TP_IPSEC_PSK) { |
| 1409 if (!client_cert_id_.empty()) | 1420 if (!client_cert_id_.empty()) |
| 1410 provider_type_ = PROVIDER_TYPE_L2TP_IPSEC_USER_CERT; | 1421 provider_type_ = PROVIDER_TYPE_L2TP_IPSEC_USER_CERT; |
| 1411 } | 1422 } |
| 1412 } | 1423 } |
| 1413 | 1424 |
| 1414 void VirtualNetwork::EraseCredentials() { | 1425 void VirtualNetwork::EraseCredentials() { |
| 1415 WipeString(&ca_cert_nss_); | 1426 WipeString(&ca_cert_nss_); |
| 1416 WipeString(&psk_passphrase_); | 1427 WipeString(&psk_passphrase_); |
| 1417 WipeString(&client_cert_id_); | 1428 WipeString(&client_cert_id_); |
| 1418 WipeString(&user_passphrase_); | 1429 WipeString(&user_passphrase_); |
| 1419 } | 1430 } |
| 1420 | 1431 |
| 1432 void VirtualNetwork::CalculateUniqueId() { |
| 1433 std::string provider_type(ProviderTypeToString(provider_type_)); |
| 1434 unique_id_ = provider_type + "|" + server_hostname_; |
| 1435 } |
| 1436 |
| 1421 bool VirtualNetwork::RequiresUserProfile() const { | 1437 bool VirtualNetwork::RequiresUserProfile() const { |
| 1422 return true; | 1438 return true; |
| 1423 } | 1439 } |
| 1424 | 1440 |
| 1441 void VirtualNetwork::CopyCredentialsFromRemembered(Network* remembered) { |
| 1442 DCHECK(remembered->type() == TYPE_VPN); |
| 1443 VirtualNetwork* remembered_vpn = static_cast<VirtualNetwork*>(remembered); |
| 1444 VLOG(1) << "Copy VPN credentials: " << name() |
| 1445 << " username: " << remembered_vpn->username(); |
| 1446 if (ca_cert_nss_.empty()) |
| 1447 ca_cert_nss_ = remembered_vpn->ca_cert_nss(); |
| 1448 if (psk_passphrase_.empty()) |
| 1449 psk_passphrase_ = remembered_vpn->psk_passphrase(); |
| 1450 if (client_cert_id_.empty()) |
| 1451 client_cert_id_ = remembered_vpn->client_cert_id(); |
| 1452 if (username_.empty()) |
| 1453 username_ = remembered_vpn->username(); |
| 1454 if (user_passphrase_.empty()) |
| 1455 user_passphrase_ = remembered_vpn->user_passphrase(); |
| 1456 } |
| 1457 |
| 1425 bool VirtualNetwork::NeedMoreInfoToConnect() const { | 1458 bool VirtualNetwork::NeedMoreInfoToConnect() const { |
| 1426 if (server_hostname_.empty() || username_.empty() || user_passphrase_.empty()) | 1459 if (server_hostname_.empty() || username_.empty() || user_passphrase_.empty()) |
| 1427 return true; | 1460 return true; |
| 1428 switch (provider_type_) { | 1461 switch (provider_type_) { |
| 1429 case PROVIDER_TYPE_L2TP_IPSEC_PSK: | 1462 case PROVIDER_TYPE_L2TP_IPSEC_PSK: |
| 1430 if (psk_passphrase_.empty()) | 1463 if (psk_passphrase_.empty()) |
| 1431 return true; | 1464 return true; |
| 1432 break; | 1465 break; |
| 1433 case PROVIDER_TYPE_L2TP_IPSEC_USER_CERT: | 1466 case PROVIDER_TYPE_L2TP_IPSEC_USER_CERT: |
| 1434 case PROVIDER_TYPE_OPEN_VPN: | 1467 case PROVIDER_TYPE_OPEN_VPN: |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 : WirelessNetwork(service_path, TYPE_WIFI), | 1990 : WirelessNetwork(service_path, TYPE_WIFI), |
| 1958 encryption_(SECURITY_NONE), | 1991 encryption_(SECURITY_NONE), |
| 1959 passphrase_required_(false), | 1992 passphrase_required_(false), |
| 1960 eap_method_(EAP_METHOD_UNKNOWN), | 1993 eap_method_(EAP_METHOD_UNKNOWN), |
| 1961 eap_phase_2_auth_(EAP_PHASE_2_AUTH_AUTO), | 1994 eap_phase_2_auth_(EAP_PHASE_2_AUTH_AUTO), |
| 1962 eap_use_system_cas_(true) { | 1995 eap_use_system_cas_(true) { |
| 1963 } | 1996 } |
| 1964 | 1997 |
| 1965 WifiNetwork::~WifiNetwork() {} | 1998 WifiNetwork::~WifiNetwork() {} |
| 1966 | 1999 |
| 1967 // Called from ParseNetwork after calling ParseInfo. | |
| 1968 void WifiNetwork::CalculateUniqueId() { | 2000 void WifiNetwork::CalculateUniqueId() { |
| 1969 ConnectionSecurity encryption = encryption_; | 2001 ConnectionSecurity encryption = encryption_; |
| 1970 // Flimflam treats wpa and rsn as psk internally, so convert those types | 2002 // Flimflam treats wpa and rsn as psk internally, so convert those types |
| 1971 // to psk for unique naming. | 2003 // to psk for unique naming. |
| 1972 if (encryption == SECURITY_WPA || encryption == SECURITY_RSN) | 2004 if (encryption == SECURITY_WPA || encryption == SECURITY_RSN) |
| 1973 encryption = SECURITY_PSK; | 2005 encryption = SECURITY_PSK; |
| 1974 std::string security = std::string(SecurityToString(encryption)); | 2006 std::string security = std::string(SecurityToString(encryption)); |
| 1975 unique_id_ = security + "|" + name_; | 2007 unique_id_ = security + "|" + name_; |
| 1976 } | 2008 } |
| 1977 | 2009 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2091 case PROPERTY_INDEX_EAP_PIN: | 2123 case PROPERTY_INDEX_EAP_PIN: |
| 2092 case PROPERTY_INDEX_EAP_KEY_MGMT: | 2124 case PROPERTY_INDEX_EAP_KEY_MGMT: |
| 2093 // These properties are currently not used in the UI. | 2125 // These properties are currently not used in the UI. |
| 2094 return true; | 2126 return true; |
| 2095 default: | 2127 default: |
| 2096 return WirelessNetwork::ParseValue(index, value); | 2128 return WirelessNetwork::ParseValue(index, value); |
| 2097 } | 2129 } |
| 2098 return false; | 2130 return false; |
| 2099 } | 2131 } |
| 2100 | 2132 |
| 2101 void WifiNetwork::ParseInfo(const DictionaryValue* info) { | |
| 2102 Network::ParseInfo(info); | |
| 2103 CalculateUniqueId(); | |
| 2104 } | |
| 2105 | |
| 2106 const std::string& WifiNetwork::GetPassphrase() const { | 2133 const std::string& WifiNetwork::GetPassphrase() const { |
| 2107 if (!user_passphrase_.empty()) | 2134 if (!user_passphrase_.empty()) |
| 2108 return user_passphrase_; | 2135 return user_passphrase_; |
| 2109 return passphrase_; | 2136 return passphrase_; |
| 2110 } | 2137 } |
| 2111 | 2138 |
| 2112 void WifiNetwork::SetPassphrase(const std::string& passphrase) { | 2139 void WifiNetwork::SetPassphrase(const std::string& passphrase) { |
| 2113 // Set the user_passphrase_ only; passphrase_ stores the flimflam value. | 2140 // Set the user_passphrase_ only; passphrase_ stores the flimflam value. |
| 2114 // If the user sets an empty passphrase, restore it to the passphrase | 2141 // If the user sets an empty passphrase, restore it to the passphrase |
| 2115 // remembered by flimflam. | 2142 // remembered by flimflam. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 if (error_ == ERROR_BAD_PASSPHRASE || error_ == ERROR_BAD_WEPKEY) | 2296 if (error_ == ERROR_BAD_PASSPHRASE || error_ == ERROR_BAD_WEPKEY) |
| 2270 return true; | 2297 return true; |
| 2271 // For 802.1x networks, configuration is required if connectable is false. | 2298 // For 802.1x networks, configuration is required if connectable is false. |
| 2272 if (encryption_ == SECURITY_8021X) | 2299 if (encryption_ == SECURITY_8021X) |
| 2273 return !connectable_; | 2300 return !connectable_; |
| 2274 return passphrase_required_; | 2301 return passphrase_required_; |
| 2275 } | 2302 } |
| 2276 | 2303 |
| 2277 bool WifiNetwork::RequiresUserProfile() const { | 2304 bool WifiNetwork::RequiresUserProfile() const { |
| 2278 // 8021X requires certificates which are only stored for individual users. | 2305 // 8021X requires certificates which are only stored for individual users. |
| 2279 if (encryption_ == SECURITY_8021X) | 2306 if (encryption_ == SECURITY_8021X && |
| 2307 (eap_method_ == EAP_METHOD_TLS || |
| 2308 !eap_client_cert_pkcs11_id().empty())) |
| 2280 return true; | 2309 return true; |
| 2281 return false; | 2310 return false; |
| 2282 } | 2311 } |
| 2283 | 2312 |
| 2284 //////////////////////////////////////////////////////////////////////////////// | 2313 //////////////////////////////////////////////////////////////////////////////// |
| 2285 // NetworkLibrary | 2314 // NetworkLibrary |
| 2286 | 2315 |
| 2287 class NetworkLibraryImpl : public NetworkLibrary { | 2316 class NetworkLibraryImpl : public NetworkLibrary { |
| 2288 public: | 2317 public: |
| 2289 NetworkLibraryImpl() | 2318 NetworkLibraryImpl() |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2529 } | 2558 } |
| 2530 | 2559 |
| 2531 virtual const CellularNetworkVector& cellular_networks() const { | 2560 virtual const CellularNetworkVector& cellular_networks() const { |
| 2532 return cellular_networks_; | 2561 return cellular_networks_; |
| 2533 } | 2562 } |
| 2534 | 2563 |
| 2535 virtual const VirtualNetworkVector& virtual_networks() const { | 2564 virtual const VirtualNetworkVector& virtual_networks() const { |
| 2536 return virtual_networks_; | 2565 return virtual_networks_; |
| 2537 } | 2566 } |
| 2538 | 2567 |
| 2568 virtual const VirtualNetworkVector& remembered_virtual_networks() const { |
| 2569 return remembered_virtual_networks_; |
| 2570 } |
| 2571 |
| 2539 ///////////////////////////////////////////////////////////////////////////// | 2572 ///////////////////////////////////////////////////////////////////////////// |
| 2540 | 2573 |
| 2541 virtual const NetworkDevice* FindNetworkDeviceByPath( | 2574 virtual const NetworkDevice* FindNetworkDeviceByPath( |
| 2542 const std::string& path) const { | 2575 const std::string& path) const { |
| 2543 NetworkDeviceMap::const_iterator iter = device_map_.find(path); | 2576 NetworkDeviceMap::const_iterator iter = device_map_.find(path); |
| 2544 if (iter != device_map_.end()) | 2577 if (iter != device_map_.end()) |
| 2545 return iter->second; | 2578 return iter->second; |
| 2546 LOG(WARNING) << "Device path not found: " << path; | 2579 LOG(WARNING) << "Device path not found: " << path; |
| 2547 return NULL; | 2580 return NULL; |
| 2548 } | 2581 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2614 | 2647 |
| 2615 virtual Network* FindNetworkFromRemembered( | 2648 virtual Network* FindNetworkFromRemembered( |
| 2616 const Network* remembered) const { | 2649 const Network* remembered) const { |
| 2617 NetworkMap::const_iterator found = | 2650 NetworkMap::const_iterator found = |
| 2618 network_unique_id_map_.find(remembered->unique_id()); | 2651 network_unique_id_map_.find(remembered->unique_id()); |
| 2619 if (found != network_unique_id_map_.end()) | 2652 if (found != network_unique_id_map_.end()) |
| 2620 return found->second; | 2653 return found->second; |
| 2621 return NULL; | 2654 return NULL; |
| 2622 } | 2655 } |
| 2623 | 2656 |
| 2657 Network* FindRememberedFromNetwork(const Network* network) const { |
| 2658 for (NetworkMap::const_iterator iter = remembered_network_map_.begin(); |
| 2659 iter != remembered_network_map_.end(); ++iter) { |
| 2660 if (iter->second->unique_id() == network->unique_id()) |
| 2661 return iter->second; |
| 2662 } |
| 2663 return NULL; |
| 2664 } |
| 2665 |
| 2624 virtual Network* FindRememberedNetworkByPath(const std::string& path) const { | 2666 virtual Network* FindRememberedNetworkByPath(const std::string& path) const { |
| 2625 NetworkMap::const_iterator iter = remembered_network_map_.find(path); | 2667 NetworkMap::const_iterator iter = remembered_network_map_.find(path); |
| 2626 if (iter != remembered_network_map_.end()) | 2668 if (iter != remembered_network_map_.end()) |
| 2627 return iter->second; | 2669 return iter->second; |
| 2628 return NULL; | 2670 return NULL; |
| 2629 } | 2671 } |
| 2630 | 2672 |
| 2631 virtual const CellularDataPlanVector* GetDataPlans( | 2673 virtual const CellularDataPlanVector* GetDataPlans( |
| 2632 const std::string& path) const { | 2674 const std::string& path) const { |
| 2633 CellularDataPlanMap::const_iterator iter = data_plan_map_.find(path); | 2675 CellularDataPlanMap::const_iterator iter = data_plan_map_.find(path); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3157 active_wifi_ = NULL; | 3199 active_wifi_ = NULL; |
| 3158 else if (found_network == active_cellular_) | 3200 else if (found_network == active_cellular_) |
| 3159 active_cellular_ = NULL; | 3201 active_cellular_ = NULL; |
| 3160 else if (found_network == active_virtual_) | 3202 else if (found_network == active_virtual_) |
| 3161 active_virtual_ = NULL; | 3203 active_virtual_ = NULL; |
| 3162 } | 3204 } |
| 3163 NotifyNetworkManagerChanged(true); // Forced update. | 3205 NotifyNetworkManagerChanged(true); // Forced update. |
| 3164 } | 3206 } |
| 3165 } | 3207 } |
| 3166 | 3208 |
| 3167 virtual void ForgetWifiNetwork(const std::string& service_path) { | 3209 virtual void ForgetNetwork(const std::string& service_path) { |
| 3168 if (!EnsureCrosLoaded()) | 3210 if (!EnsureCrosLoaded()) |
| 3169 return; | 3211 return; |
| 3170 // Remove network from remembered list and notify observers. | 3212 // Remove network from remembered list and notify observers. |
| 3171 DeleteRememberedWifiNetwork(service_path); | 3213 DeleteRememberedNetwork(service_path); |
| 3172 NotifyNetworkManagerChanged(true); // Forced update. | 3214 NotifyNetworkManagerChanged(true); // Forced update. |
| 3173 } | 3215 } |
| 3174 | 3216 |
| 3175 // Note: currently there is no way to change the profile of a network | 3217 // Note: currently there is no way to change the profile of a network |
| 3176 // unless it is visible (i.e. in network_map_). We change the profile by | 3218 // unless it is visible (i.e. in network_map_). We change the profile by |
| 3177 // setting the Profile property of the visible network. | 3219 // setting the Profile property of the visible network. |
| 3178 // See chromium-os:15523. | 3220 // See chromium-os:15523. |
| 3179 virtual void SetNetworkProfile(const std::string& service_path, | 3221 virtual void SetNetworkProfile(const std::string& service_path, |
| 3180 NetworkProfileType type) { | 3222 NetworkProfileType type) { |
| 3181 Network* network = FindNetworkByPath(service_path); | 3223 Network* network = FindNetworkByPath(service_path); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3664 } | 3706 } |
| 3665 | 3707 |
| 3666 static void RememberedNetworkServiceUpdate(void* object, | 3708 static void RememberedNetworkServiceUpdate(void* object, |
| 3667 const char* service_path, | 3709 const char* service_path, |
| 3668 const Value* info) { | 3710 const Value* info) { |
| 3669 NetworkLibraryImpl* networklib = static_cast<NetworkLibraryImpl*>(object); | 3711 NetworkLibraryImpl* networklib = static_cast<NetworkLibraryImpl*>(object); |
| 3670 DCHECK(networklib); | 3712 DCHECK(networklib); |
| 3671 if (service_path) { | 3713 if (service_path) { |
| 3672 if (!info) { | 3714 if (!info) { |
| 3673 // Remembered network no longer exists. | 3715 // Remembered network no longer exists. |
| 3674 networklib->DeleteRememberedWifiNetwork(std::string(service_path)); | 3716 networklib->DeleteRememberedNetwork(std::string(service_path)); |
| 3675 } else { | 3717 } else { |
| 3676 DCHECK_EQ(info->GetType(), Value::TYPE_DICTIONARY); | 3718 DCHECK_EQ(info->GetType(), Value::TYPE_DICTIONARY); |
| 3677 const DictionaryValue* dict = static_cast<const DictionaryValue*>(info); | 3719 const DictionaryValue* dict = static_cast<const DictionaryValue*>(info); |
| 3678 networklib->ParseRememberedNetwork(std::string(service_path), dict); | 3720 networklib->ParseRememberedNetwork(std::string(service_path), dict); |
| 3679 } | 3721 } |
| 3680 } | 3722 } |
| 3681 } | 3723 } |
| 3682 | 3724 |
| 3683 static void NetworkDeviceUpdate(void* object, | 3725 static void NetworkDeviceUpdate(void* object, |
| 3684 const char* device_path, | 3726 const char* device_path, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3818 data_plan_map_.find(network->service_path()); | 3860 data_plan_map_.find(network->service_path()); |
| 3819 if (found != data_plan_map_.end()) { | 3861 if (found != data_plan_map_.end()) { |
| 3820 CellularDataPlanVector* data_plans = found->second; | 3862 CellularDataPlanVector* data_plans = found->second; |
| 3821 delete data_plans; | 3863 delete data_plans; |
| 3822 data_plan_map_.erase(found); | 3864 data_plan_map_.erase(found); |
| 3823 } | 3865 } |
| 3824 } | 3866 } |
| 3825 delete network; | 3867 delete network; |
| 3826 } | 3868 } |
| 3827 | 3869 |
| 3828 void AddRememberedWifiNetwork(WifiNetwork* wifi) { | 3870 void AddRememberedNetwork(Network* network) { |
| 3829 std::pair<NetworkMap::iterator,bool> result = | 3871 std::pair<NetworkMap::iterator,bool> result = |
| 3830 remembered_network_map_.insert( | 3872 remembered_network_map_.insert( |
| 3831 std::make_pair(wifi->service_path(), wifi)); | 3873 std::make_pair(network->service_path(), network)); |
| 3832 DCHECK(result.second); // Should only get called with new network. | 3874 DCHECK(result.second); // Should only get called with new network. |
| 3833 remembered_wifi_networks_.push_back(wifi); | 3875 if (network->type() == TYPE_WIFI) { |
| 3876 remembered_wifi_networks_.push_back( |
| 3877 static_cast<WifiNetwork*>(network)); |
| 3878 } else if (network->type() == TYPE_VPN) { |
| 3879 remembered_virtual_networks_.push_back( |
| 3880 static_cast<VirtualNetwork*>(network)); |
| 3881 } else { |
| 3882 NOTREACHED(); |
| 3883 } |
| 3834 // Find service path in profiles. Flimflam does not set the Profile | 3884 // Find service path in profiles. Flimflam does not set the Profile |
| 3835 // property for remembered networks, only active networks. | 3885 // property for remembered networks, only active networks. |
| 3836 for (NetworkProfileList::iterator iter = profile_list_.begin(); | 3886 for (NetworkProfileList::iterator iter = profile_list_.begin(); |
| 3837 iter != profile_list_.end(); ++iter) { | 3887 iter != profile_list_.end(); ++iter) { |
| 3838 NetworkProfile& profile = *iter; | 3888 NetworkProfile& profile = *iter; |
| 3839 if (profile.services.find(wifi->service_path()) != | 3889 if (profile.services.find(network->service_path()) != |
| 3840 profile.services.end()) { | 3890 profile.services.end()) { |
| 3841 wifi->set_profile_path(profile.path); | 3891 network->set_profile_path(profile.path); |
| 3842 wifi->set_profile_type(profile.type); | 3892 network->set_profile_type(profile.type); |
| 3843 VLOG(1) << "AddRememberedWifiNetwork: " << wifi->service_path() | 3893 VLOG(1) << "AddRememberedNetwork: " << network->service_path() |
| 3844 << " Profile: " << profile.path; | 3894 << " Profile: " << profile.path; |
| 3845 break; | 3895 break; |
| 3846 } | 3896 } |
| 3847 } | 3897 } |
| 3848 DCHECK(!wifi->profile_path().empty()) | 3898 DCHECK(!network->profile_path().empty()) |
| 3849 << "Wifi service path not in any profile: " << wifi->service_path(); | 3899 << "Service path not in any profile: " << network->service_path(); |
| 3850 } | 3900 } |
| 3851 | 3901 |
| 3852 void DeleteRememberedWifiNetwork(const std::string& service_path) { | 3902 void DeleteRememberedNetwork(const std::string& service_path) { |
| 3853 NetworkMap::iterator found = remembered_network_map_.find(service_path); | 3903 NetworkMap::iterator found = remembered_network_map_.find(service_path); |
| 3854 if (found == remembered_network_map_.end()) { | 3904 if (found == remembered_network_map_.end()) { |
| 3855 LOG(WARNING) << "Attempt to delete non-existant remembered network: " | 3905 LOG(WARNING) << "Attempt to delete non-existant remembered network: " |
| 3856 << service_path; | 3906 << service_path; |
| 3857 return; | 3907 return; |
| 3858 } | 3908 } |
| 3859 | 3909 |
| 3860 // Delete remembered network from lists. | 3910 // Delete remembered network from lists. |
| 3861 Network* remembered_network = found->second; | 3911 Network* remembered_network = found->second; |
| 3862 remembered_network_map_.erase(found); | 3912 remembered_network_map_.erase(found); |
| 3863 WifiNetworkVector::iterator iter = std::find( | |
| 3864 remembered_wifi_networks_.begin(), remembered_wifi_networks_.end(), | |
| 3865 remembered_network); | |
| 3866 if (iter != remembered_wifi_networks_.end()) | |
| 3867 remembered_wifi_networks_.erase(iter); | |
| 3868 | 3913 |
| 3914 if (remembered_network->type() == TYPE_WIFI) { |
| 3915 WifiNetworkVector::iterator iter = std::find( |
| 3916 remembered_wifi_networks_.begin(), |
| 3917 remembered_wifi_networks_.end(), |
| 3918 remembered_network); |
| 3919 if (iter != remembered_wifi_networks_.end()) |
| 3920 remembered_wifi_networks_.erase(iter); |
| 3921 } else if (remembered_network->type() == TYPE_VPN) { |
| 3922 VirtualNetworkVector::iterator iter = std::find( |
| 3923 remembered_virtual_networks_.begin(), |
| 3924 remembered_virtual_networks_.end(), |
| 3925 remembered_network); |
| 3926 if (iter != remembered_virtual_networks_.end()) |
| 3927 remembered_virtual_networks_.erase(iter); |
| 3928 } |
| 3869 // Delete remembered network from all profiles it is in. | 3929 // Delete remembered network from all profiles it is in. |
| 3870 for (NetworkProfileList::iterator iter = profile_list_.begin(); | 3930 for (NetworkProfileList::iterator iter = profile_list_.begin(); |
| 3871 iter != profile_list_.end(); ++iter) { | 3931 iter != profile_list_.end(); ++iter) { |
| 3872 NetworkProfile& profile = *iter; | 3932 NetworkProfile& profile = *iter; |
| 3873 NetworkProfile::ServiceList::iterator found = | 3933 NetworkProfile::ServiceList::iterator found = |
| 3874 profile.services.find(remembered_network->service_path()); | 3934 profile.services.find(remembered_network->service_path()); |
| 3875 if (found != profile.services.end()) { | 3935 if (found != profile.services.end()) { |
| 3876 VLOG(1) << "Deleting: " << remembered_network->service_path() | 3936 VLOG(1) << "Deleting: " << remembered_network->service_path() |
| 3877 << " From: " << profile.path; | 3937 << " From: " << profile.path; |
| 3878 chromeos::DeleteServiceFromProfile( | 3938 chromeos::DeleteServiceFromProfile( |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4087 | 4147 |
| 4088 network->ParseInfo(info); // virtual. | 4148 network->ParseInfo(info); // virtual. |
| 4089 | 4149 |
| 4090 if (!network->unique_id().empty()) | 4150 if (!network->unique_id().empty()) |
| 4091 network_unique_id_map_[network->unique_id()] = network; | 4151 network_unique_id_map_[network->unique_id()] = network; |
| 4092 | 4152 |
| 4093 SetProfileTypeFromPath(network); | 4153 SetProfileTypeFromPath(network); |
| 4094 | 4154 |
| 4095 UpdateActiveNetwork(network); | 4155 UpdateActiveNetwork(network); |
| 4096 | 4156 |
| 4157 // Copy remembered credentials if required. |
| 4158 Network* remembered = FindRememberedFromNetwork(network); |
| 4159 if (remembered) |
| 4160 network->CopyCredentialsFromRemembered(remembered); |
| 4161 |
| 4097 // Find and erase entry in update_requests, and set network priority. | 4162 // Find and erase entry in update_requests, and set network priority. |
| 4098 PriorityMap::iterator found2 = network_update_requests_.find(service_path); | 4163 PriorityMap::iterator found2 = network_update_requests_.find(service_path); |
| 4099 if (found2 != network_update_requests_.end()) { | 4164 if (found2 != network_update_requests_.end()) { |
| 4100 network->priority_order_ = found2->second; | 4165 network->priority_order_ = found2->second; |
| 4101 network_update_requests_.erase(found2); | 4166 network_update_requests_.erase(found2); |
| 4102 if (network_update_requests_.empty()) { | 4167 if (network_update_requests_.empty()) { |
| 4103 // Clear wifi_scanning_ when we have no pending requests. | 4168 // Clear wifi_scanning_ when we have no pending requests. |
| 4104 wifi_scanning_ = false; | 4169 wifi_scanning_ = false; |
| 4105 } | 4170 } |
| 4106 } else { | 4171 } else { |
| 4107 // TODO(stevenjb): Enable warning once UpdateNetworkServiceList is fixed. | 4172 // TODO(stevenjb): Enable warning once UpdateNetworkServiceList is fixed. |
| 4108 // LOG(WARNING) << "ParseNetwork called with no update request entry: " | 4173 // LOG(WARNING) << "ParseNetwork called with no update request entry: " |
| 4109 // << service_path; | 4174 // << service_path; |
| 4110 } | 4175 } |
| 4111 | 4176 |
| 4112 VLOG(1) << "ParseNetwork: " << network->name() | 4177 VLOG(1) << "ParseNetwork: " << network->name() |
| 4113 << " Path: " << network->service_path() | 4178 << " Path: " << network->service_path() |
| 4114 << " Profile: " << network->profile_path_; | 4179 << " Profile: " << network->profile_path_; |
| 4115 NotifyNetworkManagerChanged(false); // Not forced. | 4180 NotifyNetworkManagerChanged(false); // Not forced. |
| 4116 return network; | 4181 return network; |
| 4117 } | 4182 } |
| 4118 | 4183 |
| 4119 // Returns NULL if |service_path| refers to a network that is not a | 4184 // Returns NULL if |service_path| refers to a network that is not a |
| 4120 // remembered type. Called from RememberedNetworkServiceUpdate. | 4185 // remembered type. Called from RememberedNetworkServiceUpdate. |
| 4121 Network* ParseRememberedNetwork(const std::string& service_path, | 4186 Network* ParseRememberedNetwork(const std::string& service_path, |
| 4122 const DictionaryValue* info) { | 4187 const DictionaryValue* info) { |
| 4123 Network* network; | 4188 Network* remembered; |
| 4124 NetworkMap::iterator found = remembered_network_map_.find(service_path); | 4189 NetworkMap::iterator found = remembered_network_map_.find(service_path); |
| 4125 if (found != remembered_network_map_.end()) { | 4190 if (found != remembered_network_map_.end()) { |
| 4126 network = found->second; | 4191 remembered = found->second; |
| 4127 } else { | 4192 } else { |
| 4128 ConnectionType type = ParseTypeFromDictionary(info); | 4193 ConnectionType type = ParseTypeFromDictionary(info); |
| 4129 if (type == TYPE_WIFI) { | 4194 if (type == TYPE_WIFI || type == TYPE_VPN) { |
| 4130 network = CreateNewNetwork(type, service_path); | 4195 remembered = CreateNewNetwork(type, service_path); |
| 4131 WifiNetwork* wifi = static_cast<WifiNetwork*>(network); | 4196 AddRememberedNetwork(remembered); |
| 4132 AddRememberedWifiNetwork(wifi); | |
| 4133 } else { | 4197 } else { |
| 4134 VLOG(1) << "Ignoring remembered network: " << service_path | 4198 VLOG(1) << "Ignoring remembered network: " << service_path |
| 4135 << " Type: " << ConnectionTypeToString(type); | 4199 << " Type: " << ConnectionTypeToString(type); |
| 4136 return NULL; | 4200 return NULL; |
| 4137 } | 4201 } |
| 4138 } | 4202 } |
| 4139 network->ParseInfo(info); // virtual. | 4203 remembered->ParseInfo(info); // virtual. |
| 4140 | 4204 |
| 4141 SetProfileTypeFromPath(network); | 4205 SetProfileTypeFromPath(remembered); |
| 4142 | 4206 |
| 4143 VLOG(1) << "ParseRememberedNetwork: " << network->name() | 4207 VLOG(1) << "ParseRememberedNetwork: " << remembered->name() |
| 4144 << " Path: " << network->service_path() | 4208 << " Path: " << remembered->service_path() |
| 4145 << " Profile: " << network->profile_path_; | 4209 << " Profile: " << remembered->profile_path_; |
| 4146 NotifyNetworkManagerChanged(false); // Not forced. | 4210 NotifyNetworkManagerChanged(false); // Not forced. |
| 4147 return network; | 4211 |
| 4212 if (remembered->type() == TYPE_VPN) { |
| 4213 // VPNs are only stored in profiles. If we don't have a network for it, |
| 4214 // request one. |
| 4215 if (!FindNetworkFromRemembered(remembered)) { |
| 4216 VirtualNetwork* vpn = static_cast<VirtualNetwork*>(remembered); |
| 4217 std::string provider_type = ProviderTypeToString(vpn->provider_type()); |
| 4218 VLOG(1) << "Requesting VPN: " << vpn->name() |
| 4219 << " Server: " << vpn->server_hostname() |
| 4220 << " Type: " << provider_type; |
| 4221 RequestVirtualNetwork( |
| 4222 vpn->name().c_str(), |
| 4223 vpn->server_hostname().c_str(), |
| 4224 provider_type.c_str(), |
| 4225 NetworkServiceUpdate, |
| 4226 this); |
| 4227 } |
| 4228 } |
| 4229 |
| 4230 return remembered; |
| 4148 } | 4231 } |
| 4149 | 4232 |
| 4150 void SetProfileType(Network* network, NetworkProfileType type) { | 4233 void SetProfileType(Network* network, NetworkProfileType type) { |
| 4151 if (type == PROFILE_NONE) { | 4234 if (type == PROFILE_NONE) { |
| 4152 network->SetProfilePath(std::string()); | 4235 network->SetProfilePath(std::string()); |
| 4153 network->set_profile_type(PROFILE_NONE); | 4236 network->set_profile_type(PROFILE_NONE); |
| 4154 } else { | 4237 } else { |
| 4155 std::string profile_path = GetProfilePath(type); | 4238 std::string profile_path = GetProfilePath(type); |
| 4156 if (!profile_path.empty()) { | 4239 if (!profile_path.empty()) { |
| 4157 network->SetProfilePath(profile_path); | 4240 network->SetProfilePath(profile_path); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4199 active_cellular_ = NULL; | 4282 active_cellular_ = NULL; |
| 4200 active_virtual_ = NULL; | 4283 active_virtual_ = NULL; |
| 4201 wifi_networks_.clear(); | 4284 wifi_networks_.clear(); |
| 4202 cellular_networks_.clear(); | 4285 cellular_networks_.clear(); |
| 4203 virtual_networks_.clear(); | 4286 virtual_networks_.clear(); |
| 4204 } | 4287 } |
| 4205 | 4288 |
| 4206 void ClearRememberedNetworks() { | 4289 void ClearRememberedNetworks() { |
| 4207 remembered_network_map_.clear(); | 4290 remembered_network_map_.clear(); |
| 4208 remembered_wifi_networks_.clear(); | 4291 remembered_wifi_networks_.clear(); |
| 4292 remembered_virtual_networks_.clear(); |
| 4209 } | 4293 } |
| 4210 | 4294 |
| 4211 void DeleteNetworks() { | 4295 void DeleteNetworks() { |
| 4212 STLDeleteValues(&network_map_); | 4296 STLDeleteValues(&network_map_); |
| 4213 ClearNetworks(); | 4297 ClearNetworks(); |
| 4214 } | 4298 } |
| 4215 | 4299 |
| 4216 void DeleteRememberedNetworks() { | 4300 void DeleteRememberedNetworks() { |
| 4217 STLDeleteValues(&remembered_network_map_); | 4301 STLDeleteValues(&remembered_network_map_); |
| 4218 ClearRememberedNetworks(); | 4302 ClearRememberedNetworks(); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4691 active_cellular_ = cellular1; | 4775 active_cellular_ = cellular1; |
| 4692 | 4776 |
| 4693 CellularNetwork* cellular2 = new CellularNetwork("fc2"); | 4777 CellularNetwork* cellular2 = new CellularNetwork("fc2"); |
| 4694 cellular2->set_name("Fake Cellular 2"); | 4778 cellular2->set_name("Fake Cellular 2"); |
| 4695 cellular2->set_strength(70); | 4779 cellular2->set_strength(70); |
| 4696 cellular2->set_connected(true); | 4780 cellular2->set_connected(true); |
| 4697 cellular2->set_activation_state(ACTIVATION_STATE_ACTIVATED); | 4781 cellular2->set_activation_state(ACTIVATION_STATE_ACTIVATED); |
| 4698 cellular2->set_network_technology(NETWORK_TECHNOLOGY_UMTS); | 4782 cellular2->set_network_technology(NETWORK_TECHNOLOGY_UMTS); |
| 4699 AddNetwork(cellular2); | 4783 AddNetwork(cellular2); |
| 4700 | 4784 |
| 4701 // Remembered Networks | |
| 4702 DeleteRememberedNetworks(); | |
| 4703 NetworkProfile profile("default", PROFILE_SHARED); | |
| 4704 profile.services.insert("fw2"); | |
| 4705 profile_list_.push_back(profile); | |
| 4706 WifiNetwork* remembered_wifi2 = new WifiNetwork("fw2"); | |
| 4707 remembered_wifi2->set_name("Fake Wifi 2"); | |
| 4708 remembered_wifi2->set_strength(70); | |
| 4709 remembered_wifi2->set_connected(true); | |
| 4710 remembered_wifi2->set_encryption(SECURITY_WEP); | |
| 4711 AddRememberedWifiNetwork(remembered_wifi2); | |
| 4712 | |
| 4713 // VPNs. | 4785 // VPNs. |
| 4714 VirtualNetwork* vpn1 = new VirtualNetwork("fv1"); | 4786 VirtualNetwork* vpn1 = new VirtualNetwork("fv1"); |
| 4715 vpn1->set_name("Fake VPN Provider 1"); | 4787 vpn1->set_name("Fake VPN Provider 1"); |
| 4716 vpn1->set_server_hostname("vpn1server.fake.com"); | 4788 vpn1->set_server_hostname("vpn1server.fake.com"); |
| 4717 vpn1->set_provider_type(VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_PSK); | 4789 vpn1->set_provider_type(VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_PSK); |
| 4718 vpn1->set_username("VPN User 1"); | 4790 vpn1->set_username("VPN User 1"); |
| 4719 vpn1->set_connected(false); | 4791 vpn1->set_connected(false); |
| 4720 AddNetwork(vpn1); | 4792 AddNetwork(vpn1); |
| 4721 | 4793 |
| 4722 VirtualNetwork* vpn2 = new VirtualNetwork("fv2"); | 4794 VirtualNetwork* vpn2 = new VirtualNetwork("fv2"); |
| 4723 vpn2->set_name("Fake VPN Provider 2"); | 4795 vpn2->set_name("Fake VPN Provider 2"); |
| 4724 vpn2->set_server_hostname("vpn2server.fake.com"); | 4796 vpn2->set_server_hostname("vpn2server.fake.com"); |
| 4725 vpn2->set_provider_type(VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_USER_CERT); | 4797 vpn2->set_provider_type(VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_USER_CERT); |
| 4726 vpn2->set_username("VPN User 2"); | 4798 vpn2->set_username("VPN User 2"); |
| 4727 vpn2->set_connected(true); | 4799 vpn2->set_connected(true); |
| 4728 AddNetwork(vpn2); | 4800 AddNetwork(vpn2); |
| 4729 | 4801 |
| 4730 VirtualNetwork* vpn3 = new VirtualNetwork("fv3"); | 4802 VirtualNetwork* vpn3 = new VirtualNetwork("fv3"); |
| 4731 vpn3->set_name("Fake VPN Provider 3"); | 4803 vpn3->set_name("Fake VPN Provider 3"); |
| 4732 vpn3->set_server_hostname("vpn3server.fake.com"); | 4804 vpn3->set_server_hostname("vpn3server.fake.com"); |
| 4733 vpn3->set_provider_type(VirtualNetwork::PROVIDER_TYPE_OPEN_VPN); | 4805 vpn3->set_provider_type(VirtualNetwork::PROVIDER_TYPE_OPEN_VPN); |
| 4734 vpn3->set_connected(false); | 4806 vpn3->set_connected(false); |
| 4735 AddNetwork(vpn3); | 4807 AddNetwork(vpn3); |
| 4736 | 4808 |
| 4737 active_virtual_ = vpn2; | 4809 active_virtual_ = vpn2; |
| 4738 | 4810 |
| 4811 // Remembered Networks |
| 4812 DeleteRememberedNetworks(); |
| 4813 NetworkProfile profile("default", PROFILE_SHARED); |
| 4814 profile.services.insert("fw2"); |
| 4815 profile.services.insert("fv2"); |
| 4816 profile_list_.push_back(profile); |
| 4817 WifiNetwork* remembered_wifi2 = new WifiNetwork("fw2"); |
| 4818 remembered_wifi2->set_name("Fake Wifi 2"); |
| 4819 remembered_wifi2->set_encryption(SECURITY_WEP); |
| 4820 AddRememberedNetwork(remembered_wifi2); |
| 4821 VirtualNetwork* remembered_vpn2 = new VirtualNetwork("fv2"); |
| 4822 remembered_vpn2->set_name("Fake VPN Provider 2"); |
| 4823 remembered_vpn2->set_server_hostname("vpn2server.fake.com"); |
| 4824 remembered_vpn2->set_provider_type( |
| 4825 VirtualNetwork::PROVIDER_TYPE_L2TP_IPSEC_USER_CERT); |
| 4826 remembered_vpn2->set_connected(true); |
| 4827 AddRememberedNetwork(remembered_vpn2); |
| 4828 |
| 4739 wifi_scanning_ = false; | 4829 wifi_scanning_ = false; |
| 4740 offline_mode_ = false; | 4830 offline_mode_ = false; |
| 4741 } | 4831 } |
| 4742 | 4832 |
| 4743 // Network manager observer list | 4833 // Network manager observer list |
| 4744 ObserverList<NetworkManagerObserver> network_manager_observers_; | 4834 ObserverList<NetworkManagerObserver> network_manager_observers_; |
| 4745 | 4835 |
| 4746 // Cellular data plan observer list | 4836 // Cellular data plan observer list |
| 4747 ObserverList<CellularDataPlanObserver> data_plan_observers_; | 4837 ObserverList<CellularDataPlanObserver> data_plan_observers_; |
| 4748 | 4838 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4805 | 4895 |
| 4806 // The current connected (or connecting) cellular network. | 4896 // The current connected (or connecting) cellular network. |
| 4807 CellularNetwork* active_cellular_; | 4897 CellularNetwork* active_cellular_; |
| 4808 | 4898 |
| 4809 // The list of available virtual networks. | 4899 // The list of available virtual networks. |
| 4810 VirtualNetworkVector virtual_networks_; | 4900 VirtualNetworkVector virtual_networks_; |
| 4811 | 4901 |
| 4812 // The current connected (or connecting) virtual network. | 4902 // The current connected (or connecting) virtual network. |
| 4813 VirtualNetwork* active_virtual_; | 4903 VirtualNetwork* active_virtual_; |
| 4814 | 4904 |
| 4905 // The remembered virtual networks. |
| 4906 VirtualNetworkVector remembered_virtual_networks_; |
| 4907 |
| 4815 // The path of the active profile (for retrieving remembered services). | 4908 // The path of the active profile (for retrieving remembered services). |
| 4816 std::string active_profile_path_; | 4909 std::string active_profile_path_; |
| 4817 | 4910 |
| 4818 // The current available network devices. Bitwise flag of ConnectionTypes. | 4911 // The current available network devices. Bitwise flag of ConnectionTypes. |
| 4819 int available_devices_; | 4912 int available_devices_; |
| 4820 | 4913 |
| 4821 // The current enabled network devices. Bitwise flag of ConnectionTypes. | 4914 // The current enabled network devices. Bitwise flag of ConnectionTypes. |
| 4822 int enabled_devices_; | 4915 int enabled_devices_; |
| 4823 | 4916 |
| 4824 // The current connected network devices. Bitwise flag of ConnectionTypes. | 4917 // The current connected network devices. Bitwise flag of ConnectionTypes. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4931 } | 5024 } |
| 4932 virtual const WifiNetworkVector& remembered_wifi_networks() const { | 5025 virtual const WifiNetworkVector& remembered_wifi_networks() const { |
| 4933 return wifi_networks_; | 5026 return wifi_networks_; |
| 4934 } | 5027 } |
| 4935 virtual const CellularNetworkVector& cellular_networks() const { | 5028 virtual const CellularNetworkVector& cellular_networks() const { |
| 4936 return cellular_networks_; | 5029 return cellular_networks_; |
| 4937 } | 5030 } |
| 4938 virtual const VirtualNetworkVector& virtual_networks() const { | 5031 virtual const VirtualNetworkVector& virtual_networks() const { |
| 4939 return virtual_networks_; | 5032 return virtual_networks_; |
| 4940 } | 5033 } |
| 5034 virtual const VirtualNetworkVector& remembered_virtual_networks() const { |
| 5035 return virtual_networks_; |
| 5036 } |
| 4941 virtual bool has_cellular_networks() const { | 5037 virtual bool has_cellular_networks() const { |
| 4942 return cellular_networks_.begin() != cellular_networks_.end(); | 5038 return cellular_networks_.begin() != cellular_networks_.end(); |
| 4943 } | 5039 } |
| 4944 ///////////////////////////////////////////////////////////////////////////// | 5040 ///////////////////////////////////////////////////////////////////////////// |
| 4945 | 5041 |
| 4946 virtual const NetworkDevice* FindNetworkDeviceByPath( | 5042 virtual const NetworkDevice* FindNetworkDeviceByPath( |
| 4947 const std::string& path) const { return NULL; } | 5043 const std::string& path) const { return NULL; } |
| 4948 virtual const NetworkDevice* FindCellularDevice() const { | 5044 virtual const NetworkDevice* FindCellularDevice() const { |
| 4949 return NULL; | 5045 return NULL; |
| 4950 } | 5046 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5013 virtual void ConnectToVirtualNetworkCert( | 5109 virtual void ConnectToVirtualNetworkCert( |
| 5014 const std::string& service_name, | 5110 const std::string& service_name, |
| 5015 const std::string& server_hostname, | 5111 const std::string& server_hostname, |
| 5016 const std::string& server_ca_cert_nss_nickname, | 5112 const std::string& server_ca_cert_nss_nickname, |
| 5017 const std::string& client_cert_pkcs11_id, | 5113 const std::string& client_cert_pkcs11_id, |
| 5018 const std::string& username, | 5114 const std::string& username, |
| 5019 const std::string& user_passphrase) {} | 5115 const std::string& user_passphrase) {} |
| 5020 virtual void SignalCellularPlanPayment() {} | 5116 virtual void SignalCellularPlanPayment() {} |
| 5021 virtual bool HasRecentCellularPlanPayment() { return false; } | 5117 virtual bool HasRecentCellularPlanPayment() { return false; } |
| 5022 virtual void DisconnectFromNetwork(const Network* network) {} | 5118 virtual void DisconnectFromNetwork(const Network* network) {} |
| 5023 virtual void ForgetWifiNetwork(const std::string& service_path) {} | 5119 virtual void ForgetNetwork(const std::string& service_path) {} |
| 5024 virtual void SetNetworkProfile(const std::string& service_path, | 5120 virtual void SetNetworkProfile(const std::string& service_path, |
| 5025 NetworkProfileType type) {} | 5121 NetworkProfileType type) {} |
| 5026 virtual std::string GetCellularHomeCarrierId() const { return std::string(); } | 5122 virtual std::string GetCellularHomeCarrierId() const { return std::string(); } |
| 5027 virtual bool ethernet_available() const { return true; } | 5123 virtual bool ethernet_available() const { return true; } |
| 5028 virtual bool wifi_available() const { return false; } | 5124 virtual bool wifi_available() const { return false; } |
| 5029 virtual bool cellular_available() const { return false; } | 5125 virtual bool cellular_available() const { return false; } |
| 5030 virtual bool ethernet_enabled() const { return true; } | 5126 virtual bool ethernet_enabled() const { return true; } |
| 5031 virtual bool wifi_enabled() const { return false; } | 5127 virtual bool wifi_enabled() const { return false; } |
| 5032 virtual bool cellular_enabled() const { return false; } | 5128 virtual bool cellular_enabled() const { return false; } |
| 5033 virtual bool wifi_scanning() const { return false; } | 5129 virtual bool wifi_scanning() const { return false; } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 5063 return new NetworkLibraryStubImpl(); | 5159 return new NetworkLibraryStubImpl(); |
| 5064 else | 5160 else |
| 5065 return new NetworkLibraryImpl(); | 5161 return new NetworkLibraryImpl(); |
| 5066 } | 5162 } |
| 5067 | 5163 |
| 5068 } // namespace chromeos | 5164 } // namespace chromeos |
| 5069 | 5165 |
| 5070 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 5166 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
| 5071 // won't be deleted until it's last InvokeLater is run. | 5167 // won't be deleted until it's last InvokeLater is run. |
| 5072 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); | 5168 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImpl); |
| OLD | NEW |