Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / renderer_host / quota_dispatcher_host.h
blob1e64fce70d13e38c25f57af28df2a66cef5a1f08
1 // Copyright (c) 2012 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_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_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 "webkit/common/quota/quota_types.h"
13 class GURL;
15 namespace IPC {
16 class Message;
19 namespace quota {
20 class QuotaManager;
23 namespace content {
24 class QuotaPermissionContext;
26 class QuotaDispatcherHost : public BrowserMessageFilter {
27 public:
28 QuotaDispatcherHost(int process_id,
29 quota::QuotaManager* quota_manager,
30 QuotaPermissionContext* permission_context);
32 // BrowserMessageFilter:
33 virtual bool OnMessageReceived(const IPC::Message& message,
34 bool* message_was_ok) OVERRIDE;
36 protected:
37 virtual ~QuotaDispatcherHost();
39 private:
40 class RequestDispatcher;
41 class QueryUsageAndQuotaDispatcher;
42 class RequestQuotaDispatcher;
44 void OnQueryStorageUsageAndQuota(
45 int request_id,
46 const GURL& origin_url,
47 quota::StorageType type);
48 void OnRequestStorageQuota(
49 int render_view_id,
50 int request_id,
51 const GURL& origin_url,
52 quota::StorageType type,
53 int64 requested_size);
55 // The ID of this process.
56 int process_id_;
58 quota::QuotaManager* quota_manager_;
59 scoped_refptr<QuotaPermissionContext> permission_context_;
61 IDMap<RequestDispatcher, IDMapOwnPointer> outstanding_requests_;
63 DISALLOW_IMPLICIT_CONSTRUCTORS(QuotaDispatcherHost);
66 } // namespace content
68 #endif // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_