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

[Smart Lock] Update password generation confirmation to use new branding

BUG=486739

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

Cr-Commit-Position: refs/heads/master@{#330198}
parent 44406a3f
...@@ -13616,13 +13616,16 @@ Some features may be unavailable. Please check that the profile exists and you ...@@ -13616,13 +13616,16 @@ Some features may be unavailable. Please check that the profile exists and you
</if> </if>
<message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TITLE" desc="The title text that is used in the manage passwords bubble when the user has generated a password."> <message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TITLE" desc="The title text that is used in the manage passwords bubble when the user has generated a password.">
Generated password saved Password saved
</message> </message>
<message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT" desc="A message that the browser shows after saving a password it has autogenerated for the user. This message appears in a bubble 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" desc="A message that the browser shows after saving a password it has autogenerated for the user. This message appears in a bubble 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.">
You can access it and all your <ph name="SAVED_PASSWORDS_LINK">$1<ex>Google saved passwords</ex></ph> from any browser. 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_SMART_LOCK_TEXT" desc="A message that the browser shows after saving a password it has autogenerated for the user if Smart Lock branding is enabled. This message appears in a bubble and contains a link to all the user's saved autogenerated passwords.">
Access your passwords from any device at <ph name="MANAGEMENT_LINK">$1<ex>passwords.google.com</ex></ph>.
</message>
<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. 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_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."> <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
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
#include "chrome/browser/ui/passwords/password_bubble_experiment.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/chromium_strings.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/feedback/feedback_data.h" #include "components/feedback/feedback_data.h"
...@@ -119,10 +120,19 @@ ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( ...@@ -119,10 +120,19 @@ 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_LINK); l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK);
int confirmation_text_id = IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT;
if (password_bubble_experiment::IsSmartLockBrandingEnabled(GetProfile())) {
std::string management_hostname =
GURL(chrome::kPasswordManagerAccountDashboardURL).host();
save_confirmation_link = base::UTF8ToUTF16(management_hostname);
confirmation_text_id =
IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_SMART_LOCK_TEXT;
}
size_t offset; size_t offset;
save_confirmation_text_ = save_confirmation_text_ =
l10n_util::GetStringFUTF16(IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT, l10n_util::GetStringFUTF16(
save_confirmation_link, &offset); confirmation_text_id, save_confirmation_link, &offset);
save_confirmation_link_range_ = save_confirmation_link_range_ =
gfx::Range(offset, offset + save_confirmation_link.length()); gfx::Range(offset, offset + save_confirmation_link.length());
} }
...@@ -239,8 +249,13 @@ void ManagePasswordsBubbleModel::OnOKClicked() { ...@@ -239,8 +249,13 @@ void ManagePasswordsBubbleModel::OnOKClicked() {
void ManagePasswordsBubbleModel::OnManageLinkClicked() { void ManagePasswordsBubbleModel::OnManageLinkClicked() {
dismissal_reason_ = metrics_util::CLICKED_MANAGE; dismissal_reason_ = metrics_util::CLICKED_MANAGE;
ManagePasswordsUIController::FromWebContents(web_contents()) if (password_bubble_experiment::IsSmartLockBrandingEnabled(GetProfile())) {
->NavigateToPasswordManagerSettingsPage(); ManagePasswordsUIController::FromWebContents(web_contents())
->NavigateToExternalPasswordManager();
} else {
ManagePasswordsUIController::FromWebContents(web_contents())
->NavigateToPasswordManagerSettingsPage();
}
} }
void ManagePasswordsBubbleModel::OnBrandLinkClicked() { void ManagePasswordsBubbleModel::OnBrandLinkClicked() {
...@@ -314,7 +329,7 @@ void ManagePasswordsBubbleModel::UpdatePendingStateTitle() { ...@@ -314,7 +329,7 @@ void ManagePasswordsBubbleModel::UpdatePendingStateTitle() {
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::IsSmartLockBrandingEnabled( } 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 =
l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);
......
...@@ -159,8 +159,7 @@ void ManagePasswordsUIController::OnLoginsChanged( ...@@ -159,8 +159,7 @@ void ManagePasswordsUIController::OnLoginsChanged(
UpdateBubbleAndIconVisibility(); UpdateBubbleAndIconVisibility();
} }
void ManagePasswordsUIController:: void ManagePasswordsUIController::NavigateToPasswordManagerSettingsPage() {
NavigateToPasswordManagerSettingsPage() {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
chrome::android::ChromiumApplication::ShowPasswordSettings(); chrome::android::ChromiumApplication::ShowPasswordSettings();
#else #else
...@@ -170,6 +169,19 @@ void ManagePasswordsUIController:: ...@@ -170,6 +169,19 @@ void ManagePasswordsUIController::
#endif #endif
} }
void ManagePasswordsUIController::NavigateToExternalPasswordManager() {
#if defined(OS_ANDROID)
NOTREACHED();
#else
chrome::NavigateParams params(
chrome::FindBrowserWithWebContents(web_contents()),
GURL(chrome::kPasswordManagerAccountDashboardURL),
ui::PAGE_TRANSITION_LINK);
params.disposition = NEW_FOREGROUND_TAB;
chrome::Navigate(&params);
#endif
}
void ManagePasswordsUIController::NavigateToSmartLockHelpArticle() { void ManagePasswordsUIController::NavigateToSmartLockHelpArticle() {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
NOTREACHED(); NOTREACHED();
......
...@@ -104,6 +104,9 @@ class ManagePasswordsUIController ...@@ -104,6 +104,9 @@ class ManagePasswordsUIController
// Open a new tab, pointing to the password manager settings page. // Open a new tab, pointing to the password manager settings page.
virtual void NavigateToPasswordManagerSettingsPage(); virtual void NavigateToPasswordManagerSettingsPage();
// Open a new tab, pointing to passwords.google.com.
void NavigateToExternalPasswordManager();
// Open a new tab, pointing to the Smart Lock help article. // Open a new tab, pointing to the Smart Lock help article.
void NavigateToSmartLockHelpArticle(); void NavigateToSmartLockHelpArticle();
......
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