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 = base::Callback<void(QueryUsageAndQuotaResponse)>; |
19 | 19 |
20 UsageAndQuotaQuery(scoped_refptr<storage::QuotaManager> quota_manager, | 20 UsageAndQuotaQuery(scoped_refptr<storage::QuotaManager> quota_manager, |
21 const GURL& security_origin, | 21 const GURL& security_origin, |
22 const Callback& callback); | 22 const Callback& callback); |
23 | 23 |
24 private: | 24 private: |
25 friend class base::RefCounted<UsageAndQuotaQuery>; | 25 friend class base::RefCounted<UsageAndQuotaQuery>; |
26 | 26 |
27 virtual ~UsageAndQuotaQuery(); | 27 virtual ~UsageAndQuotaQuery(); |
28 | 28 |
29 void DidGetTemporaryQuota(storage::QuotaStatusCode status, | 29 void DidGetTemporaryQuota(storage::QuotaStatusCode status, |
30 int64 used_bytes, | 30 int64 used_bytes, |
31 int64 quota_in_bytes); | 31 int64 quota_in_bytes); |
32 | 32 |
33 void DidGetPersistentQuota(storage::QuotaStatusCode status, int64 value); | 33 void DidGetPersistentQuota(storage::QuotaStatusCode status, int64 value); |
34 | 34 |
35 using UsageItemsCallback = | 35 void GetHostUsage(ListBuilder<UsageItem>* list, |
36 base::Callback<void(const std::vector<UsageItem>&)>; | 36 storage::StorageType storage_type); |
37 | 37 |
38 void GetHostUsage(storage::StorageType storage_type, | 38 void GetUsageForClient(ListBuilder<UsageItem>* list, |
39 const UsageItemsCallback& items_callback); | 39 storage::StorageType storage_type, |
40 storage::QuotaClient::ID client_id, | |
41 const std::string& client_name); | |
40 | 42 |
41 void DidGetHostUsage(const UsageItemsCallback& items_callback, | 43 void DidGetUsageForClient(ListBuilder<UsageItem>* list, |
42 const std::vector<UsageItem>& usage_list); | 44 const std::string& client_name, |
45 int64 value); | |
43 | 46 |
44 scoped_refptr<storage::QuotaManager> quota_manager_; | 47 scoped_refptr<storage::QuotaManager> quota_manager_; |
45 GURL security_origin_; | 48 GURL security_origin_; |
46 Callback callback_; | 49 Callback callback_; |
47 Quota quota_; | 50 double temporary_quota_; |
dgozman
2014/11/06 14:20:42
Please initialize this field in constructor.
vkuzkokov
2014/11/06 16:30:12
Done.
| |
48 Usage usage_; | 51 double persistent_quota_; |
dgozman
2014/11/06 14:20:42
ditto
vkuzkokov
2014/11/06 16:30:12
Done.
| |
52 ListBuilder<UsageItem> temporary_usage_; | |
53 ListBuilder<UsageItem> persistent_usage_; | |
54 ListBuilder<UsageItem> syncable_usage_; | |
49 }; | 55 }; |
50 | 56 |
51 } // namespace page | 57 } // namespace page |
52 } // namespace devtools | 58 } // namespace devtools |
53 } // namespace content | 59 } // namespace content |
54 | 60 |
55 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_QUOTA_AND_USAGE_QUERY_H_ | 61 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_QUOTA_AND_USAGE_QUERY_H_ |
OLD | NEW |