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

Unified Diff: components/autofill/content/browser/content_autofill_driver.cc

Issue 2762233004: Fix autofill popup controller key press callback registration (Closed)
Patch Set: Fix typo Created 3 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: components/autofill/content/browser/content_autofill_driver.cc
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc
index a0fed92c8641b8815a7067f8ca77037980b48a2c..59456b06dd21862e0ad78dddf5664f0d52814780 100644
--- a/components/autofill/content/browser/content_autofill_driver.cc
+++ b/components/autofill/content/browser/content_autofill_driver.cc
@@ -20,6 +20,7 @@
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
@@ -41,6 +42,7 @@ ContentAutofillDriver::ContentAutofillDriver(
app_locale,
enable_download_manager)),
autofill_external_delegate_(autofill_manager_.get(), this),
+ key_press_handler_manager_(this),
binding_(this) {
autofill_manager_->SetExternalDelegate(&autofill_external_delegate_);
}
@@ -267,4 +269,29 @@ const mojom::AutofillAgentPtr& ContentAutofillDriver::GetAutofillAgent() {
return autofill_agent_;
}
+void ContentAutofillDriver::RegisterKeyPressHandler(
+ const content::RenderWidgetHost::KeyPressEventCallback& handler) {
+ key_press_handler_manager_.RegisterKeyPressHandler(handler);
+}
+
+void ContentAutofillDriver::RemoveKeyPressHandler() {
+ key_press_handler_manager_.RemoveKeyPressHandler();
+}
+
+void ContentAutofillDriver::AddHandler(
+ const content::RenderWidgetHost::KeyPressEventCallback& handler) {
+ content::RenderWidgetHostView* view = render_frame_host_->GetView();
+ if (!view)
+ return;
+ view->GetRenderWidgetHost()->AddKeyPressEventCallback(handler);
+}
+
+void ContentAutofillDriver::RemoveHandler(
+ const content::RenderWidgetHost::KeyPressEventCallback& handler) {
+ content::RenderWidgetHostView* view = render_frame_host_->GetView();
+ if (!view)
+ return;
+ view->GetRenderWidgetHost()->RemoveKeyPressEventCallback(handler);
+}
+
} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698