Index: chrome/browser/profiles/profile_io_data.cc |
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc |
index 97b27a27540f8fd4298a4dcf98bde4e35c0155aa..9261fdc6a2a2df30babbaf0ef61f61968eab5d2e 100644 |
--- a/chrome/browser/profiles/profile_io_data.cc |
+++ b/chrome/browser/profiles/profile_io_data.cc |
@@ -281,15 +281,12 @@ void StartTPMSlotInitializationOnIOThread(const std::string& username, |
void StartNSSInitOnIOThread(const std::string& username, |
const std::string& username_hash, |
- const base::FilePath& path, |
- bool is_primary_user) { |
+ const base::FilePath& path) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
DVLOG(1) << "Starting NSS init for " << username |
- << " hash:" << username_hash |
- << " is_primary_user:" << is_primary_user; |
+ << " hash:" << username_hash; |
- if (!crypto::InitializeNSSForChromeOSUser( |
- username, username_hash, is_primary_user, path)) { |
+ if (!crypto::InitializeNSSForChromeOSUser(username, username_hash, path)) { |
// If the user already exists in nss_util's map, it is already initialized |
// or in the process of being initialized. In either case, there's no need |
// to do anything. |
@@ -352,20 +349,22 @@ void ProfileIOData::InitializeOnUIThread(Profile* profile) { |
chromeos::UserManager* user_manager = chromeos::UserManager::Get(); |
if (user_manager) { |
chromeos::User* user = user_manager->GetUserByProfile(profile); |
- if (user) { |
+ // No need to initialize NSS for users with empty username hash: |
+ // Getters for a user's NSS slots always return NULL slot if the user's |
+ // username hash is empty, even when the NSS is not initialized for the |
+ // user. |
+ if (user && !user->username_hash().empty()) { |
params->username_hash = user->username_hash(); |
- bool is_primary_user = (user_manager->GetPrimaryUser() == user); |
BrowserThread::PostTask(BrowserThread::IO, |
FROM_HERE, |
base::Bind(&StartNSSInitOnIOThread, |
user->email(), |
user->username_hash(), |
- profile->GetPath(), |
- is_primary_user)); |
+ profile->GetPath())); |
} |
} |
if (params->username_hash.empty()) |
- LOG(WARNING) << "no username_hash"; |
+ LOG(WARNING) << "No username_hash; skipped NSS initialization."; |
#endif |
params->profile = profile; |