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

Unified Diff: crypto/nss_util.cc

Issue 112533002: Add ClientCertStoreChromeOS which only returns the certs for a given user. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: explicits Created 7 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
« no previous file with comments | « crypto/nss_util.h ('k') | net/cert/nss_profile_filter_chromeos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/nss_util.cc
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index 5b8c6f5173bd3dc060b88767755cfaaba164d2e4..571ee1fdcbb5626af04ed1b8d6f74a8a94dd6a4d 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -31,7 +31,6 @@
#include "base/environment.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
-#include "base/files/scoped_temp_dir.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -470,6 +469,14 @@ class NSSInitSingleton {
return chromeos_user_map_[username_hash]->GetPrivateSlot(callback);
}
+
+ void CloseTestChromeOSUser(const std::string& username_hash) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ ChromeOSUserMap::iterator i = chromeos_user_map_.find(username_hash);
+ DCHECK(i != chromeos_user_map_.end());
+ delete i->second;
+ chromeos_user_map_.erase(i);
+ }
#endif // defined(OS_CHROMEOS)
@@ -983,6 +990,27 @@ bool InitializeTPMToken(int token_slot_id) {
return g_nss_singleton.Get().InitializeTPMToken(token_slot_id);
}
+ScopedTestNSSChromeOSUser::ScopedTestNSSChromeOSUser(
+ const std::string& username_hash)
+ : username_hash_(username_hash), constructed_successfully_(false) {
+ if (!temp_dir_.CreateUniqueTempDir())
+ return;
+ constructed_successfully_ =
+ InitializeNSSForChromeOSUser(username_hash,
+ username_hash,
+ false /* is_primary_user */,
+ temp_dir_.path());
+}
+
+ScopedTestNSSChromeOSUser::~ScopedTestNSSChromeOSUser() {
+ if (constructed_successfully_)
+ g_nss_singleton.Get().CloseTestChromeOSUser(username_hash_);
+}
+
+void ScopedTestNSSChromeOSUser::FinishInit() {
+ InitializePrivateSoftwareSlotForChromeOSUser(username_hash_);
+}
+
bool InitializeNSSForChromeOSUser(
const std::string& email,
const std::string& username_hash,
« no previous file with comments | « crypto/nss_util.h ('k') | net/cert/nss_profile_filter_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698