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

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: Rebase and updated comment. Created 6 years, 9 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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 GetMainContext()->transport_security_state(); 1227 GetMainContext()->transport_security_state();
1228 if (!transport_security_state) { 1228 if (!transport_security_state) {
1229 result->SetString("error", "no TransportSecurityState active"); 1229 result->SetString("error", "no TransportSecurityState active");
1230 } else { 1230 } else {
1231 net::TransportSecurityState::DomainState state; 1231 net::TransportSecurityState::DomainState state;
1232 const bool found = transport_security_state->GetDomainState( 1232 const bool found = transport_security_state->GetDomainState(
1233 domain, true, &state); 1233 domain, true, &state);
1234 1234
1235 result->SetBoolean("result", found); 1235 result->SetBoolean("result", found);
1236 if (found) { 1236 if (found) {
1237 result->SetInteger("mode", static_cast<int>(state.upgrade_mode)); 1237 result->SetBoolean("has_static_sts", state.has_static_sts);
1238 result->SetBoolean("sts_subdomains", state.sts_include_subdomains); 1238 if (state.has_static_sts) {
1239 result->SetBoolean("pkp_subdomains", state.pkp_include_subdomains); 1239 result->SetInteger("static_upgrade_mode",
1240 result->SetDouble("sts_observed", state.sts_observed.ToDoubleT()); 1240 static_cast<int>(state.static_sts.upgrade_mode));
1241 result->SetDouble("pkp_observed", state.pkp_observed.ToDoubleT()); 1241 result->SetBoolean("static_sts_include_subdomains",
1242 state.static_sts.include_subdomains);
1243 result->SetDouble("static_sts_observed",
1244 state.static_sts.last_observed.ToDoubleT());
1245 result->SetDouble("static_sts_expiry",
1246 state.static_sts.expiry.ToDoubleT());
1247 }
1248 result->SetBoolean("has_static_pkp", state.has_static_pkp);
1249 if (state.has_static_pkp) {
1250 result->SetBoolean("static_pkp_include_subdomains",
1251 state.static_pkp.include_subdomains);
1252 result->SetDouble("static_pkp_observed",
1253 state.static_pkp.last_observed.ToDoubleT());
1254 result->SetDouble("static_pkp_expiry",
1255 state.static_pkp.expiry.ToDoubleT());
1256 result->SetString("static_spki_hashes",
1257 HashesToBase64String(state.static_pkp.spki_hashes));
1258 }
1259 result->SetInteger("dynamic_upgrade_mode",
1260 static_cast<int>(state.dynamic_sts.upgrade_mode));
1261 result->SetBoolean("dynamic_sts_include_subdomains",
1262 state.dynamic_sts.include_subdomains);
1263 result->SetBoolean("dynamic_pkp_include_subdomains",
1264 state.dynamic_pkp.include_subdomains);
1265 result->SetDouble("dynamic_sts_observed",
1266 state.dynamic_sts.last_observed.ToDoubleT());
1267 result->SetDouble("dynamic_pkp_observed",
1268 state.dynamic_pkp.last_observed.ToDoubleT());
1269 result->SetDouble("dynamic_sts_expiry",
1270 state.dynamic_sts.expiry.ToDoubleT());
1271 result->SetDouble("dynamic_pkp_expiry",
1272 state.dynamic_pkp.expiry.ToDoubleT());
1273 result->SetString("dynamic_spki_hashes",
1274 HashesToBase64String(state.dynamic_pkp.spki_hashes));
1275
1242 result->SetString("domain", state.domain); 1276 result->SetString("domain", state.domain);
1243 result->SetDouble("expiry", state.upgrade_expiry.ToDoubleT());
1244 result->SetDouble("dynamic_spki_hashes_expiry",
1245 state.dynamic_spki_hashes_expiry.ToDoubleT());
1246
1247 result->SetString("static_spki_hashes",
1248 HashesToBase64String(state.static_spki_hashes));
1249 result->SetString("dynamic_spki_hashes",
1250 HashesToBase64String(state.dynamic_spki_hashes));
1251 } 1277 }
1252 } 1278 }
1253 } 1279 }
1254 1280
1255 SendJavascriptCommand("receivedHSTSResult", result); 1281 SendJavascriptCommand("receivedHSTSResult", result);
1256 } 1282 }
1257 1283
1258 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd( 1284 void NetInternalsMessageHandler::IOThreadImpl::OnHSTSAdd(
1259 const base::ListValue* list) { 1285 const base::ListValue* list) {
1260 // |list| should be: [<domain to query>, <STS include subdomains>, <PKP 1286 // |list| should be: [<domain to query>, <STS include subdomains>, <PKP
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 } 1895 }
1870 1896
1871 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1897 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1872 : WebUIController(web_ui) { 1898 : WebUIController(web_ui) {
1873 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1899 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1874 1900
1875 // Set up the chrome://net-internals/ source. 1901 // Set up the chrome://net-internals/ source.
1876 Profile* profile = Profile::FromWebUI(web_ui); 1902 Profile* profile = Profile::FromWebUI(web_ui);
1877 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1903 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1878 } 1904 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698