Commit a21dc0d5 authored by Milica Selakovic's avatar Milica Selakovic Committed by Commit Bot

[Password Manager] Add password change button

Bug: 1053522
Change-Id: I968877db3dc2e3749c872f748502276002fea07f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2089680
Commit-Queue: Milica Selakovic <selakovic@google.com>
Reviewed-by: default avatarMaxim Kolosovskiy <kolos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747674}
parent e679937c
......@@ -9,7 +9,9 @@
#include "chrome/browser/ui/android/passwords/credential_leak_dialog_password_change_view_android.h"
#include "chrome/common/url_constants.h"
#include "components/password_manager/core/browser/leak_detection_dialog_utils.h"
#include "components/strings/grit/components_strings.h"
#include "ui/android/window_android.h"
#include "ui/base/l10n/l10n_util.h"
using password_manager::metrics_util::LeakDialogDismissalReason;
using password_manager::metrics_util::LogLeakDialogTypeAndDismissalReason;
......@@ -53,6 +55,9 @@ void CredentialLeakPasswordChangeControllerAndroid::OnCloseDialog() {
base::string16
CredentialLeakPasswordChangeControllerAndroid::GetAcceptButtonLabel() const {
if (ShouldShowChangePasswordButton()) {
return l10n_util::GetStringUTF16(IDS_PASSWORD_CHANGE);
}
return password_manager::GetAcceptButtonLabel(leak_type_);
}
......@@ -77,5 +82,13 @@ bool CredentialLeakPasswordChangeControllerAndroid::ShouldCheckPasswords()
bool CredentialLeakPasswordChangeControllerAndroid::ShouldShowCancelButton()
const {
return password_manager::ShouldShowCancelButton(leak_type_);
return password_manager::ShouldShowCancelButton(leak_type_) ||
ShouldShowChangePasswordButton();
}
bool CredentialLeakPasswordChangeControllerAndroid::
ShouldShowChangePasswordButton() const {
return password_manager::IsPasswordSaved(leak_type_) &&
!password_manager::IsPasswordUsedOnOtherSites(leak_type_) &&
password_manager::IsSyncingPasswordsNormally(leak_type_);
}
......@@ -65,6 +65,8 @@ class CredentialLeakPasswordChangeControllerAndroid {
bool ShouldShowCancelButton() const;
private:
bool ShouldShowChangePasswordButton() const;
// Used to customize the UI.
const password_manager::CredentialLeakType leak_type_;
......
......@@ -62,4 +62,7 @@
<message name="IDS_PASSWORD_MANAGER_DEFAULT_EXPORT_FILENAME" desc="Chrome suggests this file name when user chooses to export their passwords saved with Chrome.">
Chrome Passwords
</message>
<message name="IDS_PASSWORD_CHANGE" desc="The text of the change password button in the dialog for credentials leaked.">
Change password
</message>
</grit-part>
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