| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_USAGE_AND_QUOTA_QUERY_H_ | |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_USAGE_AND_QUOTA_QUERY_H_ | |
| 7 | |
| 8 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" | |
| 9 #include "storage/browser/quota/quota_manager.h" | |
| 10 | |
| 11 namespace content { | |
| 12 namespace devtools { | |
| 13 namespace page { | |
| 14 | |
| 15 // This class can only be used on IO thread. | |
| 16 class UsageAndQuotaQuery : public base::RefCounted<UsageAndQuotaQuery> { | |
| 17 public: | |
| 18 using Callback = | |
| 19 base::Callback<void(scoped_refptr<QueryUsageAndQuotaResponse>)>; | |
| 20 | |
| 21 UsageAndQuotaQuery(scoped_refptr<storage::QuotaManager> quota_manager, | |
| 22 const GURL& security_origin, | |
| 23 const Callback& callback); | |
| 24 | |
| 25 private: | |
| 26 friend class base::RefCounted<UsageAndQuotaQuery>; | |
| 27 | |
| 28 using UsageItems = std::vector<scoped_refptr<UsageItem>>; | |
| 29 | |
| 30 virtual ~UsageAndQuotaQuery(); | |
| 31 | |
| 32 void DidGetTemporaryQuota(storage::QuotaStatusCode status, | |
| 33 int64 used_bytes, | |
| 34 int64 quota_in_bytes); | |
| 35 | |
| 36 void DidGetPersistentQuota(storage::QuotaStatusCode status, int64 value); | |
| 37 | |
| 38 void GetHostUsage(UsageItems* list, storage::StorageType storage_type); | |
| 39 | |
| 40 void GetUsageForClient(UsageItems* list, | |
| 41 storage::StorageType storage_type, | |
| 42 storage::QuotaClient::ID client_id, | |
| 43 const std::string& client_name); | |
| 44 | |
| 45 void DidGetUsageForClient(UsageItems* list, | |
| 46 const std::string& client_name, | |
| 47 int64 value); | |
| 48 | |
| 49 scoped_refptr<storage::QuotaManager> quota_manager_; | |
| 50 GURL security_origin_; | |
| 51 Callback callback_; | |
| 52 double temporary_quota_; | |
| 53 double persistent_quota_; | |
| 54 UsageItems temporary_usage_; | |
| 55 UsageItems persistent_usage_; | |
| 56 UsageItems syncable_usage_; | |
| 57 }; | |
| 58 | |
| 59 } // namespace page | |
| 60 } // namespace devtools | |
| 61 } // namespace content | |
| 62 | |
| 63 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_USAGE_AND_QUOTA_QUERY_H_ | |
| OLD | NEW |