Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ | |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <utility> | |
| 10 #include <vector> | |
| 11 #include "base/task/cancelable_task_tracker.h" | |
| 12 #include "chrome/browser/profiles/profile.h" | |
| 13 | |
| 14 namespace profiles { | |
| 15 | |
| 16 // Constants for the categories in ProfileStatisticsReturn | |
| 17 extern const char kProfileStatisticsBrowsingHistory[]; | |
| 18 extern const char kProfileStatisticsPasswords[]; | |
| 19 extern const char kProfileStatisticsBookmarks[]; | |
| 20 extern const char kProfileStatisticsSettings[]; | |
| 21 | |
| 22 // Definition of a single return value of |ProfileStatisticsCallback|. If | |
| 23 // |success| is false, the statistics failed to load and |count| is undefined. | |
| 24 // The data look like these: {"BrowsingHistory", 912, true}, | |
| 25 // {"Passwords", 71, true}, {"Bookmarks", 120, true}, {"Settings", 200, true} | |
| 26 struct ProfileStatisticsDatum { | |
|
Mike Lerman
2015/08/17 14:23:38
I am highly entertained by your use of Datum! Sadl
lwchkg
2015/08/19 06:19:45
Acknowledged.
| |
| 27 std::string category; | |
| 28 int count; | |
| 29 bool success; | |
| 30 }; | |
| 31 | |
| 32 // Definition of the return value of |ProfileStatisticsCallback|. | |
| 33 typedef std::vector<ProfileStatisticsDatum> ProfileStatisticsReturn; | |
| 34 | |
| 35 // Definition of the callback function. Note that a copy of | |
| 36 // |ProfileStatisticsReturn| is made each time the callback is called. | |
| 37 typedef base::Callback<void(ProfileStatisticsReturn)> | |
| 38 ProfileStatisticsCallback; | |
| 39 | |
| 40 // This function collects statistical information about |profile| and returns | |
| 41 // the information via |callback|. Currently bookmarks, history, logins and | |
| 42 // preferences are counted. The callback function will probably be called more | |
| 43 // than once so binding parameters with bind::Passed() is prohibited. | |
| 44 void GetProfileStatistics(Profile* profile, | |
| 45 const ProfileStatisticsCallback& callback, | |
| 46 base::CancelableTaskTracker* tracker); | |
| 47 | |
| 48 } // namespace profiles | |
| 49 | |
| 50 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ | |
| OLD | NEW |