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

Unified Diff: chrome/browser/chromeos/net/client_cert_filter_chromeos.cc

Issue 802433002: Handle empty username_hash in ClientCertFilterChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment change. Created 6 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 | « chrome/browser/chromeos/net/client_cert_filter_chromeos.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/net/client_cert_filter_chromeos.cc
diff --git a/chrome/browser/chromeos/net/client_cert_filter_chromeos.cc b/chrome/browser/chromeos/net/client_cert_filter_chromeos.cc
index 6f735b8f17eb9dcacbd3c75269e7620d00c61751..69b86b54f56f1f9c09ed291ebb65b806ea126ee3 100644
--- a/chrome/browser/chromeos/net/client_cert_filter_chromeos.cc
+++ b/chrome/browser/chromeos/net/client_cert_filter_chromeos.cc
@@ -16,6 +16,7 @@ ClientCertFilterChromeOS::ClientCertFilterChromeOS(
: init_called_(false),
use_system_slot_(use_system_slot),
username_hash_(username_hash),
+ waiting_for_private_slot_(false),
weak_ptr_factory_(this) {
}
@@ -26,16 +27,25 @@ bool ClientCertFilterChromeOS::Init(const base::Closure& callback) {
DCHECK(!init_called_);
init_called_ = true;
+ waiting_for_private_slot_ = true;
+
if (use_system_slot_) {
system_slot_ = crypto::GetSystemNSSKeySlot(
base::Bind(&ClientCertFilterChromeOS::GotSystemSlot,
weak_ptr_factory_.GetWeakPtr())).Pass();
}
+
private_slot_ =
crypto::GetPrivateSlotForChromeOSUser(
username_hash_, base::Bind(&ClientCertFilterChromeOS::GotPrivateSlot,
weak_ptr_factory_.GetWeakPtr())).Pass();
+ // If the returned slot is null, GotPrivateSlot will be called back
+ // eventually. If it is not null, the private slot was available synchronously
+ // and the callback will not be called.
+ if (private_slot_)
+ waiting_for_private_slot_ = false;
+
// Do not call back if we initialized synchronously.
if (InitIfSlotsAvailable())
return true;
@@ -60,6 +70,7 @@ void ClientCertFilterChromeOS::GotSystemSlot(
void ClientCertFilterChromeOS::GotPrivateSlot(
crypto::ScopedPK11Slot private_slot) {
+ waiting_for_private_slot_ = false;
private_slot_ = private_slot.Pass();
if (InitIfSlotsAvailable() && !init_callback_.is_null()) {
init_callback_.Run();
@@ -68,7 +79,7 @@ void ClientCertFilterChromeOS::GotPrivateSlot(
}
bool ClientCertFilterChromeOS::InitIfSlotsAvailable() {
- if ((use_system_slot_ && !system_slot_) || !private_slot_)
+ if ((use_system_slot_ && !system_slot_) || waiting_for_private_slot_)
return false;
nss_profile_filter_.Init(crypto::GetPublicSlotForChromeOSUser(username_hash_),
private_slot_.Pass(),
« no previous file with comments | « chrome/browser/chromeos/net/client_cert_filter_chromeos.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698