-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Local Authentication Dialog for re-auth session.
- Implement LocalAuthenticationdRequestView and related Widget and Controller - Add unittest - Add pixeltest - Add a button that can use the dialog with a debug view Change-Id: I2301ca4eea6ad21cb07a7f22a94de3af9e2ba748 Bug: b:291811391 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4819967 Reviewed-by: Denis Kuznetsov <antrim@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Commit-Queue: Istvan Nagy <iscsi@google.com> Cr-Commit-Position: refs/heads/main@{#1217272}
- Loading branch information
Istvan Nagy
authored and
Chromium LUCI CQ
committed
Oct 30, 2023
1 parent
533025a
commit 93bfdf5
Showing
19 changed files
with
1,570 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
ash/ash_strings_grd/IDS_ASH_LOGIN_LOCAL_AUTHENTICATION_REQUEST_DESCRIPTION.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5d68d9ee4e421920f0866383b06fb1fc6bbd6b3e |
1 change: 1 addition & 0 deletions
1
ash/ash_strings_grd/IDS_ASH_LOGIN_LOCAL_AUTHENTICATION_REQUEST_TITLE.png.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ca2a3ba9a0c6a226f293dbb8943414468b65f553 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
ash/login/ui/local_authentication_request_controller_impl.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/login/ui/local_authentication_request_controller_impl.h" | ||
|
||
#include <string> | ||
#include <utility> | ||
|
||
#include "ash/login/ui/local_authentication_request_view.h" | ||
#include "ash/login/ui/local_authentication_request_widget.h" | ||
#include "ash/session/session_controller_impl.h" | ||
#include "ash/shell.h" | ||
#include "ash/strings/grit/ash_strings.h" | ||
#include "base/check.h" | ||
#include "base/functional/bind.h" | ||
#include "base/task/single_thread_task_runner.h" | ||
#include "chromeos/ash/components/login/auth/public/user_context.h" | ||
#include "components/account_id/account_id.h" | ||
#include "components/session_manager/session_manager_types.h" | ||
#include "ui/base/l10n/l10n_util.h" | ||
|
||
namespace ash { | ||
|
||
LocalAuthenticationRequestControllerImpl:: | ||
LocalAuthenticationRequestControllerImpl() = default; | ||
|
||
LocalAuthenticationRequestControllerImpl:: | ||
~LocalAuthenticationRequestControllerImpl() = default; | ||
|
||
void LocalAuthenticationRequestControllerImpl::OnClose() {} | ||
|
||
bool LocalAuthenticationRequestControllerImpl::ShowWidget( | ||
OnLocalAuthenticationCompleted on_local_authentication_completed, | ||
std::unique_ptr<UserContext> user_context) { | ||
if (LocalAuthenticationRequestWidget::Get()) { | ||
LOG(ERROR) << "LocalAuthenticationRequestWidget is already shown."; | ||
return false; | ||
} | ||
|
||
const AccountId& account_id = user_context->GetAccountId(); | ||
|
||
const std::string& user_email = account_id.GetUserEmail(); | ||
|
||
const std::u16string desc = l10n_util::GetStringFUTF16( | ||
IDS_ASH_LOGIN_LOCAL_AUTHENTICATION_REQUEST_DESCRIPTION, | ||
base::UTF8ToUTF16(user_email)); | ||
|
||
LocalAuthenticationRequestWidget::Show( | ||
std::move(on_local_authentication_completed), | ||
l10n_util::GetStringUTF16( | ||
IDS_ASH_LOGIN_LOCAL_AUTHENTICATION_REQUEST_TITLE), | ||
desc, this, std::move(user_context)); | ||
return true; | ||
} | ||
|
||
} // namespace ash |
47 changes: 47 additions & 0 deletions
47
ash/login/ui/local_authentication_request_controller_impl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_LOGIN_UI_LOCAL_AUTHENTICATION_REQUEST_CONTROLLER_IMPL_H_ | ||
#define ASH_LOGIN_UI_LOCAL_AUTHENTICATION_REQUEST_CONTROLLER_IMPL_H_ | ||
|
||
#include <memory> | ||
|
||
#include "ash/login/ui/local_authentication_request_view.h" | ||
#include "ash/login/ui/local_authentication_request_widget.h" | ||
#include "ash/public/cpp/login/local_authentication_request_controller.h" | ||
#include "base/memory/weak_ptr.h" | ||
|
||
namespace ash { | ||
|
||
class UserContext; | ||
|
||
// Implementation of LocalAuthenticationRequestController. It serves to finalize | ||
// the re-auth session with local authentication. | ||
class ASH_EXPORT LocalAuthenticationRequestControllerImpl | ||
: public LocalAuthenticationRequestController, | ||
public LocalAuthenticationRequestView::Delegate { | ||
public: | ||
LocalAuthenticationRequestControllerImpl(); | ||
LocalAuthenticationRequestControllerImpl( | ||
const LocalAuthenticationRequestControllerImpl&) = delete; | ||
LocalAuthenticationRequestControllerImpl& operator=( | ||
const LocalAuthenticationRequestControllerImpl&) = delete; | ||
~LocalAuthenticationRequestControllerImpl() override; | ||
|
||
// LocalAuthenticationRequestView::Delegate: | ||
void OnClose() override; | ||
|
||
// LocalAuthenticationRequestController: | ||
bool ShowWidget( | ||
OnLocalAuthenticationCompleted on_local_authentication_completed, | ||
std::unique_ptr<UserContext> user_context) override; | ||
|
||
private: | ||
base::WeakPtrFactory<LocalAuthenticationRequestControllerImpl> weak_factory_{ | ||
this}; | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_LOGIN_UI_LOCAL_AUTHENTICATION_REQUEST_CONTROLLER_IMPL_H_ |
Oops, something went wrong.