Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 103803012: Make HSTS headers not clobber preloaded pins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make use of has_dynamic. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 GetMainContext()->transport_security_state(); 1219 GetMainContext()->transport_security_state();
1220 if (!transport_security_state) { 1220 if (!transport_security_state) {
1221 result->SetString("error", "no TransportSecurityState active"); 1221 result->SetString("error", "no TransportSecurityState active");
1222 } else { 1222 } else {
1223 net::TransportSecurityState::DomainState state; 1223 net::TransportSecurityState::DomainState state;
1224 const bool found = transport_security_state->GetDomainState( 1224 const bool found = transport_security_state->GetDomainState(
1225 domain, true, &state); 1225 domain, true, &state);
1226 1226
1227 result->SetBoolean("result", found); 1227 result->SetBoolean("result", found);
1228 if (found) { 1228 if (found) {
1229 result->SetInteger("mode", static_cast<int>(state.upgrade_mode)); 1229 result->SetBoolean("has_static_sts", state.has_static_sts);
1230 result->SetBoolean("sts_subdomains", state.sts_include_subdomains); 1230 if (state.has_static_sts) {
1231 result->SetBoolean("pkp_subdomains", state.pkp_include_subdomains); 1231 result->SetInteger("static_upgrade_mode",
1232 result->SetDouble("sts_observed", state.sts_observed.ToDoubleT()); 1232 static_cast<int>(state.static_sts.upgrade_mode));
1233 result->SetDouble("pkp_observed", state.pkp_observed.ToDoubleT()); 1233 result->SetBoolean("static_sts_include_subdomains",
1234 state.static_sts.include_subdomains);
1235 result->SetDouble("static_sts_observed",
1236 state.static_sts.last_observed.ToDoubleT());
1237 result->SetDouble("static_sts_expiry",
1238 state.static_sts.expiry.ToDoubleT());
1239 }
1240 result->SetBoolean("has_static_pkp", state.has_static_pkp);
1241 if (state.has_static_pkp) {
1242 result->SetBoolean("static_pkp_include_subdomains",
1243 state.static_pkp.include_subdomains);
1244 result->SetDouble("static_pkp_observed",
1245 state.static_pkp.last_observed.ToDoubleT());
1246 result->SetDouble("static_pkp_expiry",
1247 state.static_pkp.expiry.ToDoubleT());
1248 result->SetString("static_spki_hashes",
1249 HashesToBase64String(state.static_pkp.spki_hashes));
1250 }
1251 result->SetInteger("dynamic_upgrade_mode",
1252 static_cast<int>(state.dynamic_sts.upgrade_mode));
1253 result->SetBoolean("dynamic_sts_include_subdomains",
1254 state.dynamic_sts.include_subdomains);
1255 result->SetBoolean("dynamic_pkp_include_subdomains",
1256 state.dynamic_pkp.include_subdomains);
1257 result->SetDouble("dynamic_sts_observed",
1258 state.dynamic_sts.last_observed.ToDoubleT());
1259 result->SetDouble("dynamic_pkp_observed",
1260 state.dynamic_pkp.last_observed.ToDoubleT());
1261 result->SetDouble("dynamic_sts_expiry",
1262 state.dynamic_sts.expiry.ToDoubleT());
1263 result->SetDouble("dynamic_pkp_expiry",
1264 state.dynamic_pkp.expiry.ToDoubleT());
1265 result->SetString("dynamic_spki_hashes",
1266 HashesToBase64String(state.dynamic_pkp.spki_hashes));
1267
1234 result->SetString("domain", state.domain); 1268 result->SetString("domain", state.domain);
1235 result->SetDouble("expiry", state.upgrade_expiry.ToDoubleT());
1236 result->SetDouble("dynamic_spki_hashes_expiry",
1237 state.dynamic_spki_hashes_expiry.ToDoubleT());
1238
1239 result->SetString("static_spki_hashes",
1240 HashesToBase64String(state.static_spki_hashes));
1241 result->SetString("dynamic_spki_hashes",
1242 HashesToBase64String(state.dynamic_spki_hashes));
1243 } 1269 }
1244 } 1270 }
1245 } 1271 }
1246 1272
1247 SendJavascriptCommand("receivedHSTSResult", result); 1273 SendJavascriptCommand("receivedHSTSResult", result);
1248 } 1274 }
1249 1275
1250 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd( 1276 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd(
1251 const base::ListValue* list) { 1277 const base::ListValue* list) {
1252 // |list| should be: [<domain to query>, <STS include subdomains>, <PKP 1278 // |list| should be: [<domain to query>, <STS include subdomains>, <PKP
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 } 1875 }
1850 1876
1851 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1877 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1852 : WebUIController(web_ui) { 1878 : WebUIController(web_ui) {
1853 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1879 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1854 1880
1855 // Set up the chrome://net-internals/ source. 1881 // Set up the chrome://net-internals/ source.
1856 Profile* profile = Profile::FromWebUI(web_ui); 1882 Profile* profile = Profile::FromWebUI(web_ui);
1857 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1883 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1858 } 1884 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698