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

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

Issue 2846023003: Creating a preference for storing a sync password hash. (Closed)
Patch Set: Reviewer's comments addressed 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.cc
diff --git a/components/password_manager/core/browser/password_reuse_detector.cc b/components/password_manager/core/browser/password_reuse_detector.cc
index 27c445ef2190748f7781714382f40bbc344e312a..a06e94eb1838d049822ad0a581cecc05099f8d86 100644
--- a/components/password_manager/core/browser/password_reuse_detector.cc
+++ b/components/password_manager/core/browser/password_reuse_detector.cc
@@ -10,6 +10,8 @@
#include "components/password_manager/core/browser/password_manager_util.h"
#include "components/password_manager/core/browser/password_reuse_detector_consumer.h"
#include "components/password_manager/core/browser/psl_matching_helper.h"
+#include "components/password_manager/core/common/password_manager_pref_names.h"
+#include "components/prefs/pref_service.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "google_apis/gaia/gaia_urls.h"
#include "url/origin.h"
@@ -41,7 +43,8 @@ bool ReverseStringLess::operator()(const base::string16& lhs,
rhs.rend());
}
-PasswordReuseDetector::PasswordReuseDetector() {}
+PasswordReuseDetector::PasswordReuseDetector(PrefService* prefs)
+ : prefs_(prefs) {}
PasswordReuseDetector::~PasswordReuseDetector() {}
@@ -127,8 +130,11 @@ void PasswordReuseDetector::SaveSyncPasswordHash(
const base::string16& password) {
sync_password_hash_ =
password_manager_util::Calculate37BitsOfSHA256Hash(password);
- // TODO(crbug.com/657041) Implement saving of sync password hash into
- // preferences.
+ if (prefs_) {
+ // TODO(crbug.com/657041) Implement encrypting and saving of
+ // |sync_password_hash_| into preference kSyncPasswordHash.
+ prefs_->SetString(prefs::kSyncPasswordHash, std::string());
+ }
}
void PasswordReuseDetector::AddPassword(const autofill::PasswordForm& form) {

Powered by Google App Engine
This is Rietveld 408576698