Chromium Code Reviews| Index: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
| diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
| index d572f6e3cc078e4ebffe186b539f8d326e7d59ee..fc0d4df905dae37faeb356ab79a5291d2bc49acc 100644 |
| --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
| +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc |
| @@ -43,13 +43,22 @@ void RecordExperimentStatistics(content::WebContents* web_contents, |
| password_bubble_experiment::RecordBubbleClosed(profile->GetPrefs(), reason); |
| } |
| +base::string16 PendingStateTitleBasedOnSafePasswordPref( |
| + bool never_save_passwords) { |
| + if (!never_save_passwords) |
|
Mike West
2014/12/04 00:11:48
Negations are confusing. :)
How about something m
melandory
2014/12/04 09:41:30
Done.
|
| + return l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD); |
| + else |
| + return l10n_util::GetStringUTF16( |
| + IDS_MANAGE_PASSWORDS_BLACKLIST_CONFIRMATION_TITLE); |
| +} |
| + |
| } // namespace |
| ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( |
| content::WebContents* web_contents) |
| : content::WebContentsObserver(web_contents), |
| - display_disposition_( |
| - metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING), |
| + never_save_passwords_(false), |
| + display_disposition_(metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING), |
| dismissal_reason_(metrics_util::NOT_DISPLAYED) { |
| ManagePasswordsUIController* controller = |
| ManagePasswordsUIController::FromWebContents(web_contents); |
| @@ -63,7 +72,7 @@ ManagePasswordsBubbleModel::ManagePasswordsBubbleModel( |
| best_matches_ = controller->best_matches(); |
| if (password_manager::ui::IsPendingState(state_)) { |
| - title_ = l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD); |
| + title_ = PendingStateTitleBasedOnSafePasswordPref(never_save_passwords_); |
|
Mike West
2014/12/04 00:11:48
Nit: s/Safe/Save/?
melandory
2014/12/04 09:41:30
Done.
|
| } else if (state_ == password_manager::ui::BLACKLIST_STATE) { |
| title_ = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_BLACKLISTED_TITLE); |
| } else if (state_ == password_manager::ui::CONFIRMATION_STATE) { |
| @@ -148,6 +157,16 @@ void ManagePasswordsBubbleModel::OnNopeClicked() { |
| state_ = password_manager::ui::PENDING_PASSWORD_STATE; |
| } |
| +void ManagePasswordsBubbleModel::OnConfirmationForNeverForThisSite() { |
| + never_save_passwords_ = true; |
| + PendingStateTitleBasedOnSafePasswordPref(never_save_passwords_); |
|
Mike West
2014/12/04 00:11:48
You're not doing anything with the result of this
melandory
2014/12/04 09:41:30
Nope. It's bug, thanks for catching.
|
| +} |
| + |
| +void ManagePasswordsBubbleModel::OnUndoNeverForThisSite() { |
| + never_save_passwords_ = false; |
| + PendingStateTitleBasedOnSafePasswordPref(never_save_passwords_); |
|
Mike West
2014/12/04 00:11:48
Ditto.
melandory
2014/12/04 09:41:30
Done.
|
| +} |
| + |
| void ManagePasswordsBubbleModel::OnNeverForThisSiteClicked() { |
| dismissal_reason_ = metrics_util::CLICKED_NEVER; |
| RecordExperimentStatistics(web_contents(), dismissal_reason_); |