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

Unified Diff: chrome/browser/ui/webui/options/chromeos/storage_manager_handler.h

Issue 2123133002: Storage manager: Add site data size on the amount of browsing data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a missing header. Created 4 years, 5 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/ui/webui/options/chromeos/storage_manager_handler.h
diff --git a/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.h b/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.h
index c6e1629ba246801caa905d954fdc57b6db53c207..07d3b74e3c86c3c348097ac0d695b108a2875e3d 100644
--- a/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.h
+++ b/chrome/browser/ui/webui/options/chromeos/storage_manager_handler.h
@@ -7,10 +7,13 @@
#include <stdint.h>
+#include <map>
+#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "chrome/browser/browsing_data/site_data_size_collector.h"
#include "chrome/browser/ui/webui/options/options_ui.h"
#include "components/arc/storage_manager/arc_storage_manager.h"
#include "components/user_manager/user.h"
@@ -40,6 +43,13 @@ class StorageManagerHandler : public ::options::OptionsPageUIHandler {
void RegisterMessages() override;
private:
+ // Enumlation for types of browsing data which we aocunt.
+ enum BrowsingDataType {
+ BROWSING_DATA_TYPE_HTTP_CACHE = 0,
+ BROWSING_DATA_TYPE_SITE_DATA,
+ BROWSING_DATA_TYPE_MAX
+ };
+
// Handlers of JS messages.
void HandleUpdateStorageInfo(const base::ListValue* unused_args);
void HandleOpenDownloads(const base::ListValue* unused_args);
@@ -68,7 +78,7 @@ class StorageManagerHandler : public ::options::OptionsPageUIHandler {
void UpdateBrowsingDataSize();
// Callback to update the UI about the size of browsing data.
- void OnGetBrowsingDataSize(bool is_site_data, int64_t size);
+ void OnGetBrowsingDataSize(BrowsingDataType, int64_t size);
// Requests updating the total size of other users' data.
void UpdateOtherUsersSize();
@@ -85,11 +95,8 @@ class StorageManagerHandler : public ::options::OptionsPageUIHandler {
// Callback called when clearing Drive cache is done.
void OnClearDriveCacheDone(bool success);
- // Total size of cache data in browsing data.
- int64_t browser_cache_size_;
-
- // Total size of site data in browsing data.
- int64_t browser_site_data_size_;
+ // Map to store fetched size of browsing data.
+ std::map<BrowsingDataType, int64_t> browsing_data_size_;
// The list of other users whose directory sizes will be accumulated as the
// size of "Other users".
@@ -98,6 +105,9 @@ class StorageManagerHandler : public ::options::OptionsPageUIHandler {
// Fetched sizes of user directories.
std::vector<int64_t> user_sizes_;
+ // Helper to compute the total size of all types of site date.
+ std::unique_ptr<SiteDataSizeCollector> site_data_size_collector_;
+
base::WeakPtrFactory<StorageManagerHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(StorageManagerHandler);

Powered by Google App Engine
This is Rietveld 408576698