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

Side by Side 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: Suffixed chromeos for chromeos compiling of secure_module_*. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_scre en.h" 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_scre en.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 403
404 base::string16 title; 404 base::string16 title;
405 base::string16 message; 405 base::string16 message;
406 base::string16 button; 406 base::string16 button;
407 // TODO(antrim) : find out which errors do we really have. 407 // TODO(antrim) : find out which errors do we really have.
408 // We might reuse some error messages from ordinary user flow. 408 // We might reuse some error messages from ordinary user flow.
409 switch (code) { 409 switch (code) {
410 case SupervisedUserCreationController::CRYPTOHOME_NO_MOUNT: 410 case SupervisedUserCreationController::CRYPTOHOME_NO_MOUNT:
411 case SupervisedUserCreationController::CRYPTOHOME_FAILED_MOUNT: 411 case SupervisedUserCreationController::CRYPTOHOME_FAILED_MOUNT:
412 case SupervisedUserCreationController::CRYPTOHOME_FAILED_TPM: 412 case SupervisedUserCreationController::CRYPTOHOME_FAILED_TPM:
413 title = l10n_util::GetStringUTF16( 413 ::login::GetSecureModuleUsed(
414 IDS_CREATE_SUPERVISED_USER_TPM_ERROR_TITLE); 414 base::Bind(&SupervisedUserCreationScreen::UpdateSecureModuleMessages,
415 message = l10n_util::GetStringUTF16( 415 weak_factory_.GetWeakPtr()));
416 IDS_CREATE_SUPERVISED_USER_TPM_ERROR); 416 return;
417 button = l10n_util::GetStringUTF16(
418 IDS_CREATE_SUPERVISED_USER_TPM_ERROR_BUTTON);
419 break;
420 case SupervisedUserCreationController::CLOUD_SERVER_ERROR: 417 case SupervisedUserCreationController::CLOUD_SERVER_ERROR:
421 case SupervisedUserCreationController::TOKEN_WRITE_FAILED: 418 case SupervisedUserCreationController::TOKEN_WRITE_FAILED:
422 title = l10n_util::GetStringUTF16( 419 title = l10n_util::GetStringUTF16(
423 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_TITLE); 420 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_TITLE);
424 message = l10n_util::GetStringUTF16( 421 message = l10n_util::GetStringUTF16(
425 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR); 422 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR);
426 button = l10n_util::GetStringUTF16( 423 button = l10n_util::GetStringUTF16(
427 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_BUTTON); 424 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_BUTTON);
428 break; 425 break;
429 case SupervisedUserCreationController::NO_ERROR: 426 case SupervisedUserCreationController::NO_ERROR:
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 577
581 ui_copy->SetBoolean(kUserNeedPassword, !has_password); 578 ui_copy->SetBoolean(kUserNeedPassword, !has_password);
582 ui_copy->SetString("id", it.key()); 579 ui_copy->SetString("id", it.key());
583 580
584 existing_users_->Set(it.key(), std::move(local_copy)); 581 existing_users_->Set(it.key(), std::move(local_copy));
585 ui_users->Append(std::move(ui_copy)); 582 ui_users->Append(std::move(ui_copy));
586 } 583 }
587 view_->ShowExistingSupervisedUsers(ui_users.get()); 584 view_->ShowExistingSupervisedUsers(ui_users.get());
588 } 585 }
589 586
587 void SupervisedUserCreationScreen::UpdateSecureModuleMessages(
588 ::login::SecureModuleUsed secure_module_used) {
589 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
590 base::string16 title;
591 base::string16 message;
592 base::string16 button;
593 switch (secure_module_used) {
594 case ::login::SecureModuleUsed::TPM:
595 title =
596 l10n_util::GetStringUTF16(IDS_CREATE_SUPERVISED_USER_TPM_ERROR_TITLE);
597 message = l10n_util::GetStringUTF16(IDS_CREATE_SUPERVISED_USER_TPM_ERROR);
598 button = l10n_util::GetStringUTF16(
599 IDS_CREATE_SUPERVISED_USER_TPM_ERROR_BUTTON);
600 break;
601 case ::login::SecureModuleUsed::CR50:
602 title = l10n_util::GetStringUTF16(
603 IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR_TITLE);
604 message = l10n_util::GetStringUTF16(
605 IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR);
606 button = l10n_util::GetStringUTF16(
607 IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR_BUTTON);
608 break;
609 default:
610 NOTREACHED();
611 break;
612 }
613 if (view_)
614 view_->ShowErrorPage(title, message, button);
615 }
616
590 void SupervisedUserCreationScreen::OnPhotoTaken( 617 void SupervisedUserCreationScreen::OnPhotoTaken(
591 const std::string& raw_data) { 618 const std::string& raw_data) {
592 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 619 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
593 user_photo_ = gfx::ImageSkia(); 620 user_photo_ = gfx::ImageSkia();
594 ImageDecoder::Cancel(this); 621 ImageDecoder::Cancel(this);
595 ImageDecoder::Start(this, raw_data); 622 ImageDecoder::Start(this, raw_data);
596 } 623 }
597 624
598 void SupervisedUserCreationScreen::OnImageDecoded( 625 void SupervisedUserCreationScreen::OnImageDecoded(
599 const SkBitmap& decoded_image) { 626 const SkBitmap& decoded_image) {
(...skipping 19 matching lines...) Expand all
619 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; 646 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL;
620 } else { 647 } else {
621 NOTREACHED() << "Unexpected image type: " << image_type; 648 NOTREACHED() << "Unexpected image type: " << image_type;
622 } 649 }
623 } 650 }
624 651
625 void SupervisedUserCreationScreen::OnImageAccepted() { 652 void SupervisedUserCreationScreen::OnImageAccepted() {
626 } 653 }
627 654
628 } // namespace chromeos 655 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698