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

Unified Diff: chrome/browser/engagement/important_sites_util.h

Issue 2752263003: Count site data size for important sites (Closed)
Patch Set: add localstorage to test case Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/engagement/important_sites_util.h
diff --git a/chrome/browser/engagement/important_sites_util.h b/chrome/browser/engagement/important_sites_util.h
index 364da285f30c9036214524bce3d0bdab493af516..7de0366d39ab9e8db0cd4d0279f62ef9cbcba35c 100644
--- a/chrome/browser/engagement/important_sites_util.h
+++ b/chrome/browser/engagement/important_sites_util.h
@@ -8,11 +8,20 @@
#include <string>
#include <vector>
+#include "base/callback.h"
#include "base/macros.h"
#include "url/gurl.h"
class Profile;
+namespace content {
+class DOMStorageContext;
+}
+
+namespace storage {
+class QuotaManager;
+}
+
namespace user_prefs {
class PrefRegistrySyncable;
}
@@ -24,6 +33,7 @@ class ImportantSitesUtil {
GURL example_origin;
double engagement_score = 0;
int32_t reason_bitfield = 0;
+ int64_t usage = 0;
};
// Do not change the values here, as they are used for UMA histograms.
@@ -36,6 +46,9 @@ class ImportantSitesUtil {
REASON_BOUNDARY
};
+ using UsageCallback =
+ base::Callback<void(std::vector<ImportantDomainInfo> sites)>;
+
static bool IsDialogDisabled(Profile* profile);
static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
@@ -50,6 +63,14 @@ class ImportantSitesUtil {
Profile* profile,
size_t max_results);
+ // Populate the ImportantDomainInfo::usage field of each site with the amount
+ // of storage bytes used. The |sites| vector with populated usage fields is
+ // returned by |callback|.
+ static void PopulateUsage(storage::QuotaManager* quota_manager,
dmurph 2017/03/27 22:22:45 Can you document threading expectations? I guess t
dullweber 2017/03/28 14:06:45 I checked the other methods and it looks like all
+ content::DOMStorageContext* dom_storage,
+ std::vector<ImportantDomainInfo> sites,
+ UsageCallback callback);
+
// Record the sites that the user chose to blacklist from clearing (in the
// Clear Browsing Dialog) and the sites they ignored. The blacklisted sites
// are NOT cleared as they are 'blacklisted' from the clear operation.
« no previous file with comments | « no previous file | chrome/browser/engagement/important_sites_util.cc » ('j') | chrome/browser/engagement/important_sites_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698