| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 typedef Statistics::const_iterator iterator; | 71 typedef Statistics::const_iterator iterator; |
| 72 for (iterator itr(stats.begin()); itr != stats.end(); ++itr) { | 72 for (iterator itr(stats.begin()); itr != stats.end(); ++itr) { |
| 73 dict.SetString(itr->first, itr->second); | 73 dict.SetString(itr->first, itr->second); |
| 74 } | 74 } |
| 75 | 75 |
| 76 SendMessage("StatisticsUpdated", dict); | 76 SendMessage("StatisticsUpdated", dict); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void QuotaInternalsHandler::SendMessage(const std::string& message, | 79 void QuotaInternalsHandler::SendMessage(const std::string& message, |
| 80 const base::Value& value) { | 80 const base::Value& value) { |
| 81 scoped_ptr<base::Value> message_data(base::Value::CreateStringValue(message)); | 81 web_ui()->CallJavascriptFunction( |
| 82 web_ui()->CallJavascriptFunction("cr.quota.messageHandler", | 82 "cr.quota.messageHandler", base::StringValue(message), value); |
| 83 *message_data, | |
| 84 value); | |
| 85 } | 83 } |
| 86 | 84 |
| 87 void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) { | 85 void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) { |
| 88 if (!proxy_.get()) | 86 if (!proxy_.get()) |
| 89 proxy_ = new QuotaInternalsProxy(this); | 87 proxy_ = new QuotaInternalsProxy(this); |
| 90 proxy_->RequestInfo( | 88 proxy_->RequestInfo( |
| 91 BrowserContext::GetDefaultStoragePartition( | 89 BrowserContext::GetDefaultStoragePartition( |
| 92 Profile::FromWebUI(web_ui()))->GetQuotaManager()); | 90 Profile::FromWebUI(web_ui()))->GetQuotaManager()); |
| 93 } | 91 } |
| 94 | 92 |
| 95 } // namespace quota_internals | 93 } // namespace quota_internals |
| OLD | NEW |