Commit 6cc5d5a1 authored by stevenjb@chromium.org's avatar stevenjb@chromium.org

Fix minor bugs found in NetworkConnectionHandler code

* Removed an unused member variable
* Use GetStringWithoutPathExpansion consistently except where expansion is desired
* Use kProviderTypeProperty (with expansion) instead of kTypeProperty

BUG=247104

Review URL: https://chromiumcodereview.appspot.com/17167010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208065 0039d316-1c4b-4281-b951-d872f2087c98
parent ead61a43
...@@ -72,13 +72,15 @@ bool VPNIsConfigured(const std::string& service_path, ...@@ -72,13 +72,15 @@ bool VPNIsConfigured(const std::string& service_path,
} }
std::string provider_type; std::string provider_type;
// Note: we use Value path expansion to extract Provider.Type. // Note: we use Value path expansion to extract Provider.Type.
if (!properties->GetString(flimflam::kTypeProperty, &provider_type)) { if (!properties->GetStringWithoutPathExpansion(
flimflam::kTypeProperty, &provider_type)) {
NET_LOG_ERROR("VPN Provider Type not present", service_path); NET_LOG_ERROR("VPN Provider Type not present", service_path);
return false; return false;
} }
if (provider_type == flimflam::kProviderOpenVpn) { if (provider_type == flimflam::kProviderOpenVpn) {
std::string hostname; std::string hostname;
properties->GetString(flimflam::kHostProperty, &hostname); properties->GetStringWithoutPathExpansion(
flimflam::kHostProperty, &hostname);
if (hostname.empty()) { if (hostname.empty()) {
NET_LOG_EVENT("OpenVPN: No hostname", service_path); NET_LOG_EVENT("OpenVPN: No hostname", service_path);
return false; return false;
...@@ -220,7 +222,7 @@ void NetworkConnectionHandler::OnCertificatesLoaded( ...@@ -220,7 +222,7 @@ void NetworkConnectionHandler::OnCertificatesLoaded(
true /* ignore_error_state */); true /* ignore_error_state */);
} else if (initial_load) { } else if (initial_load) {
// Once certificates have loaded, connect to the "best" available network. // Once certificates have loaded, connect to the "best" available network.
NetworkHandler::Get()->network_state_handler()->ConnectToBestWifiNetwork(); network_state_handler_->ConnectToBestWifiNetwork();
} }
} }
...@@ -399,7 +401,8 @@ void NetworkConnectionHandler::VerifyConfiguredAndConnect( ...@@ -399,7 +401,8 @@ void NetworkConnectionHandler::VerifyConfiguredAndConnect(
if (network->type() == flimflam::kTypeVPN) { if (network->type() == flimflam::kTypeVPN) {
std::string provider_type; std::string provider_type;
properties.GetString(flimflam::kTypeProperty, &provider_type); // Get 'Type' property from 'Provider' dictionary (use expansion).
properties.GetString(flimflam::kProviderTypeProperty, &provider_type);
if (provider_type == flimflam::kProviderOpenVpn) { if (provider_type == flimflam::kProviderOpenVpn) {
config_properties.SetStringWithoutPathExpansion( config_properties.SetStringWithoutPathExpansion(
flimflam::kOpenVPNClientCertSlotProperty, tpm_slot); flimflam::kOpenVPNClientCertSlotProperty, tpm_slot);
......
...@@ -169,7 +169,6 @@ class CHROMEOS_EXPORT NetworkConnectionHandler ...@@ -169,7 +169,6 @@ class CHROMEOS_EXPORT NetworkConnectionHandler
// Local references to the associated handler instances. // Local references to the associated handler instances.
CertLoader* cert_loader_; CertLoader* cert_loader_;
NetworkStateHandler* network_state_handler_; NetworkStateHandler* network_state_handler_;
NetworkProfileHandler* network_profile_handler_;
NetworkConfigurationHandler* network_configuration_handler_; NetworkConfigurationHandler* network_configuration_handler_;
// Map of pending connect requests, used to prevent repeated attempts while // Map of pending connect requests, used to prevent repeated attempts while
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment