OLD | NEW |
---|---|
1 // Copyright 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_PROFILES_PROFILE_STATISTICS_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... | |
35 | 35 |
36 // Definition of the callback function. Note that a copy of | 36 // Definition of the callback function. Note that a copy of |
37 // |ProfileCategoryStats| is made each time the callback is called. | 37 // |ProfileCategoryStats| is made each time the callback is called. |
38 using ProfileStatisticsCallback = base::Callback<void(ProfileCategoryStats)>; | 38 using ProfileStatisticsCallback = base::Callback<void(ProfileCategoryStats)>; |
39 | 39 |
40 // Profile Statistics ---------------------------------------------------------- | 40 // Profile Statistics ---------------------------------------------------------- |
41 | 41 |
42 // This function collects statistical information about |profile| and returns | 42 // This function collects statistical information about |profile| and returns |
43 // the information via |callback|. Currently bookmarks, history, logins and | 43 // the information via |callback|. Currently bookmarks, history, logins and |
44 // preferences are counted. The callback function will probably be called more | 44 // preferences are counted. The callback function will probably be called more |
45 // than once so binding parameters with bind::Passed() is prohibited. | 45 // than once so binding parameters with bind::Passed() is prohibited. The |
46 // statistical information are also copied to ProfileInfoCache. | |
46 void GetProfileStatistics(Profile* profile, | 47 void GetProfileStatistics(Profile* profile, |
47 const ProfileStatisticsCallback& callback, | 48 const ProfileStatisticsCallback& callback, |
48 base::CancelableTaskTracker* tracker); | 49 base::CancelableTaskTracker* tracker); |
49 | 50 |
51 // This function collects statistical information about |profile| and sends the | |
52 // information to ProfileInfoCache. | |
Mike Lerman
2015/11/26 15:06:25
nit: to the ProfileInfoCache
lwchkg
2015/12/02 15:33:34
Acknowledged.
| |
53 void StoreProfileStatisticsToCache(Profile* profile); | |
Mike Lerman
2015/11/26 15:06:25
Why is this method really needed? Can't I just cal
lwchkg
2015/12/02 15:33:34
Calling GetProfileStatistics to store the statisti
Mike Lerman
2015/12/07 16:21:20
You could rename GetProfileStatistics to GatherPro
lwchkg
2015/12/09 03:39:41
Brilliant idea! Problem solved. And now I finally
| |
54 | |
50 // ProfileInfoCache ------------------------------------------------------------ | 55 // ProfileInfoCache ------------------------------------------------------------ |
51 | 56 |
52 // Gets statistical information from ProfileInfoCache. | 57 // Gets statistical information from ProfileInfoCache. |
53 ProfileCategoryStats GetProfileStatisticsFromCache( | 58 ProfileCategoryStats GetProfileStatisticsFromCache( |
54 const base::FilePath& profile_path); | 59 const base::FilePath& profile_path); |
55 | 60 |
56 // Sets an individual statistic to ProfileInfoCache. | 61 // Sets an individual statistic to ProfileInfoCache. |
57 void SetProfileStatisticsInCache(const base::FilePath& profile_path, | 62 void SetProfileStatisticsInCache(const base::FilePath& profile_path, |
58 const std::string& category, int count); | 63 const std::string& category, int count); |
59 | 64 |
60 } // namespace profiles | 65 } // namespace profiles |
61 | 66 |
62 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ | 67 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ |
OLD | NEW |