Commit 8c18987a authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Commit Bot

Change the strings for password leak detection.

In addition the CL fixes a small bug in the settings on desktop. Before the
toggle was enabled in the Sync on - temporary signed out state.

Bug: 1014660
Change-Id: I9e0f4b6012118b6a0bb98510d206377be18ef689
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1882321Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: default avatarIoana Pandele <ioanap@chromium.org>
Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710022}
parent d52f1ff6
......@@ -34,11 +34,11 @@ public class CredentialLeakDialogBridge {
@CalledByNative
public void showDialog(String credentialLeakTitle, String credentialLeakDetails,
int boldRangeStart, int boldRangeEnd, String positiveButton, String negativeButton) {
String positiveButton, String negativeButton) {
boolean primaryButtonFilled = negativeButton != null;
mCredentialLeakDialog.showDialog(credentialLeakTitle, credentialLeakDetails, boldRangeStart,
boldRangeEnd, R.drawable.password_check_warning, positiveButton, negativeButton,
this::onClick, primaryButtonFilled, ModalDialogManager.ModalDialogType.APP);
mCredentialLeakDialog.showDialog(credentialLeakTitle, credentialLeakDetails,
R.drawable.password_check_warning, positiveButton, negativeButton, this::onClick,
primaryButtonFilled, ModalDialogManager.ModalDialogType.APP);
}
@CalledByNative
......
......@@ -988,16 +988,10 @@
Automatically sign in to websites using stored credentials. If disabled, you will be asked for confirmation every time before signing in to a website.
</message>
<message name="IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_LABEL" desc="Label for a checkbox that allows users to choose whether chrome should check that credentials have been part of a leak.">
Check password safety
</message>
<message name="IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_IN_DESC" desc="Text that describes the 'Password Leak Detection' functionality to signed-in users.">
Warns you if a password you use was part of a data breach
</message>
<message name="IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_OUT_DISABLED_DESC" desc="Text that describes the 'Password Leak Detection' functionality to signed-out users who have disabled the feature.">
Google can check if your passwords were part of a data breach
Warn you if passwords are compromised
</message>
<message name="IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_OUT_ENABLED_DESC" desc="Text that describes the 'Password Leak Detection' functionality to signed-out users who have not disabled the feature.">
Google can check if your passwords were part of a data breach. This will be turned on when you sign in with your Google Account.
When you sign in to your Google Account, this feature is turned on
</message>
<message name="IDS_SETTINGS_PASSWORDS_SAVED_HEADING" desc="The title for a list of username/site/password items. These items are already saved by the browser and can be deleted/edited.">
Saved Passwords
......
f80b6f34d7da815901ca55903969ccb4760fc7cd
\ No newline at end of file
1f0c045af8829a9b3142e8bf984c38e7ad136f7f
\ No newline at end of file
9ee7fa48fd32e7ef8b3cbe131e534de7481ca8ca
\ No newline at end of file
624b93b715dba37f77a0d950c97d6cec4051a66e
\ No newline at end of file
......@@ -77,10 +77,6 @@ base::string16 CredentialLeakControllerAndroid::GetTitle() const {
return password_manager::GetTitle(leak_type_);
}
gfx::Range CredentialLeakControllerAndroid::GetDescriptionBoldRange() const {
return password_manager::GetChangePasswordBoldRange(leak_type_, origin_);
}
bool CredentialLeakControllerAndroid::ShouldCheckPasswords() const {
return password_manager::ShouldCheckPasswords(leak_type_);
}
......
......@@ -55,10 +55,6 @@ class CredentialLeakControllerAndroid {
// The title of the dialog displaying the leak warning.
base::string16 GetTitle() const;
// Returns the range that bold text should span in the description. Varies
// by leak type.
gfx::Range GetDescriptionBoldRange() const;
// Checks whether the dialog should show the option to check passwords.
bool ShouldCheckPasswords() const;
......
......@@ -367,8 +367,9 @@ Polymer({
* @private
*/
computeUserSignedIn_: function() {
return (!!this.syncStatus_ && !!this.syncStatus_.signedIn) ||
(!!this.storedAccounts_ && this.storedAccounts_.length > 0);
return (!!this.syncStatus_ && !!this.syncStatus_.signedIn) ?
!this.syncStatus_.hasError :
(!!this.storedAccounts_ && this.storedAccounts_.length > 0);
},
/**
......@@ -401,12 +402,12 @@ Polymer({
*/
getPasswordsLeakDetectionSubLabel_: function() {
if (this.userSignedIn_) {
return this.i18n('passwordsLeakDetectionSignedInDescription');
return '';
}
if (this.getPref('profile.password_manager_leak_detection').value) {
return this.i18n('passwordsLeakDetectionSignedOutEnabledDescription');
}
return this.i18n('passwordsLeakDetectionSignedOutDisabledDescription');
return '';
},
/**
......@@ -546,6 +547,6 @@ Polymer({
showImportOrExportPasswords_: function(
showExportPasswords, showImportPasswords) {
return showExportPasswords || showImportPasswords;
}
},
});
})();
......@@ -35,14 +35,11 @@ void CredentialLeakDialogViewAndroid::Show(ui::WindowAndroid* window_android) {
java_object_.Reset(Java_CredentialLeakDialogBridge_create(
env, window_android->GetJavaObject(), reinterpret_cast<intptr_t>(this)));
gfx::Range bold_range = controller_->GetDescriptionBoldRange();
Java_CredentialLeakDialogBridge_showDialog(
env, java_object_,
base::android::ConvertUTF16ToJavaString(env, controller_->GetTitle()),
base::android::ConvertUTF16ToJavaString(env,
controller_->GetDescription()),
bold_range.start(), bold_range.end(),
base::android::ConvertUTF16ToJavaString(
env, controller_->GetAcceptButtonLabel()),
controller_->ShouldShowCancelButton()
......
......@@ -41,10 +41,6 @@ class CredentialLeakDialogController : public PasswordBaseDialogController {
// Checks whether the dialog should show cancel button.
virtual bool ShouldShowCancelButton() const = 0;
// Returns the range of the bold part of the leak dialog message when
// credentials were leaked only on current site.
virtual gfx::Range GetChangePasswordBoldRange() const = 0;
protected:
~CredentialLeakDialogController() override = default;
};
......
......@@ -89,11 +89,6 @@ bool CredentialLeakDialogControllerImpl::ShouldShowCancelButton() const {
return password_manager::ShouldShowCancelButton(leak_type_);
}
gfx::Range CredentialLeakDialogControllerImpl::GetChangePasswordBoldRange()
const {
return password_manager::GetChangePasswordBoldRange(leak_type_, origin_);
}
void CredentialLeakDialogControllerImpl::ResetDialog() {
if (credential_leak_dialog_) {
credential_leak_dialog_->ControllerGone();
......
......@@ -37,7 +37,6 @@ class CredentialLeakDialogControllerImpl
base::string16 GetTitle() const override;
bool ShouldCheckPasswords() const override;
bool ShouldShowCancelButton() const override;
gfx::Range GetChangePasswordBoldRange() const override;
private:
// Release |credential_leak_dialog_| and close the open dialog.
......
......@@ -62,10 +62,8 @@ std::unique_ptr<NonAccessibleImageView> CreateIllustration(
// Creates the content containing the title and description for the dialog
// rendered below the illustration.
std::unique_ptr<views::View> CreateContent(
const base::string16& title,
const base::string16& description,
gfx::Range bold_change_password_range) {
std::unique_ptr<views::View> CreateContent(const base::string16& title,
const base::string16& description) {
auto content = std::make_unique<views::View>();
content->SetLayoutManager(std::make_unique<BoxLayout>(
BoxLayout::Orientation::kVertical, gfx::Insets(),
......@@ -83,12 +81,6 @@ std::unique_ptr<views::View> CreateContent(
auto description_label =
std::make_unique<views::StyledLabel>(description, nullptr);
if (!bold_change_password_range.is_empty()) {
views::StyledLabel::RangeStyleInfo style;
style.custom_font = description_label->GetDefaultFontList().Derive(
0, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::BOLD);
description_label->AddStyleRange(bold_change_password_range, style);
}
content->AddChildView(std::move(description_label));
return content;
......@@ -182,8 +174,7 @@ void CredentialLeakDialogView::InitWindow() {
CreateIllustration(GetNativeTheme()->ShouldUseDarkColors());
image_view_ = illustration.get();
std::unique_ptr<views::View> content =
CreateContent(controller_->GetTitle(), controller_->GetDescription(),
controller_->GetChangePasswordBoldRange());
CreateContent(controller_->GetTitle(), controller_->GetDescription());
AddChildView(std::move(illustration));
AddChildView(std::move(content));
}
......
......@@ -1810,10 +1810,6 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_PASSWORDS_AUTOSIGNIN_CHECKBOX_DESC},
{"passwordsLeakDetectionLabel",
IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_LABEL},
{"passwordsLeakDetectionSignedInDescription",
IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_IN_DESC},
{"passwordsLeakDetectionSignedOutDisabledDescription",
IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_OUT_DISABLED_DESC},
{"passwordsLeakDetectionSignedOutEnabledDescription",
IDS_SETTINGS_PASSWORDS_LEAK_DETECTION_SIGNED_OUT_ENABLED_DESC},
{"savedPasswordsHeading", IDS_SETTINGS_PASSWORDS_SAVED_HEADING},
......
......@@ -894,9 +894,7 @@ cr.define('settings_passwords_section', function() {
assertTrue(passwordsSection.$.passwordsLeakDetectionCheckbox.disabled);
assertFalse(passwordsSection.$.passwordsLeakDetectionCheckbox.checked);
assertEquals(
loadTimeData.getString(
'passwordsLeakDetectionSignedOutDisabledDescription'),
passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
'', passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
});
test('leakDetectionToggleSignedOutWithTruePref', function() {
......@@ -939,8 +937,7 @@ cr.define('settings_passwords_section', function() {
assertFalse(passwordsSection.$.passwordsLeakDetectionCheckbox.disabled);
assertFalse(passwordsSection.$.passwordsLeakDetectionCheckbox.checked);
assertEquals(
loadTimeData.getString('passwordsLeakDetectionSignedInDescription'),
passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
'', passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
});
test('leakDetectionToggleSignedInNotSyncingWithTruePref', function() {
......@@ -962,8 +959,7 @@ cr.define('settings_passwords_section', function() {
assertFalse(passwordsSection.$.passwordsLeakDetectionCheckbox.disabled);
assertTrue(passwordsSection.$.passwordsLeakDetectionCheckbox.checked);
assertEquals(
loadTimeData.getString('passwordsLeakDetectionSignedInDescription'),
passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
'', passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
});
}
......@@ -981,8 +977,7 @@ cr.define('settings_passwords_section', function() {
assertFalse(passwordsSection.$.passwordsLeakDetectionCheckbox.disabled);
assertFalse(passwordsSection.$.passwordsLeakDetectionCheckbox.checked);
assertEquals(
loadTimeData.getString('passwordsLeakDetectionSignedInDescription'),
passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
'', passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
});
test('leakDetectionToggleSignedInAndSyncingWithTruePref', function() {
......@@ -997,8 +992,7 @@ cr.define('settings_passwords_section', function() {
assertFalse(passwordsSection.$.passwordsLeakDetectionCheckbox.disabled);
assertTrue(passwordsSection.$.passwordsLeakDetectionCheckbox.checked);
assertEquals(
loadTimeData.getString('passwordsLeakDetectionSignedInDescription'),
passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
'', passwordsSection.$.passwordsLeakDetectionCheckbox.subLabel);
});
});
});
......@@ -78,12 +78,8 @@ base::string16 GetDescription(CredentialLeakType leak_type,
const GURL& origin) {
const base::string16 formatted = GetFormattedUrl(origin);
if (!ShouldCheckPasswords(leak_type)) {
std::vector<size_t> offsets;
base::string16 bold_message = l10n_util::GetStringUTF16(
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_BOLD_MESSAGE);
return l10n_util::GetStringFUTF16(
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE, bold_message, formatted,
&offsets);
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE, formatted);
} else if (password_manager::IsPasswordSaved(leak_type)) {
return l10n_util::GetStringUTF16(
IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE);
......@@ -123,20 +119,4 @@ GURL GetPasswordCheckupURL() {
return GURL(value);
}
gfx::Range GetChangePasswordBoldRange(CredentialLeakType leak_type,
const GURL& origin) {
if (ShouldCheckPasswords(leak_type))
return gfx::Range();
std::vector<size_t> offsets;
const base::string16 bold_message = l10n_util::GetStringUTF16(
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_BOLD_MESSAGE);
const base::string16 change_password_message = l10n_util::GetStringFUTF16(
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE, bold_message,
GetFormattedUrl(origin), &offsets);
return offsets.empty()
? gfx::Range()
: gfx::Range(offsets[0], offsets[0] + bold_message.length());
}
} // namespace password_manager
......@@ -75,12 +75,6 @@ password_manager::metrics_util::LeakDialogType GetLeakDialogType(
// Returns the URL used to launch the password checkup.
GURL GetPasswordCheckupURL();
// Returns the range of the bold part of the leak dialog message when
// credentials were leaked only on current site.
gfx::Range GetChangePasswordBoldRange(
password_manager::CredentialLeakType leak_type,
const GURL& origin);
} // namespace password_manager
#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_LEAK_DETECTION_DIALOG_UTILS_H_
......@@ -78,8 +78,7 @@ TEST(CredentialLeakDialogUtilsTest, GetCheckPasswordsDescription) {
if (kLeakTypesTestCases[i].leak_message_id ==
IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE) {
SCOPED_TRACE(testing::Message() << i);
base::string16 expected_message;
expected_message = l10n_util::GetStringUTF16(
base::string16 expected_message = l10n_util::GetStringUTF16(
IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE);
EXPECT_EQ(expected_message,
GetDescription(kLeakTypesTestCases[i].leak_type, origin));
......@@ -93,8 +92,7 @@ TEST(CredentialLeakDialogUtilsTest, GetChangeAndCheckPasswordsDescription) {
if (kLeakTypesTestCases[i].leak_message_id ==
IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE) {
SCOPED_TRACE(testing::Message() << i);
base::string16 expected_message;
expected_message = l10n_util::GetStringFUTF16(
base::string16 expected_message = l10n_util::GetStringFUTF16(
IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE,
url_formatter::FormatOriginForSecurityDisplay(
url::Origin::Create(origin),
......@@ -111,16 +109,11 @@ TEST(CredentialLeakDialogUtilsTest, GetChangePasswordDescription) {
if (kLeakTypesTestCases[i].leak_message_id ==
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE) {
SCOPED_TRACE(testing::Message() << i);
base::string16 expected_message;
std::vector<size_t> offsets;
base::string16 bold_message = l10n_util::GetStringUTF16(
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_BOLD_MESSAGE);
expected_message = l10n_util::GetStringFUTF16(
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE, bold_message,
base::string16 expected_message = l10n_util::GetStringFUTF16(
IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE,
url_formatter::FormatOriginForSecurityDisplay(
url::Origin::Create(origin),
url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS),
&offsets);
url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS));
EXPECT_EQ(expected_message,
GetDescription(kLeakTypesTestCases[i].leak_type, origin));
}
......
......@@ -11,19 +11,16 @@
</message>
</if>
<message name="IDS_CREDENTIAL_LEAK_TITLE" desc="The title of the credential leak dialog.">
Data breach reported
Your password was compromised
</message>
<message name="IDS_CREDENTIAL_LEAK_CHECK_PASSWORDS_MESSAGE" desc="The text that is used in credential leak detection dialog when saved credentials were used on multiple sites.">
A data breach on a site or app you use exposed your password. Chrome recommends checking your saved passwords now.
A data breach occurred on a site or app you use. Chrome recommends checking your saved passwords now.
</message>
<message name="IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_MESSAGE" desc="The text that is used in credential leak detection dialog when credentials were leaked on current site only.">
A data breach on a site or app you use exposed your password. Chrome recommends <ph name="BOLD">$1<ex>changing your password</ex></ph> on <ph name="ORIGIN">$2<ex>example.com</ex></ph> now.
</message>
<message name="IDS_CREDENTIAL_LEAK_CHANGE_PASSWORD_BOLD_MESSAGE" desc="The text that is written in bold in leak dialog message when credentials were leaked on current site only.">
changing your password
A data breach occurred on a site or app you use. Chrome recommends changing your password on <ph name="ORIGIN">$1<ex>example.com</ex></ph> now.
</message>
<message name="IDS_CREDENTIAL_LEAK_CHANGE_AND_CHECK_PASSWORDS_MESSAGE" desc="The text that is used in credential leak detection dialog when credentials were not saved in chrome, but used on multiple sites.">
A data breach on a site or app you use exposed your password. Chrome recommends checking your saved passwords and changing your password on <ph name="ORIGIN">$1<ex>example.com</ex></ph>.
A data breach occurred on a site or app you use. Chrome recommends checking your saved passwords and changing your password on <ph name="ORIGIN">$1<ex>example.com</ex></ph> now.
</message>
<message name="IDS_MANAGE_PASSWORDS_AUTO_SIGNIN_TITLE" desc="The title of the auto-signin toast.">
Signing in as <ph name="username">$1<ex>chef@google.com</ex></ph>
......
321fb6213aeaed94126445db61ab5430d8475db7
\ No newline at end of file
9837c6abca70ef86a15e71586b165ab83984d7c6
\ No newline at end of file
321fb6213aeaed94126445db61ab5430d8475db7
\ No newline at end of file
file://components/password_manager/OWNERS
# COMPONENT: UI>Browser>Passwords
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