Chromium Code Reviews| Index: webkit/browser/quota/storage_observer.h |
| diff --git a/webkit/browser/quota/storage_observer.h b/webkit/browser/quota/storage_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6ff36ed19bd184a49e31e6596fd23bcab3f06013 |
| --- /dev/null |
| +++ b/webkit/browser/quota/storage_observer.h |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ |
| +#define WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ |
| + |
| +#include "base/basic_types.h" |
| +#include "url/gurl.h" |
| +#include "webkit/browser/quota/quota_client.h" |
| +#include "webkit/browser/quota/quota_types.h" |
| + |
| +namespace quota { |
| + |
| +// This interface is implemented by subsystems that wish to monitor storage |
| +// events, such as changes in quota or usage. |
| +class WEBKIT_STORAGE_BROWSER_EXPORT StorageObserver { |
| + public: |
| + struct WEBKIT_STORAGE_BROWSER_EXPORT Filter { |
| + // The storage type to monitor. This must not be kStorageTypeUnknown. |
| + StorageType storage_type; |
| + |
| + // The quota client to monitor. This can be kAllClientsMask to monitor the |
| + // aggregated usage for the given storage type and origin. In this case, the |
| + // threshold will apply to the accumulated total usage. |
|
nhiroki
2014/03/17 06:41:51
"In this case, ..." seems to be deprecated by Patc
|
| + QuotaClient::ID client_id; |
| + |
| + // The origin to monitor usage for. Must be specified. |
| + GURL origin; |
| + |
| + Filter(); |
| + }; |
| + |
| + struct WEBKIT_STORAGE_BROWSER_EXPORT MonitorParams { |
| + // Storage types and origin to monitor. |
| + Filter filter; |
| + |
| + // The rate (in seconds) at which storage events will be fired. |
| + // Events will be fired at approximately this rate, or when a storage status |
| + // change has been detected, whichever is the least frequent. |
| + int rate; |
| + |
| + MonitorParams(); |
| + }; |
| + |
| + struct WEBKIT_STORAGE_BROWSER_EXPORT Event { |
| + // The storage types and origin monitored. |
| + Filter filter; |
| + |
| + // The current usage corresponding to the filter. |
| + int64 usage; |
| + |
| + // The quota corresponding to the filter. |
| + 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
|
| + |
| + Event(); |
| + }; |
| + |
| + // Will be called when a storage event occurs. |
| + virtual void OnStorageEvent(const Event& event) = 0; |
| + |
| + protected: |
| + virtual ~StorageObserver() {} |
| +}; |
| + |
| +} // namespace quota |
| + |
| +#endif // WEBKIT_BROWSER_QUOTA_STORAGE_OBSERVER_H_ |