[email protected] | 4a29a11 | 2013-07-24 19:20:18 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
[email protected] | 10e5cf1 | 2011-04-13 04:10:40 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 4a29a11 | 2013-07-24 19:20:18 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_ |
6 | #define CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_ | ||||
[email protected] | 10e5cf1 | 2011-04-13 04:10:40 | [diff] [blame] | 7 | |
[email protected] | 595765c | 2011-04-27 13:20:14 | [diff] [blame] | 8 | #include "base/id_map.h" |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 9 | #include "base/macros.h" |
[email protected] | 57a96ba | 2011-12-16 03:00:09 | [diff] [blame] | 10 | #include "content/public/browser/browser_message_filter.h" |
pilgrim | 1633055 | 2014-09-10 01:32:22 | [diff] [blame] | 11 | #include "storage/common/quota/quota_types.h" |
[email protected] | 10e5cf1 | 2011-04-13 04:10:40 | [diff] [blame] | 12 | |
13 | class GURL; | ||||
14 | |||||
[email protected] | 595765c | 2011-04-27 13:20:14 | [diff] [blame] | 15 | namespace IPC { |
16 | class Message; | ||||
17 | } | ||||
18 | |||||
[email protected] | cd501a7 | 2014-08-22 19:58:31 | [diff] [blame] | 19 | namespace storage { |
[email protected] | 595765c | 2011-04-27 13:20:14 | [diff] [blame] | 20 | class QuotaManager; |
21 | } | ||||
22 | |||||
[email protected] | 09b361bb | 2012-10-19 03:26:31 | [diff] [blame] | 23 | namespace content { |
24 | class QuotaPermissionContext; | ||||
[email protected] | f78aa772 | 2014-04-04 00:04:25 | [diff] [blame] | 25 | struct StorageQuotaParams; |
[email protected] | 09b361bb | 2012-10-19 03:26:31 | [diff] [blame] | 26 | |
27 | class QuotaDispatcherHost : public BrowserMessageFilter { | ||||
[email protected] | 10e5cf1 | 2011-04-13 04:10:40 | [diff] [blame] | 28 | public: |
[email protected] | 317f96c9 | 2011-05-31 06:53:41 | [diff] [blame] | 29 | QuotaDispatcherHost(int process_id, |
[email protected] | cd501a7 | 2014-08-22 19:58:31 | [diff] [blame] | 30 | storage::QuotaManager* quota_manager, |
[email protected] | 09b361bb | 2012-10-19 03:26:31 | [diff] [blame] | 31 | QuotaPermissionContext* permission_context); |
[email protected] | fb90c94 | 2012-04-27 23:40:50 | [diff] [blame] | 32 | |
[email protected] | 09b361bb | 2012-10-19 03:26:31 | [diff] [blame] | 33 | // BrowserMessageFilter: |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 34 | bool OnMessageReceived(const IPC::Message& message) override; |
[email protected] | 10e5cf1 | 2011-04-13 04:10:40 | [diff] [blame] | 35 | |
[email protected] | fb90c94 | 2012-04-27 23:40:50 | [diff] [blame] | 36 | protected: |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 37 | ~QuotaDispatcherHost() override; |
[email protected] | fb90c94 | 2012-04-27 23:40:50 | [diff] [blame] | 38 | |
[email protected] | 10e5cf1 | 2011-04-13 04:10:40 | [diff] [blame] | 39 | private: |
[email protected] | 317f96c9 | 2011-05-31 06:53:41 | [diff] [blame] | 40 | class RequestDispatcher; |
41 | class QueryUsageAndQuotaDispatcher; | ||||
42 | class RequestQuotaDispatcher; | ||||
43 | |||||
[email protected] | cd501a7 | 2014-08-22 19:58:31 | [diff] [blame] | 44 | void OnQueryStorageUsageAndQuota(int request_id, |
45 | const GURL& origin_url, | ||||
46 | storage::StorageType type); | ||||
[email protected] | f78aa772 | 2014-04-04 00:04:25 | [diff] [blame] | 47 | void OnRequestStorageQuota(const StorageQuotaParams& params); |
[email protected] | 595765c | 2011-04-27 13:20:14 | [diff] [blame] | 48 | |
[email protected] | 317f96c9 | 2011-05-31 06:53:41 | [diff] [blame] | 49 | // The ID of this process. |
50 | int process_id_; | ||||
[email protected] | 595765c | 2011-04-27 13:20:14 | [diff] [blame] | 51 | |
[email protected] | cd501a7 | 2014-08-22 19:58:31 | [diff] [blame] | 52 | storage::QuotaManager* quota_manager_; |
[email protected] | 09b361bb | 2012-10-19 03:26:31 | [diff] [blame] | 53 | scoped_refptr<QuotaPermissionContext> permission_context_; |
[email protected] | 317f96c9 | 2011-05-31 06:53:41 | [diff] [blame] | 54 | |
rlanday | de24c6d | 2016-12-01 03:05:40 | [diff] [blame] | 55 | IDMap<std::unique_ptr<RequestDispatcher>> outstanding_requests_; |
[email protected] | 317f96c9 | 2011-05-31 06:53:41 | [diff] [blame] | 56 | |
[email protected] | 596cfef | 2013-09-09 14:45:51 | [diff] [blame] | 57 | base::WeakPtrFactory<QuotaDispatcherHost> weak_factory_; |
58 | |||||
[email protected] | 317f96c9 | 2011-05-31 06:53:41 | [diff] [blame] | 59 | DISALLOW_IMPLICIT_CONSTRUCTORS(QuotaDispatcherHost); |
[email protected] | 10e5cf1 | 2011-04-13 04:10:40 | [diff] [blame] | 60 | }; |
61 | |||||
[email protected] | 09b361bb | 2012-10-19 03:26:31 | [diff] [blame] | 62 | } // namespace content |
63 | |||||
[email protected] | 4a29a11 | 2013-07-24 19:20:18 | [diff] [blame] | 64 | #endif // CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_ |