Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ | |
| 6 #define WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ | |
| 7 | |
| 8 #include "base/basic_types.h" | |
| 9 #include "url/gurl.h" | |
| 10 #include "webkit/browser/quota/quota_client.h" | |
| 11 #include "webkit/browser/quota/quota_types.h" | |
| 12 | |
| 13 namespace quota { | |
| 14 | |
| 15 // This interface is implemented by subsystems that wish to monitor storage | |
| 16 // events, such as changes in quota or usage. | |
| 17 class WEBKIT_STORAGE_BROWSER_EXPORT StorageObserver { | |
| 18 public: | |
| 19 struct WEBKIT_STORAGE_BROWSER_EXPORT Filter { | |
| 20 // The storage type to monitor. This must not be kStorageTypeUnknown. | |
| 21 StorageType storage_type; | |
| 22 | |
| 23 // The quota client to monitor. This can be kAllClientsMask to monitor the | |
| 24 // aggregated usage for the given storage type and origin. In this case, the | |
| 25 // threshold will apply to the accumulated total usage. | |
|
nhiroki
2014/03/17 06:41:51
"In this case, ..." seems to be deprecated by Patc
| |
| 26 QuotaClient::ID client_id; | |
| 27 | |
| 28 // The origin to monitor usage for. Must be specified. | |
| 29 GURL origin; | |
| 30 | |
| 31 Filter(); | |
| 32 }; | |
| 33 | |
| 34 struct WEBKIT_STORAGE_BROWSER_EXPORT MonitorParams { | |
| 35 // Storage types and origin to monitor. | |
| 36 Filter filter; | |
| 37 | |
| 38 // The rate (in seconds) at which storage events will be fired. | |
| 39 // Events will be fired at approximately this rate, or when a storage status | |
| 40 // change has been detected, whichever is the least frequent. | |
| 41 int rate; | |
| 42 | |
| 43 MonitorParams(); | |
| 44 }; | |
| 45 | |
| 46 struct WEBKIT_STORAGE_BROWSER_EXPORT Event { | |
| 47 // The storage types and origin monitored. | |
| 48 Filter filter; | |
| 49 | |
| 50 // The current usage corresponding to the filter. | |
| 51 int64 usage; | |
| 52 | |
| 53 // The quota corresponding to the filter. | |
| 54 int64 quota; | |
|
nhiroki
2014/03/17 06:41:51
What does |quota| contains when the aggregated usa
nhiroki
2014/03/17 07:23:22
Oops... sorry I misunderstood. I thought "aggregat
| |
| 55 | |
| 56 Event(); | |
| 57 }; | |
| 58 | |
| 59 // Will be called when a storage event occurs. | |
| 60 virtual void OnStorageEvent(const Event& event) = 0; | |
| 61 | |
| 62 protected: | |
| 63 virtual ~StorageObserver() {} | |
| 64 }; | |
| 65 | |
| 66 } // namespace quota | |
| 67 | |
| 68 #endif // WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ | |
| OLD | NEW |