#include "chrome/browser/ui/passwords/credential_manager_dialog_controller_impl.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/browser/ui/passwords/password_dialog_prompts.h"
#include "chrome/browser/ui/passwords/passwords_model_delegate.h"
#include "chrome/browser/ui/passwords/ui_utils.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/password_manager/core/browser/password_bubble_experiment.h"
#include "components/password_manager/core/browser/password_feature_manager.h"
#include "components/password_manager/core/browser/password_form.h"
#include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/browser/password_sync_util.h"
#include "components/password_manager/core/browser/password_ui_utils.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/service/sync_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
namespace {
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
std::u16string GetAuthenticationMessage(PasswordsModelDelegate* delegate) {
if (!delegate || !delegate->GetWebContents()) {
return u"";
}
const std::u16string origin = base::UTF8ToUTF16(
password_manager::GetShownOrigin(delegate->GetWebContents()
->GetPrimaryMainFrame()
->GetLastCommittedOrigin()));
return l10n_util::GetStringFUTF16(IDS_PASSWORD_MANAGER_FILLING_REAUTH,
origin);
}
#endif
}
CredentialManagerDialogControllerImpl::CredentialManagerDialogControllerImpl(
Profile* profile,
PasswordsModelDelegate* delegate)
: … { … }
CredentialManagerDialogControllerImpl::
~CredentialManagerDialogControllerImpl() { … }
void CredentialManagerDialogControllerImpl::ShowAccountChooser(
AccountChooserPrompt* dialog,
std::vector<std::unique_ptr<password_manager::PasswordForm>> locals) { … }
void CredentialManagerDialogControllerImpl::ShowAutosigninPrompt(
AutoSigninFirstRunPrompt* dialog) { … }
bool CredentialManagerDialogControllerImpl::IsShowingAccountChooser() const { … }
const CredentialManagerDialogController::FormsVector&
CredentialManagerDialogControllerImpl::GetLocalForms() const { … }
std::u16string CredentialManagerDialogControllerImpl::GetAccoutChooserTitle()
const { … }
bool CredentialManagerDialogControllerImpl::ShouldShowSignInButton() const { … }
std::u16string CredentialManagerDialogControllerImpl::GetAutoSigninPromoTitle()
const { … }
std::u16string CredentialManagerDialogControllerImpl::GetAutoSigninText()
const { … }
bool CredentialManagerDialogControllerImpl::ShouldShowFooter() const { … }
void CredentialManagerDialogControllerImpl::OnChooseCredentials(
const password_manager::PasswordForm& password_form,
password_manager::CredentialType credential_type) { … }
void CredentialManagerDialogControllerImpl::OnSignInClicked() { … }
void CredentialManagerDialogControllerImpl::OnAutoSigninOK() { … }
void CredentialManagerDialogControllerImpl::OnAutoSigninTurnOff() { … }
void CredentialManagerDialogControllerImpl::OnCloseDialog() { … }
void CredentialManagerDialogControllerImpl::ResetDialog() { … }
void CredentialManagerDialogControllerImpl::OnBiometricReauthCompleted(
password_manager::PasswordForm password_form,
password_manager::CredentialType credential_type,
bool result) { … }