| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_COMMON_QUOTA_DISPATCHER_H_ | 5 #ifndef CONTENT_COMMON_QUOTA_DISPATCHER_H_ |
| 6 #define CONTENT_COMMON_QUOTA_DISPATCHER_H_ | 6 #define CONTENT_COMMON_QUOTA_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace WebKit { | 23 namespace WebKit { |
| 24 class WebStorageQuotaCallbacks; | 24 class WebStorageQuotaCallbacks; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // Dispatches and sends quota related messages sent to/from a child | 27 // Dispatches and sends quota related messages sent to/from a child |
| 28 // process from/to the main browser process. There is one instance | 28 // process from/to the main browser process. There is one instance |
| 29 // per child process. Messages are dispatched on the main child thread. | 29 // per child process. Messages are dispatched on the main child thread. |
| 30 class QuotaDispatcher : public IPC::Channel::Listener { | 30 class QuotaDispatcher : public IPC::Channel::Listener { |
| 31 public: | 31 public: |
| 32 QuotaDispatcher(); | 32 QuotaDispatcher(); |
| 33 ~QuotaDispatcher(); | 33 virtual ~QuotaDispatcher(); |
| 34 | 34 |
| 35 // IPC::Channel::Listener implementation. | 35 // IPC::Channel::Listener implementation. |
| 36 virtual bool OnMessageReceived(const IPC::Message& msg); | 36 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 37 | 37 |
| 38 void QueryStorageUsageAndQuota(const GURL& gurl, | 38 void QueryStorageUsageAndQuota(const GURL& gurl, |
| 39 WebKit::WebStorageQuotaType type, | 39 WebKit::WebStorageQuotaType type, |
| 40 WebKit::WebStorageQuotaCallbacks* callbacks); | 40 WebKit::WebStorageQuotaCallbacks* callbacks); |
| 41 void RequestStorageQuota(const GURL& gurl, | 41 void RequestStorageQuota(const GURL& gurl, |
| 42 WebKit::WebStorageQuotaType type, | 42 WebKit::WebStorageQuotaType type, |
| 43 unsigned long long requested_size, | 43 unsigned long long requested_size, |
| 44 WebKit::WebStorageQuotaCallbacks* callbacks); | 44 WebKit::WebStorageQuotaCallbacks* callbacks); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // Message handlers. | 47 // Message handlers. |
| 48 void DidQueryStorageUsageAndQuota(int request_id, | 48 void DidQueryStorageUsageAndQuota(int request_id, |
| 49 int64 current_usage, | 49 int64 current_usage, |
| 50 int64 current_quota); | 50 int64 current_quota); |
| 51 void DidGrantStorageQuota(int request_id, | 51 void DidGrantStorageQuota(int request_id, |
| 52 int64 granted_quota); | 52 int64 granted_quota); |
| 53 void DidFail(int request_id, | 53 void DidFail(int request_id, |
| 54 WebKit::WebStorageQuotaError error); | 54 WebKit::WebStorageQuotaError error); |
| 55 | 55 |
| 56 IDMap<WebKit::WebStorageQuotaCallbacks> pending_quota_callbacks_; | 56 IDMap<WebKit::WebStorageQuotaCallbacks> pending_quota_callbacks_; |
| 57 | 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher); | 58 DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 #endif // CONTENT_COMMON_QUOTA_DISPATCHER_H_ | 61 #endif // CONTENT_COMMON_QUOTA_DISPATCHER_H_ |
| OLD | NEW |