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

Side by Side Diff: chrome/browser/storage/storage_info_fetcher.h

Issue 1607483005: Show data usage on Site Details (MDSettings) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix update problem Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/storage/OWNERS ('k') | chrome/browser/storage/storage_info_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_STORAGE_STORAGE_INFO_FETCHER_H_
6 #define CHROME_BROWSER_STORAGE_STORAGE_INFO_FETCHER_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "storage/browser/quota/quota_manager.h"
10
11 // Asynchronously fetches the amount of storage used by websites.
12 class StorageInfoFetcher :
13 public base::RefCountedThreadSafe<StorageInfoFetcher> {
14 public:
15 // Observer interface for monitoring StorageInfoFetcher.
16 class Observer {
17 public:
18 // Called when the storage has been calculated.
19 virtual void OnGetUsageInfo(const storage::UsageInfoEntries& entries) = 0;
20
21 protected:
22 virtual ~Observer() {}
23 };
24
25 explicit StorageInfoFetcher(storage::QuotaManager* quota_manager);
26
27 // Asynchronously fetches the StorageInfo.
28 void Run();
29
30 void AddObserver(Observer* observer);
31 void RemoveObserver(Observer* observer);
32
33 private:
34 virtual ~StorageInfoFetcher();
35
36 friend class base::RefCountedThreadSafe<StorageInfoFetcher>;
37
38 // Fetches the usage information.
39 void GetUsageInfo(const storage::GetUsageInfoCallback& callback);
40
41 // Called when usage information is available.
42 void OnGetUsageInfoInternal(const storage::UsageInfoEntries& entries);
43
44 // Reports back to all observers that information is available.
45 void InvokeCallback();
46
47 // All clients observing this class.
48 base::ObserverList<Observer> observers_;
49
50 // The quota manager to use to calculate the storage usage.
51 storage::QuotaManager* quota_manager_;
52
53 // Hosts and their usage.
54 storage::UsageInfoEntries entries_;
55
56 DISALLOW_COPY_AND_ASSIGN(StorageInfoFetcher);
57 };
58
59 #endif // CHROME_BROWSER_STORAGE_STORAGE_INFO_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/storage/OWNERS ('k') | chrome/browser/storage/storage_info_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698