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

Unified Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 2472133004: Creating class for processing of keypress events. (Closed)
Patch Set: comment fix Created 4 years 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/password_manager/chrome_password_manager_client.cc
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
index 22a725914159216f6c6a9283a9d582b5faec9ce6..b58bec683aa34fa45328eedddd0695b6f2b75ebd 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -144,6 +144,7 @@ ChromePasswordManagerClient::ChromePasswordManagerClient(
: content::WebContentsObserver(web_contents),
profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())),
password_manager_(this),
+ password_reuse_detection_manager_(this),
driver_factory_(nullptr),
credential_manager_impl_(web_contents, this),
password_manager_client_bindings_(web_contents, this),
@@ -377,6 +378,28 @@ void ChromePasswordManagerClient::HidePasswordGenerationPopup() {
popup_controller_->HideAndDestroy();
}
+void ChromePasswordManagerClient::DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) {
+ password_reuse_detection_manager_.DidNavigateMainFrame();
+ // After some navigations RenderViewHost persists and just adding the observer
+ // will cause multiple call of OnInputEvent. Since Widget API doesn't allow to
+ // check whether the observer is already added, the observer is removed and
+ // added again, to ensure that it is added only once.
+ web_contents()->GetRenderViewHost()->GetWidget()->RemoveInputEventObserver(
+ this);
+ web_contents()->GetRenderViewHost()->GetWidget()->AddInputEventObserver(this);
+}
+
+void ChromePasswordManagerClient::OnInputEvent(
+ const blink::WebInputEvent& event) {
+ if (event.type != blink::WebInputEvent::Char)
+ return;
+ const blink::WebKeyboardEvent& key_event =
+ static_cast<const blink::WebKeyboardEvent&>(event);
+ password_reuse_detection_manager_.OnKeyPressed(key_event.text);
+}
+
PrefService* ChromePasswordManagerClient::GetPrefs() {
return profile_->GetPrefs();
}
« no previous file with comments | « chrome/browser/password_manager/chrome_password_manager_client.h ('k') | components/password_manager/core/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698