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. ...@@ -460,8 +460,11 @@ Chromium is unable to recover your settings.
</message> </message>
</if> </if>
<!-- Password generation strings --> <!-- Password generation strings -->
<message name="IDS_PASSWORD_GENERATION_PROMPT" desc="Autofill dropdown text describing password generation. The text inside |bars| is link text."> <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 |Google saved passwords| and remember it the next time you need it. 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>
<message name="IDS_PASSWORD_GENERATION_SUGGESTION" desc="Text shown next to a generated password describing it as a suggestion."> <message name="IDS_PASSWORD_GENERATION_SUGGESTION" desc="Text shown next to a generated password describing it as a suggestion.">
Use password generated by Chromium 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 ...@@ -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."> <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 Google Smart Lock
</message> </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."> <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] https://support.google.com/chromebook/answer/6070209?hl=[GRITLANGCODE]
</message> </message>
...@@ -13625,7 +13628,7 @@ Some features may be unavailable. Please check that the profile exists and you ...@@ -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."> <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. 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>
<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 Google saved passwords
</message> </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."> <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. ...@@ -383,8 +383,11 @@ Google Chrome is unable to recover your settings.
</message> </message>
</if> </if>
<!-- Password generation strings --> <!-- Password generation strings -->
<message name="IDS_PASSWORD_GENERATION_PROMPT" desc="Autofill dropdown text describing password generation. The text inside |bars| is link text."> <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 |Google saved passwords| and remember it the next time you need it. 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>
<message name="IDS_PASSWORD_GENERATION_SUGGESTION" desc="Text shown next to a generated password describing it as a suggestion."> <message name="IDS_PASSWORD_GENERATION_SUGGESTION" desc="Text shown next to a generated password describing it as a suggestion.">
Use password generated by Chrome Use password generated by Chrome
......
...@@ -22,7 +22,7 @@ GeneratedPasswordSavedInfoBarDelegateAndroid:: ...@@ -22,7 +22,7 @@ GeneratedPasswordSavedInfoBarDelegateAndroid::
GeneratedPasswordSavedInfoBarDelegateAndroid() GeneratedPasswordSavedInfoBarDelegateAndroid()
: button_label_(l10n_util::GetStringUTF16(IDS_OK)) { : button_label_(l10n_util::GetStringUTF16(IDS_OK)) {
base::string16 link = l10n_util::GetStringUTF16( base::string16 link = l10n_util::GetStringUTF16(
IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_LINK); IDS_MANAGE_PASSWORDS_LINK);
size_t offset; size_t offset;
message_text_ = l10n_util::GetStringFUTF16( message_text_ = l10n_util::GetStringFUTF16(
IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT_INFOBAR, link, &offset); IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT_INFOBAR, link, &offset);
......
...@@ -44,7 +44,7 @@ void SavePasswordInfoBarDelegate::Create( ...@@ -44,7 +44,7 @@ void SavePasswordInfoBarDelegate::Create(
SavePasswordInfoBarDelegate* infobar_delegate = SavePasswordInfoBarDelegate* infobar_delegate =
new SavePasswordInfoBarDelegate( new SavePasswordInfoBarDelegate(
form_to_save.Pass(), uma_histogram_suffix, source_type, form_to_save.Pass(), uma_histogram_suffix, source_type,
password_bubble_experiment::IsEnabledSmartLockBranding(profile)); password_bubble_experiment::IsSmartLockBrandingEnabled(profile));
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// For Android in case of smart lock we need different appearance of infobar. // For Android in case of smart lock we need different appearance of infobar.
scoped_ptr<infobars::InfoBar> infobar = scoped_ptr<infobars::InfoBar> infobar =
......
...@@ -11,11 +11,13 @@ ...@@ -11,11 +11,13 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversion_utils.h" #include "base/strings/utf_string_conversion_utils.h"
#include "base/strings/utf_string_conversions.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_observer.h"
#include "chrome/browser/ui/autofill/password_generation_popup_view.h" #include "chrome/browser/ui/autofill/password_generation_popup_view.h"
#include "chrome/browser/ui/autofill/popup_constants.h" #include "chrome/browser/ui/autofill/popup_constants.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.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/common/url_constants.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
...@@ -87,15 +89,18 @@ PasswordGenerationPopupControllerImpl::PasswordGenerationPopupControllerImpl( ...@@ -87,15 +89,18 @@ PasswordGenerationPopupControllerImpl::PasswordGenerationPopupControllerImpl(
base::Bind(&PasswordGenerationPopupControllerImpl::HandleKeyPressEvent, base::Bind(&PasswordGenerationPopupControllerImpl::HandleKeyPressEvent,
base::Unretained(this))); base::Unretained(this)));
std::vector<base::string16> pieces; int link_id = IDS_MANAGE_PASSWORDS_LINK;
base::SplitStringDontTrim( int help_text_id = IDS_PASSWORD_GENERATION_PROMPT;
l10n_util::GetStringUTF16(IDS_PASSWORD_GENERATION_PROMPT), if (password_bubble_experiment::IsSmartLockBrandingEnabled(
'|', // separator Profile::FromBrowserContext(web_contents->GetBrowserContext()))) {
&pieces); help_text_id = IDS_PASSWORD_GENERATION_SMART_LOCK_PROMPT;
DCHECK_EQ(3u, pieces.size()); link_id = IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS;
link_range_ = gfx::Range(pieces[0].size(), }
pieces[0].size() + pieces[1].size());
help_text_ = JoinString(pieces, base::string16()); 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() PasswordGenerationPopupControllerImpl::~PasswordGenerationPopupControllerImpl()
......
...@@ -118,7 +118,7 @@ ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( ...@@ -118,7 +118,7 @@ ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
if (state_ == password_manager::ui::CONFIRMATION_STATE) { if (state_ == password_manager::ui::CONFIRMATION_STATE) {
base::string16 save_confirmation_link = base::string16 save_confirmation_link =
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_LINK); l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK);
size_t offset; size_t offset;
save_confirmation_text_ = save_confirmation_text_ =
l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT, l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT,
...@@ -313,7 +313,7 @@ void ManagePasswordsBubbleModel::UpdatePendingStateTitle() { ...@@ -313,7 +313,7 @@ void ManagePasswordsBubbleModel::UpdatePendingStateTitle() {
if (never_save_passwords_) { if (never_save_passwords_) {
title_ = l10n_util::GetStringUTF16( title_ = l10n_util::GetStringUTF16(
IDS_MANAGE_PASSWORDS_BLACKLIST_CONFIRMATION_TITLE); IDS_MANAGE_PASSWORDS_BLACKLIST_CONFIRMATION_TITLE);
} else if (password_bubble_experiment::IsEnabledSmartLockBranding( } else if (password_bubble_experiment::IsSmartLockBrandingEnabled(
GetProfile())) { GetProfile())) {
// "Google Smart Lock" should be a hyperlink. // "Google Smart Lock" should be a hyperlink.
base::string16 brand_link = base::string16 brand_link =
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
namespace password_bubble_experiment { namespace password_bubble_experiment {
namespace { namespace {
const char kBrandingExperimentName[] = "PasswordBubbleBranding"; const char kBrandingExperimentName[] = "PasswordBranding";
const char kSmartLockBrandingGroupName[] = "SmartLockBranding"; const char kSmartLockBrandingGroupName[] = "SmartLockBranding";
} // namespace } // namespace
...@@ -23,7 +23,7 @@ void RecordBubbleClosed( ...@@ -23,7 +23,7 @@ void RecordBubbleClosed(
// TODO(vasilii): store the statistics. // TODO(vasilii): store the statistics.
} }
bool IsEnabledSmartLockBranding(Profile* profile) { bool IsSmartLockBrandingEnabled(Profile* profile) {
const ProfileSyncService* sync_service = const ProfileSyncService* sync_service =
ProfileSyncServiceFactory::GetForProfile(profile); ProfileSyncServiceFactory::GetForProfile(profile);
return password_manager_util::GetPasswordSyncState(sync_service) == return password_manager_util::GetPasswordSyncState(sync_service) ==
...@@ -32,5 +32,4 @@ bool IsEnabledSmartLockBranding(Profile* profile) { ...@@ -32,5 +32,4 @@ bool IsEnabledSmartLockBranding(Profile* profile) {
kSmartLockBrandingGroupName; kSmartLockBrandingGroupName;
} }
} // namespace password_bubble_experiment } // namespace password_bubble_experiment
...@@ -18,9 +18,9 @@ void RecordBubbleClosed( ...@@ -18,9 +18,9 @@ void RecordBubbleClosed(
PrefService* prefs, PrefService* prefs,
password_manager::metrics_util::UIDismissalReason reason); 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. // This is only true for signed-in users.
bool IsEnabledSmartLockBranding(Profile* profile); bool IsSmartLockBrandingEnabled(Profile* profile);
} // namespace password_bubble_experiment } // 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