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

Unified Diff: components/safe_browsing/password_protection/password_protection_service.h

Issue 2720643003: Call CSD whitelist checking on UI thread and record UMA (Closed)
Patch Set: change source_set name Created 3 years, 10 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/safe_browsing/password_protection/password_protection_service.h
diff --git a/components/safe_browsing/password_protection/password_protection_service.h b/components/safe_browsing/password_protection/password_protection_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..32afe41496bd87c0877097a0864b2de69bda2a85
--- /dev/null
+++ b/components/safe_browsing/password_protection/password_protection_service.h
@@ -0,0 +1,47 @@
+// Copyright 2017 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.
+
+#ifndef COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE_H_
+#define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+
+class GURL;
+
+namespace safe_browsing {
+
+class SafeBrowsingDatabaseManager;
+
+class PasswordProtectionService {
+ public:
+ explicit PasswordProtectionService(
+ const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager);
+
+ virtual ~PasswordProtectionService();
+
+ // Check if |url| matches CSD whitelist and record UMA metric accordingly.
+ // Currently called by PasswordReuseDetectionManager on UI thread.
+ void RecordPasswordReuse(const GURL& url);
+
+ base::WeakPtr<PasswordProtectionService> GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+ }
+
+ protected:
+ // Called on UI thread.
+ // Increases "PasswordManager.PasswordReuse.MainFrameMatchCsdWhitelist" UMA
+ // metric based on input.
+ void OnMatchCsdWhiteListResult(bool match_whitelist);
+
+ private:
+ scoped_refptr<SafeBrowsingDatabaseManager> database_manager_;
+ base::WeakPtrFactory<PasswordProtectionService> weak_factory_;
+ DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService);
+};
+
+} // namespace safe_browsing
+
+#endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698