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

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

Issue 2472133004: Creating class for processing of keypress events. (Closed)
Patch Set: 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..c0bdae991a835e3f91831ccaa253f4182bf868d9 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),
@@ -255,8 +256,7 @@ bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword(
std::move(form_to_save));
return true;
}
- SavePasswordInfoBarDelegate::Create(web_contents(),
- std::move(form_to_save));
+ SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save));
#endif // !BUILDFLAG(ANDROID_JAVA_UI)
return true;
}
@@ -377,18 +377,36 @@ void ChromePasswordManagerClient::HidePasswordGenerationPopup() {
popup_controller_->HideAndDestroy();
}
+void ChromePasswordManagerClient::DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) {
+ password_reuse_detection_manager_.DidNavigateMainFrame();
+ web_contents()->GetRenderViewHost()->GetWidget()->RemoveInputEventObserver(
vabr (Chromium) 2016/12/23 17:14:10 Why is it needed to remove and immediately add its
dvadym 2016/12/23 17:45:20 I've added a comment with explanation.
vabr (Chromium) 2016/12/23 21:24:24 Acknowledged.
+ 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();
}
-password_manager::PasswordStore*
-ChromePasswordManagerClient::GetPasswordStore() const {
+password_manager::PasswordStore* ChromePasswordManagerClient::GetPasswordStore()
vabr (Chromium) 2016/12/23 17:14:10 nit: Also here and on lines 408-409, please revert
dvadym 2016/12/23 17:45:20 Done.
+ const {
// Always use EXPLICIT_ACCESS as the password manager checks IsOffTheRecord
// itself when it shouldn't access the PasswordStore.
// TODO(gcasto): Is is safe to change this to
// ServiceAccessType::IMPLICIT_ACCESS?
- return PasswordStoreFactory::GetForProfile(
- profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
+ return PasswordStoreFactory::GetForProfile(profile_,
+ ServiceAccessType::EXPLICIT_ACCESS).get();
}
password_manager::PasswordSyncState
@@ -405,8 +423,7 @@ bool ChromePasswordManagerClient::WasLastNavigationHTTPError() const {
if (log_manager_->IsLoggingActive()) {
logger.reset(new password_manager::BrowserSavePasswordProgressLogger(
log_manager_.get()));
- logger->LogMessage(
- Logger::STRING_WAS_LAST_NAVIGATION_HTTP_ERROR_METHOD);
+ logger->LogMessage(Logger::STRING_WAS_LAST_NAVIGATION_HTTP_ERROR_METHOD);
}
content::NavigationEntry* entry =

Powered by Google App Engine
This is Rietveld 408576698