| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_COMMON_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_COMMON_H_ |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_COMMON_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_COMMON_H_ |
| 7 | 7 |
| 8 #include <array> | 8 #include <array> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 | 13 |
| 14 namespace profiles { | 14 namespace profiles { |
| 15 // Constants for the categories in ProfileCategoryStats. | 15 // Constants for the categories in ProfileCategoryStats. |
| 16 extern const char kProfileStatisticsBrowsingHistory[]; | 16 extern const char kProfileStatisticsBrowsingHistory[]; |
| 17 extern const char kProfileStatisticsPasswords[]; | 17 extern const char kProfileStatisticsPasswords[]; |
| 18 extern const char kProfileStatisticsBookmarks[]; | 18 extern const char kProfileStatisticsBookmarks[]; |
| 19 extern const char kProfileStatisticsSettings[]; | 19 extern const char kProfileStatisticsAutofill[]; |
| 20 | 20 |
| 21 extern const std::array<const char*, 4> kProfileStatisticsCategories; | 21 extern const std::array<const char*, 4> kProfileStatisticsCategories; |
| 22 | 22 |
| 23 // Definition of a single return value of |ProfileStatisticsCallback|. If | 23 // Definition of a single return value of |ProfileStatisticsCallback|. |
| 24 // |success| is false, the statistics failed to load and |count| is undefined. | 24 // The data look like these: {"BrowsingHistory", 912}, |
| 25 // The data look like these: {"BrowsingHistory", 912, true}, | 25 // {"Passwords", 71}, {"Bookmarks", 120}, {"Autofill", 200}. |
| 26 // {"Passwords", 71, true}, {"Bookmarks", 120, true}, {"Settings", 200, true} | |
| 27 struct ProfileCategoryStat { | 26 struct ProfileCategoryStat { |
| 28 std::string category; | 27 std::string category; |
| 29 int count; | 28 int count; |
| 30 bool success; | |
| 31 }; | 29 }; |
| 32 | 30 |
| 33 // Definition of the return value of |ProfileStatisticsCallback|. | 31 // Definition of the return value of |ProfileStatisticsCallback|. |
| 34 using ProfileCategoryStats = std::vector<ProfileCategoryStat>; | 32 using ProfileCategoryStats = std::vector<ProfileCategoryStat>; |
| 35 | 33 |
| 36 // Definition of the callback function. Note that a copy of | 34 // Definition of the callback function. Note that a copy of |
| 37 // |ProfileCategoryStats| is made each time the callback is called. | 35 // |ProfileCategoryStats| is made each time the callback is called. |
| 38 using ProfileStatisticsCallback = base::Callback<void(ProfileCategoryStats)>; | 36 using ProfileStatisticsCallback = base::Callback<void(ProfileCategoryStats)>; |
| 39 } // namespace profiles | 37 } // namespace profiles |
| 40 | 38 |
| 41 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_COMMON_H_ | 39 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_COMMON_H_ |
| OLD | NEW |