| 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/net_internals/net_internals_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 void NetInternalsMessageHandler::IOThreadImpl::OnGetHttpCacheInfo( | 1204 void NetInternalsMessageHandler::IOThreadImpl::OnGetHttpCacheInfo( |
| 1205 const base::ListValue* list) { | 1205 const base::ListValue* list) { |
| 1206 DCHECK(!list); | 1206 DCHECK(!list); |
| 1207 base::DictionaryValue* info_dict = new base::DictionaryValue(); | 1207 base::DictionaryValue* info_dict = new base::DictionaryValue(); |
| 1208 base::DictionaryValue* stats_dict = new base::DictionaryValue(); | 1208 base::DictionaryValue* stats_dict = new base::DictionaryValue(); |
| 1209 | 1209 |
| 1210 disk_cache::Backend* disk_cache = GetDiskCacheBackend(GetMainContext()); | 1210 disk_cache::Backend* disk_cache = GetDiskCacheBackend(GetMainContext()); |
| 1211 | 1211 |
| 1212 if (disk_cache) { | 1212 if (disk_cache) { |
| 1213 // Extract the statistics key/value pairs from the backend. | 1213 // Extract the statistics key/value pairs from the backend. |
| 1214 std::vector<std::pair<std::string, std::string> > stats; | 1214 base::StringPairs stats; |
| 1215 disk_cache->GetStats(&stats); | 1215 disk_cache->GetStats(&stats); |
| 1216 for (size_t i = 0; i < stats.size(); ++i) { | 1216 for (size_t i = 0; i < stats.size(); ++i) { |
| 1217 stats_dict->SetStringWithoutPathExpansion( | 1217 stats_dict->SetStringWithoutPathExpansion( |
| 1218 stats[i].first, stats[i].second); | 1218 stats[i].first, stats[i].second); |
| 1219 } | 1219 } |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 info_dict->Set("stats", stats_dict); | 1222 info_dict->Set("stats", stats_dict); |
| 1223 | 1223 |
| 1224 SendJavascriptCommand("receivedHttpCacheInfo", info_dict); | 1224 SendJavascriptCommand("receivedHttpCacheInfo", info_dict); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 } | 1709 } |
| 1710 | 1710 |
| 1711 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1711 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1712 : WebUIController(web_ui) { | 1712 : WebUIController(web_ui) { |
| 1713 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1713 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1714 | 1714 |
| 1715 // Set up the chrome://net-internals/ source. | 1715 // Set up the chrome://net-internals/ source. |
| 1716 Profile* profile = Profile::FromWebUI(web_ui); | 1716 Profile* profile = Profile::FromWebUI(web_ui); |
| 1717 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1717 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
| 1718 } | 1718 } |
| OLD | NEW |