| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "content/public/browser/web_contents.h" | 51 #include "content/public/browser/web_contents.h" |
| 52 #include "content/public/browser/web_ui.h" | 52 #include "content/public/browser/web_ui.h" |
| 53 #include "content/public/browser/web_ui_message_handler.h" | 53 #include "content/public/browser/web_ui_message_handler.h" |
| 54 #include "grit/generated_resources.h" | 54 #include "grit/generated_resources.h" |
| 55 #include "grit/net_internals_resources.h" | 55 #include "grit/net_internals_resources.h" |
| 56 #include "net/base/escape.h" | 56 #include "net/base/escape.h" |
| 57 #include "net/base/host_cache.h" | 57 #include "net/base/host_cache.h" |
| 58 #include "net/base/host_resolver.h" | 58 #include "net/base/host_resolver.h" |
| 59 #include "net/base/net_errors.h" | 59 #include "net/base/net_errors.h" |
| 60 #include "net/base/net_util.h" | 60 #include "net/base/net_util.h" |
| 61 #include "net/base/sys_addrinfo.h" | |
| 62 #include "net/base/transport_security_state.h" | 61 #include "net/base/transport_security_state.h" |
| 63 #include "net/base/x509_cert_types.h" | 62 #include "net/base/x509_cert_types.h" |
| 64 #include "net/disk_cache/disk_cache.h" | 63 #include "net/disk_cache/disk_cache.h" |
| 65 #include "net/http/http_cache.h" | 64 #include "net/http/http_cache.h" |
| 66 #include "net/http/http_network_layer.h" | 65 #include "net/http/http_network_layer.h" |
| 67 #include "net/http/http_network_session.h" | 66 #include "net/http/http_network_session.h" |
| 68 #include "net/http/http_server_properties.h" | 67 #include "net/http/http_server_properties.h" |
| 69 #include "net/http/http_stream_factory.h" | 68 #include "net/http/http_stream_factory.h" |
| 70 #include "net/proxy/proxy_service.h" | 69 #include "net/proxy/proxy_service.h" |
| 71 #include "net/url_request/url_request_context.h" | 70 #include "net/url_request/url_request_context.h" |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 entry_dict->SetInteger("address_family", | 945 entry_dict->SetInteger("address_family", |
| 947 static_cast<int>(key.address_family)); | 946 static_cast<int>(key.address_family)); |
| 948 entry_dict->SetString("expiration", | 947 entry_dict->SetString("expiration", |
| 949 net::NetLog::TickCountToString(it.expiration())); | 948 net::NetLog::TickCountToString(it.expiration())); |
| 950 | 949 |
| 951 if (entry.error != net::OK) { | 950 if (entry.error != net::OK) { |
| 952 entry_dict->SetInteger("error", entry.error); | 951 entry_dict->SetInteger("error", entry.error); |
| 953 } else { | 952 } else { |
| 954 // Append all of the resolved addresses. | 953 // Append all of the resolved addresses. |
| 955 ListValue* address_list = new ListValue(); | 954 ListValue* address_list = new ListValue(); |
| 956 const struct addrinfo* current_address = entry.addrlist.head(); | 955 for (size_t i = 0; i < entry.addrlist.size(); ++i) { |
| 957 while (current_address) { | 956 address_list->Append( |
| 958 address_list->Append(Value::CreateStringValue( | 957 Value::CreateStringValue(entry.addrlist[i].ToStringWithoutPort())); |
| 959 net::NetAddressToStringWithPort(current_address))); | |
| 960 current_address = current_address->ai_next; | |
| 961 } | 958 } |
| 962 entry_dict->Set("addresses", address_list); | 959 entry_dict->Set("addresses", address_list); |
| 963 } | 960 } |
| 964 | 961 |
| 965 entry_list->Append(entry_dict); | 962 entry_list->Append(entry_dict); |
| 966 } | 963 } |
| 967 | 964 |
| 968 cache_info_dict->Set("entries", entry_list); | 965 cache_info_dict->Set("entries", entry_list); |
| 969 dict->Set("cache", cache_info_dict); | 966 dict->Set("cache", cache_info_dict); |
| 970 | 967 |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 } | 1670 } |
| 1674 | 1671 |
| 1675 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1672 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1676 : WebUIController(web_ui) { | 1673 : WebUIController(web_ui) { |
| 1677 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1674 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1678 | 1675 |
| 1679 // Set up the chrome://net-internals/ source. | 1676 // Set up the chrome://net-internals/ source. |
| 1680 Profile* profile = Profile::FromWebUI(web_ui); | 1677 Profile* profile = Profile::FromWebUI(web_ui); |
| 1681 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); | 1678 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); |
| 1682 } | 1679 } |
| OLD | NEW |