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

Unified Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 2858113003: Enable device-wide EAP-TLS networks (Closed)
Patch Set: initial_load only true on initial load, added tests, fixed comments. Created 3 years, 7 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
Index: chrome/browser/chromeos/chrome_browser_main_chromeos.cc
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index 2dbda14ecf242471155366f32f4231e7ca0f22e9..bfaab6733340959b164b8b0cdf1d2c58f294ab1b 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -145,6 +145,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/main_function_params.h"
+#include "crypto/nss_util_internal.h"
#include "dbus/object_path.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/dbus/bluez_dbus_manager.h"
@@ -204,6 +205,36 @@ void InitializeNetworkPortalDetector() {
}
}
+void StartCertLoaderWithSystemNSSDB(net::NSSCertDatabase* system_nss_cert_db) {
+ CertLoader::Get()->StartWithSystemNSSDB(system_nss_cert_db);
+}
+
+void InitializeSystemSlotCertDatabaseOnUIThread(
+ crypto::ScopedPK11Slot system_slot) {
+ g_browser_process->platform_part()->InitializeSystemSlotCertDatabase(
+ std::move(system_slot));
+ g_browser_process->platform_part()->GetSystemSlotCertDatabase(
+ base::Bind(&StartCertLoaderWithSystemNSSDB));
+}
+
+// Called on IO Thread when the system slot has been retrieved.
+void GotSystemSlot(crypto::ScopedPK11Slot system_slot) {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::BindOnce(&InitializeSystemSlotCertDatabaseOnUIThread,
+ std::move(system_slot)));
+}
+
+// Called on IO Thread
+void InitializeSystemSlotCertDatabaseOnIOThread() {
+ auto callback = base::Bind(&GotSystemSlot);
+ crypto::ScopedPK11Slot system_nss_slot =
+ crypto::GetSystemNSSKeySlot(callback);
+ if (system_nss_slot) {
+ callback.Run(std::move(system_nss_slot));
+ }
+}
+
} // namespace
namespace internal {
@@ -469,6 +500,12 @@ void ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() {
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::IO));
+ // Initialize NSS database for system token.
+ TPMTokenLoader::Get()->EnsureStarted();
+ content::BrowserThread::PostTask(
+ content::BrowserThread::IO, FROM_HERE,
+ base::BindOnce(&InitializeSystemSlotCertDatabaseOnIOThread));
+
CrasAudioHandler::Initialize(
new AudioDevicesPrefHandlerImpl(g_browser_process->local_state()));

Powered by Google App Engine
This is Rietveld 408576698