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

Unified Diff: components/password_manager/core/browser/password_reuse_detector.h

Issue 2847743002: Implementation of sync password reuse checking. (Closed)
Patch Set: Addressed comments 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/password_manager/core/browser/password_reuse_detector.h
diff --git a/components/password_manager/core/browser/password_reuse_detector.h b/components/password_manager/core/browser/password_reuse_detector.h
index e9766c8a737e5e7e01501349cc1c6edcd8642a6b..721f90685faddffb5b082f5ec1f906cc345b3fe4 100644
--- a/components/password_manager/core/browser/password_reuse_detector.h
+++ b/components/password_manager/core/browser/password_reuse_detector.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTOR_H_
#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_REUSE_DETECTOR_H_
+#include <stdint.h>
#include <map>
#include <memory>
#include <set>
@@ -12,6 +13,7 @@
#include <vector>
#include "base/macros.h"
+#include "base/optional.h"
#include "base/strings/string16.h"
#include "components/password_manager/core/browser/password_store_change.h"
#include "components/password_manager/core/browser/password_store_consumer.h"
@@ -43,7 +45,7 @@ class PasswordReuseDetector : public PasswordStoreConsumer {
void OnLoginsChanged(const PasswordStoreChangeList& changes);
// Checks that some suffix of |input| equals to a password saved on another
- // registry controlled domain than |domain|.
+ // registry controlled domain than |domain| or to a sync password.
// If such suffix is found, |consumer|->OnReuseFound() is called on the same
// thread on which this method is called.
// |consumer| should not be null.
@@ -62,6 +64,18 @@ class PasswordReuseDetector : public PasswordStoreConsumer {
// Add password from |form| to |passwords_|.
void AddPassword(const autofill::PasswordForm& form);
+ // Returns true iff a reuse of a sync password is found. If reuse is found it
+ // is reported to |consumer|.
+ bool CheckSyncPasswordReuse(const base::string16& input,
+ const std::string& domain,
+ PasswordReuseDetectorConsumer* consumer);
+
+ // Returns true iff a reuse of a saved password is found. If reuse is found it
+ // is reported to |consumer|.
+ bool CheckSavedPasswordReuse(const base::string16& input,
+ const std::string& domain,
+ PasswordReuseDetectorConsumer* consumer);
+
// Returns the iterator to |passwords_| that corresponds to the longest key in
// |passwords_| that is a suffix of |input|. Returns passwords_.end() in case
// when no key in |passwords_| is a prefix of |input|.
@@ -77,6 +91,8 @@ class PasswordReuseDetector : public PasswordStoreConsumer {
// of times how many different sites it's saved on.
int saved_passwords_ = 0;
+ base::Optional<uint64_t> sync_password_hash_;
+
DISALLOW_COPY_AND_ASSIGN(PasswordReuseDetector);
};

Powered by Google App Engine
This is Rietveld 408576698