| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/quota_internals_handler.h" | 5 #include "chrome/browser/ui/webui/quota_internals/quota_internals_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 proxy_->handler_ = NULL; | 27 proxy_->handler_ = NULL; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void QuotaInternalsHandler::RegisterMessages() { | 30 void QuotaInternalsHandler::RegisterMessages() { |
| 31 web_ui()->RegisterMessageCallback("requestInfo", | 31 web_ui()->RegisterMessageCallback("requestInfo", |
| 32 base::Bind(&QuotaInternalsHandler::OnRequestInfo, | 32 base::Bind(&QuotaInternalsHandler::OnRequestInfo, |
| 33 base::Unretained(this))); | 33 base::Unretained(this))); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void QuotaInternalsHandler::ReportAvailableSpace(int64 available_space) { | 36 void QuotaInternalsHandler::ReportAvailableSpace(int64 available_space) { |
| 37 scoped_ptr<base::Value> avail( | 37 SendMessage("AvailableSpaceUpdated", |
| 38 base::Value::CreateDoubleValue(static_cast<double>(available_space))); | 38 base::FundamentalValue(static_cast<double>(available_space))); |
| 39 SendMessage("AvailableSpaceUpdated", *avail); | |
| 40 } | 39 } |
| 41 | 40 |
| 42 void QuotaInternalsHandler::ReportGlobalInfo(const GlobalStorageInfo& data) { | 41 void QuotaInternalsHandler::ReportGlobalInfo(const GlobalStorageInfo& data) { |
| 43 scoped_ptr<base::Value> value(data.NewValue()); | 42 scoped_ptr<base::Value> value(data.NewValue()); |
| 44 SendMessage("GlobalInfoUpdated", *value); | 43 SendMessage("GlobalInfoUpdated", *value); |
| 45 } | 44 } |
| 46 | 45 |
| 47 void QuotaInternalsHandler::ReportPerHostInfo( | 46 void QuotaInternalsHandler::ReportPerHostInfo( |
| 48 const std::vector<PerHostStorageInfo>& hosts) { | 47 const std::vector<PerHostStorageInfo>& hosts) { |
| 49 base::ListValue values; | 48 base::ListValue values; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 83 |
| 85 void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) { | 84 void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) { |
| 86 if (!proxy_.get()) | 85 if (!proxy_.get()) |
| 87 proxy_ = new QuotaInternalsProxy(this); | 86 proxy_ = new QuotaInternalsProxy(this); |
| 88 proxy_->RequestInfo( | 87 proxy_->RequestInfo( |
| 89 BrowserContext::GetDefaultStoragePartition( | 88 BrowserContext::GetDefaultStoragePartition( |
| 90 Profile::FromWebUI(web_ui()))->GetQuotaManager()); | 89 Profile::FromWebUI(web_ui()))->GetQuotaManager()); |
| 91 } | 90 } |
| 92 | 91 |
| 93 } // namespace quota_internals | 92 } // namespace quota_internals |
| OLD | NEW |