| 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 <list> | 7 #include <list> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 // For example, turn "www.google.com" into "http://www.google.com". | 1077 // For example, turn "www.google.com" into "http://www.google.com". |
| 1078 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(url_str), std::string())); | 1078 GURL url(URLFixerUpper::FixupURL(UTF16ToUTF8(url_str), std::string())); |
| 1079 | 1079 |
| 1080 connection_tester_.reset(new ConnectionTester( | 1080 connection_tester_.reset(new ConnectionTester( |
| 1081 this, | 1081 this, |
| 1082 io_thread_->globals()->proxy_script_fetcher_context.get(), | 1082 io_thread_->globals()->proxy_script_fetcher_context.get(), |
| 1083 net_log())); | 1083 net_log())); |
| 1084 connection_tester_->RunAllTests(url); | 1084 connection_tester_->RunAllTests(url); |
| 1085 } | 1085 } |
| 1086 | 1086 |
| 1087 void SPKIHashesToString(const net::FingerprintVector& hashes, | 1087 void SPKIHashesToString(const net::HashValueVector& hashes, |
| 1088 std::string* string) { | 1088 std::string* string) { |
| 1089 for (net::FingerprintVector::const_iterator | 1089 for (net::HashValueVector::const_iterator |
| 1090 i = hashes.begin(); i != hashes.end(); ++i) { | 1090 i = hashes.begin(); i != hashes.end(); ++i) { |
| 1091 base::StringPiece hash_str(reinterpret_cast<const char*>(i->data), | 1091 base::StringPiece hash_str(reinterpret_cast<const char*>(i->data()), |
| 1092 arraysize(i->data)); | 1092 i->size()); |
| 1093 std::string encoded; | 1093 std::string encoded; |
| 1094 base::Base64Encode(hash_str, &encoded); | 1094 base::Base64Encode(hash_str, &encoded); |
| 1095 | 1095 |
| 1096 if (i != hashes.begin()) | 1096 if (i != hashes.begin()) |
| 1097 *string += ","; | 1097 *string += ","; |
| 1098 *string += "sha1/" + encoded; | 1098 *string += i->label() + encoded; |
| 1099 } | 1099 } |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery( | 1102 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSQuery( |
| 1103 const ListValue* list) { | 1103 const ListValue* list) { |
| 1104 // |list| should be: [<domain to query>]. | 1104 // |list| should be: [<domain to query>]. |
| 1105 std::string domain; | 1105 std::string domain; |
| 1106 CHECK(list->GetString(0, &domain)); | 1106 CHECK(list->GetString(0, &domain)); |
| 1107 DictionaryValue* result = new DictionaryValue(); | 1107 DictionaryValue* result = new DictionaryValue(); |
| 1108 | 1108 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 net::TransportSecurityState::DomainState state; | 1164 net::TransportSecurityState::DomainState state; |
| 1165 state.upgrade_expiry = state.created + base::TimeDelta::FromDays(1000); | 1165 state.upgrade_expiry = state.created + base::TimeDelta::FromDays(1000); |
| 1166 state.include_subdomains = include_subdomains; | 1166 state.include_subdomains = include_subdomains; |
| 1167 if (!hashes_str.empty()) { | 1167 if (!hashes_str.empty()) { |
| 1168 std::vector<std::string> type_and_b64s; | 1168 std::vector<std::string> type_and_b64s; |
| 1169 base::SplitString(hashes_str, ',', &type_and_b64s); | 1169 base::SplitString(hashes_str, ',', &type_and_b64s); |
| 1170 for (std::vector<std::string>::const_iterator | 1170 for (std::vector<std::string>::const_iterator |
| 1171 i = type_and_b64s.begin(); i != type_and_b64s.end(); ++i) { | 1171 i = type_and_b64s.begin(); i != type_and_b64s.end(); ++i) { |
| 1172 std::string type_and_b64; | 1172 std::string type_and_b64; |
| 1173 RemoveChars(*i, " \t\r\n", &type_and_b64); | 1173 RemoveChars(*i, " \t\r\n", &type_and_b64); |
| 1174 net::SHA1Fingerprint hash; | 1174 net::HashValue hash; |
| 1175 if (!net::TransportSecurityState::ParsePin(type_and_b64, &hash)) | 1175 if (!net::TransportSecurityState::ParsePin(type_and_b64, &hash)) |
| 1176 continue; | 1176 continue; |
| 1177 | 1177 |
| 1178 state.dynamic_spki_hashes.push_back(hash); | 1178 state.dynamic_spki_hashes.push_back(hash); |
| 1179 } | 1179 } |
| 1180 } | 1180 } |
| 1181 | 1181 |
| 1182 transport_security_state->EnableHost(domain, state); | 1182 transport_security_state->EnableHost(domain, state); |
| 1183 } | 1183 } |
| 1184 | 1184 |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1743 } | 1743 } |
| 1744 | 1744 |
| 1745 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1745 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
| 1746 : WebUIController(web_ui) { | 1746 : WebUIController(web_ui) { |
| 1747 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1747 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
| 1748 | 1748 |
| 1749 // Set up the chrome://net-internals/ source. | 1749 // Set up the chrome://net-internals/ source. |
| 1750 Profile* profile = Profile::FromWebUI(web_ui); | 1750 Profile* profile = Profile::FromWebUI(web_ui); |
| 1751 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); | 1751 ChromeURLDataManager::AddDataSource(profile, CreateNetInternalsHTMLSource()); |
| 1752 } | 1752 } |
| OLD | NEW |