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

Unified Diff: chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc

Issue 2856683002: cros: Replace "TPM" with "secure module" for machines without TPM. (Closed)
Patch Set: Use IO thread to check files. 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/login/supervised/supervised_user_creation_screen.cc
diff --git a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc
index f2ed96360680139397c09c720dc499ad04d2ba73..58feba8b1b8c84e61ccb49478c92a3c6bc14ac14 100644
--- a/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc
+++ b/chrome/browser/chromeos/login/supervised/supervised_user_creation_screen.cc
@@ -38,6 +38,7 @@
#include "chromeos/login/auth/key.h"
#include "chromeos/login/auth/user_context.h"
#include "chromeos/network/network_state.h"
+#include "components/login/secure_module_util.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_image/user_image.h"
#include "content/public/browser/browser_thread.h"
@@ -410,13 +411,18 @@ void SupervisedUserCreationScreen::OnCreationError(
case SupervisedUserCreationController::CRYPTOHOME_NO_MOUNT:
case SupervisedUserCreationController::CRYPTOHOME_FAILED_MOUNT:
case SupervisedUserCreationController::CRYPTOHOME_FAILED_TPM:
- title = l10n_util::GetStringUTF16(
- IDS_CREATE_SUPERVISED_USER_TPM_ERROR_TITLE);
- message = l10n_util::GetStringUTF16(
- IDS_CREATE_SUPERVISED_USER_TPM_ERROR);
- button = l10n_util::GetStringUTF16(
- IDS_CREATE_SUPERVISED_USER_TPM_ERROR_BUTTON);
- break;
+ if (::login::GetSecureModuleUsed() ==
+ ::login::SecureModuleUsed::UNQUERIED) {
xiyuan 2017/05/04 18:26:35 Can we hide this inside the QuerySecureModuleUsed?
sammiequon 2017/05/04 22:30:41 Thanks, yeah I wanted to move the async in there b
+ content::BrowserThread::PostTaskAndReply(
+ content::BrowserThread::IO, FROM_HERE,
xiyuan 2017/05/04 18:26:35 IO thread is actually the IPC thread. We should us
sammiequon 2017/05/04 22:30:41 Acknowledged.
+ base::BindOnce(&::login::QuerySecureModuleUsed),
+ base::BindOnce(
+ &SupervisedUserCreationScreen::UpdateSecureModuleMessages,
+ weak_factory_.GetWeakPtr()));
+ } else {
+ UpdateSecureModuleMessages();
+ }
+ return;
case SupervisedUserCreationController::CLOUD_SERVER_ERROR:
case SupervisedUserCreationController::TOKEN_WRITE_FAILED:
title = l10n_util::GetStringUTF16(
@@ -587,6 +593,35 @@ void SupervisedUserCreationScreen::OnGetSupervisedUsers(
view_->ShowExistingSupervisedUsers(ui_users.get());
}
+void SupervisedUserCreationScreen::UpdateSecureModuleMessages() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ base::string16 title;
+ base::string16 message;
+ base::string16 button;
+ switch (::login::GetSecureModuleUsed()) {
+ case ::login::SecureModuleUsed::TPM:
+ title =
+ l10n_util::GetStringUTF16(IDS_CREATE_SUPERVISED_USER_TPM_ERROR_TITLE);
+ message = l10n_util::GetStringUTF16(IDS_CREATE_SUPERVISED_USER_TPM_ERROR);
+ button = l10n_util::GetStringUTF16(
+ IDS_CREATE_SUPERVISED_USER_TPM_ERROR_BUTTON);
+ break;
+ case ::login::SecureModuleUsed::CR50:
+ title = l10n_util::GetStringUTF16(
+ IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR_TITLE);
+ message = l10n_util::GetStringUTF16(
+ IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR);
+ button = l10n_util::GetStringUTF16(
+ IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR_BUTTON);
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+ if (view_)
+ view_->ShowErrorPage(title, message, button);
+}
+
void SupervisedUserCreationScreen::OnPhotoTaken(
const std::string& raw_data) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

Powered by Google App Engine
This is Rietveld 408576698