[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / quota_dispatcher_host.h
blob8a30f229f81c64f104d19a2b514f18109484261a
1 // Copyright 2013 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.
5 #ifndef CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_
8 #include "base/basictypes.h"
9 #include "base/id_map.h"
10 #include "content/public/browser/browser_message_filter.h"
11 #include "storage/common/quota/quota_types.h"
13 class GURL;
15 namespace IPC {
16 class Message;
19 namespace storage {
20 class QuotaManager;
23 namespace content {
24 class QuotaPermissionContext;
25 struct StorageQuotaParams;
27 class QuotaDispatcherHost : public BrowserMessageFilter {
28 public:
29 QuotaDispatcherHost(int process_id,
30 storage::QuotaManager* quota_manager,
31 QuotaPermissionContext* permission_context);
33 // BrowserMessageFilter:
34 bool OnMessageReceived(const IPC::Message& message) override;
36 protected:
37 ~QuotaDispatcherHost() override;
39 private:
40 class RequestDispatcher;
41 class QueryUsageAndQuotaDispatcher;
42 class RequestQuotaDispatcher;
44 void OnQueryStorageUsageAndQuota(int request_id,
45 const GURL& origin_url,
46 storage::StorageType type);
47 void OnRequestStorageQuota(const StorageQuotaParams& params);
49 // The ID of this process.
50 int process_id_;
52 storage::QuotaManager* quota_manager_;
53 scoped_refptr<QuotaPermissionContext> permission_context_;
55 IDMap<RequestDispatcher, IDMapOwnPointer> outstanding_requests_;
57 base::WeakPtrFactory<QuotaDispatcherHost> weak_factory_;
59 DISALLOW_IMPLICIT_CONSTRUCTORS(QuotaDispatcherHost);
62 } // namespace content
64 #endif // CONTENT_BROWSER_QUOTA_DISPATCHER_HOST_H_