Commit 6a00a7e3 authored by Leo Lai's avatar Leo Lai Committed by Commit Bot

clean up tpm password fetching logic of EULA screen.

Since chromium:1109629, eula screen doesn't show the owner password but
it still tryies to fetch the password before showing the security system
settings.

Thus, cleaning it up for sake of security as well as for product
excellence. Also, it is part of steps getting rid of `TpmGetPassword()`
D-Bus method.

BUG=b:172748724
BUG=b:168852740
BUG=chromium:1109629
TEST=browser_tests.

Change-Id: If5c0829658753aacadc1dfc3df7d054e6f458851
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536657
Commit-Queue: Leo Lai <cylai@google.com>
Reviewed-by: default avatarAchuith Bhandarkar <achuith@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828063}
parent 8c28f33e
...@@ -95,8 +95,7 @@ std::string EulaScreen::GetResultString(Result result) { ...@@ -95,8 +95,7 @@ std::string EulaScreen::GetResultString(Result result) {
EulaScreen::EulaScreen(EulaView* view, const ScreenExitCallback& exit_callback) EulaScreen::EulaScreen(EulaView* view, const ScreenExitCallback& exit_callback)
: BaseScreen(EulaView::kScreenId, OobeScreenPriority::DEFAULT), : BaseScreen(EulaView::kScreenId, OobeScreenPriority::DEFAULT),
view_(view), view_(view),
exit_callback_(exit_callback), exit_callback_(exit_callback) {
password_fetcher_(this) {
DCHECK(view_); DCHECK(view_);
if (view_) if (view_)
view_->Bind(this); view_->Bind(this);
...@@ -107,15 +106,6 @@ EulaScreen::~EulaScreen() { ...@@ -107,15 +106,6 @@ EulaScreen::~EulaScreen() {
view_->Unbind(); view_->Unbind();
} }
void EulaScreen::InitiatePasswordFetch() {
if (tpm_password_.empty()) {
password_fetcher_.Fetch();
// Will call view after password has been fetched.
} else if (view_) {
view_->OnPasswordFetched(tpm_password_);
}
}
void EulaScreen::SetUsageStatsEnabled(bool enabled) { void EulaScreen::SetUsageStatsEnabled(bool enabled) {
g_usage_statistics_reporting_enabled = enabled; g_usage_statistics_reporting_enabled = enabled;
} }
...@@ -154,7 +144,7 @@ void EulaScreen::OnUserAction(const std::string& action_id) { ...@@ -154,7 +144,7 @@ void EulaScreen::OnUserAction(const std::string& action_id) {
} else if (action_id == kUserActionShowAdditionalTos) { } else if (action_id == kUserActionShowAdditionalTos) {
ShowAdditionalTosDialog(); ShowAdditionalTosDialog();
} else if (action_id == kUserActionShowSecuritySettings) { } else if (action_id == kUserActionShowSecuritySettings) {
InitiatePasswordFetch(); ShowSecuritySettingsDialog();
} else if (action_id == kUserActionSelectStatsUsage) { } else if (action_id == kUserActionSelectStatsUsage) {
SetUsageStatsEnabled(true); SetUsageStatsEnabled(true);
} else if (action_id == kUserActionUnselectStatsUsage) { } else if (action_id == kUserActionUnselectStatsUsage) {
...@@ -176,12 +166,6 @@ bool EulaScreen::HandleAccelerator(ash::LoginAcceleratorAction action) { ...@@ -176,12 +166,6 @@ bool EulaScreen::HandleAccelerator(ash::LoginAcceleratorAction action) {
return false; return false;
} }
void EulaScreen::OnPasswordFetched(const std::string& tpm_password) {
tpm_password_ = tpm_password;
if (view_)
view_->OnPasswordFetched(tpm_password_);
}
void EulaScreen::ShowStatsUsageLearnMore() { void EulaScreen::ShowStatsUsageLearnMore() {
if (view_) if (view_)
view_->ShowStatsUsageLearnMore(); view_->ShowStatsUsageLearnMore();
...@@ -192,4 +176,9 @@ void EulaScreen::ShowAdditionalTosDialog() { ...@@ -192,4 +176,9 @@ void EulaScreen::ShowAdditionalTosDialog() {
view_->ShowAdditionalTosDialog(); view_->ShowAdditionalTosDialog();
} }
void EulaScreen::ShowSecuritySettingsDialog() {
if (view_)
view_->ShowSecuritySettingsDialog();
}
} // namespace chromeos } // namespace chromeos
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/chromeos/login/screens/base_screen.h" #include "chrome/browser/chromeos/login/screens/base_screen.h"
#include "chromeos/tpm/tpm_password_fetcher.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace chromeos { namespace chromeos {
...@@ -20,10 +19,7 @@ class EulaView; ...@@ -20,10 +19,7 @@ class EulaView;
// Representation independent class that controls OOBE screen showing EULA // Representation independent class that controls OOBE screen showing EULA
// to users. // to users.
// class EulaScreen : public BaseScreen {
// TODO(b/168852740): Clean up the password-related logic with the removal of
// `TpmGetPassword` D-Bus method.
class EulaScreen : public BaseScreen, public TpmPasswordFetcherDelegate {
public: public:
enum class Result { enum class Result {
// The user accepted EULA, and enabled usage stats reporting. // The user accepted EULA, and enabled usage stats reporting.
...@@ -59,10 +55,6 @@ class EulaScreen : public BaseScreen, public TpmPasswordFetcherDelegate { ...@@ -59,10 +55,6 @@ class EulaScreen : public BaseScreen, public TpmPasswordFetcherDelegate {
// locale and manifest. Returns empty URL otherwise. // locale and manifest. Returns empty URL otherwise.
GURL GetOemEulaUrl() const; GURL GetOemEulaUrl() const;
// Initiate TPM password fetch. Will call view's OnPasswordFetched() when
// done.
void InitiatePasswordFetch();
void SetUsageStatsEnabled(bool enabled); void SetUsageStatsEnabled(bool enabled);
// Returns true if usage statistics reporting is enabled. // Returns true if usage statistics reporting is enabled.
...@@ -82,10 +74,10 @@ class EulaScreen : public BaseScreen, public TpmPasswordFetcherDelegate { ...@@ -82,10 +74,10 @@ class EulaScreen : public BaseScreen, public TpmPasswordFetcherDelegate {
void OnUserAction(const std::string& action_id) override; void OnUserAction(const std::string& action_id) override;
bool HandleAccelerator(ash::LoginAcceleratorAction action) override; bool HandleAccelerator(ash::LoginAcceleratorAction action) override;
// TpmPasswordFetcherDelegate implementation: // EulaView:
void OnPasswordFetched(const std::string& tpm_password) override;
void ShowStatsUsageLearnMore(); void ShowStatsUsageLearnMore();
void ShowAdditionalTosDialog(); void ShowAdditionalTosDialog();
void ShowSecuritySettingsDialog();
// URL of the OEM EULA page (on disk). // URL of the OEM EULA page (on disk).
GURL oem_eula_page_; GURL oem_eula_page_;
...@@ -101,8 +93,6 @@ class EulaScreen : public BaseScreen, public TpmPasswordFetcherDelegate { ...@@ -101,8 +93,6 @@ class EulaScreen : public BaseScreen, public TpmPasswordFetcherDelegate {
ScreenExitCallback exit_callback_; ScreenExitCallback exit_callback_;
TpmPasswordFetcher password_fetcher_;
DISALLOW_COPY_AND_ASSIGN(EulaScreen); DISALLOW_COPY_AND_ASSIGN(EulaScreen);
}; };
......
...@@ -35,9 +35,9 @@ class MockEulaView : public EulaView { ...@@ -35,9 +35,9 @@ class MockEulaView : public EulaView {
MOCK_METHOD(void, MockBind, (EulaScreen * screen)); MOCK_METHOD(void, MockBind, (EulaScreen * screen));
MOCK_METHOD(void, MockUnbind, ()); MOCK_METHOD(void, MockUnbind, ());
MOCK_METHOD(void, OnPasswordFetched, (const std::string& tpm_password));
MOCK_METHOD(void, ShowStatsUsageLearnMore, ()); MOCK_METHOD(void, ShowStatsUsageLearnMore, ());
MOCK_METHOD(void, ShowAdditionalTosDialog, ()); MOCK_METHOD(void, ShowAdditionalTosDialog, ());
MOCK_METHOD(void, ShowSecuritySettingsDialog, ());
private: private:
EulaScreen* screen_ = nullptr; EulaScreen* screen_ = nullptr;
......
...@@ -139,10 +139,6 @@ void EulaScreenHandler::Initialize() { ...@@ -139,10 +139,6 @@ void EulaScreenHandler::Initialize() {
} }
} }
void EulaScreenHandler::OnPasswordFetched(const std::string& tpm_password) {
CallJS("login.EulaScreen.showSecuritySettingsDialog");
}
void EulaScreenHandler::ShowStatsUsageLearnMore() { void EulaScreenHandler::ShowStatsUsageLearnMore() {
if (!help_app_.get()) if (!help_app_.get())
help_app_ = new HelpAppLauncher( help_app_ = new HelpAppLauncher(
...@@ -154,6 +150,10 @@ void EulaScreenHandler::ShowAdditionalTosDialog() { ...@@ -154,6 +150,10 @@ void EulaScreenHandler::ShowAdditionalTosDialog() {
CallJS("login.EulaScreen.showAdditionalTosDialog"); CallJS("login.EulaScreen.showAdditionalTosDialog");
} }
void EulaScreenHandler::ShowSecuritySettingsDialog() {
CallJS("login.EulaScreen.showSecuritySettingsDialog");
}
void EulaScreenHandler::UpdateLocalizedValues( void EulaScreenHandler::UpdateLocalizedValues(
::login::SecureModuleUsed secure_module_used) { ::login::SecureModuleUsed secure_module_used) {
base::DictionaryValue updated_secure_module_strings; base::DictionaryValue updated_secure_module_strings;
......
...@@ -34,9 +34,9 @@ class EulaView { ...@@ -34,9 +34,9 @@ class EulaView {
virtual void Hide() = 0; virtual void Hide() = 0;
virtual void Bind(EulaScreen* screen) = 0; virtual void Bind(EulaScreen* screen) = 0;
virtual void Unbind() = 0; virtual void Unbind() = 0;
virtual void OnPasswordFetched(const std::string& tpm_password) = 0;
virtual void ShowStatsUsageLearnMore() = 0; virtual void ShowStatsUsageLearnMore() = 0;
virtual void ShowAdditionalTosDialog() = 0; virtual void ShowAdditionalTosDialog() = 0;
virtual void ShowSecuritySettingsDialog() = 0;
}; };
// WebUI implementation of EulaScreenView. It is used to interact // WebUI implementation of EulaScreenView. It is used to interact
...@@ -54,9 +54,9 @@ class EulaScreenHandler : public EulaView, public BaseScreenHandler { ...@@ -54,9 +54,9 @@ class EulaScreenHandler : public EulaView, public BaseScreenHandler {
void Hide() override; void Hide() override;
void Bind(EulaScreen* screen) override; void Bind(EulaScreen* screen) override;
void Unbind() override; void Unbind() override;
void OnPasswordFetched(const std::string& tpm_password) override;
void ShowStatsUsageLearnMore() override; void ShowStatsUsageLearnMore() override;
void ShowAdditionalTosDialog() override; void ShowAdditionalTosDialog() override;
void ShowSecuritySettingsDialog() override;
// BaseScreenHandler implementation: // BaseScreenHandler implementation:
void DeclareLocalizedValues( void DeclareLocalizedValues(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment