summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-06 20:32:59 +0000
committerpneubeck@chromium.org <pneubeck@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-06 20:32:59 +0000
commita15f140a949146c118da9847ba26ea55af71cac2 (patch)
tree458fecbc0d1733206b6e4d43f6a0193479acd782
parentc89d3dff016fe8c39e458f1f1ea0b4bd15141a5b (diff)
downloadchromium_src-a15f140a949146c118da9847ba26ea55af71cac2.zip
chromium_src-a15f140a949146c118da9847ba26ea55af71cac2.tar.gz
chromium_src-a15f140a949146c118da9847ba26ea55af71cac2.tar.bz2
Use FavoriteList in ClientCertResolver instead of NetworkList
This is required for EthernetEAP, because that one will not show up in the network list of NetworkStateHandler. BUG=126870 Review URL: https://chromiumcodereview.appspot.com/23902011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221772 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chromeos/network/client_cert_resolver.cc33
-rw-r--r--chromeos/network/client_cert_resolver.h6
-rw-r--r--chromeos/network/favorite_state.cc2
-rw-r--r--chromeos/network/favorite_state.h2
4 files changed, 20 insertions, 23 deletions
diff --git a/chromeos/network/client_cert_resolver.cc b/chromeos/network/client_cert_resolver.cc
index adbb9de..fcda9ba 100644
--- a/chromeos/network/client_cert_resolver.cc
+++ b/chromeos/network/client_cert_resolver.cc
@@ -20,8 +20,8 @@
#include "chromeos/dbus/shill_service_client.h"
#include "chromeos/network/certificate_pattern.h"
#include "chromeos/network/client_cert_util.h"
+#include "chromeos/network/favorite_state.h"
#include "chromeos/network/managed_network_configuration_handler.h"
-#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_handler.h"
#include "chromeos/network/network_ui_data.h"
#include "chromeos/network/onc/onc_constants.h"
@@ -299,18 +299,12 @@ void ClientCertResolver::NetworkListChanged() {
std::set<std::string> old_resolved_networks;
old_resolved_networks.swap(resolved_networks_);
- NetworkStateList networks;
- network_state_handler_->GetNetworkList(&networks);
+ FavoriteStateList networks;
+ network_state_handler_->GetFavoriteList(&networks);
- NetworkStateList networks_to_check;
- for (NetworkStateList::const_iterator it = networks.begin();
+ FavoriteStateList networks_to_check;
+ for (FavoriteStateList::const_iterator it = networks.begin();
it != networks.end(); ++it) {
- // If this network is not managed, it cannot have a ClientCertPattern.
- // We do this check here additionally to ResolveNetworks because it's cheap
- // and prevents |resolved_networks_| from becoming too large.
- if ((*it)->guid().empty())
- continue;
-
const std::string& service_path = (*it)->path();
if (ContainsKey(old_resolved_networks, service_path)) {
resolved_networks_.insert(service_path);
@@ -329,8 +323,8 @@ void ClientCertResolver::OnCertificatesLoaded(
if (!ClientCertificatesLoaded())
return;
// Compare all networks with all certificates.
- NetworkStateList networks;
- network_state_handler_->GetNetworkList(&networks);
+ FavoriteStateList networks;
+ network_state_handler_->GetFavoriteList(&networks);
ResolveNetworks(networks);
}
@@ -339,27 +333,26 @@ void ClientCertResolver::PolicyApplied(const std::string& service_path) {
if (!ClientCertificatesLoaded())
return;
// Compare this network with all certificates.
- const NetworkState* network =
- network_state_handler_->GetNetworkState(service_path);
+ const FavoriteState* network =
+ network_state_handler_->GetFavoriteState(service_path);
if (!network) {
LOG(ERROR) << "service path '" << service_path << "' unknown.";
return;
}
- NetworkStateList networks;
+ FavoriteStateList networks;
networks.push_back(network);
ResolveNetworks(networks);
}
-void ClientCertResolver::ResolveNetworks(
- const NetworkStateList& networks) {
+void ClientCertResolver::ResolveNetworks(const FavoriteStateList& networks) {
scoped_ptr<std::vector<NetworkAndCertPattern> > networks_with_pattern(
new std::vector<NetworkAndCertPattern>);
// Filter networks with ClientCertPattern. As ClientCertPatterns can only be
// set by policy, we check there.
- for (NetworkStateList::const_iterator it = networks.begin();
+ for (FavoriteStateList::const_iterator it = networks.begin();
it != networks.end(); ++it) {
- const NetworkState* network = *it;
+ const FavoriteState* network = *it;
// In any case, don't check this network again in NetworkListChanged.
resolved_networks_.insert(network->path());
diff --git a/chromeos/network/client_cert_resolver.h b/chromeos/network/client_cert_resolver.h
index a1be963..da5fd8f 100644
--- a/chromeos/network/client_cert_resolver.h
+++ b/chromeos/network/client_cert_resolver.h
@@ -23,7 +23,7 @@ class TaskRunner;
namespace chromeos {
-class NetworkState;
+class FavoriteState;
class NetworkStateHandler;
class ManagedNetworkConfigurationHandler;
@@ -48,7 +48,7 @@ class CHROMEOS_EXPORT ClientCertResolver : public NetworkStateHandlerObserver,
const scoped_refptr<base::TaskRunner>& task_runner);
private:
- typedef std::vector<const NetworkState*> NetworkStateList;
+ typedef std::vector<const FavoriteState*> FavoriteStateList;
// NetworkStateHandlerObserver overrides
virtual void NetworkListChanged() OVERRIDE;
@@ -63,7 +63,7 @@ class CHROMEOS_EXPORT ClientCertResolver : public NetworkStateHandlerObserver,
// Check which networks of |networks| are configured with a client certificate
// pattern. Search for certificates, on the worker thread, and configure the
// networks for which a matching cert is found (see ConfigureCertificates).
- void ResolveNetworks(const NetworkStateList& networks);
+ void ResolveNetworks(const FavoriteStateList& networks);
// |matches| contains networks for which a matching certificate was found.
// Configures these networks.
diff --git a/chromeos/network/favorite_state.cc b/chromeos/network/favorite_state.cc
index a365a91..96fc74f 100644
--- a/chromeos/network/favorite_state.cc
+++ b/chromeos/network/favorite_state.cc
@@ -37,6 +37,8 @@ bool FavoriteState::PropertyChanged(const std::string& key,
}
ui_data_ = *new_ui_data;
return true;
+ } else if (key == flimflam::kGuidProperty) {
+ return GetStringValue(key, value, &guid_);
}
return false;
}
diff --git a/chromeos/network/favorite_state.h b/chromeos/network/favorite_state.h
index 53f9281..1eaadf5 100644
--- a/chromeos/network/favorite_state.h
+++ b/chromeos/network/favorite_state.h
@@ -32,6 +32,7 @@ class CHROMEOS_EXPORT FavoriteState : public ManagedState {
const std::string& profile_path() const { return profile_path_; }
bool is_favorite() const { return !profile_path_.empty(); }
const NetworkUIData& ui_data() const { return ui_data_; }
+ const std::string& guid() const { return guid_; }
// Returns true if the ONC source is a device or user policy.
bool IsManaged() const;
@@ -42,6 +43,7 @@ class CHROMEOS_EXPORT FavoriteState : public ManagedState {
private:
std::string profile_path_;
NetworkUIData ui_data_;
+ std::string guid_;
DISALLOW_COPY_AND_ASSIGN(FavoriteState);
};