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_CACHE_COUNTER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "components/browsing_data/core/counters/browsing_data_counter.h" | 11 #include "components/browsing_data/core/counters/browsing_data_counter.h" |
12 | 12 |
13 class Profile; | 13 class Profile; |
14 | 14 |
15 class CacheCounter : public browsing_data::BrowsingDataCounter { | 15 class CacheCounter : public browsing_data::BrowsingDataCounter { |
16 public: | 16 public: |
17 explicit CacheCounter(Profile* profile); | 17 explicit CacheCounter(Profile* profile); |
18 ~CacheCounter() override; | 18 ~CacheCounter() override; |
19 | 19 |
20 // Whether this counter awaits the calculation result callback. | 20 // Whether this counter awaits the calculation result callback. |
21 // Used only for testing. | 21 // Used only for testing. |
22 bool Pending(); | 22 bool Pending(); |
23 | 23 |
| 24 const std::string& GetPrefName() const override; |
| 25 |
24 private: | 26 private: |
| 27 const std::string pref_name_; |
25 Profile* profile_; | 28 Profile* profile_; |
26 bool pending_; | 29 bool pending_; |
27 | 30 |
28 base::WeakPtrFactory<CacheCounter> weak_ptr_factory_; | 31 base::WeakPtrFactory<CacheCounter> weak_ptr_factory_; |
29 | 32 |
30 void Count() override; | 33 void Count() override; |
31 void OnCacheSizeCalculated(int64_t bytes); | 34 void OnCacheSizeCalculated(int64_t bytes); |
32 }; | 35 }; |
33 | 36 |
34 #endif // CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ | 37 #endif // CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ |
OLD | NEW |