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

Unified Diff: chrome/browser/browsing_data/passwords_counter.cc

Issue 2084903002: Moved BrowsingDataCounter and part of BrowsingDataCounterUtils to components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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: chrome/browser/browsing_data/passwords_counter.cc
diff --git a/chrome/browser/browsing_data/passwords_counter.cc b/chrome/browser/browsing_data/passwords_counter.cc
index 6fc68cbc8f06396b5aab3594ce1a88b36745d213..e235fa41c4ff298018c354b2cbb533864266905d 100644
--- a/chrome/browser/browsing_data/passwords_counter.cc
+++ b/chrome/browser/browsing_data/passwords_counter.cc
@@ -4,35 +4,25 @@
#include "chrome/browser/browsing_data/passwords_counter.h"
#include "chrome/browser/password_manager/password_store_factory.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "components/password_manager/core/browser/password_store.h"
-PasswordsCounter::PasswordsCounter() : pref_name_(prefs::kDeletePasswords) {}
+PasswordsCounter::PasswordsCounter(Profile* profile)
+ : BrowsingDataCounter(prefs::kDeletePasswords), profile_(profile) {}
PasswordsCounter::~PasswordsCounter() {
- if (store_)
- store_->RemoveObserver(this);
+ store_->RemoveObserver(this);
}
void PasswordsCounter::OnInitialized() {
store_ = PasswordStoreFactory::GetForProfile(
- GetProfile(), ServiceAccessType::EXPLICIT_ACCESS).get();
- if (store_)
- store_->AddObserver(this);
- else
- LOG(ERROR) << "No password store! Cannot count passwords.";
-}
-
-const std::string& PasswordsCounter::GetPrefName() const {
- return pref_name_;
+ profile_, ServiceAccessType::EXPLICIT_ACCESS);
+ DCHECK(store_);
+ store_->AddObserver(this);
}
void PasswordsCounter::Count() {
- if (!store_) {
- ReportResult(0);
- return;
- }
-
cancelable_task_tracker()->TryCancelAll();
// TODO(msramek): We don't actually need the logins themselves, just their
// count. Consider implementing |PasswordStore::CountAutofillableLogins|.
« no previous file with comments | « chrome/browser/browsing_data/passwords_counter.h ('k') | chrome/browser/browsing_data/passwords_counter_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698