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

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

Issue 2202373002: Ignore OnBubbleHidden() event when the password bubble is reopened. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 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_ui_controller.cc
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
index 81f5748e73c9f56100a989751bfed9a257b9f44f..fb1ebb9c4d46684581d39cbcc0339caa9227361e 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/ui/passwords/manage_passwords_icon_view.h"
#include "chrome/browser/ui/passwords/password_dialog_controller_impl.h"
#include "chrome/browser/ui/passwords/password_dialog_prompts.h"
+#include "chrome/browser/ui/passwords/passwords_model_delegate_proxy.h"
#include "chrome/browser/ui/tab_dialogs.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
@@ -59,6 +60,7 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(ManagePasswordsUIController);
ManagePasswordsUIController::ManagePasswordsUIController(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
+ bubble_delegate_proxy_(new PasswordsModelDelegateProxy(this)),
bubble_status_(NOT_SHOWN) {
passwords_data_.set_client(
ChromePasswordManagerClient::FromWebContents(web_contents));
@@ -174,6 +176,8 @@ void ManagePasswordsUIController::UpdateIconAndBubbleState(
ManagePasswordsIconView* icon) {
if (bubble_status_ == SHOULD_POP_UP) {
DCHECK(!dialog_controller_);
+ // This will detach any existing bubble so OnBubbleHidden() isn't called.
+ bubble_delegate_proxy_.reset(new PasswordsModelDelegateProxy(this));
// We must display the icon before showing the bubble, as the bubble would
// be otherwise unanchored.
icon->SetState(GetState());
@@ -191,6 +195,10 @@ void ManagePasswordsUIController::UpdateIconAndBubbleState(
}
}
+content::WebContents* ManagePasswordsUIController::GetWebContents() const {
+ return web_contents();
+}
+
const GURL& ManagePasswordsUIController::GetOrigin() const {
return passwords_data_.origin();
}
@@ -298,13 +306,16 @@ void ManagePasswordsUIController::UpdatePassword(
}
void ManagePasswordsUIController::ChooseCredential(
- autofill::PasswordForm form,
+ const autofill::PasswordForm& form,
password_manager::CredentialType credential_type) {
DCHECK(dialog_controller_);
DCHECK_EQ(password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD,
credential_type);
+ // Copy the argument before destroying the controller. |form| is a member of
+ // |dialog_controller_|.
+ autofill::PasswordForm copy_form = form;
dialog_controller_.reset();
- passwords_data_.ChooseCredential(&form);
+ passwords_data_.ChooseCredential(&copy_form);
passwords_data_.TransitionToState(password_manager::ui::MANAGE_STATE);
UpdateBubbleAndIconVisibility();
}

Powered by Google App Engine
This is Rietveld 408576698