Chromium Code Reviews| Index: content/common/quota_dispatcher.h |
| diff --git a/content/common/quota_dispatcher.h b/content/common/quota_dispatcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..883bc59387eaff084df19b8a1801ae18e7e389f0 |
| --- /dev/null |
| +++ b/content/common/quota_dispatcher.h |
| @@ -0,0 +1,62 @@ |
| +// Copyright (c) 2011 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 CONTENT_COMMON_QUOTA_DISPATCHER_H_ |
| +#define CONTENT_COMMON_QUOTA_DISPATCHER_H_ |
| + |
| +#include <map> |
| +#include <set> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/id_map.h" |
| +#include "ipc/ipc_channel.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaError.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h" |
|
ericu
2011/04/08 03:31:18
Huh. I've not previously hit this problem. I don
kinuko
2011/04/08 09:02:53
I've seen this happening in several files, like in
|
| + |
| +class GURL; |
| + |
| +namespace IPC { |
| +class Message; |
| +} |
| + |
| +namespace WebKit { |
| +class WebStorageQuotaCallbacks; |
| +} |
| + |
| +// Dispatches and sends quota related messages sent to/from a child |
| +// process from/to the main browser process. There is one instance |
| +// per child process. Messages are dispatched on the main child thread. |
| +class QuotaDispatcher : public IPC::Channel::Listener { |
| + public: |
| + QuotaDispatcher(); |
| + ~QuotaDispatcher(); |
| + |
| + // IPC::Channel::Listener implementation. |
| + virtual bool OnMessageReceived(const IPC::Message& msg); |
| + |
| + void QueryStorageUsageAndQuota(const GURL& gurl, |
| + WebKit::WebStorageQuotaType type, |
| + WebKit::WebStorageQuotaCallbacks* callbacks); |
| + void RequestStorageQuota(const GURL& gurl, |
| + WebKit::WebStorageQuotaType type, |
| + unsigned long long requested_size, |
| + WebKit::WebStorageQuotaCallbacks* callbacks); |
| + |
| + private: |
| + // Message handlers. |
| + void DidHandleRequestStorageQuota(int request_id, |
| + WebKit::WebStorageQuotaError error, |
| + int64 granted_quota); |
| + void DidHandleUsageAndQuotaQuery(int request_id, |
| + WebKit::WebStorageQuotaError error, |
| + int64 current_usage, |
| + int64 current_quota); |
| + |
| + struct PendingQuotaCallbacks; |
| + IDMap<PendingQuotaCallbacks, IDMapOwnPointer> pending_quota_callbacks_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher); |
| +}; |
| + |
| +#endif // CONTENT_COMMON_QUOTA_DISPATCHER_H_ |