| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // Definition of the return value of |ProfileStatisticsCallback|. | 33 // Definition of the return value of |ProfileStatisticsCallback|. |
| 34 using ProfileCategoryStats = std::vector<ProfileCategoryStat>; | 34 using ProfileCategoryStats = std::vector<ProfileCategoryStat>; |
| 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|, also returns |
| 43 // the information via |callback|. Currently bookmarks, history, logins and | 43 // the information via |callback| if |callback| is not null. The statistical |
| 44 // preferences are counted. The callback function will probably be called more | 44 // information is also copied to ProfileInfoCache. Currently bookmarks, history, |
| 45 // than once so binding parameters with bind::Passed() is prohibited. | 45 // logins and preferences are counted. The callback function will probably be |
| 46 void GetProfileStatistics(Profile* profile, | 46 // called more than once, so binding parameters with bind::Passed() is |
| 47 const ProfileStatisticsCallback& callback, | 47 // prohibited. Most of the async tasks involved in this function can be |
| 48 base::CancelableTaskTracker* tracker); | 48 // cancelled if |tracker| is not null. |
| 49 void GatherProfileStatistics(Profile* profile, |
| 50 const ProfileStatisticsCallback& callback, |
| 51 base::CancelableTaskTracker* tracker); |
| 49 | 52 |
| 50 // ProfileInfoCache ------------------------------------------------------------ | 53 // ProfileInfoCache ------------------------------------------------------------ |
| 51 | 54 |
| 52 // Gets statistical information from ProfileInfoCache. | 55 // Gets statistical information from ProfileInfoCache. |
| 53 ProfileCategoryStats GetProfileStatisticsFromCache( | 56 ProfileCategoryStats GetProfileStatisticsFromCache( |
| 54 const base::FilePath& profile_path); | 57 const base::FilePath& profile_path); |
| 55 | 58 |
| 56 // Sets an individual statistic to ProfileInfoCache. | 59 // Sets an individual statistic to ProfileInfoCache. |
| 57 void SetProfileStatisticsInCache(const base::FilePath& profile_path, | 60 void SetProfileStatisticsInCache(const base::FilePath& profile_path, |
| 58 const std::string& category, int count); | 61 const std::string& category, int count); |
| 59 | 62 |
| 60 } // namespace profiles | 63 } // namespace profiles |
| 61 | 64 |
| 62 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ | 65 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ |
| OLD | NEW |