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

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

Issue 228593002: Password bubble: Keep the bubble in sync with the password store. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vabr's feedback. Created 6 years, 8 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.h
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h b/chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h
index e7e7118550e3507137109768950d7c3184172a15..3e57ce45935b20460c230e63f266b53ef8424e60 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h
@@ -6,6 +6,8 @@
#define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_UI_CONTROLLER_H_
#include "components/password_manager/core/browser/password_form_manager.h"
+#include "components/password_manager/core/browser/password_store.h"
+#include "components/password_manager/core/browser/password_store_change.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
@@ -17,7 +19,8 @@ class WebContents;
// Per-tab class to control the Omnibox password icon and bubble.
class ManagePasswordsBubbleUIController
: public content::WebContentsObserver,
- public content::WebContentsUserData<ManagePasswordsBubbleUIController> {
+ public content::WebContentsUserData<ManagePasswordsBubbleUIController>,
+ public PasswordStore::Observer {
public:
virtual ~ManagePasswordsBubbleUIController();
@@ -36,12 +39,8 @@ class ManagePasswordsBubbleUIController
// Called when a form is _not_ autofilled due to user blacklisting.
void OnBlacklistBlockedAutofill();
- // TODO(npentrel) This ought to be changed. Best matches should be newly
- // made when opening the ManagePasswordsBubble because there may have been
- // changes to the best matches via the settings page. At the moment this also
- // fails if one deletes a password when they are autofilled, as it still shows
- // up after logging in and saving a password.
- void RemoveFromBestMatches(autofill::PasswordForm password_form);
+ // PasswordStore::Observer implementation.
+ virtual void OnLoginsChanged(const PasswordStoreChangeList& changes) OVERRIDE;
void SavePassword();
@@ -79,14 +78,6 @@ class ManagePasswordsBubbleUIController
return password_form_map_;
}
- bool password_submitted() const {
- return password_submitted_;
- }
-
- void set_password_submitted(bool password_submitted) {
- password_submitted_ = password_submitted;
- }
-
bool autofill_blocked() const { return autofill_blocked_; }
void set_autofill_blocked(bool autofill_blocked) {
autofill_blocked_ = autofill_blocked;
@@ -107,6 +98,8 @@ class ManagePasswordsBubbleUIController
virtual void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) OVERRIDE;
+ virtual void WebContentsDestroyed(
+ content::WebContents* web_contents) OVERRIDE;
// Set by OnPasswordSubmitted() when the user submits a form containing login
// information. If the user responds to a subsequent "Do you want to save
@@ -121,14 +114,16 @@ class ManagePasswordsBubbleUIController
bool manage_passwords_icon_to_be_shown_;
bool password_to_be_saved_;
bool manage_passwords_bubble_needs_showing_;
- // Stores whether a new password has been submitted, if so we have
- // |pending_credentials|.
- bool password_submitted_;
// Stores whether autofill was blocked due to a user's decision to blacklist
// the current site ("Never save passwords for this site").
bool autofill_blocked_;
+ // The origin of the form we're currently dealing with; we'll use this to
+ // determine which PasswordStore changes we should care about when updating
+ // |password_form_map_|.
+ GURL origin_;
+
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleUIController);
};

Powered by Google App Engine
This is Rietveld 408576698