| Index: chrome/browser/ui/webui/quota_internals_proxy.cc
|
| diff --git a/chrome/browser/ui/webui/quota_internals_proxy.cc b/chrome/browser/ui/webui/quota_internals_proxy.cc
|
| index 100f6d51aaa4a19319c61db7c3541e6911650995..2fa16844f1e73113b5ea5245152f769e6f0fc2a2 100644
|
| --- a/chrome/browser/ui/webui/quota_internals_proxy.cc
|
| +++ b/chrome/browser/ui/webui/quota_internals_proxy.cc
|
| @@ -21,30 +21,6 @@ QuotaInternalsProxy::QuotaInternalsProxy(QuotaInternalsHandler* handler)
|
| weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
|
| }
|
|
|
| -QuotaInternalsProxy::~QuotaInternalsProxy() {}
|
| -
|
| -#define RELAY_TO_HANDLER(func, arg_t) \
|
| - void QuotaInternalsProxy::func(arg_t arg) { \
|
| - if (!handler_) \
|
| - return; \
|
| - if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { \
|
| - BrowserThread::PostTask( \
|
| - BrowserThread::UI, FROM_HERE, \
|
| - base::Bind(&QuotaInternalsProxy::func, this, arg)); \
|
| - return; \
|
| - } \
|
| - \
|
| - handler_->func(arg); \
|
| - }
|
| -
|
| -RELAY_TO_HANDLER(ReportAvailableSpace, int64)
|
| -RELAY_TO_HANDLER(ReportGlobalInfo, const GlobalStorageInfo&)
|
| -RELAY_TO_HANDLER(ReportPerHostInfo, const std::vector<PerHostStorageInfo>&)
|
| -RELAY_TO_HANDLER(ReportPerOriginInfo, const std::vector<PerOriginStorageInfo>&)
|
| -RELAY_TO_HANDLER(ReportStatistics, const Statistics&)
|
| -
|
| -#undef RELAY_TO_HANDLER
|
| -
|
| void QuotaInternalsProxy::RequestInfo(
|
| scoped_refptr<quota::QuotaManager> quota_manager) {
|
| DCHECK(quota_manager);
|
| @@ -87,6 +63,30 @@ void QuotaInternalsProxy::RequestInfo(
|
| ReportStatistics(stats);
|
| }
|
|
|
| +QuotaInternalsProxy::~QuotaInternalsProxy() {}
|
| +
|
| +#define RELAY_TO_HANDLER(func, arg_t) \
|
| + void QuotaInternalsProxy::func(arg_t arg) { \
|
| + if (!handler_) \
|
| + return; \
|
| + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { \
|
| + BrowserThread::PostTask( \
|
| + BrowserThread::UI, FROM_HERE, \
|
| + base::Bind(&QuotaInternalsProxy::func, this, arg)); \
|
| + return; \
|
| + } \
|
| + \
|
| + handler_->func(arg); \
|
| + }
|
| +
|
| +RELAY_TO_HANDLER(ReportAvailableSpace, int64)
|
| +RELAY_TO_HANDLER(ReportGlobalInfo, const GlobalStorageInfo&)
|
| +RELAY_TO_HANDLER(ReportPerHostInfo, const std::vector<PerHostStorageInfo>&)
|
| +RELAY_TO_HANDLER(ReportPerOriginInfo, const std::vector<PerOriginStorageInfo>&)
|
| +RELAY_TO_HANDLER(ReportStatistics, const Statistics&)
|
| +
|
| +#undef RELAY_TO_HANDLER
|
| +
|
| void QuotaInternalsProxy::DidGetAvailableSpace(quota::QuotaStatusCode status,
|
| int64 space) {
|
| if (status == quota::kQuotaStatusOk)
|
| @@ -167,25 +167,6 @@ void QuotaInternalsProxy::DidGetHostUsage(const std::string& host,
|
| hosts_pending_.begin()->second);
|
| }
|
|
|
| -void QuotaInternalsProxy::VisitHost(const std::string& host,
|
| - quota::StorageType type) {
|
| - if (hosts_visited_.insert(std::make_pair(host, type)).second) {
|
| - hosts_pending_.insert(std::make_pair(host, type));
|
| - if (hosts_pending_.size() == 1) {
|
| - GetHostUsage(host, type);
|
| - }
|
| - }
|
| -}
|
| -
|
| -void QuotaInternalsProxy::GetHostUsage(const std::string& host,
|
| - quota::StorageType type) {
|
| - DCHECK(quota_manager_);
|
| - quota_manager_->GetHostUsage(
|
| - host, type,
|
| - base::Bind(&QuotaInternalsProxy::DidGetHostUsage,
|
| - weak_factory_.GetWeakPtr()));
|
| -}
|
| -
|
| void QuotaInternalsProxy::RequestPerOriginInfo(quota::StorageType type) {
|
| DCHECK(quota_manager_);
|
|
|
| @@ -215,4 +196,23 @@ void QuotaInternalsProxy::RequestPerOriginInfo(quota::StorageType type) {
|
| ReportPerHostInfo(host_info);
|
| }
|
|
|
| +void QuotaInternalsProxy::VisitHost(const std::string& host,
|
| + quota::StorageType type) {
|
| + if (hosts_visited_.insert(std::make_pair(host, type)).second) {
|
| + hosts_pending_.insert(std::make_pair(host, type));
|
| + if (hosts_pending_.size() == 1) {
|
| + GetHostUsage(host, type);
|
| + }
|
| + }
|
| +}
|
| +
|
| +void QuotaInternalsProxy::GetHostUsage(const std::string& host,
|
| + quota::StorageType type) {
|
| + DCHECK(quota_manager_);
|
| + quota_manager_->GetHostUsage(
|
| + host, type,
|
| + base::Bind(&QuotaInternalsProxy::DidGetHostUsage,
|
| + weak_factory_.GetWeakPtr()));
|
| +}
|
| +
|
| } // namespace quota_internals
|
|
|