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 "chrome/browser/profiles/profile.h" |
msramek
2016/06/21 14:43:56
As mentioned elsewhere, Profile should be forward-
ioanap
2016/06/23 14:56:27
Done.
| |
9 #include "components/browsing_data/counters/browsing_data_counter.h" | |
9 #include "components/password_manager/core/browser/password_store.h" | 10 #include "components/password_manager/core/browser/password_store.h" |
10 #include "components/password_manager/core/browser/password_store_consumer.h" | 11 #include "components/password_manager/core/browser/password_store_consumer.h" |
11 | 12 |
12 class PasswordsCounter: public BrowsingDataCounter, | 13 class PasswordsCounter: public BrowsingDataCounter, |
13 public password_manager::PasswordStoreConsumer, | 14 public password_manager::PasswordStoreConsumer, |
14 public password_manager::PasswordStore::Observer { | 15 public password_manager::PasswordStore::Observer { |
15 public: | 16 public: |
16 PasswordsCounter(); | 17 explicit PasswordsCounter(Profile* profile_); |
17 ~PasswordsCounter() override; | 18 ~PasswordsCounter() override; |
18 | 19 |
19 const std::string& GetPrefName() const override; | |
20 | |
21 private: | 20 private: |
22 const std::string pref_name_; | |
23 base::CancelableTaskTracker cancelable_task_tracker_; | 21 base::CancelableTaskTracker cancelable_task_tracker_; |
24 password_manager::PasswordStore* store_ = nullptr; | 22 password_manager::PasswordStore* store_ = nullptr; |
25 | 23 |
24 Profile* profile_; | |
25 | |
26 void OnInitialized() override; | 26 void OnInitialized() override; |
27 | 27 |
28 // Counting is done asynchronously in a request to PasswordStore. | 28 // Counting is done asynchronously in a request to PasswordStore. |
29 // This callback returns the results, which are subsequently reported. | 29 // This callback returns the results, which are subsequently reported. |
30 void OnGetPasswordStoreResults( | 30 void OnGetPasswordStoreResults( |
31 ScopedVector<autofill::PasswordForm> results) override; | 31 ScopedVector<autofill::PasswordForm> results) override; |
32 | 32 |
33 // Called when the contents of the password store change. Triggers new | 33 // Called when the contents of the password store change. Triggers new |
34 // counting. | 34 // counting. |
35 void OnLoginsChanged( | 35 void OnLoginsChanged( |
36 const password_manager::PasswordStoreChangeList& changes) override; | 36 const password_manager::PasswordStoreChangeList& changes) override; |
37 | 37 |
38 void Count() override; | 38 void Count() override; |
39 }; | 39 }; |
40 | 40 |
41 #endif // CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ | 41 #endif // CHROME_BROWSER_BROWSING_DATA_PASSWORDS_COUNTER_H_ |
OLD | NEW |