Commit b3b8d6c4 authored by gcasto's avatar gcasto Committed by Commit bot

[Smart Lock] Update password generation prompt to conditionally use new branding

This also changes IsSmartLockedBrandingEnabled() to only return true if the user is syncing without using a custom passphrase.

BUG=486739

Review URL: https://codereview.chromium.org/1138523005

Cr-Commit-Position: refs/heads/master@{#330149}
parent 57da3a29
......@@ -460,8 +460,11 @@ Chromium is unable to recover your settings.
</message>
</if>
<!-- Password generation strings -->
<message name="IDS_PASSWORD_GENERATION_PROMPT" desc="Autofill dropdown text describing password generation. The text inside |bars| is link text.">
Chromium will store this in your |Google saved passwords| and remember it the next time you need it.
<message name="IDS_PASSWORD_GENERATION_PROMPT" desc="Autofill dropdown text describing password generation. The link text is a separate string in the translation console and appears here as placeholder text.">
Chromium will store this in your <ph name="SAVED_PASSWORD_LINK">$1<ex>Google saved passwords</ex></ph> and remember it the next time you need it.
</message>
<message name="IDS_PASSWORD_GENERATION_SMART_LOCK_PROMPT" desc="Autofill dropdown text describing password generation. Used when we change the branding to SmartLock. The link text is a separate string in the translation console and appears here as placeholder text.">
Chromium will store this with <ph name="SAVED_PASSWORD_LINK">$1<ex>Google Smart Lock for Passwords</ex></ph> and remember it the next time you need it.
</message>
<message name="IDS_PASSWORD_GENERATION_SUGGESTION" desc="Text shown next to a generated password describing it as a suggestion.">
Use password generated by Chromium
......
......@@ -6379,6 +6379,9 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_PASSWORD_MANAGER_SMART_LOCK" desc="The brand name of the password manager for the title of the save password bubble when a user is signed in.">
Google Smart Lock
</message>
<message name="IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS" desc="The more descriptive brand name of the password manager when the user is signed in. Used in various UI elements, can be in link format.">
Google Smart Lock for Passwords
</message>
<message name="IDS_PASSWORD_MANAGER_SMART_LOCK_ARTICLE" desc="URL of help center page explaining what the 'Google Smart Lock' is.">
https://support.google.com/chromebook/answer/6070209?hl=[GRITLANGCODE]
</message>
......@@ -13625,7 +13628,7 @@ Some features may be unavailable. Please check that the profile exists and you
<message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT_INFOBAR" desc="A message that the browser shows after saving a password it has autogenerated for the user. This message appears in an infobar and contains a link to all the user's saved autogenerated passwords. The link text is a separate string in the translation console and appears here as placeholder text.">
Generated password saved. You can access it and all your <ph name="SAVED_PASSWORDS_LINK">$1<ex>Google saved passwords</ex></ph> from any browser.
</message>
<message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_LINK" desc="The text for a link to the user's saved autogenerated passwords. This is inserted into an infobar or a bubble that the browser shows to the user after it saves an autogenerated password. The infobar and the bubble use a separate string in the translation console that has a placeholder for this link title.">
<message name="IDS_MANAGE_PASSWORDS_LINK" desc="The text for a link to the user's saved passwords. This is inserted into an infobar or a bubble that the browser shows to the user. The infobar and the bubble use a separate string in the translation console that has a placeholder for this link title.">
Google saved passwords
</message>
<message name="IDS_MANAGE_PASSWORDS_TITLE" desc="The title text that is used in the manage passwords bubble when a password is autofilled or after a user has stored a password.">
......@@ -383,8 +383,11 @@ Google Chrome is unable to recover your settings.
</message>
</if>
<!-- Password generation strings -->
<message name="IDS_PASSWORD_GENERATION_PROMPT" desc="Autofill dropdown text describing password generation. The text inside |bars| is link text.">
Chrome will store this in your |Google saved passwords| and remember it the next time you need it.
<message name="IDS_PASSWORD_GENERATION_PROMPT" desc="Autofill dropdown text describing password generation. The link text is a separate string in the translation console and appears here as placeholder text.">
Chrome will store this in your <ph name="SAVED_PASSWORDS_LINK">$1<ex>Google saved passwords</ex></ph> and remember it the next time you need it.
</message>
<message name="IDS_PASSWORD_GENERATION_SMART_LOCK_PROMPT" desc="Autofill dropdown text describing password generation. Used when we change the branding to SmartLock. The link text is a separate string in the translation console and appears here as placeholder text.">
Chrome will store this with <ph name="SAVED_PASSWORD_LINK">$1<ex>Google Smart Lock for Passwords</ex></ph> and remember it the next time you need it.
</message>
<message name="IDS_PASSWORD_GENERATION_SUGGESTION" desc="Text shown next to a generated password describing it as a suggestion.">
Use password generated by Chrome
......
......@@ -22,7 +22,7 @@ GeneratedPasswordSavedInfoBarDelegateAndroid::
GeneratedPasswordSavedInfoBarDelegateAndroid()
: button_label_(l10n_util::GetStringUTF16(IDS_OK)) {
base::string16 link = l10n_util::GetStringUTF16(
IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_LINK);
IDS_MANAGE_PASSWORDS_LINK);
size_t offset;
message_text_ = l10n_util::GetStringFUTF16(
IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT_INFOBAR, link, &offset);
......
......@@ -44,7 +44,7 @@ void SavePasswordInfoBarDelegate::Create(
SavePasswordInfoBarDelegate* infobar_delegate =
new SavePasswordInfoBarDelegate(
form_to_save.Pass(), uma_histogram_suffix, source_type,
password_bubble_experiment::IsEnabledSmartLockBranding(profile));
password_bubble_experiment::IsSmartLockBrandingEnabled(profile));
#if defined(OS_ANDROID)
// For Android in case of smart lock we need different appearance of infobar.
scoped_ptr<infobars::InfoBar> infobar =
......
......@@ -11,11 +11,13 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/autofill/password_generation_popup_observer.h"
#include "chrome/browser/ui/autofill/password_generation_popup_view.h"
#include "chrome/browser/ui/autofill/popup_constants.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/passwords/password_bubble_experiment.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
......@@ -87,15 +89,18 @@ PasswordGenerationPopupControllerImpl::PasswordGenerationPopupControllerImpl(
base::Bind(&PasswordGenerationPopupControllerImpl::HandleKeyPressEvent,
base::Unretained(this)));
std::vector<base::string16> pieces;
base::SplitStringDontTrim(
l10n_util::GetStringUTF16(IDS_PASSWORD_GENERATION_PROMPT),
'|', // separator
&pieces);
DCHECK_EQ(3u, pieces.size());
link_range_ = gfx::Range(pieces[0].size(),
pieces[0].size() + pieces[1].size());
help_text_ = JoinString(pieces, base::string16());
int link_id = IDS_MANAGE_PASSWORDS_LINK;
int help_text_id = IDS_PASSWORD_GENERATION_PROMPT;
if (password_bubble_experiment::IsSmartLockBrandingEnabled(
Profile::FromBrowserContext(web_contents->GetBrowserContext()))) {
help_text_id = IDS_PASSWORD_GENERATION_SMART_LOCK_PROMPT;
link_id = IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS;
}
base::string16 link = l10n_util::GetStringUTF16(link_id);
size_t offset;
help_text_ = l10n_util::GetStringFUTF16(help_text_id, link, &offset);
link_range_ = gfx::Range(offset, offset + link.length());
}
PasswordGenerationPopupControllerImpl::~PasswordGenerationPopupControllerImpl()
......
......@@ -118,7 +118,7 @@ ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
if (state_ == password_manager::ui::CONFIRMATION_STATE) {
base::string16 save_confirmation_link =
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_LINK);
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK);
size_t offset;
save_confirmation_text_ =
l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT,
......@@ -313,7 +313,7 @@ void ManagePasswordsBubbleModel::UpdatePendingStateTitle() {
if (never_save_passwords_) {
title_ = l10n_util::GetStringUTF16(
IDS_MANAGE_PASSWORDS_BLACKLIST_CONFIRMATION_TITLE);
} else if (password_bubble_experiment::IsEnabledSmartLockBranding(
} else if (password_bubble_experiment::IsSmartLockBrandingEnabled(
GetProfile())) {
// "Google Smart Lock" should be a hyperlink.
base::string16 brand_link =
......
......@@ -12,7 +12,7 @@
namespace password_bubble_experiment {
namespace {
const char kBrandingExperimentName[] = "PasswordBubbleBranding";
const char kBrandingExperimentName[] = "PasswordBranding";
const char kSmartLockBrandingGroupName[] = "SmartLockBranding";
} // namespace
......@@ -23,7 +23,7 @@ void RecordBubbleClosed(
// TODO(vasilii): store the statistics.
}
bool IsEnabledSmartLockBranding(Profile* profile) {
bool IsSmartLockBrandingEnabled(Profile* profile) {
const ProfileSyncService* sync_service =
ProfileSyncServiceFactory::GetForProfile(profile);
return password_manager_util::GetPasswordSyncState(sync_service) ==
......@@ -32,5 +32,4 @@ bool IsEnabledSmartLockBranding(Profile* profile) {
kSmartLockBrandingGroupName;
}
} // namespace password_bubble_experiment
......@@ -18,9 +18,9 @@ void RecordBubbleClosed(
PrefService* prefs,
password_manager::metrics_util::UIDismissalReason reason);
// Returns true if the Save bubble should mention Smart Lock instead of Chrome.
// Returns true if the password manager should be referred to as Smart Lock.
// This is only true for signed-in users.
bool IsEnabledSmartLockBranding(Profile* profile);
bool IsSmartLockBrandingEnabled(Profile* profile);
} // namespace password_bubble_experiment
......
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