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

Unified Diff: chrome/browser/chromeos/cros/onc_network_parser.h

Issue 8566056: This applies GUIDs to certificate and key nicknames when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More review changes Created 9 years 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
Index: chrome/browser/chromeos/cros/onc_network_parser.h
diff --git a/chrome/browser/chromeos/cros/onc_network_parser.h b/chrome/browser/chromeos/cros/onc_network_parser.h
index 2c717aee21864a4ccabfbc97ec6b046ace2fde0d..c3d1b70c036c6a1999b9ea12f34272f224cf8a49 100644
--- a/chrome/browser/chromeos/cros/onc_network_parser.h
+++ b/chrome/browser/chromeos/cros/onc_network_parser.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/compiler_specific.h" // for OVERRIDE
+#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/cros/network_parser.h"
@@ -18,6 +19,11 @@ class ListValue;
class Value;
}
+namespace net {
+class X509Certificate;
+typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
+}
+
namespace chromeos {
// This is the network parser that parses the data from an Open Network
@@ -35,16 +41,17 @@ class OncNetworkParser : public NetworkParser {
// Returns the number of networks in the "NetworkConfigs" list.
int GetNetworkConfigsSize() const;
- // Returns the number of certificates in the "Certificates" list.
- int GetCertificatesSize() const;
-
// Call to create the network by parsing network config in the nth position.
// (0-based). Returns NULL if there's a parse error or if n is out of range.
Network* ParseNetwork(int n);
+ // Returns the number of certificates in the "Certificates" list.
+ int GetCertificatesSize() const;
+
// Call to parse and import the nth certificate in the certificate
- // list. Returns false on failure.
- bool ParseCertificate(int n);
+ // list into the certificate store. Returns a NULL refptr if
+ // there's a parse error or if n is out of range.
+ scoped_refptr<net::X509Certificate> ParseCertificate(int n);
virtual Network* CreateNetworkFromInfo(const std::string& service_path,
const base::DictionaryValue& info) OVERRIDE;
@@ -67,13 +74,21 @@ class OncNetworkParser : public NetworkParser {
std::string GetGuidFromDictionary(const base::DictionaryValue& info);
private:
- bool ParseServerOrCaCertificate(
+ FRIEND_TEST_ALL_PREFIXES(OncNetworkParserTest, TestAddClientCertificate);
+ FRIEND_TEST_ALL_PREFIXES(OncNetworkParserTest, TestAddServerCertificate);
+ FRIEND_TEST_ALL_PREFIXES(OncNetworkParserTest, TestAddAuthorityCertificate);
+ scoped_refptr<net::X509Certificate> ParseServerOrCaCertificate(
int cert_index,
const std::string& cert_type,
+ const std::string& guid,
base::DictionaryValue* certificate);
- bool ParseClientCertificate(
+ scoped_refptr<net::X509Certificate> ParseClientCertificate(
int cert_index,
+ const std::string& guid,
base::DictionaryValue* certificate);
+ static void ListCertsWithLabel(const std::string& label,
+ net::CertificateList* result);
+ static bool DeleteCertAndKeyByLabel(const std::string& label);
// Error message from the JSON parser, if applicable.
std::string parse_error_;

Powered by Google App Engine
This is Rietveld 408576698