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

Unified Diff: chromeos/network/network_ui_data.cc

Issue 368233004: ONC: Cleanup client certificate related fields. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation on Win/Mac. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/certificate_pattern.cc ('k') | chromeos/network/onc/onc_normalizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/network_ui_data.cc
diff --git a/chromeos/network/network_ui_data.cc b/chromeos/network/network_ui_data.cc
index c88161a5ea8573cbdac8a29f8c2feb0feb08b5b5..27b4beb03738174e3facab27d99b3ac12abd9c01 100644
--- a/chromeos/network/network_ui_data.cc
+++ b/chromeos/network/network_ui_data.cc
@@ -148,11 +148,18 @@ void NetworkUIData::FillDictionary(base::DictionaryValue* dict) const {
namespace {
-void TranslateClientCertType(const std::string& client_cert_type,
- NetworkUIData* ui_data) {
- using namespace ::onc::certificate;
+void GetAndTranslateClientCertType(const base::DictionaryValue& onc_object,
+ NetworkUIData* ui_data) {
+ using namespace ::onc::client_cert;
+
+ std::string client_cert_type;
+ if (!onc_object.GetStringWithoutPathExpansion(kClientCertType,
+ &client_cert_type)) {
+ return;
+ }
+
ClientCertType type;
- if (client_cert_type == kNone) {
+ if (client_cert_type == kClientCertTypeNone) {
type = CLIENT_CERT_TYPE_NONE;
} else if (client_cert_type == kRef) {
type = CLIENT_CERT_TYPE_REF;
@@ -174,44 +181,16 @@ void TranslateCertificatePattern(const base::DictionaryValue& onc_object,
ui_data->set_certificate_pattern(pattern);
}
-void TranslateEAP(const base::DictionaryValue& eap,
- NetworkUIData* ui_data) {
- std::string client_cert_type;
- if (eap.GetStringWithoutPathExpansion(::onc::eap::kClientCertType,
- &client_cert_type)) {
- TranslateClientCertType(client_cert_type, ui_data);
- }
-}
-
-void TranslateIPsec(const base::DictionaryValue& ipsec,
- NetworkUIData* ui_data) {
- std::string client_cert_type;
- if (ipsec.GetStringWithoutPathExpansion(::onc::vpn::kClientCertType,
- &client_cert_type)) {
- TranslateClientCertType(client_cert_type, ui_data);
- }
-}
-
-void TranslateOpenVPN(const base::DictionaryValue& openvpn,
- NetworkUIData* ui_data) {
- std::string client_cert_type;
- if (openvpn.GetStringWithoutPathExpansion(::onc::vpn::kClientCertType,
- &client_cert_type)) {
- TranslateClientCertType(client_cert_type, ui_data);
- }
-}
-
void TranslateONCHierarchy(const onc::OncValueSignature& signature,
const base::DictionaryValue& onc_object,
NetworkUIData* ui_data) {
- if (&signature == &onc::kCertificatePatternSignature)
+ if (&signature == &onc::kCertificatePatternSignature) {
TranslateCertificatePattern(onc_object, ui_data);
- else if (&signature == &onc::kEAPSignature)
- TranslateEAP(onc_object, ui_data);
- else if (&signature == &onc::kIPsecSignature)
- TranslateIPsec(onc_object, ui_data);
- else if (&signature == &onc::kOpenVPNSignature)
- TranslateOpenVPN(onc_object, ui_data);
+ } else if (&signature == &onc::kEAPSignature ||
+ &signature == &onc::kIPsecSignature ||
+ &signature == &onc::kOpenVPNSignature) {
+ GetAndTranslateClientCertType(onc_object, ui_data);
+ }
// Recurse into nested objects.
for (base::DictionaryValue::Iterator it(onc_object); !it.IsAtEnd();
« no previous file with comments | « chromeos/network/certificate_pattern.cc ('k') | chromeos/network/onc/onc_normalizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698