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

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

Issue 1083293004: Implement the statistics table for the passwords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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_store.cc
diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc
index 5b13a3cb86e2f294dc3ac95555d326abdf738cae..97129d0982f222f84b147ffdbcd503b2e6aa1a6d 100644
--- a/components/password_manager/core/browser/password_store.cc
+++ b/components/password_manager/core/browser/password_store.cc
@@ -14,6 +14,7 @@
#include "components/password_manager/core/browser/affiliated_match_helper.h"
#include "components/password_manager/core/browser/password_store_consumer.h"
#include "components/password_manager/core/browser/password_syncable_service.h"
+#include "components/password_manager/core/browser/statistics_table.h"
using autofill::PasswordForm;
@@ -59,6 +60,13 @@ void PasswordStore::GetLoginsRequest::NotifyConsumerWithResults(
consumer_weak_, base::Passed(&results)));
}
+void PasswordStore::GetLoginsRequest::NotifyWithSiteStatistics(
+ scoped_ptr<InteractionsStats> stats) {
+ origin_loop_->PostTask(FROM_HERE,
+ base::Bind(&PasswordStoreConsumer::OnGetSiteStatistics,
+ consumer_weak_, base::Passed(&stats)));
+}
+
PasswordStore::PasswordStore(
scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner)
@@ -163,6 +171,22 @@ void PasswordStore::ReportMetrics(const std::string& sync_username,
}
}
+void PasswordStore::AddSiteStats(const InteractionsStats& stats) {
+ ScheduleTask(base::Bind(&PasswordStore::AddSiteStatsImpl, this, stats));
+}
+
+void PasswordStore::RemoveSiteStats(const GURL& origin_domain) {
+ ScheduleTask(
+ base::Bind(&PasswordStore::RemoveSiteStatsImpl, this, origin_domain));
+}
+
+void PasswordStore::GetSiteStats(const GURL& origin_domain,
+ PasswordStoreConsumer* consumer) {
+ scoped_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer));
+ ScheduleTask(base::Bind(&PasswordStore::GetSiteStatsInternal, this,
+ origin_domain, base::Passed(&request)));
+}
+
void PasswordStore::AddObserver(Observer* observer) {
observers_->AddObserver(observer);
}
@@ -302,6 +326,12 @@ void PasswordStore::RemoveLoginsSyncedBetweenInternal(base::Time delete_begin,
NotifyLoginsChanged(changes);
}
+void PasswordStore::GetSiteStatsInternal(const GURL& origin_domain,
+ scoped_ptr<GetLoginsRequest> request) {
+ request->NotifyWithSiteStatistics(
+ scoped_ptr<InteractionsStats>(GetSiteStatsImpl(origin_domain)));
+}
+
void PasswordStore::GetLoginsWithAffiliationsImpl(
const PasswordForm& form,
AuthorizationPromptPolicy prompt_policy,

Powered by Google App Engine
This is Rietveld 408576698