| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 STORAGE_BROWSER_QUOTA_STORAGE_MONITOR_H_ | 5 #ifndef STORAGE_BROWSER_QUOTA_STORAGE_MONITOR_H_ |
| 6 #define STORAGE_BROWSER_QUOTA_STORAGE_MONITOR_H_ | 6 #define STORAGE_BROWSER_QUOTA_STORAGE_MONITOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Manages the observers of a common storage type. | 124 // Manages the observers of a common storage type. |
| 125 class STORAGE_EXPORT StorageTypeObservers { | 125 class STORAGE_EXPORT StorageTypeObservers { |
| 126 public: | 126 public: |
| 127 explicit StorageTypeObservers(QuotaManager* quota_manager); | 127 explicit StorageTypeObservers(QuotaManager* quota_manager); |
| 128 virtual ~StorageTypeObservers(); | 128 virtual ~StorageTypeObservers(); |
| 129 | 129 |
| 130 // Adds and removes an observer. | 130 // Adds and removes an observer. |
| 131 void AddObserver(StorageObserver* observer, | 131 void AddObserver(StorageObserver* observer, |
| 132 const StorageObserver::MonitorParams& params); | 132 const StorageObserver::MonitorParams& params); |
| 133 void RemoveObserver(StorageObserver* observer); | 133 void RemoveObserver(StorageObserver* observer); |
| 134 void RemoveObserverForFilter(StorageObserver* observer, | |
| 135 const StorageObserver::Filter& filter); | |
| 136 | 134 |
| 137 // Returns the observers of a specific host. | 135 // Returns the observers of a specific host. |
| 138 const HostStorageObservers* GetHostObservers(const std::string& host) const; | 136 const HostStorageObservers* GetHostObservers(const std::string& host) const; |
| 139 | 137 |
| 140 // Handles a usage change. | 138 // Handles a usage change. |
| 141 void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta); | 139 void NotifyUsageChange(const StorageObserver::Filter& filter, int64_t delta); |
| 142 | 140 |
| 143 private: | 141 private: |
| 144 QuotaManager* quota_manager_; | 142 QuotaManager* quota_manager_; |
| 145 std::map<std::string, std::unique_ptr<HostStorageObservers>> | 143 std::map<std::string, std::unique_ptr<HostStorageObservers>> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 173 QuotaManager* quota_manager_; | 171 QuotaManager* quota_manager_; |
| 174 std::map<StorageType, std::unique_ptr<StorageTypeObservers>> | 172 std::map<StorageType, std::unique_ptr<StorageTypeObservers>> |
| 175 storage_type_observers_map_; | 173 storage_type_observers_map_; |
| 176 | 174 |
| 177 DISALLOW_COPY_AND_ASSIGN(StorageMonitor); | 175 DISALLOW_COPY_AND_ASSIGN(StorageMonitor); |
| 178 }; | 176 }; |
| 179 | 177 |
| 180 } // namespace storage | 178 } // namespace storage |
| 181 | 179 |
| 182 #endif // STORAGE_BROWSER_QUOTA_STORAGE_MONITOR_H_ | 180 #endif // STORAGE_BROWSER_QUOTA_STORAGE_MONITOR_H_ |
| OLD | NEW |