Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1905)

Unified Diff: chrome/browser/password_manager/save_password_infobar_delegate.cc

Issue 1181623004: [Password Manager] Replace "this site" in save password prompt with password's origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for Windows bot. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/save_password_infobar_delegate.cc
diff --git a/chrome/browser/password_manager/save_password_infobar_delegate.cc b/chrome/browser/password_manager/save_password_infobar_delegate.cc
index 0966fc92065644d8e259da5a775f9b623f26ddc6..f4e9d90d6465f33a747fad46bc5203a7eb9cb3d5 100644
--- a/chrome/browser/password_manager/save_password_infobar_delegate.cc
+++ b/chrome/browser/password_manager/save_password_infobar_delegate.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/infobars/core/infobar.h"
@@ -37,12 +38,13 @@ void SavePasswordInfoBarDelegate::Create(
password_manager::CredentialSourceType source_type) {
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
- InfoBarService::FromWebContents(web_contents)->AddInfoBar(
- CreateSavePasswordInfoBar(make_scoped_ptr(
- new SavePasswordInfoBarDelegate(
- form_to_save.Pass(), uma_histogram_suffix, source_type,
- password_bubble_experiment::IsSmartLockBrandingEnabled(
- ProfileSyncServiceFactory::GetForProfile(profile))))));
+ InfoBarService::FromWebContents(web_contents)
+ ->AddInfoBar(CreateSavePasswordInfoBar(
+ make_scoped_ptr(new SavePasswordInfoBarDelegate(
+ web_contents, form_to_save.Pass(), uma_histogram_suffix,
+ source_type,
+ password_bubble_experiment::IsSmartLockBrandingEnabled(
+ ProfileSyncServiceFactory::GetForProfile(profile))))));
}
SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() {
@@ -71,6 +73,7 @@ SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() {
}
SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate(
+ content::WebContents* web_contents,
scoped_ptr<password_manager::PasswordFormManager> form_to_save,
const std::string& uma_histogram_suffix,
password_manager::CredentialSourceType source_type,
@@ -86,17 +89,9 @@ SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate(
true);
}
title_link_range_ = gfx::Range();
- if (is_smartlock_branding_enabled) {
- size_t offset = 0;
- base::string16 title_link =
- l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);
- title_ = l10n_util::GetStringFUTF16(IDS_SAVE_PASSWORD, title_link, &offset);
- title_link_range_ = gfx::Range(offset, offset + title_link.length());
- } else {
- title_ = l10n_util::GetStringFUTF16(
- IDS_SAVE_PASSWORD,
- l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND));
- }
+ GetSavePasswordDialogTitleTextAndLinkRange(
+ web_contents->GetVisibleURL(), form_to_save_->observed_form().origin,
+ is_smartlock_branding_enabled, &title_, &title_link_range_);
}
bool SavePasswordInfoBarDelegate::ShouldShowMoreButton() {

Powered by Google App Engine
This is Rietveld 408576698