Chromium Code Reviews| 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 (net::AddressList::const_iterator addr_it = entry.addrlist.begin(); |
|
eroman
2012/05/04 01:08:41
[optional] style nit: For vectors I actually much
| |
| 957 while (current_address) { | 956 addr_it != entry.addrlist.end(); ++addr_it) { |
| 958 address_list->Append(Value::CreateStringValue( | 957 address_list->Append( |
| 959 net::NetAddressToStringWithPort(current_address))); | 958 Value::CreateStringValue(addr_it->ToStringWithoutPort())); |
| 960 current_address = current_address->ai_next; | |
| 961 } | 959 } |
| 962 entry_dict->Set("addresses", address_list); | 960 entry_dict->Set("addresses", address_list); |
| 963 } | 961 } |
| 964 | 962 |
| 965 entry_list->Append(entry_dict); | 963 entry_list->Append(entry_dict); |
| 966 } | 964 } |
| 967 | 965 |
| 968 cache_info_dict->Set("entries", entry_list); | 966 cache_info_dict->Set("entries", entry_list); |
| 969 dict->Set("cache", cache_info_dict); | 967 dict->Set("cache", cache_info_dict); |
| 970 | 968 |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1674 } | 1672 } |
| 1675 | 1673 |
| 1676 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1674 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1677 : WebUIController(web_ui) { | 1675 : WebUIController(web_ui) { |
| 1678 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1676 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1679 | 1677 |
| 1680 // Set up the chrome://net-internals/ source. | 1678 // Set up the chrome://net-internals/ source. |
| 1681 Profile* profile = Profile::FromWebUI(web_ui); | 1679 Profile* profile = Profile::FromWebUI(web_ui); |
| 1682 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); | 1680 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); |
| 1683 } | 1681 } |
| OLD | NEW |