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

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

Issue 1661533002: Implement deletion of storage per site. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_STORAGE_STORAGE_INFO_FETCHER_H_ 5 #ifndef CHROME_BROWSER_STORAGE_STORAGE_INFO_FETCHER_H_
6 #define CHROME_BROWSER_STORAGE_STORAGE_INFO_FETCHER_H_ 6 #define CHROME_BROWSER_STORAGE_STORAGE_INFO_FETCHER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "storage/browser/quota/quota_manager.h" 9 #include "storage/browser/quota/quota_manager.h"
10 10
11 // Asynchronously fetches the amount of storage used by websites. 11 // Asynchronously fetches the amount of storage used by websites.
12 class StorageInfoFetcher : 12 class StorageInfoFetcher :
13 public base::RefCountedThreadSafe<StorageInfoFetcher> { 13 public base::RefCountedThreadSafe<StorageInfoFetcher> {
14 public: 14 public:
15 // Observer interface for monitoring StorageInfoFetcher. 15 // Observer interface for monitoring StorageInfoFetcher.
16 class Observer { 16 class Observer {
17 public: 17 public:
18 // Called when the storage has been calculated. 18 // Called when the storage has been calculated.
19 virtual void OnGetUsageInfo(const storage::UsageInfoEntries& entries) = 0; 19 virtual void OnGetUsageInfo(const storage::UsageInfoEntries& entries) = 0;
20 20
21 // Called when the storage has been cleared.
22 virtual void OnUsageInfoCleared() = 0;
michaelpg 2016/02/03 18:39:13 If this isn't used yet, add it in a later patch wh
Finnur 2016/02/04 14:56:58 It is used in the latest version of this patch.
23
21 protected: 24 protected:
22 virtual ~Observer() {} 25 virtual ~Observer() {}
23 }; 26 };
24 27
25 explicit StorageInfoFetcher(storage::QuotaManager* quota_manager); 28 explicit StorageInfoFetcher(storage::QuotaManager* quota_manager);
26 29
27 // Asynchronously fetches the StorageInfo. 30 // Asynchronously fetches the StorageInfo.
28 void Run(); 31 void FetchStorageInfo();
32
33 // Asynchronously clears storage for the given host.
34 void ClearStorage(const std::string& host, storage::StorageType type);
35
36 // Called when usage has been cleared.
37 void OnUsageCleared(storage::QuotaStatusCode code);
29 38
30 void AddObserver(Observer* observer); 39 void AddObserver(Observer* observer);
31 void RemoveObserver(Observer* observer); 40 void RemoveObserver(Observer* observer);
32 41
33 private: 42 private:
34 virtual ~StorageInfoFetcher(); 43 virtual ~StorageInfoFetcher();
35 44
36 friend class base::RefCountedThreadSafe<StorageInfoFetcher>; 45 friend class base::RefCountedThreadSafe<StorageInfoFetcher>;
37 46
38 // Fetches the usage information. 47 // Fetches the usage information.
(...skipping 11 matching lines...) Expand all
50 // The quota manager to use to calculate the storage usage. 59 // The quota manager to use to calculate the storage usage.
51 storage::QuotaManager* quota_manager_; 60 storage::QuotaManager* quota_manager_;
52 61
53 // Hosts and their usage. 62 // Hosts and their usage.
54 storage::UsageInfoEntries entries_; 63 storage::UsageInfoEntries entries_;
55 64
56 DISALLOW_COPY_AND_ASSIGN(StorageInfoFetcher); 65 DISALLOW_COPY_AND_ASSIGN(StorageInfoFetcher);
57 }; 66 };
58 67
59 #endif // CHROME_BROWSER_STORAGE_STORAGE_INFO_FETCHER_H_ 68 #endif // CHROME_BROWSER_STORAGE_STORAGE_INFO_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698