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

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: 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 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 20 matching lines...) Expand all
31 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h" 31 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service.h"
32 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_fac tory.h" 32 #include "chrome/browser/supervised_user/legacy/supervised_user_sync_service_fac tory.h"
33 #include "chrome/browser/supervised_user/supervised_user_constants.h" 33 #include "chrome/browser/supervised_user/supervised_user_constants.h"
34 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 34 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
35 #include "chrome/grit/generated_resources.h" 35 #include "chrome/grit/generated_resources.h"
36 #include "chromeos/dbus/dbus_thread_manager.h" 36 #include "chromeos/dbus/dbus_thread_manager.h"
37 #include "chromeos/dbus/session_manager_client.h" 37 #include "chromeos/dbus/session_manager_client.h"
38 #include "chromeos/login/auth/key.h" 38 #include "chromeos/login/auth/key.h"
39 #include "chromeos/login/auth/user_context.h" 39 #include "chromeos/login/auth/user_context.h"
40 #include "chromeos/network/network_state.h" 40 #include "chromeos/network/network_state.h"
41 #include "components/login/secure_module_util.h"
41 #include "components/user_manager/user.h" 42 #include "components/user_manager/user.h"
42 #include "components/user_manager/user_image/user_image.h" 43 #include "components/user_manager/user_image/user_image.h"
43 #include "content/public/browser/browser_thread.h" 44 #include "content/public/browser/browser_thread.h"
44 #include "third_party/skia/include/core/SkBitmap.h" 45 #include "third_party/skia/include/core/SkBitmap.h"
45 #include "ui/base/l10n/l10n_util.h" 46 #include "ui/base/l10n/l10n_util.h"
46 #include "ui/gfx/image/image_skia.h" 47 #include "ui/gfx/image/image_skia.h"
47 48
48 namespace chromeos { 49 namespace chromeos {
49 50
50 namespace { 51 namespace {
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 404
404 base::string16 title; 405 base::string16 title;
405 base::string16 message; 406 base::string16 message;
406 base::string16 button; 407 base::string16 button;
407 // TODO(antrim) : find out which errors do we really have. 408 // TODO(antrim) : find out which errors do we really have.
408 // We might reuse some error messages from ordinary user flow. 409 // We might reuse some error messages from ordinary user flow.
409 switch (code) { 410 switch (code) {
410 case SupervisedUserCreationController::CRYPTOHOME_NO_MOUNT: 411 case SupervisedUserCreationController::CRYPTOHOME_NO_MOUNT:
411 case SupervisedUserCreationController::CRYPTOHOME_FAILED_MOUNT: 412 case SupervisedUserCreationController::CRYPTOHOME_FAILED_MOUNT:
412 case SupervisedUserCreationController::CRYPTOHOME_FAILED_TPM: 413 case SupervisedUserCreationController::CRYPTOHOME_FAILED_TPM:
413 title = l10n_util::GetStringUTF16( 414 if (::login::GetSecureModuleUsed() ==
414 IDS_CREATE_SUPERVISED_USER_TPM_ERROR_TITLE); 415 ::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
415 message = l10n_util::GetStringUTF16( 416 content::BrowserThread::PostTaskAndReply(
416 IDS_CREATE_SUPERVISED_USER_TPM_ERROR); 417 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.
417 button = l10n_util::GetStringUTF16( 418 base::BindOnce(&::login::QuerySecureModuleUsed),
418 IDS_CREATE_SUPERVISED_USER_TPM_ERROR_BUTTON); 419 base::BindOnce(
419 break; 420 &SupervisedUserCreationScreen::UpdateSecureModuleMessages,
421 weak_factory_.GetWeakPtr()));
422 } else {
423 UpdateSecureModuleMessages();
424 }
425 return;
420 case SupervisedUserCreationController::CLOUD_SERVER_ERROR: 426 case SupervisedUserCreationController::CLOUD_SERVER_ERROR:
421 case SupervisedUserCreationController::TOKEN_WRITE_FAILED: 427 case SupervisedUserCreationController::TOKEN_WRITE_FAILED:
422 title = l10n_util::GetStringUTF16( 428 title = l10n_util::GetStringUTF16(
423 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_TITLE); 429 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_TITLE);
424 message = l10n_util::GetStringUTF16( 430 message = l10n_util::GetStringUTF16(
425 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR); 431 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR);
426 button = l10n_util::GetStringUTF16( 432 button = l10n_util::GetStringUTF16(
427 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_BUTTON); 433 IDS_CREATE_SUPERVISED_USER_GENERIC_ERROR_BUTTON);
428 break; 434 break;
429 case SupervisedUserCreationController::NO_ERROR: 435 case SupervisedUserCreationController::NO_ERROR:
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 586
581 ui_copy->SetBoolean(kUserNeedPassword, !has_password); 587 ui_copy->SetBoolean(kUserNeedPassword, !has_password);
582 ui_copy->SetString("id", it.key()); 588 ui_copy->SetString("id", it.key());
583 589
584 existing_users_->Set(it.key(), std::move(local_copy)); 590 existing_users_->Set(it.key(), std::move(local_copy));
585 ui_users->Append(std::move(ui_copy)); 591 ui_users->Append(std::move(ui_copy));
586 } 592 }
587 view_->ShowExistingSupervisedUsers(ui_users.get()); 593 view_->ShowExistingSupervisedUsers(ui_users.get());
588 } 594 }
589 595
596 void SupervisedUserCreationScreen::UpdateSecureModuleMessages() {
597 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
598 base::string16 title;
599 base::string16 message;
600 base::string16 button;
601 switch (::login::GetSecureModuleUsed()) {
602 case ::login::SecureModuleUsed::TPM:
603 title =
604 l10n_util::GetStringUTF16(IDS_CREATE_SUPERVISED_USER_TPM_ERROR_TITLE);
605 message = l10n_util::GetStringUTF16(IDS_CREATE_SUPERVISED_USER_TPM_ERROR);
606 button = l10n_util::GetStringUTF16(
607 IDS_CREATE_SUPERVISED_USER_TPM_ERROR_BUTTON);
608 break;
609 case ::login::SecureModuleUsed::CR50:
610 title = l10n_util::GetStringUTF16(
611 IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR_TITLE);
612 message = l10n_util::GetStringUTF16(
613 IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR);
614 button = l10n_util::GetStringUTF16(
615 IDS_CREATE_SUPERVISED_USER_SECURE_MODULE_ERROR_BUTTON);
616 break;
617 default:
618 NOTREACHED();
619 break;
620 }
621 if (view_)
622 view_->ShowErrorPage(title, message, button);
623 }
624
590 void SupervisedUserCreationScreen::OnPhotoTaken( 625 void SupervisedUserCreationScreen::OnPhotoTaken(
591 const std::string& raw_data) { 626 const std::string& raw_data) {
592 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 627 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
593 user_photo_ = gfx::ImageSkia(); 628 user_photo_ = gfx::ImageSkia();
594 ImageDecoder::Cancel(this); 629 ImageDecoder::Cancel(this);
595 ImageDecoder::Start(this, raw_data); 630 ImageDecoder::Start(this, raw_data);
596 } 631 }
597 632
598 void SupervisedUserCreationScreen::OnImageDecoded( 633 void SupervisedUserCreationScreen::OnImageDecoded(
599 const SkBitmap& decoded_image) { 634 const SkBitmap& decoded_image) {
(...skipping 19 matching lines...) Expand all
619 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; 654 selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL;
620 } else { 655 } else {
621 NOTREACHED() << "Unexpected image type: " << image_type; 656 NOTREACHED() << "Unexpected image type: " << image_type;
622 } 657 }
623 } 658 }
624 659
625 void SupervisedUserCreationScreen::OnImageAccepted() { 660 void SupervisedUserCreationScreen::OnImageAccepted() {
626 } 661 }
627 662
628 } // namespace chromeos 663 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698