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

Unified Diff: chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.cc

Issue 259153004: Password bubble: Give users the option of unblacklisting a site. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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/ui/passwords/manage_passwords_bubble_ui_controller.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.cc
index 88c76e64107b753d5d0099dfe3bbbdab3dc51476..2dbd6c13fad2c4632c4ee393b41d53bb957aa974 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.cc
@@ -80,7 +80,10 @@ void ManagePasswordsBubbleUIController::OnPasswordAutofilled(
UpdateBubbleAndIconVisibility();
}
-void ManagePasswordsBubbleUIController::OnBlacklistBlockedAutofill() {
+void ManagePasswordsBubbleUIController::OnBlacklistBlockedAutofill(
+ const PasswordFormMap& password_form_map) {
+ password_form_map_ = password_form_map;
+ origin_ = password_form_map_.begin()->second->origin;
manage_passwords_icon_to_be_shown_ = true;
password_to_be_saved_ = false;
manage_passwords_bubble_needs_showing_ = false;
@@ -130,11 +133,32 @@ void ManagePasswordsBubbleUIController::
void ManagePasswordsBubbleUIController::SavePassword() {
DCHECK(form_manager_.get());
form_manager_->Save();
+ password_to_be_saved_ = false;
}
void ManagePasswordsBubbleUIController::NeverSavePassword() {
DCHECK(form_manager_.get());
form_manager_->PermanentlyBlacklist();
+ autofill_blocked_ = true;
+ password_to_be_saved_ = false;
+ UpdateBubbleAndIconVisibility();
+}
+
+void ManagePasswordsBubbleUIController::UnblacklistSite() {
+ // We're in one of two states: either the user _just_ blacklisted the site
+ // by clicking "Never save" in the pending bubble, or the user is visiting
+ // a blacklisted site.
+ //
+ // Either way, |password_form_map_| has been populated with the relevant
+ // form. We can safely pull it out, send it over to the password store
+ // for removal, and update our internal state.
+ DCHECK(!password_form_map_.empty());
+ password_manager::PasswordStore* password_store =
+ GetPasswordStore(web_contents());
+ if (password_store)
+ password_store->RemoveLogin(*password_form_map_.begin()->second);
+ autofill_blocked_ = false;
+ UpdateBubbleAndIconVisibility();
}
void ManagePasswordsBubbleUIController::DidNavigateMainFrame(

Powered by Google App Engine
This is Rietveld 408576698