Chromium Code Reviews| 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 54bfc2814b4cda4d4d6104c8ccd45432262508fe..449f5cbf78bd61cc4086789945ef7dfefc460309 100644 |
| --- a/chrome/browser/password_manager/save_password_infobar_delegate.cc |
| +++ b/chrome/browser/password_manager/save_password_infobar_delegate.cc |
| @@ -6,6 +6,8 @@ |
| #include "base/metrics/histogram.h" |
| #include "chrome/browser/infobars/infobar_service.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/passwords/password_bubble_experiment.h" |
| #include "chrome/grit/chromium_strings.h" |
| #include "chrome/grit/generated_resources.h" |
| #include "components/infobars/core/infobar.h" |
| @@ -38,8 +40,8 @@ void SavePasswordInfoBarDelegate::Create( |
| InfoBarService* infobar_service = |
| InfoBarService::FromWebContents(web_contents); |
| SavePasswordInfoBarDelegate* infobar_delegate = |
| - new SavePasswordInfoBarDelegate( |
| - form_to_save.Pass(), uma_histogram_suffix, source_type); |
| + new SavePasswordInfoBarDelegate(web_contents, form_to_save.Pass(), |
| + uma_histogram_suffix, source_type); |
| #if defined(OS_ANDROID) |
| // For Android in case of smart lock we need different appearance of infobar. |
| scoped_ptr<infobars::InfoBar> infobar = |
| @@ -79,6 +81,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,7 +89,8 @@ SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate( |
| form_to_save_(form_to_save.Pass()), |
| infobar_response_(password_manager::metrics_util::NO_RESPONSE), |
| uma_histogram_suffix_(uma_histogram_suffix), |
| - source_type_(source_type) { |
| + source_type_(source_type), |
| + web_contents_(web_contents) { |
| if (!uma_histogram_suffix_.empty()) { |
| password_manager::metrics_util::LogUMAHistogramBoolean( |
| "PasswordManager.SavePasswordPromptDisplayed_" + uma_histogram_suffix_, |
| @@ -125,11 +129,14 @@ void SavePasswordInfoBarDelegate::InfoBarDismissed() { |
| } |
| base::string16 SavePasswordInfoBarDelegate::GetMessageText() const { |
| - int brand_string_id = |
| - (source_type_ == |
| - password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API) |
| - ? IDS_PASSWORD_MANAGER_SMART_LOCK |
| - : IDS_SAVE_PASSWORD_TITLE_BRAND; |
| + int brand_string_id = IDS_SAVE_PASSWORD_TITLE_BRAND; |
| + Profile* profile = |
| + Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| + if (source_type_ == |
| + password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API || |
|
vabr (Chromium)
2015/05/11 15:29:10
Did you mean && instead of ||?
(At least that's wh
Mike West
2015/05/11 15:51:48
Moreover, why are we changing the branding based o
melandory
2015/05/12 09:07:23
I meant || here. Because my understanding was that
|
| + password_bubble_experiment::IsEnabledSmartLockBranding(profile)) { |
| + brand_string_id = IDS_PASSWORD_MANAGER_SMART_LOCK; |
| + } |
| return l10n_util::GetStringFUTF16(IDS_SAVE_PASSWORD, |
| l10n_util::GetStringUTF16(brand_string_id)); |
| } |