OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/ui/webui/quota_internals_proxy.h" | 5 #include "chrome/browser/ui/webui/quota_internals_proxy.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 quota_manager_->GetGlobalUsage( | 43 quota_manager_->GetGlobalUsage( |
44 quota::kStorageTypeTemporary, | 44 quota::kStorageTypeTemporary, |
45 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage, | 45 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage, |
46 weak_factory_.GetWeakPtr())); | 46 weak_factory_.GetWeakPtr())); |
47 | 47 |
48 quota_manager_->GetGlobalUsage( | 48 quota_manager_->GetGlobalUsage( |
49 quota::kStorageTypePersistent, | 49 quota::kStorageTypePersistent, |
50 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage, | 50 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage, |
51 weak_factory_.GetWeakPtr())); | 51 weak_factory_.GetWeakPtr())); |
52 | 52 |
| 53 quota_manager_->GetGlobalUsage( |
| 54 quota::kStorageTypeSyncable, |
| 55 base::Bind(&QuotaInternalsProxy::DidGetGlobalUsage, |
| 56 weak_factory_.GetWeakPtr())); |
| 57 |
53 quota_manager_->DumpQuotaTable( | 58 quota_manager_->DumpQuotaTable( |
54 base::Bind(&QuotaInternalsProxy::DidDumpQuotaTable, | 59 base::Bind(&QuotaInternalsProxy::DidDumpQuotaTable, |
55 weak_factory_.GetWeakPtr())); | 60 weak_factory_.GetWeakPtr())); |
56 | 61 |
57 quota_manager_->DumpOriginInfoTable( | 62 quota_manager_->DumpOriginInfoTable( |
58 base::Bind(&QuotaInternalsProxy::DidDumpOriginInfoTable, | 63 base::Bind(&QuotaInternalsProxy::DidDumpOriginInfoTable, |
59 weak_factory_.GetWeakPtr())); | 64 weak_factory_.GetWeakPtr())); |
60 | 65 |
61 std::map<std::string, std::string> stats; | 66 std::map<std::string, std::string> stats; |
62 quota_manager_->GetStatistics(&stats); | 67 quota_manager_->GetStatistics(&stats); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 origin_info.push_back(info); | 148 origin_info.push_back(info); |
144 } | 149 } |
145 | 150 |
146 ReportPerOriginInfo(origin_info); | 151 ReportPerOriginInfo(origin_info); |
147 } | 152 } |
148 | 153 |
149 void QuotaInternalsProxy::DidGetHostUsage(const std::string& host, | 154 void QuotaInternalsProxy::DidGetHostUsage(const std::string& host, |
150 quota::StorageType type, | 155 quota::StorageType type, |
151 int64 usage) { | 156 int64 usage) { |
152 DCHECK(type == quota::kStorageTypeTemporary || | 157 DCHECK(type == quota::kStorageTypeTemporary || |
153 type == quota::kStorageTypePersistent); | 158 type == quota::kStorageTypePersistent || |
| 159 type == quota::kStorageTypeSyncable); |
154 | 160 |
155 PerHostStorageInfo info(host, type); | 161 PerHostStorageInfo info(host, type); |
156 info.set_usage(usage); | 162 info.set_usage(usage); |
157 | 163 |
158 report_pending_.push_back(info); | 164 report_pending_.push_back(info); |
159 hosts_pending_.erase(make_pair(host, type)); | 165 hosts_pending_.erase(make_pair(host, type)); |
160 if (report_pending_.size() >= 10 || hosts_pending_.empty()) { | 166 if (report_pending_.size() >= 10 || hosts_pending_.empty()) { |
161 ReportPerHostInfo(report_pending_); | 167 ReportPerHostInfo(report_pending_); |
162 report_pending_.clear(); | 168 report_pending_.clear(); |
163 } | 169 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void QuotaInternalsProxy::GetHostUsage(const std::string& host, | 215 void QuotaInternalsProxy::GetHostUsage(const std::string& host, |
210 quota::StorageType type) { | 216 quota::StorageType type) { |
211 DCHECK(quota_manager_); | 217 DCHECK(quota_manager_); |
212 quota_manager_->GetHostUsage( | 218 quota_manager_->GetHostUsage( |
213 host, type, | 219 host, type, |
214 base::Bind(&QuotaInternalsProxy::DidGetHostUsage, | 220 base::Bind(&QuotaInternalsProxy::DidGetHostUsage, |
215 weak_factory_.GetWeakPtr(), host, type)); | 221 weak_factory_.GetWeakPtr(), host, type)); |
216 } | 222 } |
217 | 223 |
218 } // namespace quota_internals | 224 } // namespace quota_internals |
OLD | NEW |