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