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

Unified Diff: chrome/browser/autofill/autofill_external_delegate.cc

Issue 12288046: Merge 182751 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 10 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/autofill/autofill_external_delegate.cc
===================================================================
--- chrome/browser/autofill/autofill_external_delegate.cc (revision 183209)
+++ chrome/browser/autofill/autofill_external_delegate.cc (working copy)
@@ -49,7 +49,8 @@
password_autofill_manager_(web_contents),
autofill_query_id_(0),
display_warning_if_disabled_(false),
- has_shown_autofill_popup_for_current_edit_(false) {
+ has_shown_autofill_popup_for_current_edit_(false),
+ registered_keyboard_listener_with_(NULL) {
registrar_.Add(this,
content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
content::Source<content::WebContents>(web_contents));
@@ -206,14 +207,19 @@
void AutofillExternalDelegate::OnPopupShown(
content::KeyboardListener* listener) {
- if (web_contents_)
- web_contents_->GetRenderViewHost()->AddKeyboardListener(listener);
+ if (web_contents_ && !registered_keyboard_listener_with_) {
+ registered_keyboard_listener_with_ = web_contents_->GetRenderViewHost();
+ registered_keyboard_listener_with_->AddKeyboardListener(listener);
+ }
}
void AutofillExternalDelegate::OnPopupHidden(
content::KeyboardListener* listener) {
- if (web_contents_)
+ if (web_contents_ && registered_keyboard_listener_with_ ==
+ web_contents_->GetRenderViewHost())
web_contents_->GetRenderViewHost()->RemoveKeyboardListener(listener);
+
+ registered_keyboard_listener_with_ = NULL;
}
void AutofillExternalDelegate::DidSelectSuggestion(int identifier) {
@@ -278,10 +284,8 @@
}
void AutofillExternalDelegate::HideAutofillPopup() {
- if (controller_) {
+ if (controller_)
controller_->Hide();
- OnPopupHidden(controller_.get());
- }
}
void AutofillExternalDelegate::Reset() {

Powered by Google App Engine
This is Rietveld 408576698