Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/profiles/profile_statistics.h

Issue 1415223002: Add counts of User data to ProfileInfoCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bug fix. Removed a non-trivial style fix (will upload in another CL). Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include "base/files/file_path.h"
11 #include "base/task/cancelable_task_tracker.h" 12 #include "base/task/cancelable_task_tracker.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 14
14 namespace profiles { 15 namespace profiles {
15 16
16 // Constants for the categories in ProfileCategoryStats 17 // Constants for the categories in ProfileCategoryStats
17 extern const char kProfileStatisticsBrowsingHistory[]; 18 extern const char kProfileStatisticsBrowsingHistory[];
18 extern const char kProfileStatisticsPasswords[]; 19 extern const char kProfileStatisticsPasswords[];
19 extern const char kProfileStatisticsBookmarks[]; 20 extern const char kProfileStatisticsBookmarks[];
20 extern const char kProfileStatisticsSettings[]; 21 extern const char kProfileStatisticsSettings[];
21 22
22 // Definition of a single return value of |ProfileStatisticsCallback|. If 23 // Definition of a single return value of |ProfileStatisticsCallback|. If
23 // |success| is false, the statistics failed to load and |count| is undefined. 24 // |success| is false, the statistics failed to load and |count| is undefined.
24 // The data look like these: {"BrowsingHistory", 912, true}, 25 // The data look like these: {"BrowsingHistory", 912, true},
25 // {"Passwords", 71, true}, {"Bookmarks", 120, true}, {"Settings", 200, true} 26 // {"Passwords", 71, true}, {"Bookmarks", 120, true}, {"Settings", 200, true}
26 struct ProfileCategoryStat { 27 struct ProfileCategoryStat {
27 std::string category; 28 std::string category;
28 int count; 29 int count;
29 bool success; 30 bool success;
30 }; 31 };
31 32
32 // Definition of the return value of |ProfileStatisticsCallback|. 33 // Definition of the return value of |ProfileStatisticsCallback|.
33 using ProfileCategoryStats = std::vector<ProfileCategoryStat>; 34 using ProfileCategoryStats = std::vector<ProfileCategoryStat>;
34 35
35 // Definition of the callback function. Note that a copy of 36 // Definition of the callback function. Note that a copy of
36 // |ProfileCategoryStats| is made each time the callback is called. 37 // |ProfileCategoryStats| is made each time the callback is called.
37 using ProfileStatisticsCallback = base::Callback<void(ProfileCategoryStats)>; 38 using ProfileStatisticsCallback = base::Callback<void(ProfileCategoryStats)>;
38 39
40 // Profile Statistics ----------------------------------------------------------
41
39 // This function collects statistical information about |profile| and returns 42 // This function collects statistical information about |profile| and returns
40 // the information via |callback|. Currently bookmarks, history, logins and 43 // the information via |callback|. Currently bookmarks, history, logins and
41 // preferences are counted. The callback function will probably be called more 44 // preferences are counted. The callback function will probably be called more
42 // than once so binding parameters with bind::Passed() is prohibited. 45 // than once so binding parameters with bind::Passed() is prohibited.
43 void GetProfileStatistics(Profile* profile, 46 void GetProfileStatistics(Profile* profile,
44 const ProfileStatisticsCallback& callback, 47 const ProfileStatisticsCallback& callback,
45 base::CancelableTaskTracker* tracker); 48 base::CancelableTaskTracker* tracker);
46 49
50 // ProfileInfoCache ------------------------------------------------------------
51
52 // Gets statistical information from ProfileInfoCache.
53 ProfileCategoryStats GetProfileStatisticsFromCache(
54 const base::FilePath& profile_path);
55
56 // Sets an individual statistic to ProfileInfoCache.
57 void SetProfileStatisticsInCache(const base::FilePath& profile_path,
58 const std::string& category, int count);
59
47 } // namespace profiles 60 } // namespace profiles
48 61
49 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ 62 #endif // CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/profiles/profile_statistics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698