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

Unified Diff: components/password_manager/core/browser/password_reuse_detection_manager.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: components/password_manager/core/browser/password_reuse_detection_manager.cc
diff --git a/components/password_manager/core/browser/password_reuse_detection_manager.cc b/components/password_manager/core/browser/password_reuse_detection_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8063d739925ae2a3bb8146624cb80d6e6607a0d9
--- /dev/null
+++ b/components/password_manager/core/browser/password_reuse_detection_manager.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/core/browser/password_reuse_detection_manager.h"
+
+#include "components/password_manager/core/browser/password_manager_client.h"
+
+namespace password_manager {
+
+namespace {
+const size_t kMaxNumberOfCharactersToStore = 30;
vabr (Chromium) 2016/12/23 17:14:11 constexpr
dvadym 2016/12/23 17:45:20 Done.
+}
+
+PasswordReuseDetectionManager::PasswordReuseDetectionManager(
+ PasswordManagerClient* client)
+ : client_(client) {
+ DCHECK(client_);
+}
+
+PasswordReuseDetectionManager::~PasswordReuseDetectionManager() {}
+
+void PasswordReuseDetectionManager::DidNavigateMainFrame() {
+ input_characters_.clear();
+}
+
+void PasswordReuseDetectionManager::OnKeyPressed(const base::string16& text) {
+ input_characters_ += text;
+ if (input_characters_.size() > kMaxNumberOfCharactersToStore)
+ input_characters_.erase(
vabr (Chromium) 2016/12/23 17:14:11 This is fairly inefficient -- with every key strok
dvadym 2016/12/23 17:45:20 Good point. I think that cyclic buffer is the best
+ 0, input_characters_.size() - kMaxNumberOfCharactersToStore);
+ // TODO(dvadym): Implement here asking a store about password reuse.
+}
+
+} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698