| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/browsing_data/browsing_data_counter.h" | 8 #include "components/browsing_data/counters/browsing_data_counter.h" |
| 9 #include "components/password_manager/core/browser/password_store.h" | 9 #include "components/password_manager/core/browser/password_store.h" |
| 10 #include "components/password_manager/core/browser/password_store_consumer.h" | 10 #include "components/password_manager/core/browser/password_store_consumer.h" |
| 11 | 11 |
| 12 class PasswordsCounter: public BrowsingDataCounter, | 12 class Profile; |
| 13 public password_manager::PasswordStoreConsumer, | 13 |
| 14 public password_manager::PasswordStore::Observer { | 14 class PasswordsCounter : public browsing_data::BrowsingDataCounter, |
| 15 public password_manager::PasswordStoreConsumer, |
| 16 public password_manager::PasswordStore::Observer { |
| 15 public: | 17 public: |
| 16 PasswordsCounter(); | 18 explicit PasswordsCounter(Profile* profile_); |
| 17 ~PasswordsCounter() override; | 19 ~PasswordsCounter() override; |
| 18 | 20 |
| 19 const std::string& GetPrefName() const override; | 21 private: |
| 22 base::CancelableTaskTracker cancelable_task_tracker_; |
| 23 scoped_refptr<password_manager::PasswordStore> store_; |
| 20 | 24 |
| 21 private: | 25 Profile* profile_; |
| 22 const std::string pref_name_; | |
| 23 base::CancelableTaskTracker cancelable_task_tracker_; | |
| 24 password_manager::PasswordStore* store_ = nullptr; | |
| 25 | 26 |
| 26 void OnInitialized() override; | 27 void OnInitialized() override; |
| 27 | 28 |
| 28 // Counting is done asynchronously in a request to PasswordStore. | 29 // Counting is done asynchronously in a request to PasswordStore. |
| 29 // This callback returns the results, which are subsequently reported. | 30 // This callback returns the results, which are subsequently reported. |
| 30 void OnGetPasswordStoreResults( | 31 void OnGetPasswordStoreResults( |
| 31 ScopedVector<autofill::PasswordForm> results) override; | 32 ScopedVector<autofill::PasswordForm> results) override; |
| 32 | 33 |
| 33 // Called when the contents of the password store change. Triggers new | 34 // Called when the contents of the password store change. Triggers new |
| 34 // counting. | 35 // counting. |
| 35 void OnLoginsChanged( | 36 void OnLoginsChanged( |
| 36 const password_manager::PasswordStoreChangeList& changes) override; | 37 const password_manager::PasswordStoreChangeList& changes) override; |
| 37 | 38 |
| 38 void Count() override; | 39 void Count() override; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 #endif // CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ | 42 #endif // CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ |
| OLD | NEW |