OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_BROWSING_DATA_CORE_COUNTERS_PASSWORDS_COUNTER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ | 6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_PASSWORDS_COUNTER_H_ |
7 | 7 |
8 #include "components/browsing_data/core/counters/browsing_data_counter.h" | 8 #include "components/browsing_data/core/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 Profile; | 12 namespace browsing_data { |
13 | 13 |
14 class PasswordsCounter : public browsing_data::BrowsingDataCounter, | 14 class PasswordsCounter : public browsing_data::BrowsingDataCounter, |
15 public password_manager::PasswordStoreConsumer, | 15 public password_manager::PasswordStoreConsumer, |
16 public password_manager::PasswordStore::Observer { | 16 public password_manager::PasswordStore::Observer { |
17 public: | 17 public: |
18 explicit PasswordsCounter(Profile* profile); | 18 explicit PasswordsCounter( |
| 19 scoped_refptr<password_manager::PasswordStore> store); |
19 ~PasswordsCounter() override; | 20 ~PasswordsCounter() override; |
20 | 21 |
| 22 const char* GetPrefName() const override; |
| 23 |
21 private: | 24 private: |
22 base::CancelableTaskTracker cancelable_task_tracker_; | |
23 scoped_refptr<password_manager::PasswordStore> store_; | |
24 | |
25 Profile* profile_; | |
26 | |
27 void OnInitialized() override; | 25 void OnInitialized() override; |
28 | 26 |
29 // Counting is done asynchronously in a request to PasswordStore. | 27 // Counting is done asynchronously in a request to PasswordStore. |
30 // This callback returns the results, which are subsequently reported. | 28 // This callback returns the results, which are subsequently reported. |
31 void OnGetPasswordStoreResults( | 29 void OnGetPasswordStoreResults( |
32 ScopedVector<autofill::PasswordForm> results) override; | 30 ScopedVector<autofill::PasswordForm> results) override; |
33 | 31 |
34 // Called when the contents of the password store change. Triggers new | 32 // Called when the contents of the password store change. Triggers new |
35 // counting. | 33 // counting. |
36 void OnLoginsChanged( | 34 void OnLoginsChanged( |
37 const password_manager::PasswordStoreChangeList& changes) override; | 35 const password_manager::PasswordStoreChangeList& changes) override; |
38 | 36 |
39 void Count() override; | 37 void Count() override; |
| 38 |
| 39 base::CancelableTaskTracker cancelable_task_tracker_; |
| 40 scoped_refptr<password_manager::PasswordStore> store_; |
40 }; | 41 }; |
41 | 42 |
42 #endif // CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ | 43 } // namespace browsing_data |
| 44 |
| 45 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_PASSWORDS_COUNTER_H_ |
OLD | NEW |